The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
Curses/Artistic 0131
Curses/Copying 0248
Curses/Curses.c 0428
Curses/Curses.pm 01068
Curses/CursesBoot.c 01254
Curses/CursesCon.c 0438
Curses/CursesFun.c 06941
Curses/CursesFunWide.c 0212
Curses/CursesTyp.h 052
Curses/CursesVar.c 0270
Curses/CursesWide.c 0250
Curses/HISTORY 0284
Curses/INSTALL 0280
Curses/MAINTENANCE 082
Curses/MANIFEST 056
Curses/Makefile.PL 0657
Curses/README 0131
Curses/cdemo.c 0135
Curses/demo 079
Curses/demo.form 0199
Curses/demo.menu 0121
Curses/demo.panel 080
Curses/demo2 078
Curses/gdc 0150
Curses/gen.tar --
Curses/hints/c-MSWin32.borland.h 038
Curses/hints/c-MSWin32.visualc.h 038
Curses/hints/c-aix.h 027
Curses/hints/c-bsd386.h 030
Curses/hints/c-bsdos.h 029
Curses/hints/c-cygwin.h 031
Curses/hints/c-darwin.h 029
Curses/hints/c-darwin.old.h 029
Curses/hints/c-dec_osf.h 030
Curses/hints/c-dgux.h 029
Curses/hints/c-dynixptx.h 029
Curses/hints/c-freebsd.bsd.h 017
Curses/hints/c-freebsd.ncurses.h 029
Curses/hints/c-gnukfreebsd.h 027
Curses/hints/c-hpux.h 027
Curses/hints/c-irix.bsd.h 017
Curses/hints/c-irix.ncurses.h 030
Curses/hints/c-isc.h 029
Curses/hints/c-linux.bsd.h 015
Curses/hints/c-linux.ncurses.h 027
Curses/hints/c-netbsd.h 035
Curses/hints/c-next.h 029
Curses/hints/c-none.h 040
Curses/hints/c-openbsd.h 029
Curses/hints/c-os2.ncurses.h 029
Curses/hints/c-sco.h 029
Curses/hints/c-solaris.h 029
Curses/hints/c-sunos.bsd.h 015
Curses/hints/c-sunos.ncurses.h 029
Curses/hints/c-sunos.sysv.h 052
Curses/hints/c-svr4.h 030
Curses/hints/c-vms.h 032
Curses/list.syms 0355
Curses/ppport.h 06377
Curses/t/00-load.t 09
Curses/test.syms 0310
Curses/testcurses 0120
Curses/testint.c 015
Curses/testsym.c 013
Curses/testtyp.c 013
Curses.c 4966
Curses.pm 51215
CursesBoot.c 214
CursesCon.c 02
CursesFun.c 19251927
CursesFunWide.c 0206
CursesVar.c 02
CursesWide.c 0216
HISTORY 029
MAINTENANCE 16
Makefile.PL 520
README 185
demo.form 11
demo.menu 11
demo.panel 11
hints/c-MSWin32.borland.h 33
hints/c-MSWin32.visualc.h 33
hints/c-aix.h 33
hints/c-bsd386.h 33
hints/c-bsdos.h 33
hints/c-cygwin.h 33
hints/c-darwin.h 33
hints/c-darwin.old.h 33
hints/c-dec_osf.h 33
hints/c-dgux.h 33
hints/c-dynixptx.h 33
hints/c-freebsd.ncurses.h 33
hints/c-gnukfreebsd.h 33
hints/c-hpux.h 33
hints/c-irix.ncurses.h 33
hints/c-isc.h 33
hints/c-linux.ncurses.h 33
hints/c-netbsd.h 33
hints/c-next.h 33
hints/c-none.h 33
hints/c-openbsd.h 33
hints/c-os2.ncurses.h 33
hints/c-sco.h 33
hints/c-solaris.h 33
hints/c-sunos.ncurses.h 33
hints/c-sunos.sysv.h 33
hints/c-svr4.h 33
hints/c-vms.h 33
list.syms 06
test.syms 44
testint.c 08
testsym.c 08
testtyp.c 08
113 files changed (This is a version diff) 214224600
@@ -0,0 +1,131 @@
+
+
+
+
+			 The "Artistic License"
+
+				Preamble
+
+The intent of this document is to state the conditions under which a
+Package may be copied, such that the Copyright Holder maintains some
+semblance of artistic control over the development of the package,
+while giving the users of the package the right to use and distribute
+the Package in a more-or-less customary fashion, plus the right to make
+reasonable modifications.
+
+Definitions:
+
+	"Package" refers to the collection of files distributed by the
+	Copyright Holder, and derivatives of that collection of files
+	created through textual modification.
+
+	"Standard Version" refers to such a Package if it has not been
+	modified, or has been modified in accordance with the wishes
+	of the Copyright Holder as specified below.
+
+	"Copyright Holder" is whoever is named in the copyright or
+	copyrights for the package.
+
+	"You" is you, if you're thinking about copying or distributing
+	this Package.
+
+	"Reasonable copying fee" is whatever you can justify on the
+	basis of media cost, duplication charges, time of people involved,
+	and so on.  (You will not be required to justify it to the
+	Copyright Holder, but only to the computing community at large
+	as a market that must bear the fee.)
+
+	"Freely Available" means that no fee is charged for the item
+	itself, though there may be fees involved in handling the item.
+	It also means that recipients of the item may redistribute it
+	under the same conditions they received it.
+
+1. You may make and give away verbatim copies of the source form of the
+Standard Version of this Package without restriction, provided that you
+duplicate all of the original copyright notices and associated disclaimers.
+
+2. You may apply bug fixes, portability fixes and other modifications
+derived from the Public Domain or from the Copyright Holder.  A Package
+modified in such a way shall still be considered the Standard Version.
+
+3. You may otherwise modify your copy of this Package in any way, provided
+that you insert a prominent notice in each changed file stating how and
+when you changed that file, and provided that you do at least ONE of the
+following:
+
+    a) place your modifications in the Public Domain or otherwise make them
+    Freely Available, such as by posting said modifications to Usenet or
+    an equivalent medium, or placing the modifications on a major archive
+    site such as uunet.uu.net, or by allowing the Copyright Holder to include
+    your modifications in the Standard Version of the Package.
+
+    b) use the modified Package only within your corporation or organization.
+
+    c) rename any non-standard executables so the names do not conflict
+    with standard executables, which must also be provided, and provide
+    a separate manual page for each non-standard executable that clearly
+    documents how it differs from the Standard Version.
+
+    d) make other distribution arrangements with the Copyright Holder.
+
+4. You may distribute the programs of this Package in object code or
+executable form, provided that you do at least ONE of the following:
+
+    a) distribute a Standard Version of the executables and library files,
+    together with instructions (in the manual page or equivalent) on where
+    to get the Standard Version.
+
+    b) accompany the distribution with the machine-readable source of
+    the Package with your modifications.
+
+    c) give non-standard executables non-standard names, and clearly
+    document the differences in manual pages (or equivalent), together
+    with instructions on where to get the Standard Version.
+
+    d) make other distribution arrangements with the Copyright Holder.
+
+5. You may charge a reasonable copying fee for any distribution of this
+Package.  You may charge any fee you choose for support of this
+Package.  You may not charge a fee for this Package itself.  However,
+you may distribute this Package in aggregate with other (possibly
+commercial) programs as part of a larger (possibly commercial) software
+distribution provided that you do not advertise this Package as a
+product of your own.  You may embed this Package's interpreter within
+an executable of yours (by linking); this shall be construed as a mere
+form of aggregation, provided that the complete Standard Version of the
+interpreter is so embedded.
+
+6. The scripts and library files supplied as input to or produced as
+output from the programs of this Package do not automatically fall
+under the copyright of this Package, but belong to whomever generated
+them, and may be sold commercially, and may be aggregated with this
+Package.  If such scripts or library files are aggregated with this
+Package via the so-called "undump" or "unexec" methods of producing a
+binary executable image, then distribution of such an image shall
+neither be construed as a distribution of this Package nor shall it
+fall under the restrictions of Paragraphs 3 and 4, provided that you do
+not represent such an executable image as a Standard Version of this
+Package.
+
+7. C subroutines (or comparably compiled subroutines in other
+languages) supplied by you and linked into this Package in order to
+emulate subroutines and variables of the language defined by this
+Package shall not be considered part of this Package, but are the
+equivalent of input as in Paragraph 6, provided these subroutines do
+not change the language in any way that would cause it to fail the
+regression tests for the language.
+
+8. Aggregation of this Package with a commercial distribution is always
+permitted provided that the use of this Package is embedded; that is,
+when no overt attempt is made to make this Package's interfaces visible
+to the end user of the commercial distribution.  Such use shall not be
+construed as a distribution of this Package.
+
+9. The name of the Copyright Holder may not be used to endorse or promote
+products derived from this software without specific prior written permission.
+
+10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+				The End
@@ -0,0 +1,248 @@
+		    GNU GENERAL PUBLIC LICENSE
+		     Version 1, February 1989
+
+ Copyright (C) 1989 Free Software Foundation, Inc.
+                59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The license agreements of most software companies try to keep users
+at the mercy of those companies.  By contrast, our General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  The
+General Public License applies to the Free Software Foundation's
+software and to any other program whose authors commit to using it.
+You can use it for your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Specifically, the General Public License is designed to make
+sure that you have the freedom to give away or sell copies of free
+software, that you receive source code or can get it if you want it,
+that you can change the software or use pieces of it in new free
+programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of a such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must tell them their rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any program or other work which
+contains a notice placed by the copyright holder saying it may be
+distributed under the terms of this General Public License.  The
+"Program", below, refers to any such program or work, and a "work based
+on the Program" means either the Program or any work containing the
+Program or a portion of it, either verbatim or with modifications.  Each
+licensee is addressed as "you".
+
+  1. You may copy and distribute verbatim copies of the Program's source
+code as you receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice and
+disclaimer of warranty; keep intact all the notices that refer to this
+General Public License and to the absence of any warranty; and give any
+other recipients of the Program a copy of this General Public License
+along with the Program.  You may charge a fee for the physical act of
+transferring a copy.
+
+  2. You may modify your copy or copies of the Program or any portion of
+it, and copy and distribute such modifications under the terms of Paragraph
+1 above, provided that you also do the following:
+
+    a) cause the modified files to carry prominent notices stating that
+    you changed the files and the date of any change; and
+
+    b) cause the whole of any work that you distribute or publish, that
+    in whole or in part contains the Program or any part thereof, either
+    with or without modifications, to be licensed at no charge to all
+    third parties under the terms of this General Public License (except
+    that you may choose to grant warranty protection to some or all
+    third parties, at your option).
+
+    c) If the modified program normally reads commands interactively when
+    run, you must cause it, when started running for such interactive use
+    in the simplest and most usual way, to print or display an
+    announcement including an appropriate copyright notice and a notice
+    that there is no warranty (or else, saying that you provide a
+    warranty) and that users may redistribute the program under these
+    conditions, and telling the user how to view a copy of this General
+    Public License.
+
+    d) You may charge a fee for the physical act of transferring a
+    copy, and you may at your option offer warranty protection in
+    exchange for a fee.
+
+Mere aggregation of another independent work with the Program (or its
+derivative) on a volume of a storage or distribution medium does not bring
+the other work under the scope of these terms.
+
+  3. You may copy and distribute the Program (or a portion or derivative of
+it, under Paragraph 2) in object code or executable form under the terms of
+Paragraphs 1 and 2 above provided that you also do one of the following:
+
+    a) accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of
+    Paragraphs 1 and 2 above; or,
+
+    b) accompany it with a written offer, valid for at least three
+    years, to give any third party free (except for a nominal charge
+    for the cost of distribution) a complete machine-readable copy of the
+    corresponding source code, to be distributed under the terms of
+    Paragraphs 1 and 2 above; or,
+
+    c) accompany it with the information you received as to where the
+    corresponding source code may be obtained.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form alone.)
+
+Source code for a work means the preferred form of the work for making
+modifications to it.  For an executable file, complete source code means
+all the source code for all modules it contains; but, as a special
+exception, it need not include source code for modules which are standard
+libraries that accompany the operating system on which the executable
+file runs, or for standard header files or definitions files that
+accompany that operating system.
+
+  4. You may not copy, modify, sublicense, distribute or transfer the
+Program except as expressly provided under this General Public License.
+Any attempt otherwise to copy, modify, sublicense, distribute or transfer
+the Program is void, and will automatically terminate your rights to use
+the Program under this License.  However, parties who have received
+copies, or rights to use copies, from you under this General Public
+License will not have their licenses terminated so long as such parties
+remain in full compliance.
+
+  5. By copying, distributing or modifying the Program (or any work based
+on the Program) you indicate your acceptance of this license to do so,
+and all its terms and conditions.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the original
+licensor to copy, distribute or modify the Program subject to these
+terms and conditions.  You may not impose any further restrictions on the
+recipients' exercise of the rights granted herein.
+
+  7. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of the license which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+the license, you may choose any version ever published by the Free Software
+Foundation.
+
+  8. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	Appendix: How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to humanity, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these
+terms.
+
+  To do so, attach the following notices to the program.  It is safest to
+attach them to the start of each source file to most effectively convey
+the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) 19yy  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 1, or (at your option)
+    any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software Foundation,
+    Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) 19xx name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the
+appropriate parts of the General Public License.  Of course, the
+commands you use may be called something other than `show w' and `show
+c'; they could even be mouse-clicks or menu items--whatever suits your
+program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  program `Gnomovision' (a program to direct compilers to make passes
+  at assemblers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+That's all there is to it!
@@ -0,0 +1,428 @@
+/*  Curses.c
+**
+**  Copyright (c) 1994-2000  William Setzer
+**
+**  You may distribute under the terms of either the Artistic License
+**  or the GNU General Public License, as specified in the README file.
+*/
+
+#define _XOPEN_SOURCE_EXTENDED  /* We expect wide character functions */
+
+#include "CursesDef.h"
+#include "CursesTyp.h"
+#include "c-config.h"
+
+/* c-config.h above includes Ncurses header files that define macro
+   'instr'.  Unfortunately, perl.h (below) also defines 'instr'.
+   Fortunately, we don't need the Curses version -- we use
+   winstr(stdscr, ...) instead.  So we undef instr here to avoid a compiler
+   warning about the redeclaration.
+
+   Similarly, c-config.h may define a macro "tab", while the word
+   "tab" is used in perl.h another way, so we undefine it to avoid
+   a nasty syntax error.
+
+   "term.h" pollutes the name space with hundreds of other macros too.
+   We'll probably have to add to this list; maybe someday we should
+   just undef them all, since we don't use them.
+
+   "bool" is another, and is more problematic.  Sometimes, ncurses.h
+   defines that explicitly and that's bad, but sometimes it does it
+   by including <stdbool.h>, and that's fine.  In the former case,
+   we should undefine it now, but in the latter we can't, because then
+   a subsequent #include <stdbool.h> (by something we #include below)
+   won't define bool because stdbool.h has already been included.
+
+   We're going to leave bool alone now and wait for someone to report
+   that it breaks something.  With a real example, we can then plan how
+   to work around this unfortunate ncurses.h behavior.  We once had a
+   #undef bool.h in the Mac OSX hints file, so someone presumably found
+   it necessary.  But we have also had a Mac OSX system on which compile
+   failed _because_ of that undef, for the reason described above.
+ */
+
+#undef instr
+#undef tab
+
+#include <EXTERN.h>  /* Needed by <perl.h> */
+#include <perl.h>
+#include <XSUB.h>
+/* I don't know why NEED_sv_2pv_flags is necessary, but ppport.h doesn't
+   work right without it.  Maybe a bug in Devel::PPPort?  */
+#define NEED_sv_2pv_flags
+#include "ppport.h"
+    /* Defines PERL_REVISION, etc. (if perl.h doesn't) */
+
+#ifndef C_PANELFUNCTION
+#  define PANEL int
+#endif
+
+#ifndef C_MENUFUNCTION
+#  define MENU int
+#  define ITEM int
+#endif
+
+#ifndef C_FORMFUNCTION
+#  define FORM int
+#  define FIELD int
+#endif
+
+/* Before 1.17 (September 2007), we undefined macro 'SP' here, for
+   the Pdcurses case only.  I don't know why, but it caused the build
+   with Pdcurses to fail, so we took it out.  'SP' is
+   defined in Perl's CORE/pp.h via our inclusion of perl.h above.
+*/
+
+#if PERL_VERSION >= 6
+#define HAVE_PERL_UTF8_TO_UV 1
+#define HAVE_PERL_UV_TO_UTF8 1
+#else
+#define HAVE_PERL_UTF8_TO_UV 0
+#define HAVE_PERL_UV_TO_UTF8 0
+#endif
+
+#if PERL_VERSION >= 7
+#define HAVE_PERL_UTF8_TO_UVCHR 1
+#define HAVE_PERL_UVCHR_TO_UTF8 1
+#else
+#define HAVE_PERL_UTF8_TO_UVCHR 0
+#define HAVE_PERL_UVCHR_TO_UTF8 0
+#endif
+
+#if PERL_VERSION >= 16 /* really 15.something */
+#define HAVE_PERL_UTF8_TO_UVCHR_BUF 1
+#else
+#define HAVE_PERL_UTF8_TO_UVCHR_BUF 0
+#endif
+
+/*
+** Begin support variables and functions
+*/
+
+static char *c_function;
+static int   c_win, c_x, c_arg;
+
+static void
+c_countargs(fn, nargs, base)
+char *fn;
+int nargs;
+int base;
+{
+    switch (nargs - base)
+    {
+    case 0:  c_win = 0; c_x = 0; c_arg = 0; break;
+    case 1:  c_win = 1; c_x = 0; c_arg = 1; break;
+    case 2:  c_win = 0; c_x = 1; c_arg = 2; break;
+    case 3:  c_win = 1; c_x = 2; c_arg = 3; break;
+    default:
+    croak("Curses function '%s' called with too %s arguments", fn,
+          nargs < base ? "few" : "many");
+    }
+    c_function = fn;
+}
+
+static void
+c_exactargs(fn, nargs, base)
+char *fn;
+int nargs;
+int base;
+{
+    if (nargs != base)
+    croak("Curses function '%s' called with too %s arguments", fn,
+          nargs < base ? "few" : "many" );
+
+    c_function = fn;
+}
+
+static int
+c_domove(win, sv_y, sv_x)
+WINDOW *win;
+SV *sv_y;
+SV *sv_x;
+{
+    int y = (int)SvIV(sv_y);
+    int x = (int)SvIV(sv_x);
+
+    return wmove(win, y, x);
+}
+
+static void
+c_fun_not_there(fn)
+char *fn;
+{
+    croak("Curses function '%s' is not defined in your Curses library", fn);
+}
+
+static void
+c_var_not_there(fn)
+char *fn;
+{
+    croak("Curses variable '%s' is not defined in your Curses library", fn);
+}
+
+static void
+c_con_not_there(fn)
+char *fn;
+{
+    croak("Curses constant '%s' is not defined in your Curses library", fn);
+}
+
+/*
+** Begin complex type conversion routines
+*/
+
+static chtype
+c_sv2chtype(sv)
+SV *sv;
+{
+    if (SvPOK(sv)) {
+        char *tmp = SvPV_nolen(sv);
+        return (chtype)(unsigned char)tmp[0];
+    }
+    return (chtype)SvIV(sv);
+}
+
+static void
+c_chtype2sv(sv, ch)
+SV *sv;
+chtype ch;
+{
+    if (ch == ERR || ch > 255) { sv_setiv(sv, (I32)ch); }
+    else {
+    char tmp[2];
+    tmp[0] = (char)ch;
+    tmp[1] = (char)0;
+    sv_setpv(sv, tmp);
+    }
+}
+
+static FIELD *
+c_sv2field(sv, argnum)
+SV *sv;
+int argnum;
+{
+    if (sv_derived_from(sv, "Curses::Field"))
+    return (FIELD *)SvIV((SV*)SvRV(sv));
+    if (argnum >= 0)
+    croak("argument %d to Curses function '%s' is not a Curses field",
+          argnum, c_function);
+    else
+    croak("argument is not a Curses field");
+}
+
+static void
+c_field2sv(SV *    const svP,
+           FIELD * const fieldP) {
+/*----------------------------------------------------------------------------
+  Make *svP a reference to a scalar whose value is the numerical
+  equivalent of 'fieldP' and which is blessed into the hypothetical
+  package "Curses::Field".
+-----------------------------------------------------------------------------*/
+    sv_setref_pv(svP, "Curses::Field", (void*)fieldP);
+}
+
+static FORM *
+c_sv2form(sv, argnum)
+SV *sv;
+int argnum;
+{
+    if (sv_derived_from(sv, "Curses::Form"))
+    return (FORM *)SvIV((SV*)SvRV(sv));
+    if (argnum >= 0)
+    croak("argument %d to Curses function '%s' is not a Curses form",
+          argnum, c_function);
+    else
+    croak("argument is not a Curses form");
+}
+
+static void
+c_form2sv(sv, val)
+SV *sv;
+FORM *val;
+{
+    sv_setref_pv(sv, "Curses::Form", (void*)val);
+}
+
+static ITEM *
+c_sv2item(sv, argnum)
+SV *sv;
+int argnum;
+{
+    if (sv_derived_from(sv, "Curses::Item"))
+    return (ITEM *)SvIV((SV*)SvRV(sv));
+    if (argnum >= 0)
+    croak("argument %d to Curses function '%s' is not a Curses item",
+          argnum, c_function);
+    else
+    croak("argument is not a Curses item");
+}
+
+
+static void
+c_item2sv(sv, val)
+SV *sv;
+ITEM *val;
+{
+    sv_setref_pv(sv, "Curses::Item", (void*)val);
+}
+
+static MENU *
+c_sv2menu(sv, argnum)
+SV *sv;
+int argnum;
+{
+    if (sv_derived_from(sv, "Curses::Menu"))
+    return (MENU *)SvIV((SV*)SvRV(sv));
+    if (argnum >= 0)
+    croak("argument %d to Curses function '%s' is not a Curses menu",
+          argnum, c_function);
+    else
+    croak("argument is not a Curses menu");
+}
+
+static void
+c_menu2sv(sv, val)
+SV *sv;
+MENU *val;
+{
+    sv_setref_pv(sv, "Curses::Menu", (void*)val);
+}
+
+static PANEL *
+c_sv2panel(sv, argnum)
+SV *sv;
+int argnum;
+{
+    if (sv_derived_from(sv, "Curses::Panel"))
+    return (PANEL *)SvIV((SV*)SvRV(sv));
+    if (argnum >= 0)
+    croak("argument %d to Curses function '%s' is not a Curses panel",
+          argnum, c_function);
+    else
+    croak("argument is not a Curses panel");
+}
+
+static void
+c_panel2sv(sv, val)
+SV *sv;
+PANEL *val;
+{
+    sv_setref_pv(sv, "Curses::Panel", (void*)val);
+}
+
+static SCREEN *
+c_sv2screen(sv, argnum)
+SV *sv;
+int argnum;
+{
+    if (sv_derived_from(sv, "Curses::Screen"))
+    return (SCREEN *)SvIV((SV*)SvRV(sv));
+    if (argnum >= 0)
+    croak("argument %d to Curses function '%s' is not a Curses screen",
+          argnum, c_function);
+    else
+    croak("argument is not a Curses screen");
+}
+
+static void
+c_screen2sv(sv, val)
+SV *sv;
+SCREEN *val;
+{
+    sv_setref_pv(sv, "Curses::Screen", (void*)val);
+}
+
+static WINDOW *
+c_sv2window(sv, argnum)
+SV *sv;
+int argnum;
+{
+    if (sv_derived_from(sv, "Curses::Window")) {
+      WINDOW *ret = (WINDOW *)SvIV((SV*)SvRV(sv));
+      return ret;
+    }
+    if (argnum >= 0)
+    croak("argument %d to Curses function '%s' is not a Curses window",
+          argnum, c_function);
+    else
+    croak("argument is not a Curses window");
+}
+
+static void
+c_window2sv(sv, val)
+SV *sv;
+WINDOW *val;
+{
+    sv_setref_pv(sv, "Curses::Window", (void*)val);
+}
+
+
+static void
+c_setchar(sv, name)
+SV *sv;
+char *name;
+{
+    int len  = SvLEN(sv);
+
+    if (len > 0) {
+        name[len - 1] = 0;
+
+    SvCUR(sv) = strlen(name);
+    SvPOK_only(sv);
+    *SvEND(sv) = 0;
+    }
+}
+
+static void
+c_setchtype(sv, name)
+SV *sv;
+chtype *name;
+{
+    int n   = 0;
+    int rs  = sizeof(chtype);
+    int len = SvLEN(sv);
+
+    if (len - len % rs > rs) {            /* find even multiple of rs */
+        name[len - len % rs - rs] = 0;
+
+    while (*name++) { n++; }
+
+    SvCUR(sv) = n;
+    SvPOK_only(sv);
+    *(chtype *)SvEND(sv) = 0;
+    }
+}
+
+static void
+c_setmevent(sv)
+SV *sv;
+{
+    SvCUR(sv) = sizeof(MEVENT);
+    SvPOK_only(sv);
+}
+
+
+#if ((HAVE_PERL_UVCHR_TO_UTF8 || HAVE_PERL_UV_TO_UTF8) && \
+    (HAVE_PERL_UTF8_TO_UVCHR_BUF || HAVE_PERL_UTF8_TO_UVCHR || \
+     HAVE_PERL_UTF8_TO_UV))
+  #include "CursesWide.c"
+  #define HAVE_WIDE_SV_HELPER 1
+#else
+  #define HAVE_WIDE_SV_HELPER 0
+#endif
+
+/*
+**  Cheesy, I know.  But it works.
+*/
+
+
+#include "CursesFun.c"
+#if HAVE_WIDE_SV_HELPER
+  #include "CursesFunWide.c"
+  #define HAVE_WIDE_XS_FUNCTIONS 1
+#else
+  #define HAVE_WIDE_XS_FUNCTIONS 0
+#endif
+#include "CursesVar.c"
+#include "CursesCon.c"
+#include "CursesBoot.c"
@@ -0,0 +1,1068 @@
+##  CursesFun.c -- the functions
+##
+##  Copyright (c) 1994-2000  William Setzer
+##
+##  You may distribute under the terms of either the Artistic License
+##  or the GNU General Public License, as specified in the README file.
+
+###
+##  For the brave object-using person
+#
+package Curses::Window;
+
+@ISA = qw(Curses);
+
+package Curses::Screen;
+
+@ISA = qw(Curses);
+sub new     { newterm(@_) }
+sub DESTROY { }
+
+package Curses::Panel;
+
+@ISA = qw(Curses);
+sub new     { new_panel(@_) }
+sub DESTROY { }
+
+package Curses::Menu;
+
+@ISA = qw(Curses);
+sub new     { new_menu(@_) }
+sub DESTROY { }
+
+package Curses::Item;
+
+@ISA = qw(Curses);
+sub new     { new_item(@_) }
+sub DESTROY { }
+
+package Curses::Form;
+
+@ISA = qw(Curses);
+sub new     { new_form(@_) }
+sub DESTROY { }
+
+package Curses::Field;
+
+@ISA = qw(Curses);
+sub new     { new_field(@_) }
+sub DESTROY { }
+
+
+package Curses;
+
+$VERSION = '1.30'; # Makefile.PL picks this up
+
+use Carp;
+require Exporter;
+require DynaLoader;
+@ISA = qw(Exporter DynaLoader);
+
+bootstrap Curses;
+
+sub new      {
+    my $pkg = shift;
+    my ($nl, $nc, $by, $bx) = (@_,0,0,0,0);
+
+    unless ($_initscr++) { initscr() }
+    return newwin($nl, $nc, $by, $bx);
+}
+
+sub DESTROY  { }
+
+sub AUTOLOAD {
+    my $N = $AUTOLOAD;
+    $N =~ s/^.*:://;
+
+    croak
+        "No '$N' in Curses module.  This could be because the Curses " .
+        "library for which it was built does not provide the associated " .
+        "functions.  ";
+}
+
+sub printw   { addstr(sprintf shift, @_) }
+
+tie $LINES,       Curses::Vars, 1;
+tie $COLS,        Curses::Vars, 2;
+tie $stdscr,      Curses::Vars, 3;
+tie $curscr,      Curses::Vars, 4;
+tie $COLORS,      Curses::Vars, 5;
+tie $COLOR_PAIRS, Curses::Vars, 6;
+
+@EXPORT = qw(
+    printw
+
+    LINES $LINES COLS $COLS stdscr $stdscr curscr $curscr COLORS $COLORS
+    COLOR_PAIRS $COLOR_PAIRS
+
+    getchar getstring ungetchar instring addstring insstring
+
+    addch echochar addchstr addchnstr addstr addnstr attroff attron attrset
+    standend standout attr_get attr_off attr_on attr_set chgat COLOR_PAIR
+    PAIR_NUMBER beep flash bkgd bkgdset getbkgd border box hline vline
+    erase clear clrtobot clrtoeol start_color init_pair init_color
+    has_colors can_change_color color_content pair_content delch deleteln
+    insdelln insertln getch ungetch has_key KEY_F getstr getnstr getyx
+    getparyx getbegyx getmaxyx inch inchstr inchnstr initscr endwin
+    isendwin newterm set_term delscreen cbreak nocbreak echo noecho
+    halfdelay intrflush keypad meta nodelay notimeout raw noraw qiflush
+    noqiflush timeout typeahead insch insstr insnstr instr innstr
+    def_prog_mode def_shell_mode reset_prog_mode reset_shell_mode resetty
+    savetty getsyx setsyx curs_set napms move clearok idlok idcok immedok
+    leaveok setscrreg scrollok nl nonl overlay overwrite copywin newpad
+    subpad prefresh pnoutrefresh pechochar refresh noutrefresh doupdate
+    redrawwin redrawln scr_dump scr_restore scr_init scr_set scroll scrl
+    slk_init slk_set slk_refresh slk_noutrefresh slk_label slk_clear
+    slk_restore slk_touch slk_attron slk_attrset slk_attr slk_attroff
+    slk_color baudrate erasechar has_ic has_il killchar longname termattrs
+    termname touchwin touchline untouchwin touchln is_linetouched
+    is_wintouched unctrl keyname filter use_env putwin getwin delay_output
+    flushinp newwin delwin mvwin subwin derwin mvderwin dupwin syncup
+    syncok cursyncup syncdown getmouse ungetmouse mousemask enclose
+    mouse_trafo mouseinterval BUTTON_RELEASE BUTTON_PRESS BUTTON_CLICK
+    BUTTON_DOUBLE_CLICK BUTTON_TRIPLE_CLICK BUTTON_RESERVED_EVENT
+    use_default_colors assume_default_colors define_key keybound keyok
+    resizeterm resize getmaxy getmaxx flusok getcap touchoverlap new_panel
+    bottom_panel top_panel show_panel update_panels hide_panel panel_window
+    replace_panel move_panel panel_hidden panel_above panel_below
+    set_panel_userptr panel_userptr del_panel set_menu_fore menu_fore
+    set_menu_back menu_back set_menu_grey menu_grey set_menu_pad menu_pad
+    pos_menu_cursor menu_driver set_menu_format menu_format set_menu_items
+    menu_items item_count set_menu_mark menu_mark new_menu free_menu
+    menu_opts set_menu_opts menu_opts_on menu_opts_off set_menu_pattern
+    menu_pattern post_menu unpost_menu set_menu_userptr menu_userptr
+    set_menu_win menu_win set_menu_sub menu_sub scale_menu set_current_item
+    current_item set_top_row top_row item_index item_name item_description
+    new_item free_item set_item_opts item_opts_on item_opts_off item_opts
+    item_userptr set_item_userptr set_item_value item_value item_visible
+    menu_request_name menu_request_by_name set_menu_spacing menu_spacing
+    pos_form_cursor data_ahead data_behind form_driver set_form_fields
+    form_fields field_count move_field new_form free_form set_new_page
+    new_page set_form_opts form_opts_on form_opts_off form_opts
+    set_current_field current_field set_form_page form_page field_index
+    post_form unpost_form set_form_userptr form_userptr set_form_win
+    form_win set_form_sub form_sub scale_form set_field_fore field_fore
+    set_field_back field_back set_field_pad field_pad set_field_buffer
+    field_buffer set_field_status field_status set_max_field field_info
+    dynamic_field_info set_field_just field_just new_field dup_field
+    link_field free_field set_field_opts field_opts_on field_opts_off
+    field_opts set_field_userptr field_userptr field_arg form_request_name
+    form_request_by_name
+
+    ERR OK ACS_BLOCK ACS_BOARD ACS_BTEE ACS_BULLET ACS_CKBOARD ACS_DARROW
+    ACS_DEGREE ACS_DIAMOND ACS_HLINE ACS_LANTERN ACS_LARROW ACS_LLCORNER
+    ACS_LRCORNER ACS_LTEE ACS_PLMINUS ACS_PLUS ACS_RARROW ACS_RTEE ACS_S1
+    ACS_S9 ACS_TTEE ACS_UARROW ACS_ULCORNER ACS_URCORNER ACS_VLINE
+    A_ALTCHARSET A_ATTRIBUTES A_BLINK A_BOLD A_CHARTEXT A_COLOR A_DIM
+    A_INVIS A_NORMAL A_PROTECT A_REVERSE A_STANDOUT A_UNDERLINE COLOR_BLACK
+    COLOR_BLUE COLOR_CYAN COLOR_GREEN COLOR_MAGENTA COLOR_RED COLOR_WHITE
+    COLOR_YELLOW KEY_A1 KEY_A3 KEY_B2 KEY_BACKSPACE KEY_BEG KEY_BREAK
+    KEY_BTAB KEY_C1 KEY_C3 KEY_CANCEL KEY_CATAB KEY_CLEAR KEY_CLOSE
+    KEY_COMMAND KEY_COPY KEY_CREATE KEY_CTAB KEY_DC KEY_DL KEY_DOWN KEY_EIC
+    KEY_END KEY_ENTER KEY_EOL KEY_EOS KEY_EVENT KEY_EXIT
+    KEY_F0 KEY_FIND KEY_HELP
+    KEY_HOME KEY_IC KEY_IL KEY_LEFT KEY_LL KEY_MARK KEY_MAX KEY_MESSAGE
+    KEY_MOUSE KEY_MIN KEY_MOVE KEY_NEXT KEY_NPAGE
+    KEY_OPEN KEY_OPTIONS KEY_PPAGE
+    KEY_PREVIOUS KEY_PRINT KEY_REDO KEY_REFERENCE KEY_REFRESH KEY_REPLACE
+    KEY_RESET  KEY_RESIZE KEY_RESTART KEY_RESUME KEY_RIGHT KEY_SAVE KEY_SBEG
+    KEY_SCANCEL KEY_SCOMMAND KEY_SCOPY KEY_SCREATE KEY_SDC KEY_SDL
+    KEY_SELECT KEY_SEND KEY_SEOL KEY_SEXIT KEY_SF KEY_SFIND KEY_SHELP
+    KEY_SHOME KEY_SIC KEY_SLEFT KEY_SMESSAGE KEY_SMOVE KEY_SNEXT
+    KEY_SOPTIONS KEY_SPREVIOUS KEY_SPRINT KEY_SR KEY_SREDO KEY_SREPLACE
+    KEY_SRESET KEY_SRIGHT KEY_SRSUME KEY_SSAVE KEY_SSUSPEND KEY_STAB
+    KEY_SUNDO KEY_SUSPEND KEY_UNDO KEY_UP
+    BUTTON1_RELEASED BUTTON1_PRESSED BUTTON1_CLICKED BUTTON1_DOUBLE_CLICKED
+    BUTTON1_TRIPLE_CLICKED BUTTON1_RESERVED_EVENT BUTTON2_RELEASED
+    BUTTON2_PRESSED BUTTON2_CLICKED BUTTON2_DOUBLE_CLICKED
+    BUTTON2_TRIPLE_CLICKED BUTTON2_RESERVED_EVENT BUTTON3_RELEASED
+    BUTTON3_PRESSED BUTTON3_CLICKED BUTTON3_DOUBLE_CLICKED
+    BUTTON3_TRIPLE_CLICKED BUTTON3_RESERVED_EVENT BUTTON4_RELEASED
+    BUTTON4_PRESSED BUTTON4_CLICKED BUTTON4_DOUBLE_CLICKED
+    BUTTON4_TRIPLE_CLICKED BUTTON4_RESERVED_EVENT BUTTON_CTRL BUTTON_SHIFT
+    BUTTON_ALT ALL_MOUSE_EVENTS REPORT_MOUSE_POSITION NCURSES_MOUSE_VERSION
+    E_OK E_SYSTEM_ERROR E_BAD_ARGUMENT E_POSTED E_CONNECTED E_BAD_STATE
+    E_NO_ROOM E_NOT_POSTED E_UNKNOWN_COMMAND E_NO_MATCH E_NOT_SELECTABLE
+    E_NOT_CONNECTED E_REQUEST_DENIED E_INVALID_FIELD E_CURRENT
+    REQ_LEFT_ITEM REQ_RIGHT_ITEM REQ_UP_ITEM REQ_DOWN_ITEM REQ_SCR_ULINE
+    REQ_SCR_DLINE REQ_SCR_DPAGE REQ_SCR_UPAGE REQ_FIRST_ITEM REQ_LAST_ITEM
+    REQ_NEXT_ITEM REQ_PREV_ITEM REQ_TOGGLE_ITEM REQ_CLEAR_PATTERN
+    REQ_BACK_PATTERN REQ_NEXT_MATCH REQ_PREV_MATCH MIN_MENU_COMMAND
+    MAX_MENU_COMMAND O_ONEVALUE O_SHOWDESC O_ROWMAJOR O_IGNORECASE
+    O_SHOWMATCH O_NONCYCLIC O_SELECTABLE REQ_NEXT_PAGE REQ_PREV_PAGE
+    REQ_FIRST_PAGE REQ_LAST_PAGE REQ_NEXT_FIELD REQ_PREV_FIELD
+    REQ_FIRST_FIELD REQ_LAST_FIELD REQ_SNEXT_FIELD REQ_SPREV_FIELD
+    REQ_SFIRST_FIELD REQ_SLAST_FIELD REQ_LEFT_FIELD REQ_RIGHT_FIELD
+    REQ_UP_FIELD REQ_DOWN_FIELD REQ_NEXT_CHAR REQ_PREV_CHAR REQ_NEXT_LINE
+    REQ_PREV_LINE REQ_NEXT_WORD REQ_PREV_WORD REQ_BEG_FIELD REQ_END_FIELD
+    REQ_BEG_LINE REQ_END_LINE REQ_LEFT_CHAR REQ_RIGHT_CHAR REQ_UP_CHAR
+    REQ_DOWN_CHAR REQ_NEW_LINE REQ_INS_CHAR REQ_INS_LINE REQ_DEL_CHAR
+    REQ_DEL_PREV REQ_DEL_LINE REQ_DEL_WORD REQ_CLR_EOL REQ_CLR_EOF
+    REQ_CLR_FIELD REQ_OVL_MODE REQ_INS_MODE REQ_SCR_FLINE REQ_SCR_BLINE
+    REQ_SCR_FPAGE REQ_SCR_BPAGE REQ_SCR_FHPAGE REQ_SCR_BHPAGE REQ_SCR_FCHAR
+    REQ_SCR_BCHAR REQ_SCR_HFLINE REQ_SCR_HBLINE REQ_SCR_HFHALF
+    REQ_SCR_HBHALF REQ_VALIDATION REQ_NEXT_CHOICE REQ_PREV_CHOICE
+    MIN_FORM_COMMAND MAX_FORM_COMMAND NO_JUSTIFICATION JUSTIFY_LEFT
+    JUSTIFY_CENTER JUSTIFY_RIGHT O_VISIBLE O_ACTIVE O_PUBLIC O_EDIT O_WRAP
+    O_BLANK O_AUTOSKIP O_NULLOK O_PASSOK O_STATIC O_NL_OVERLOAD
+    O_BS_OVERLOAD
+);
+
+if ($OldCurses)
+{
+    @_OLD = qw(
+        wprintw mvprintw wmvprintw
+
+        waddch mvaddch mvwaddch wechochar waddchstr mvaddchstr
+        mvwaddchstr waddchnstr mvaddchnstr mvwaddchnstr waddstr
+        mvaddstr mvwaddstr waddnstr mvaddnstr mvwaddnstr wattroff
+        wattron wattrset wstandend wstandout wattr_get wattr_off wattr_on
+        wattr_set wchgat mvchgat mvwchgat wbkgd wbkgdset wborder whline
+        mvhline mvwhline wvline mvvline mvwvline werase wclear
+        wclrtobot wclrtoeol wdelch mvdelch mvwdelch wdeleteln winsdelln
+        winsertln wgetch mvgetch mvwgetch wgetstr mvgetstr mvwgetstr
+        wgetnstr mvgetnstr mvwgetnstr winch mvinch mvwinch winchstr
+        mvinchstr mvwinchstr winchnstr mvinchnstr mvwinchnstr wtimeout
+        winsch mvinsch mvwinsch winsstr mvinsstr mvwinsstr winsnstr
+        mvinsnstr mvwinsnstr winstr mvinstr mvwinstr winnstr mvinnstr
+        mvwinnstr wmove wsetscrreg wrefresh wnoutrefresh wredrawln wscrl
+        wtouchln wsyncup wcursyncup wsyncdown wenclose wmouse_trafo wresize
+    );
+
+    push (@EXPORT, @_OLD);
+    for (@_OLD)
+    {
+	/^(?:mv)?(?:w)?(.*)/;
+	eval "sub $_ { $1(\@_); }";
+    }
+
+    eval <<EOS;
+    sub wprintw   { addstr(shift,               sprintf shift, @_) }
+    sub mvprintw  { addstr(shift, shift,        sprintf shift, @_) }
+    sub mvwprintw { addstr(shift, shift, shift, sprintf shift, @_) }
+EOS
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Curses - terminal screen handling and optimization
+
+=head1 SYNOPSIS
+
+    use Curses;
+
+    initscr;
+    ...
+    endwin;
+
+=head1 DESCRIPTION
+
+C<Curses> is the interface between Perl and your system's curses(3)
+library.  For descriptions on the usage of a given function, variable,
+or constant, consult your system's documentation, as such information
+invariably varies (:-) between different curses(3) libraries and
+operating systems.  This document describes the interface itself, and
+assumes that you already know how your system's curses(3) library
+works.
+
+=head2 Unified Functions
+
+Many curses(3) functions have variants starting with the prefixes
+I<w->, I<mv->, and/or I<wmv->.  These variants differ only in the
+explicit addition of a window, or by the addition of two coordinates
+that are used to move the cursor first.  For example, C<addch()> has
+three other variants: C<waddch()>, C<mvaddch()>, and C<mvwaddch()>.
+The variants aren't very interesting; in fact, we could roll all of
+the variants into original function by allowing a variable number
+of arguments and analyzing the argument list for which variant the
+user wanted to call.
+
+Unfortunately, curses(3) predates varargs(3), so in C we were stuck
+with all the variants.  However, C<Curses> is a Perl interface, so we
+are free to "unify" these variants into one function.  The section
+L<"Available Functions"> below lists all curses(3) functions C<Curses>
+makes available as Perl equivalents, along with a column listing if it
+is I<unified>.  If so, it takes a varying number of arguments as
+follows:
+
+=over 4
+
+C<function( [win], [y, x], args );>
+
+I<win> is an optional window argument, defaulting to C<stdscr> if not
+specified.
+
+I<y, x> is an optional coordinate pair used to move the cursor,
+defaulting to no move if not specified.
+
+I<args> are the required arguments of the function.  These are the
+arguments you would specify if you were just calling the base function
+and not any of the variants.
+
+=back
+
+This makes the variants obsolete, since their functionality has been
+merged into a single function, so C<Curses> does not define them by
+default.  You can still get them if you want, by setting the
+variable C<$Curses::OldCurses> to a non-zero value before using the
+C<Curses> package.  See L<"Perl 4.X C<cursperl> Compatibility">
+for an example of this.
+
+=head2 Wide-Character-Aware Functions
+
+The following are the preferred functions for working with strings, though
+they don't follow the normal unified function naming convention (based on the
+names in the Curses library) described above.  Despite the naming, each
+corresponds to a Curses library function.  For example, a C<getchar>
+call performs a Curses library function in the C<getch> family.
+
+In addition to these functions, The C<Curses> module contains corresponding
+functions with the conventional naming (e.g. C<getch>); the duplication is for
+historical reasons.  The preferred functions were new in Curses 1.29 (April
+2014).  They use the wide character functions in the Curses library if
+available (falling back to using the traditional non-wide-character versions).
+They also have a more Perl-like interface, taking care of some gory details
+under the hood about which a Perl programmer shouldn't have to worry.
+
+The reason for two sets of string-handling functions is historical.  The
+original Curses Perl module predates Curses libraries that understand multiple
+byte character encodings.  Moreover, the module was designed to have a Perl
+interface that closely resembles the C interface syntactically and directly
+passes the internal byte representation of Perl strings to C code.  This was
+probably fine before Perl got Unicode function, but today, Perl stores strings
+internally in either Latin-1 or Unicode UTF-8 and the original module was not
+sensitive to which encoding was used.
+
+While most of the problems could be worked around in Perl code using the
+traditional interface, it's hard to get right and you need a
+wide-character-aware curses library (e.g. ncursesw) anyway to make it work
+properly.  Because existing consumers of the Curses module may be relying on
+the traditional behavior, Curses module designers couldn't simply modify the
+existing functions to understand wide characters and convert from and to Perl
+strings.
+
+None of these functions exist if Perl is older than 5.16.
+
+
+=head3 C<getchar>
+
+This calls C<wget_wch()>.  It returns a character -- more precisely, a
+one-character (not necessarily one-byte!) string holding the character -- for
+a normal key and a two-element list C<(undef, key-number)> for a function key.
+It returns C<undef> on error.
+
+If you don't expect function keys (i.e. with C<keypad(0))>, you can simply do
+
+=over 4
+
+	my $ch = getchar;
+	die "getchar failed" unless defined $ch;
+
+=back
+
+If you do expect function keys (i.e. with C<keypad(1)>), you can still assign
+the result to a scalar variable as above.  Because of of the way the comma
+operator works, that variable will receive either C<undef> or the string or
+the number, and you can decode it yourself.
+
+=over 4
+
+	my $ch = getchar;
+	die "getchar failed" unless defined $ch;
+	if (<$ch looks like a number >= 0x100>) {
+		<handle function key>
+	} else {
+		<handle normal key>
+	}
+
+=back
+
+or do
+
+=over 4
+
+	my ($ch, $key) = getchar;
+	if (defined $key) {
+		<handle function key $key>
+	} else if (defined $ch) {
+		<handle normal key $ch>
+	} else {
+		die "getchar failed";
+	}
+
+=back
+
+If C<wget_wch()> is not available (i.e. The Curses library does not understand
+wide characters), this calls C<wgetch()>, but returns the values described
+above nonetheless.  This can be a problem because with a multibyte character
+encoding like UTF-8, you will receive two one-character strings for a
+two-byte-character (e.g. "%81Ã" and "%81¤" for "%81ä").  If you append
+these characters to a Perl string, that string may internally contain a valid
+UTF-8 encoding of a character, but Perl will not interpret it that way. Perl
+may even try to convert what it believes to be two characters to UTF-8, giving
+you four bytes.
+
+
+=head3 C<getstring>
+
+This calls C<wgetn_wstr> and returns a string or C<undef>.  It cannot return a
+function key value; the Curses library will itself interpret KEY_LEFT and
+KEY_BACKSPACE.
+
+If C<wgett_wstr()> is unavailable, this calls C<wgetstr()>.
+
+In both cases, the function allocates a buffer of fixed size to hold the
+result of the Curses library call.
+
+=over 4
+
+	my $s = getstring();
+	die "getstring failed" unless defined $s;
+
+=back
+
+
+=head3 C<addstring>/C<insstring>
+
+This adds/inserts the Perl string passed as an argument to the Curses window
+using C<waddnwstr()>/C<wins_nwstr()> or, if unavailable,
+C<waddnstr()>/C<winsnstr()>.  It returns a true value on success, false on
+failure.
+
+=over 4
+
+	addstring("H%81äll%81ö, W%81örld") ||%81 die "addstring failed";
+
+=back
+
+=head3 C<instring>
+
+This returns a Perl string (or C<undef> on failure) holding the characters
+from the current cursor position up to the end of the line.  It uses
+C<winnwstr()> if available, and otherwise C<innstr()>.
+
+=over 4
+
+	my $s = instring();
+	die "instring failed" unless defined $s;
+
+=back
+
+=head3 C<ungetchar>
+
+This pushes one character (passed as a one-character Perl string) back to the
+input queue. It uses C<unget_wch()> or C<ungetch()>.  It returns a true value
+on success, false on failure.  It cannot push back a function key; the Curses
+library provides no way to push back function keys, only characters.
+
+=over 4
+
+	ungetchar("X") ||%81 die "ungetchar failed";
+
+=back
+
+The C<Curses> module provides no interface to the complex-character routines
+(C<wadd_wch()>, C<wadd_wchnstr()>, C<wecho_wchar()>, C<win_wch()>,
+C<win_wchnstr()>, C<wins_wch()>) because there is no sensible way of
+converting from Perl to a C C<cchar_t> or back.
+
+=head2 Objects
+
+Objects work.  Example:
+
+    $win = new Curses;
+    $win->addstr(10, 10, 'foo');
+    $win->refresh;
+    ...
+
+Any function that has been marked as I<unified> (see
+L<"Available Functions"> below and L<"Unified Functions"> above)
+can be called as a method for a Curses object.
+
+Do not use C<initscr()> if using objects, as the first call to get
+a C<new Curses> will do it for you.
+
+=head2 Security Concerns
+
+It has always been the case with the curses functions, but please note
+that the following functions:
+
+    getstr()   (and optional wgetstr(), mvgetstr(), and mvwgetstr())
+    inchstr()  (and optional winchstr(), mvinchstr(), and mvwinchstr())
+    instr()    (and optional winstr(), mvinstr(), and mvwinstr())
+
+are subject to buffer overflow attack.  This is because you pass in
+the buffer to be filled in, which has to be of finite length, but
+there is no way to stop a bad guy from typing.
+
+In order to avoid this problem, use the alternate functions:
+
+   getnstr()
+   inchnstr()
+   innstr()
+
+which take an extra "size of buffer" argument
+or the wide-character-aware getstring() and instring() versions.
+
+=head1 COMPATIBILITY
+
+=head2 Perl 4.X C<cursperl> Compatibility
+
+C<Curses> was written to take advantage of features of Perl 5 and later.  The
+author thought it was better to provide an improved curses programming
+environment than to be 100% compatible.  However, many old C<curseperl>
+applications will probably still work by starting the script with:
+
+    BEGIN { $Curses::OldCurses = 1; }
+    use Curses;
+
+Any old application that still does not work should print an understandable
+error message explaining the problem.
+
+Some functions and variables are not available through C<Curses>, even with
+the C<BEGIN> line.  They are listed under
+L<"Curses items not available through Perl Curses">.
+
+The variables C<$stdscr> and C<$curscr> are also available as
+functions C<stdscr> and C<curscr>.  This is because of a Perl bug.
+See the L<LIMITATIONS> section for details.
+
+=head2 Incompatibilities with previous versions of C<Curses>
+
+In previous versions of this software, some Perl functions took a different
+set of parameters than their C counterparts.  This is not true in the current
+version.  You should now use C<getstr($str)> and C<getyx($y, $x)> instead of
+C<$str = getstr()> and C<($y, $x) = getyx()>.
+
+=head1 DIAGNOSTICS
+
+=over 4
+
+=item * Curses function '%s' called with too %s arguments at ...
+
+You have called a C<Curses> function with a wrong number of
+arguments.
+
+=item * argument %d to Curses function '%s' is not a Curses %s at ...
+
+=item * argument is not a Curses %s at ...
+
+The argument you gave to the function wasn't of a valid type for the
+place you used it.
+
+This probably means that you didn't give the right arguments to a I<unified>
+function.  See the DESCRIPTION section on L<Unified Functions> for more
+information.
+
+=item * Curses function '%s' is not defined in your Curses library at ...
+
+Your code has a call to a Perl C<Curses> function that your system's Curses
+library doesn't provide.
+
+=item * Curses variable '%s' is not defined in your Curses library at ...
+
+Your code has a Perl C<Curses> variable that your system's Curses library
+doesn't provide.
+
+=item * Curses constant '%s' is not defined in your Curses library at ...
+
+Your code references the specified C<Curses> constant, and your system's
+Curses library doesn't provide it.
+
+=item * Curses::Vars::FETCH called with bad index at ...
+
+=item * Curses::Vars::STORE called with bad index at ...
+
+You've been playing with the C<tie> interface to the C<Curses> variables.
+Don't do that.  :-)
+
+=item * Anything else
+
+Check out the F<perldiag> man page to see if the error is in there.
+
+=back
+
+=head1 LIMITATIONS
+
+If you use the variables C<$stdscr> and C<$curscr> instead of their
+functional counterparts (C<stdscr> and C<curscr>), you might run into
+a bug in Perl where the "magic" isn't called early enough.  This is
+manifested by the C<Curses> package telling you C<$stdscr> isn't a
+window.  One workaround is to put a line like C<$stdscr = $stdscr>
+near the front of your program.
+
+=head1 AUTHOR
+
+William Setzer <William_Setzer@ncsu.edu>
+
+=head1 SYNOPSIS OF PERL CURSES AVAILABILITY
+
+=head2 Available Functions
+
+    Avaiable Function    Unified?     Available via $OldCurses[*]
+    -----------------    --------     ------------------------
+    addch                  Yes        waddch mvaddch mvwaddch
+    echochar               Yes        wechochar
+    addchstr               Yes        waddchstr mvaddchstr mvwaddchstr
+    addchnstr              Yes        waddchnstr mvaddchnstr mvwaddchnstr
+    addstr                 Yes        waddstr mvaddstr mvwaddstr
+    addnstr                Yes        waddnstr mvaddnstr mvwaddnstr
+    attroff                Yes        wattroff
+    attron                 Yes        wattron
+    attrset                Yes        wattrset
+    standend               Yes        wstandend
+    standout               Yes        wstandout
+    attr_get               Yes        wattr_get
+    attr_off               Yes        wattr_off
+    attr_on                Yes        wattr_on
+    attr_set               Yes        wattr_set
+    chgat                  Yes        wchgat mvchgat mvwchgat
+    COLOR_PAIR              No
+    PAIR_NUMBER             No
+    beep                    No
+    flash                   No
+    bkgd                   Yes        wbkgd
+    bkgdset                Yes        wbkgdset
+    getbkgd                Yes
+    border                 Yes        wborder
+    box                    Yes
+    hline                  Yes        whline mvhline mvwhline
+    vline                  Yes        wvline mvvline mvwvline
+    erase                  Yes        werase
+    clear                  Yes        wclear
+    clrtobot               Yes        wclrtobot
+    clrtoeol               Yes        wclrtoeol
+    start_color             No
+    init_pair               No
+    init_color              No
+    has_colors              No
+    can_change_color        No
+    color_content           No
+    pair_content            No
+    delch                  Yes        wdelch mvdelch mvwdelch
+    deleteln               Yes        wdeleteln
+    insdelln               Yes        winsdelln
+    insertln               Yes        winsertln
+    getch                  Yes        wgetch mvgetch mvwgetch
+    ungetch                 No
+    has_key                 No
+    KEY_F                   No
+    getstr                 Yes        wgetstr mvgetstr mvwgetstr
+    getnstr                Yes        wgetnstr mvgetnstr mvwgetnstr
+    getyx                  Yes
+    getparyx               Yes
+    getbegyx               Yes
+    getmaxyx               Yes
+    inch                   Yes        winch mvinch mvwinch
+    inchstr                Yes        winchstr mvinchstr mvwinchstr
+    inchnstr               Yes        winchnstr mvinchnstr mvwinchnstr
+    initscr                 No
+    endwin                  No
+    isendwin                No
+    newterm                 No
+    set_term                No
+    delscreen               No
+    cbreak                  No
+    nocbreak                No
+    echo                    No
+    noecho                  No
+    halfdelay               No
+    intrflush              Yes
+    keypad                 Yes
+    meta                   Yes
+    nodelay                Yes
+    notimeout              Yes
+    raw                     No
+    noraw                   No
+    qiflush                 No
+    noqiflush               No
+    timeout                Yes        wtimeout
+    typeahead               No
+    insch                  Yes        winsch mvinsch mvwinsch
+    insstr                 Yes        winsstr mvinsstr mvwinsstr
+    insnstr                Yes        winsnstr mvinsnstr mvwinsnstr
+    instr                  Yes        winstr mvinstr mvwinstr
+    innstr                 Yes        winnstr mvinnstr mvwinnstr
+    def_prog_mode           No
+    def_shell_mode          No
+    reset_prog_mode         No
+    reset_shell_mode        No
+    resetty                 No
+    savetty                 No
+    getsyx                  No
+    setsyx                  No
+    curs_set                No
+    napms                   No
+    move                   Yes        wmove
+    clearok                Yes
+    idlok                  Yes
+    idcok                  Yes
+    immedok                Yes
+    leaveok                Yes
+    setscrreg              Yes        wsetscrreg
+    scrollok               Yes
+    nl                      No
+    nonl                    No
+    overlay                 No
+    overwrite               No
+    copywin                 No
+    newpad                  No
+    subpad                  No
+    prefresh                No
+    pnoutrefresh            No
+    pechochar               No
+    refresh                Yes        wrefresh
+    noutrefresh            Yes        wnoutrefresh
+    doupdate                No
+    redrawwin              Yes
+    redrawln               Yes        wredrawln
+    scr_dump                No
+    scr_restore             No
+    scr_init                No
+    scr_set                 No
+    scroll                 Yes
+    scrl                   Yes        wscrl
+    slk_init                No
+    slk_set                 No
+    slk_refresh             No
+    slk_noutrefresh         No
+    slk_label               No
+    slk_clear               No
+    slk_restore             No
+    slk_touch               No
+    slk_attron              No
+    slk_attrset             No
+    slk_attr                No
+    slk_attroff             No
+    slk_color               No
+    baudrate                No
+    erasechar               No
+    has_ic                  No
+    has_il                  No
+    killchar                No
+    longname                No
+    termattrs               No
+    termname                No
+    touchwin               Yes
+    touchline              Yes
+    untouchwin             Yes
+    touchln                Yes        wtouchln
+    is_linetouched         Yes
+    is_wintouched          Yes
+    unctrl                  No
+    keyname                 No
+    filter                  No
+    use_env                 No
+    putwin                  No
+    getwin                  No
+    delay_output            No
+    flushinp                No
+    newwin                  No
+    delwin                 Yes
+    mvwin                  Yes
+    subwin                 Yes
+    derwin                 Yes
+    mvderwin               Yes
+    dupwin                 Yes
+    syncup                 Yes        wsyncup
+    syncok                 Yes
+    cursyncup              Yes        wcursyncup
+    syncdown               Yes        wsyncdown
+    getmouse                No
+    ungetmouse              No
+    mousemask               No
+    enclose                Yes        wenclose
+    mouse_trafo            Yes        wmouse_trafo
+    mouseinterval           No
+    BUTTON_RELEASE          No
+    BUTTON_PRESS            No
+    BUTTON_CLICK            No
+    BUTTON_DOUBLE_CLICK     No
+    BUTTON_TRIPLE_CLICK     No
+    BUTTON_RESERVED_EVENT   No
+    use_default_colors      No
+    assume_default_colors   No
+    define_key              No
+    keybound                No
+    keyok                   No
+    resizeterm              No
+    resize                 Yes        wresize
+    getmaxy                Yes
+    getmaxx                Yes
+    flusok                 Yes
+    getcap                  No
+    touchoverlap            No
+    new_panel               No
+    bottom_panel            No
+    top_panel               No
+    show_panel              No
+    update_panels           No
+    hide_panel              No
+    panel_window            No
+    replace_panel           No
+    move_panel              No
+    panel_hidden            No
+    panel_above             No
+    panel_below             No
+    set_panel_userptr       No
+    panel_userptr           No
+    del_panel               No
+    set_menu_fore           No
+    menu_fore               No
+    set_menu_back           No
+    menu_back               No
+    set_menu_grey           No
+    menu_grey               No
+    set_menu_pad            No
+    menu_pad                No
+    pos_menu_cursor         No
+    menu_driver             No
+    set_menu_format         No
+    menu_format             No
+    set_menu_items          No
+    menu_items              No
+    item_count              No
+    set_menu_mark           No
+    menu_mark               No
+    new_menu                No
+    free_menu               No
+    menu_opts               No
+    set_menu_opts           No
+    menu_opts_on            No
+    menu_opts_off           No
+    set_menu_pattern        No
+    menu_pattern            No
+    post_menu               No
+    unpost_menu             No
+    set_menu_userptr        No
+    menu_userptr            No
+    set_menu_win            No
+    menu_win                No
+    set_menu_sub            No
+    menu_sub                No
+    scale_menu              No
+    set_current_item        No
+    current_item            No
+    set_top_row             No
+    top_row                 No
+    item_index              No
+    item_name               No
+    item_description        No
+    new_item                No
+    free_item               No
+    set_item_opts           No
+    item_opts_on            No
+    item_opts_off           No
+    item_opts               No
+    item_userptr            No
+    set_item_userptr        No
+    set_item_value          No
+    item_value              No
+    item_visible            No
+    menu_request_name       No
+    menu_request_by_name    No
+    set_menu_spacing        No
+    menu_spacing            No
+    pos_form_cursor         No
+    data_ahead              No
+    data_behind             No
+    form_driver             No
+    set_form_fields         No
+    form_fields             No
+    field_count             No
+    move_field              No
+    new_form                No
+    free_form               No
+    set_new_page            No
+    new_page                No
+    set_form_opts           No
+    form_opts_on            No
+    form_opts_off           No
+    form_opts               No
+    set_current_field       No
+    current_field           No
+    set_form_page           No
+    form_page               No
+    field_index             No
+    post_form               No
+    unpost_form             No
+    set_form_userptr        No
+    form_userptr            No
+    set_form_win            No
+    form_win                No
+    set_form_sub            No
+    form_sub                No
+    scale_form              No
+    set_field_fore          No
+    field_fore              No
+    set_field_back          No
+    field_back              No
+    set_field_pad           No
+    field_pad               No
+    set_field_buffer        No
+    field_buffer            No
+    set_field_status        No
+    field_status            No
+    set_max_field           No
+    field_info              No
+    dynamic_field_info      No
+    set_field_just          No
+    field_just              No
+    new_field               No
+    dup_field               No
+    link_field              No
+    free_field              No
+    set_field_opts          No
+    field_opts_on           No
+    field_opts_off          No
+    field_opts              No
+    set_field_userptr       No
+    field_userptr           No
+    field_arg               No
+    form_request_name       No
+    form_request_by_name    No
+
+[*] To use any functions in this column, the program must set the variable
+C<$Curses::OldCurses> variable to a non-zero value before using the
+C<Curses> package.  See L<"Perl 4.X cursperl Compatibility"> for an
+example of this.
+
+=head2 Available Wide-Character-Aware Functions
+
+    Function    Uses wide-character call  Reverts to legacy call
+    --------    ------------------------  ----------------------
+    getchar     wget_wch                  wgetch
+    getstring   wgetn_wstr                wgetnstr
+    ungetchar   unget_wch                 ungetch
+    instring    winnwtr                   winnstr
+    addstring   waddnwstr                 waddnstr
+    insstring   wins_nwstr                winsnstr
+
+=head2 Available Variables
+
+    LINES                   COLS                    stdscr
+    curscr                  COLORS                  COLOR_PAIRS
+
+=head2 Available Constants
+
+    ERR                     OK                      ACS_BLOCK
+    ACS_BOARD               ACS_BTEE                ACS_BULLET
+    ACS_CKBOARD             ACS_DARROW              ACS_DEGREE
+    ACS_DIAMOND             ACS_HLINE               ACS_LANTERN
+    ACS_LARROW              ACS_LLCORNER            ACS_LRCORNER
+    ACS_LTEE                ACS_PLMINUS             ACS_PLUS
+    ACS_RARROW              ACS_RTEE                ACS_S1
+    ACS_S9                  ACS_TTEE                ACS_UARROW
+    ACS_ULCORNER            ACS_URCORNER            ACS_VLINE
+    A_ALTCHARSET            A_ATTRIBUTES            A_BLINK
+    A_BOLD                  A_CHARTEXT              A_COLOR
+    A_DIM                   A_INVIS                 A_NORMAL
+    A_PROTECT               A_REVERSE               A_STANDOUT
+    A_UNDERLINE             COLOR_BLACK             COLOR_BLUE
+    COLOR_CYAN              COLOR_GREEN             COLOR_MAGENTA
+    COLOR_RED               COLOR_WHITE             COLOR_YELLOW
+    KEY_A1                  KEY_A3                  KEY_B2
+    KEY_BACKSPACE           KEY_BEG                 KEY_BREAK
+    KEY_BTAB                KEY_C1                  KEY_C3
+    KEY_CANCEL              KEY_CATAB               KEY_CLEAR
+    KEY_CLOSE               KEY_COMMAND             KEY_COPY
+    KEY_CREATE              KEY_CTAB                KEY_DC
+    KEY_DL                  KEY_DOWN                KEY_EIC
+    KEY_END                 KEY_ENTER               KEY_EOL
+    KEY_EOS                 KEY_EVENT               KEY_EXIT
+    KEY_F0
+    KEY_FIND                KEY_HELP                KEY_HOME
+    KEY_IC                  KEY_IL                  KEY_LEFT
+    KEY_LL                  KEY_MARK                KEY_MAX
+    KEY_MESSAGE             KEY_MIN                 KEY_MOVE
+    KEY_NEXT                KEY_NPAGE               KEY_OPEN
+    KEY_OPTIONS             KEY_PPAGE               KEY_PREVIOUS
+    KEY_PRINT               KEY_REDO                KEY_REFERENCE
+    KEY_REFRESH             KEY_REPLACE             KEY_RESET
+    KEY_RESIZE              KEY_RESTART             KEY_RESUME
+    KEY_RIGHT
+    KEY_SAVE                KEY_SBEG                KEY_SCANCEL
+    KEY_SCOMMAND            KEY_SCOPY               KEY_SCREATE
+    KEY_SDC                 KEY_SDL                 KEY_SELECT
+    KEY_SEND                KEY_SEOL                KEY_SEXIT
+    KEY_SF                  KEY_SFIND               KEY_SHELP
+    KEY_SHOME               KEY_SIC                 KEY_SLEFT
+    KEY_SMESSAGE            KEY_SMOVE               KEY_SNEXT
+    KEY_SOPTIONS            KEY_SPREVIOUS           KEY_SPRINT
+    KEY_SR                  KEY_SREDO               KEY_SREPLACE
+    KEY_SRESET              KEY_SRIGHT              KEY_SRSUME
+    KEY_SSAVE               KEY_SSUSPEND            KEY_STAB
+    KEY_SUNDO               KEY_SUSPEND             KEY_UNDO
+    KEY_UP                  KEY_MOUSE               BUTTON1_RELEASED
+    BUTTON1_PRESSED         BUTTON1_CLICKED         BUTTON1_DOUBLE_CLICKED
+    BUTTON1_TRIPLE_CLICKED  BUTTON1_RESERVED_EVENT  BUTTON2_RELEASED
+    BUTTON2_PRESSED         BUTTON2_CLICKED         BUTTON2_DOUBLE_CLICKED
+    BUTTON2_TRIPLE_CLICKED  BUTTON2_RESERVED_EVENT  BUTTON3_RELEASED
+    BUTTON3_PRESSED         BUTTON3_CLICKED         BUTTON3_DOUBLE_CLICKED
+    BUTTON3_TRIPLE_CLICKED  BUTTON3_RESERVED_EVENT  BUTTON4_RELEASED
+    BUTTON4_PRESSED         BUTTON4_CLICKED         BUTTON4_DOUBLE_CLICKED
+    BUTTON4_TRIPLE_CLICKED  BUTTON4_RESERVED_EVENT  BUTTON_CTRL
+    BUTTON_SHIFT            BUTTON_ALT              ALL_MOUSE_EVENTS
+    REPORT_MOUSE_POSITION   NCURSES_MOUSE_VERSION   E_OK
+    E_SYSTEM_ERROR          E_BAD_ARGUMENT          E_POSTED
+    E_CONNECTED             E_BAD_STATE             E_NO_ROOM
+    E_NOT_POSTED            E_UNKNOWN_COMMAND       E_NO_MATCH
+    E_NOT_SELECTABLE        E_NOT_CONNECTED         E_REQUEST_DENIED
+    E_INVALID_FIELD         E_CURRENT               REQ_LEFT_ITEM
+    REQ_RIGHT_ITEM          REQ_UP_ITEM             REQ_DOWN_ITEM
+    REQ_SCR_ULINE           REQ_SCR_DLINE           REQ_SCR_DPAGE
+    REQ_SCR_UPAGE           REQ_FIRST_ITEM          REQ_LAST_ITEM
+    REQ_NEXT_ITEM           REQ_PREV_ITEM           REQ_TOGGLE_ITEM
+    REQ_CLEAR_PATTERN       REQ_BACK_PATTERN        REQ_NEXT_MATCH
+    REQ_PREV_MATCH          MIN_MENU_COMMAND        MAX_MENU_COMMAND
+    O_ONEVALUE              O_SHOWDESC              O_ROWMAJOR
+    O_IGNORECASE            O_SHOWMATCH             O_NONCYCLIC
+    O_SELECTABLE            REQ_NEXT_PAGE           REQ_PREV_PAGE
+    REQ_FIRST_PAGE          REQ_LAST_PAGE           REQ_NEXT_FIELD
+    REQ_PREV_FIELD          REQ_FIRST_FIELD         REQ_LAST_FIELD
+    REQ_SNEXT_FIELD         REQ_SPREV_FIELD         REQ_SFIRST_FIELD
+    REQ_SLAST_FIELD         REQ_LEFT_FIELD          REQ_RIGHT_FIELD
+    REQ_UP_FIELD            REQ_DOWN_FIELD          REQ_NEXT_CHAR
+    REQ_PREV_CHAR           REQ_NEXT_LINE           REQ_PREV_LINE
+    REQ_NEXT_WORD           REQ_PREV_WORD           REQ_BEG_FIELD
+    REQ_END_FIELD           REQ_BEG_LINE            REQ_END_LINE
+    REQ_LEFT_CHAR           REQ_RIGHT_CHAR          REQ_UP_CHAR
+    REQ_DOWN_CHAR           REQ_NEW_LINE            REQ_INS_CHAR
+    REQ_INS_LINE            REQ_DEL_CHAR            REQ_DEL_PREV
+    REQ_DEL_LINE            REQ_DEL_WORD            REQ_CLR_EOL
+    REQ_CLR_EOF             REQ_CLR_FIELD           REQ_OVL_MODE
+    REQ_INS_MODE            REQ_SCR_FLINE           REQ_SCR_BLINE
+    REQ_SCR_FPAGE           REQ_SCR_BPAGE           REQ_SCR_FHPAGE
+    REQ_SCR_BHPAGE          REQ_SCR_FCHAR           REQ_SCR_BCHAR
+    REQ_SCR_HFLINE          REQ_SCR_HBLINE          REQ_SCR_HFHALF
+    REQ_SCR_HBHALF          REQ_VALIDATION          REQ_NEXT_CHOICE
+    REQ_PREV_CHOICE         MIN_FORM_COMMAND        MAX_FORM_COMMAND
+    NO_JUSTIFICATION        JUSTIFY_LEFT            JUSTIFY_CENTER
+    JUSTIFY_RIGHT           O_VISIBLE               O_ACTIVE
+    O_PUBLIC                O_EDIT                  O_WRAP
+    O_BLANK                 O_AUTOSKIP              O_NULLOK
+    O_PASSOK                O_STATIC                O_NL_OVERLOAD
+    O_BS_OVERLOAD           
+
+=head2 Curses functions not available through Perl C<Curses>
+
+    tstp _putchar fullname scanw wscanw mvscanw mvwscanw ripoffline
+    setupterm setterm set_curterm del_curterm restartterm tparm tputs
+    putp vidputs vidattr mvcur tigetflag tigetnum tigetstr tgetent
+    tgetflag tgetnum tgetstr tgoto tputs
+
+=head2 Curses menu functions not available through Perl C<Curses>
+
+    set_item_init item_init set_item_term item_term set_menu_init
+    menu_init set_menu_term menu_term
+
+=head2 Curses form functions not available through Perl C<Curses>
+
+    new_fieldtype free_fieldtype set_fieldtype_arg
+    set_fieldtype_choice link_fieldtype set_form_init form_init
+    set_form_term form_term set_field_init field_init set_field_term
+    field_term set_field_type field_type
@@ -0,0 +1,1254 @@
+/* 
+**
+**  CursesBoot.c -- the bootstrap function
+**
+**  This is an inclusion for Curses.c.
+**
+**  Copyright (c) 1994-2000  William Setzer
+**
+**  You may distribute under the terms of either the Artistic License
+**  or the GNU General Public License, as specified in the README file.
+*/
+
+#define C_NEWXS(A,B)   newXS(A,B,file)
+#define C_NEWCS(A,B)   newCONSTSUB(stash,A,newSViv(B))
+
+XS(boot_Curses)
+{
+  int i;
+
+    dXSARGS;
+    char *file  = __FILE__;
+    HV   *stash = gv_stashpv("Curses", TRUE);
+    IV   tmp;
+    SV  *t2;
+
+    XS_VERSION_BOOTCHECK;
+
+    /* Functions */
+
+    C_NEWXS("Curses::addch",                  XS_Curses_addch);
+    C_NEWXS("Curses::echochar",               XS_Curses_echochar);
+    C_NEWXS("Curses::addchstr",               XS_Curses_addchstr);
+    C_NEWXS("Curses::addchnstr",              XS_Curses_addchnstr);
+    C_NEWXS("Curses::addstr",                 XS_Curses_addstr);
+    C_NEWXS("Curses::addnstr",                XS_Curses_addnstr);
+    C_NEWXS("Curses::attroff",                XS_Curses_attroff);
+    C_NEWXS("Curses::attron",                 XS_Curses_attron);
+    C_NEWXS("Curses::attrset",                XS_Curses_attrset);
+    C_NEWXS("Curses::standend",               XS_Curses_standend);
+    C_NEWXS("Curses::standout",               XS_Curses_standout);
+    C_NEWXS("Curses::attr_get",               XS_Curses_attr_get);
+    C_NEWXS("Curses::attr_off",               XS_Curses_attr_off);
+    C_NEWXS("Curses::attr_on",                XS_Curses_attr_on);
+    C_NEWXS("Curses::attr_set",               XS_Curses_attr_set);
+    C_NEWXS("Curses::chgat",                  XS_Curses_chgat);
+    C_NEWXS("Curses::COLOR_PAIR",             XS_Curses_COLOR_PAIR);
+    C_NEWXS("Curses::PAIR_NUMBER",            XS_Curses_PAIR_NUMBER);
+    C_NEWXS("Curses::beep",                   XS_Curses_beep);
+    C_NEWXS("Curses::flash",                  XS_Curses_flash);
+    C_NEWXS("Curses::bkgd",                   XS_Curses_bkgd);
+    C_NEWXS("Curses::bkgdset",                XS_Curses_bkgdset);
+    C_NEWXS("Curses::getbkgd",                XS_Curses_getbkgd);
+    C_NEWXS("Curses::border",                 XS_Curses_border);
+    C_NEWXS("Curses::box",                    XS_Curses_box);
+    C_NEWXS("Curses::hline",                  XS_Curses_hline);
+    C_NEWXS("Curses::vline",                  XS_Curses_vline);
+    C_NEWXS("Curses::erase",                  XS_Curses_erase);
+    C_NEWXS("Curses::clear",                  XS_Curses_clear);
+    C_NEWXS("Curses::clrtobot",               XS_Curses_clrtobot);
+    C_NEWXS("Curses::clrtoeol",               XS_Curses_clrtoeol);
+    C_NEWXS("Curses::start_color",            XS_Curses_start_color);
+    C_NEWXS("Curses::init_pair",              XS_Curses_init_pair);
+    C_NEWXS("Curses::init_color",             XS_Curses_init_color);
+    C_NEWXS("Curses::has_colors",             XS_Curses_has_colors);
+    C_NEWXS("Curses::can_change_color",       XS_Curses_can_change_color);
+    C_NEWXS("Curses::color_content",          XS_Curses_color_content);
+    C_NEWXS("Curses::pair_content",           XS_Curses_pair_content);
+    C_NEWXS("Curses::delch",                  XS_Curses_delch);
+    C_NEWXS("Curses::deleteln",               XS_Curses_deleteln);
+    C_NEWXS("Curses::insdelln",               XS_Curses_insdelln);
+    C_NEWXS("Curses::insertln",               XS_Curses_insertln);
+    C_NEWXS("Curses::getch",                  XS_Curses_getch);
+    C_NEWXS("Curses::ungetch",                XS_Curses_ungetch);
+    C_NEWXS("Curses::has_key",                XS_Curses_has_key);
+    C_NEWXS("Curses::KEY_F",                  XS_Curses_KEY_F);
+    C_NEWXS("Curses::getstr",                 XS_Curses_getstr);
+    C_NEWXS("Curses::getnstr",                XS_Curses_getnstr);
+    C_NEWXS("Curses::getyx",                  XS_Curses_getyx);
+    C_NEWXS("Curses::getparyx",               XS_Curses_getparyx);
+    C_NEWXS("Curses::getbegyx",               XS_Curses_getbegyx);
+    C_NEWXS("Curses::getmaxyx",               XS_Curses_getmaxyx);
+    C_NEWXS("Curses::inch",                   XS_Curses_inch);
+    C_NEWXS("Curses::inchstr",                XS_Curses_inchstr);
+    C_NEWXS("Curses::inchnstr",               XS_Curses_inchnstr);
+    C_NEWXS("Curses::initscr",                XS_Curses_initscr);
+    C_NEWXS("Curses::endwin",                 XS_Curses_endwin);
+    C_NEWXS("Curses::isendwin",               XS_Curses_isendwin);
+    C_NEWXS("Curses::newterm",                XS_Curses_newterm);
+    C_NEWXS("Curses::set_term",               XS_Curses_set_term);
+    C_NEWXS("Curses::delscreen",              XS_Curses_delscreen);
+#ifdef C_INTCBREAK
+    C_NEWXS("Curses::cbreak",                 XS_Curses_cbreak);
+#else
+    C_NEWXS("Curses::cbreak",                 XS_Curses_cbreak);
+#endif
+#ifdef C_INTNOCBREAK
+    C_NEWXS("Curses::nocbreak",               XS_Curses_nocbreak);
+#else
+    C_NEWXS("Curses::nocbreak",               XS_Curses_nocbreak);
+#endif
+#ifdef C_INTECHO
+    C_NEWXS("Curses::echo",                   XS_Curses_echo);
+#else
+    C_NEWXS("Curses::echo",                   XS_Curses_echo);
+#endif
+#ifdef C_INTNOECHO
+    C_NEWXS("Curses::noecho",                 XS_Curses_noecho);
+#else
+    C_NEWXS("Curses::noecho",                 XS_Curses_noecho);
+#endif
+    C_NEWXS("Curses::halfdelay",              XS_Curses_halfdelay);
+    C_NEWXS("Curses::intrflush",              XS_Curses_intrflush);
+    C_NEWXS("Curses::keypad",                 XS_Curses_keypad);
+    C_NEWXS("Curses::meta",                   XS_Curses_meta);
+    C_NEWXS("Curses::nodelay",                XS_Curses_nodelay);
+    C_NEWXS("Curses::notimeout",              XS_Curses_notimeout);
+#ifdef C_INTRAW
+    C_NEWXS("Curses::raw",                    XS_Curses_raw);
+#else
+    C_NEWXS("Curses::raw",                    XS_Curses_raw);
+#endif
+#ifdef C_INTNORAW
+    C_NEWXS("Curses::noraw",                  XS_Curses_noraw);
+#else
+    C_NEWXS("Curses::noraw",                  XS_Curses_noraw);
+#endif
+    C_NEWXS("Curses::qiflush",                XS_Curses_qiflush);
+    C_NEWXS("Curses::noqiflush",              XS_Curses_noqiflush);
+    C_NEWXS("Curses::timeout",                XS_Curses_timeout);
+    C_NEWXS("Curses::typeahead",              XS_Curses_typeahead);
+    C_NEWXS("Curses::insch",                  XS_Curses_insch);
+    C_NEWXS("Curses::insstr",                 XS_Curses_insstr);
+    C_NEWXS("Curses::insnstr",                XS_Curses_insnstr);
+    C_NEWXS("Curses::instr",                  XS_Curses_instr);
+    C_NEWXS("Curses::innstr",                 XS_Curses_innstr);
+    C_NEWXS("Curses::def_prog_mode",          XS_Curses_def_prog_mode);
+    C_NEWXS("Curses::def_shell_mode",         XS_Curses_def_shell_mode);
+    C_NEWXS("Curses::reset_prog_mode",        XS_Curses_reset_prog_mode);
+    C_NEWXS("Curses::reset_shell_mode",       XS_Curses_reset_shell_mode);
+    C_NEWXS("Curses::resetty",                XS_Curses_resetty);
+    C_NEWXS("Curses::savetty",                XS_Curses_savetty);
+#ifdef C_INTGETSYX
+    C_NEWXS("Curses::getsyx",                 XS_Curses_getsyx);
+#else
+    C_NEWXS("Curses::getsyx",                 XS_Curses_getsyx);
+#endif
+#ifdef C_INTSETSYX
+    C_NEWXS("Curses::setsyx",                 XS_Curses_setsyx);
+#else
+    C_NEWXS("Curses::setsyx",                 XS_Curses_setsyx);
+#endif
+    C_NEWXS("Curses::curs_set",               XS_Curses_curs_set);
+    C_NEWXS("Curses::napms",                  XS_Curses_napms);
+    C_NEWXS("Curses::move",                   XS_Curses_move);
+    C_NEWXS("Curses::clearok",                XS_Curses_clearok);
+#ifdef C_INTIDLOK
+    C_NEWXS("Curses::idlok",                  XS_Curses_idlok);
+#else
+    C_NEWXS("Curses::idlok",                  XS_Curses_idlok);
+#endif
+    C_NEWXS("Curses::idcok",                  XS_Curses_idcok);
+    C_NEWXS("Curses::immedok",                XS_Curses_immedok);
+    C_NEWXS("Curses::leaveok",                XS_Curses_leaveok);
+    C_NEWXS("Curses::setscrreg",              XS_Curses_setscrreg);
+    C_NEWXS("Curses::scrollok",               XS_Curses_scrollok);
+#ifdef C_INTNL
+    C_NEWXS("Curses::nl",                     XS_Curses_nl);
+#else
+    C_NEWXS("Curses::nl",                     XS_Curses_nl);
+#endif
+#ifdef C_INTNONL
+    C_NEWXS("Curses::nonl",                   XS_Curses_nonl);
+#else
+    C_NEWXS("Curses::nonl",                   XS_Curses_nonl);
+#endif
+    C_NEWXS("Curses::overlay",                XS_Curses_overlay);
+    C_NEWXS("Curses::overwrite",              XS_Curses_overwrite);
+    C_NEWXS("Curses::copywin",                XS_Curses_copywin);
+    C_NEWXS("Curses::newpad",                 XS_Curses_newpad);
+    C_NEWXS("Curses::subpad",                 XS_Curses_subpad);
+    C_NEWXS("Curses::prefresh",               XS_Curses_prefresh);
+    C_NEWXS("Curses::pnoutrefresh",           XS_Curses_pnoutrefresh);
+    C_NEWXS("Curses::pechochar",              XS_Curses_pechochar);
+    C_NEWXS("Curses::refresh",                XS_Curses_refresh);
+    C_NEWXS("Curses::noutrefresh",            XS_Curses_noutrefresh);
+    C_NEWXS("Curses::doupdate",               XS_Curses_doupdate);
+    C_NEWXS("Curses::redrawwin",              XS_Curses_redrawwin);
+    C_NEWXS("Curses::redrawln",               XS_Curses_redrawln);
+    C_NEWXS("Curses::scr_dump",               XS_Curses_scr_dump);
+    C_NEWXS("Curses::scr_restore",            XS_Curses_scr_restore);
+    C_NEWXS("Curses::scr_init",               XS_Curses_scr_init);
+    C_NEWXS("Curses::scr_set",                XS_Curses_scr_set);
+    C_NEWXS("Curses::scroll",                 XS_Curses_scroll);
+    C_NEWXS("Curses::scrl",                   XS_Curses_scrl);
+    C_NEWXS("Curses::slk_init",               XS_Curses_slk_init);
+    C_NEWXS("Curses::slk_set",                XS_Curses_slk_set);
+    C_NEWXS("Curses::slk_refresh",            XS_Curses_slk_refresh);
+    C_NEWXS("Curses::slk_noutrefresh",        XS_Curses_slk_noutrefresh);
+    C_NEWXS("Curses::slk_label",              XS_Curses_slk_label);
+    C_NEWXS("Curses::slk_clear",              XS_Curses_slk_clear);
+    C_NEWXS("Curses::slk_restore",            XS_Curses_slk_restore);
+    C_NEWXS("Curses::slk_touch",              XS_Curses_slk_touch);
+    C_NEWXS("Curses::slk_attron",             XS_Curses_slk_attron);
+    C_NEWXS("Curses::slk_attrset",            XS_Curses_slk_attrset);
+    C_NEWXS("Curses::slk_attr",               XS_Curses_slk_attr);
+    C_NEWXS("Curses::slk_attroff",            XS_Curses_slk_attroff);
+    C_NEWXS("Curses::slk_color",              XS_Curses_slk_color);
+    C_NEWXS("Curses::baudrate",               XS_Curses_baudrate);
+    C_NEWXS("Curses::erasechar",              XS_Curses_erasechar);
+    C_NEWXS("Curses::has_ic",                 XS_Curses_has_ic);
+    C_NEWXS("Curses::has_il",                 XS_Curses_has_il);
+    C_NEWXS("Curses::killchar",               XS_Curses_killchar);
+#ifdef C_LONG0ARGS
+    C_NEWXS("Curses::longname",               XS_Curses_longname);
+#else
+    C_NEWXS("Curses::longname",               XS_Curses_longname);
+#endif
+    C_NEWXS("Curses::termattrs",              XS_Curses_termattrs);
+    C_NEWXS("Curses::termname",               XS_Curses_termname);
+    C_NEWXS("Curses::touchwin",               XS_Curses_touchwin);
+#ifdef C_TOUCH3ARGS
+    C_NEWXS("Curses::touchline",              XS_Curses_touchline);
+#else
+    C_NEWXS("Curses::touchline",              XS_Curses_touchline);
+#endif
+    C_NEWXS("Curses::untouchwin",             XS_Curses_untouchwin);
+    C_NEWXS("Curses::touchln",                XS_Curses_touchln);
+    C_NEWXS("Curses::is_linetouched",         XS_Curses_is_linetouched);
+    C_NEWXS("Curses::is_wintouched",          XS_Curses_is_wintouched);
+    C_NEWXS("Curses::unctrl",                 XS_Curses_unctrl);
+    C_NEWXS("Curses::keyname",                XS_Curses_keyname);
+#ifdef C_INTFILTER
+    C_NEWXS("Curses::filter",                 XS_Curses_filter);
+#else
+    C_NEWXS("Curses::filter",                 XS_Curses_filter);
+#endif
+    C_NEWXS("Curses::use_env",                XS_Curses_use_env);
+    C_NEWXS("Curses::putwin",                 XS_Curses_putwin);
+    C_NEWXS("Curses::getwin",                 XS_Curses_getwin);
+    C_NEWXS("Curses::delay_output",           XS_Curses_delay_output);
+    C_NEWXS("Curses::flushinp",               XS_Curses_flushinp);
+    C_NEWXS("Curses::newwin",                 XS_Curses_newwin);
+    C_NEWXS("Curses::delwin",                 XS_Curses_delwin);
+    C_NEWXS("Curses::mvwin",                  XS_Curses_mvwin);
+    C_NEWXS("Curses::subwin",                 XS_Curses_subwin);
+    C_NEWXS("Curses::derwin",                 XS_Curses_derwin);
+    C_NEWXS("Curses::mvderwin",               XS_Curses_mvderwin);
+    C_NEWXS("Curses::dupwin",                 XS_Curses_dupwin);
+    C_NEWXS("Curses::syncup",                 XS_Curses_syncup);
+    C_NEWXS("Curses::syncok",                 XS_Curses_syncok);
+    C_NEWXS("Curses::cursyncup",              XS_Curses_cursyncup);
+    C_NEWXS("Curses::syncdown",               XS_Curses_syncdown);
+    C_NEWXS("Curses::getmouse",               XS_Curses_getmouse);
+    C_NEWXS("Curses::ungetmouse",             XS_Curses_ungetmouse);
+    C_NEWXS("Curses::mousemask",              XS_Curses_mousemask);
+    C_NEWXS("Curses::enclose",                XS_Curses_enclose);
+    C_NEWXS("Curses::mouse_trafo",            XS_Curses_mouse_trafo);
+    C_NEWXS("Curses::mouseinterval",          XS_Curses_mouseinterval);
+    C_NEWXS("Curses::BUTTON_RELEASE",         XS_Curses_BUTTON_RELEASE);
+    C_NEWXS("Curses::BUTTON_PRESS",           XS_Curses_BUTTON_PRESS);
+    C_NEWXS("Curses::BUTTON_CLICK",           XS_Curses_BUTTON_CLICK);
+    C_NEWXS("Curses::BUTTON_DOUBLE_CLICK",    XS_Curses_BUTTON_DOUBLE_CLICK);
+    C_NEWXS("Curses::BUTTON_TRIPLE_CLICK",    XS_Curses_BUTTON_TRIPLE_CLICK);
+    C_NEWXS("Curses::BUTTON_RESERVED_EVENT",  XS_Curses_BUTTON_RESERVED_EVENT);
+    C_NEWXS("Curses::use_default_colors",     XS_Curses_use_default_colors);
+    C_NEWXS("Curses::assume_default_colors",  XS_Curses_assume_default_colors);
+    C_NEWXS("Curses::define_key",             XS_Curses_define_key);
+    C_NEWXS("Curses::keybound",               XS_Curses_keybound);
+    C_NEWXS("Curses::keyok",                  XS_Curses_keyok);
+    C_NEWXS("Curses::resizeterm",             XS_Curses_resizeterm);
+    C_NEWXS("Curses::resize",                 XS_Curses_resize);
+    C_NEWXS("Curses::getmaxy",                XS_Curses_getmaxy);
+    C_NEWXS("Curses::getmaxx",                XS_Curses_getmaxx);
+    C_NEWXS("Curses::flusok",                 XS_Curses_flusok);
+    C_NEWXS("Curses::getcap",                 XS_Curses_getcap);
+    C_NEWXS("Curses::touchoverlap",           XS_Curses_touchoverlap);
+    C_NEWXS("Curses::new_panel",              XS_Curses_new_panel);
+    C_NEWXS("Curses::bottom_panel",           XS_Curses_bottom_panel);
+    C_NEWXS("Curses::top_panel",              XS_Curses_top_panel);
+    C_NEWXS("Curses::show_panel",             XS_Curses_show_panel);
+    C_NEWXS("Curses::update_panels",          XS_Curses_update_panels);
+    C_NEWXS("Curses::hide_panel",             XS_Curses_hide_panel);
+    C_NEWXS("Curses::panel_window",           XS_Curses_panel_window);
+    C_NEWXS("Curses::replace_panel",          XS_Curses_replace_panel);
+    C_NEWXS("Curses::move_panel",             XS_Curses_move_panel);
+    C_NEWXS("Curses::panel_hidden",           XS_Curses_panel_hidden);
+    C_NEWXS("Curses::panel_above",            XS_Curses_panel_above);
+    C_NEWXS("Curses::panel_below",            XS_Curses_panel_below);
+    C_NEWXS("Curses::set_panel_userptr",      XS_Curses_set_panel_userptr);
+    C_NEWXS("Curses::panel_userptr",          XS_Curses_panel_userptr);
+    C_NEWXS("Curses::del_panel",              XS_Curses_del_panel);
+    C_NEWXS("Curses::set_menu_fore",          XS_Curses_set_menu_fore);
+    C_NEWXS("Curses::menu_fore",              XS_Curses_menu_fore);
+    C_NEWXS("Curses::set_menu_back",          XS_Curses_set_menu_back);
+    C_NEWXS("Curses::menu_back",              XS_Curses_menu_back);
+    C_NEWXS("Curses::set_menu_grey",          XS_Curses_set_menu_grey);
+    C_NEWXS("Curses::menu_grey",              XS_Curses_menu_grey);
+    C_NEWXS("Curses::set_menu_pad",           XS_Curses_set_menu_pad);
+    C_NEWXS("Curses::menu_pad",               XS_Curses_menu_pad);
+    C_NEWXS("Curses::pos_menu_cursor",        XS_Curses_pos_menu_cursor);
+    C_NEWXS("Curses::menu_driver",            XS_Curses_menu_driver);
+    C_NEWXS("Curses::set_menu_format",        XS_Curses_set_menu_format);
+    C_NEWXS("Curses::menu_format",            XS_Curses_menu_format);
+    C_NEWXS("Curses::set_menu_items",         XS_Curses_set_menu_items);
+    C_NEWXS("Curses::menu_items",             XS_Curses_menu_items);
+    C_NEWXS("Curses::item_count",             XS_Curses_item_count);
+    C_NEWXS("Curses::set_menu_mark",          XS_Curses_set_menu_mark);
+    C_NEWXS("Curses::menu_mark",              XS_Curses_menu_mark);
+    C_NEWXS("Curses::new_menu",               XS_Curses_new_menu);
+    C_NEWXS("Curses::free_menu",              XS_Curses_free_menu);
+    C_NEWXS("Curses::menu_opts",              XS_Curses_menu_opts);
+    C_NEWXS("Curses::set_menu_opts",          XS_Curses_set_menu_opts);
+    C_NEWXS("Curses::menu_opts_on",           XS_Curses_menu_opts_on);
+    C_NEWXS("Curses::menu_opts_off",          XS_Curses_menu_opts_off);
+    C_NEWXS("Curses::set_menu_pattern",       XS_Curses_set_menu_pattern);
+    C_NEWXS("Curses::menu_pattern",           XS_Curses_menu_pattern);
+    C_NEWXS("Curses::post_menu",              XS_Curses_post_menu);
+    C_NEWXS("Curses::unpost_menu",            XS_Curses_unpost_menu);
+    C_NEWXS("Curses::set_menu_userptr",       XS_Curses_set_menu_userptr);
+    C_NEWXS("Curses::menu_userptr",           XS_Curses_menu_userptr);
+    C_NEWXS("Curses::set_menu_win",           XS_Curses_set_menu_win);
+    C_NEWXS("Curses::menu_win",               XS_Curses_menu_win);
+    C_NEWXS("Curses::set_menu_sub",           XS_Curses_set_menu_sub);
+    C_NEWXS("Curses::menu_sub",               XS_Curses_menu_sub);
+    C_NEWXS("Curses::scale_menu",             XS_Curses_scale_menu);
+    C_NEWXS("Curses::set_current_item",       XS_Curses_set_current_item);
+    C_NEWXS("Curses::current_item",           XS_Curses_current_item);
+    C_NEWXS("Curses::set_top_row",            XS_Curses_set_top_row);
+    C_NEWXS("Curses::top_row",                XS_Curses_top_row);
+    C_NEWXS("Curses::item_index",             XS_Curses_item_index);
+    C_NEWXS("Curses::item_name",              XS_Curses_item_name);
+    C_NEWXS("Curses::item_description",       XS_Curses_item_description);
+    C_NEWXS("Curses::new_item",               XS_Curses_new_item);
+    C_NEWXS("Curses::free_item",              XS_Curses_free_item);
+    C_NEWXS("Curses::set_item_opts",          XS_Curses_set_item_opts);
+    C_NEWXS("Curses::item_opts_on",           XS_Curses_item_opts_on);
+    C_NEWXS("Curses::item_opts_off",          XS_Curses_item_opts_off);
+    C_NEWXS("Curses::item_opts",              XS_Curses_item_opts);
+    C_NEWXS("Curses::item_userptr",           XS_Curses_item_userptr);
+    C_NEWXS("Curses::set_item_userptr",       XS_Curses_set_item_userptr);
+    C_NEWXS("Curses::set_item_value",         XS_Curses_set_item_value);
+    C_NEWXS("Curses::item_value",             XS_Curses_item_value);
+    C_NEWXS("Curses::item_visible",           XS_Curses_item_visible);
+    C_NEWXS("Curses::menu_request_name",      XS_Curses_menu_request_name);
+    C_NEWXS("Curses::menu_request_by_name",   XS_Curses_menu_request_by_name);
+    C_NEWXS("Curses::set_menu_spacing",       XS_Curses_set_menu_spacing);
+    C_NEWXS("Curses::menu_spacing",           XS_Curses_menu_spacing);
+    C_NEWXS("Curses::pos_form_cursor",        XS_Curses_pos_form_cursor);
+    C_NEWXS("Curses::data_ahead",             XS_Curses_data_ahead);
+    C_NEWXS("Curses::data_behind",            XS_Curses_data_behind);
+    C_NEWXS("Curses::form_driver",            XS_Curses_form_driver);
+    C_NEWXS("Curses::set_form_fields",        XS_Curses_set_form_fields);
+    C_NEWXS("Curses::form_fields",            XS_Curses_form_fields);
+    C_NEWXS("Curses::field_count",            XS_Curses_field_count);
+    C_NEWXS("Curses::move_field",             XS_Curses_move_field);
+    C_NEWXS("Curses::new_form",               XS_Curses_new_form);
+    C_NEWXS("Curses::free_form",              XS_Curses_free_form);
+    C_NEWXS("Curses::set_new_page",           XS_Curses_set_new_page);
+    C_NEWXS("Curses::new_page",               XS_Curses_new_page);
+    C_NEWXS("Curses::set_form_opts",          XS_Curses_set_form_opts);
+    C_NEWXS("Curses::form_opts_on",           XS_Curses_form_opts_on);
+    C_NEWXS("Curses::form_opts_off",          XS_Curses_form_opts_off);
+    C_NEWXS("Curses::form_opts",              XS_Curses_form_opts);
+    C_NEWXS("Curses::set_current_field",      XS_Curses_set_current_field);
+    C_NEWXS("Curses::current_field",          XS_Curses_current_field);
+    C_NEWXS("Curses::set_form_page",          XS_Curses_set_form_page);
+    C_NEWXS("Curses::form_page",              XS_Curses_form_page);
+    C_NEWXS("Curses::field_index",            XS_Curses_field_index);
+    C_NEWXS("Curses::post_form",              XS_Curses_post_form);
+    C_NEWXS("Curses::unpost_form",            XS_Curses_unpost_form);
+    C_NEWXS("Curses::set_form_userptr",       XS_Curses_set_form_userptr);
+    C_NEWXS("Curses::form_userptr",           XS_Curses_form_userptr);
+    C_NEWXS("Curses::set_form_win",           XS_Curses_set_form_win);
+    C_NEWXS("Curses::form_win",               XS_Curses_form_win);
+    C_NEWXS("Curses::set_form_sub",           XS_Curses_set_form_sub);
+    C_NEWXS("Curses::form_sub",               XS_Curses_form_sub);
+    C_NEWXS("Curses::scale_form",             XS_Curses_scale_form);
+    C_NEWXS("Curses::set_field_fore",         XS_Curses_set_field_fore);
+    C_NEWXS("Curses::field_fore",             XS_Curses_field_fore);
+    C_NEWXS("Curses::set_field_back",         XS_Curses_set_field_back);
+    C_NEWXS("Curses::field_back",             XS_Curses_field_back);
+    C_NEWXS("Curses::set_field_pad",          XS_Curses_set_field_pad);
+    C_NEWXS("Curses::field_pad",              XS_Curses_field_pad);
+    C_NEWXS("Curses::set_field_buffer",       XS_Curses_set_field_buffer);
+    C_NEWXS("Curses::field_buffer",           XS_Curses_field_buffer);
+    C_NEWXS("Curses::set_field_status",       XS_Curses_set_field_status);
+    C_NEWXS("Curses::field_status",           XS_Curses_field_status);
+    C_NEWXS("Curses::set_max_field",          XS_Curses_set_max_field);
+    C_NEWXS("Curses::field_info",             XS_Curses_field_info);
+    C_NEWXS("Curses::dynamic_field_info",     XS_Curses_dynamic_field_info);
+    C_NEWXS("Curses::set_field_just",         XS_Curses_set_field_just);
+    C_NEWXS("Curses::field_just",             XS_Curses_field_just);
+    C_NEWXS("Curses::new_field",              XS_Curses_new_field);
+    C_NEWXS("Curses::dup_field",              XS_Curses_dup_field);
+    C_NEWXS("Curses::link_field",             XS_Curses_link_field);
+    C_NEWXS("Curses::free_field",             XS_Curses_free_field);
+    C_NEWXS("Curses::set_field_opts",         XS_Curses_set_field_opts);
+    C_NEWXS("Curses::field_opts_on",          XS_Curses_field_opts_on);
+    C_NEWXS("Curses::field_opts_off",         XS_Curses_field_opts_off);
+    C_NEWXS("Curses::field_opts",             XS_Curses_field_opts);
+    C_NEWXS("Curses::set_field_userptr",      XS_Curses_set_field_userptr);
+    C_NEWXS("Curses::field_userptr",          XS_Curses_field_userptr);
+    C_NEWXS("Curses::field_arg",              XS_Curses_field_arg);
+    C_NEWXS("Curses::form_request_name",      XS_Curses_form_request_name);
+    C_NEWXS("Curses::form_request_by_name",   XS_Curses_form_request_by_name);
+
+#if HAVE_WIDE_XS_FUNCTIONS
+    /* Combined Normal/Wide-Character Functions */
+
+    C_NEWXS("Curses::addstring",		XS_CURSES_addstring);
+    C_NEWXS("Curses::insstring",		XS_CURSES_insstring);
+    C_NEWXS("Curses::instring",			XS_CURSES_instring);
+    C_NEWXS("Curses::getchar",			XS_CURSES_getchar);
+    C_NEWXS("Curses::ungetchar",		XS_CURSES_ungetchar);
+    C_NEWXS("Curses::getstring",		XS_CURSES_getstring);
+#endif
+
+    /* Variables masquerading as functions */
+
+    C_NEWXS("Curses::LINES",                  XS_Curses_LINES);
+    C_NEWXS("Curses::COLS",                   XS_Curses_COLS);
+    C_NEWXS("Curses::stdscr",                 XS_Curses_stdscr);
+    C_NEWXS("Curses::curscr",                 XS_Curses_curscr);
+    C_NEWXS("Curses::COLORS",                 XS_Curses_COLORS);
+    C_NEWXS("Curses::COLOR_PAIRS",            XS_Curses_COLOR_PAIRS);
+
+    /* Variables masquerading as variables */ 
+
+    C_NEWXS("Curses::Vars::DESTROY",          XS_Curses_Vars_DESTROY);
+    C_NEWXS("Curses::Vars::FETCH",            XS_Curses_Vars_FETCH);
+    C_NEWXS("Curses::Vars::STORE",            XS_Curses_Vars_STORE);
+    C_NEWXS("Curses::Vars::TIESCALAR",        XS_Curses_Vars_TIESCALAR);
+
+    /* Constants */
+
+#ifdef ERR
+    C_NEWCS("ERR",                            ERR);
+#endif
+#ifdef OK
+    C_NEWCS("OK",                             OK);
+#endif
+    C_NEWXS("Curses::ACS_BLOCK",              XS_Curses_ACS_BLOCK);
+    C_NEWXS("Curses::ACS_BOARD",              XS_Curses_ACS_BOARD);
+    C_NEWXS("Curses::ACS_BTEE",               XS_Curses_ACS_BTEE);
+    C_NEWXS("Curses::ACS_BULLET",             XS_Curses_ACS_BULLET);
+    C_NEWXS("Curses::ACS_CKBOARD",            XS_Curses_ACS_CKBOARD);
+    C_NEWXS("Curses::ACS_DARROW",             XS_Curses_ACS_DARROW);
+    C_NEWXS("Curses::ACS_DEGREE",             XS_Curses_ACS_DEGREE);
+    C_NEWXS("Curses::ACS_DIAMOND",            XS_Curses_ACS_DIAMOND);
+    C_NEWXS("Curses::ACS_HLINE",              XS_Curses_ACS_HLINE);
+    C_NEWXS("Curses::ACS_LANTERN",            XS_Curses_ACS_LANTERN);
+    C_NEWXS("Curses::ACS_LARROW",             XS_Curses_ACS_LARROW);
+    C_NEWXS("Curses::ACS_LLCORNER",           XS_Curses_ACS_LLCORNER);
+    C_NEWXS("Curses::ACS_LRCORNER",           XS_Curses_ACS_LRCORNER);
+    C_NEWXS("Curses::ACS_LTEE",               XS_Curses_ACS_LTEE);
+    C_NEWXS("Curses::ACS_PLMINUS",            XS_Curses_ACS_PLMINUS);
+    C_NEWXS("Curses::ACS_PLUS",               XS_Curses_ACS_PLUS);
+    C_NEWXS("Curses::ACS_RARROW",             XS_Curses_ACS_RARROW);
+    C_NEWXS("Curses::ACS_RTEE",               XS_Curses_ACS_RTEE);
+    C_NEWXS("Curses::ACS_S1",                 XS_Curses_ACS_S1);
+    C_NEWXS("Curses::ACS_S9",                 XS_Curses_ACS_S9);
+    C_NEWXS("Curses::ACS_TTEE",               XS_Curses_ACS_TTEE);
+    C_NEWXS("Curses::ACS_UARROW",             XS_Curses_ACS_UARROW);
+    C_NEWXS("Curses::ACS_ULCORNER",           XS_Curses_ACS_ULCORNER);
+    C_NEWXS("Curses::ACS_URCORNER",           XS_Curses_ACS_URCORNER);
+    C_NEWXS("Curses::ACS_VLINE",              XS_Curses_ACS_VLINE);
+#ifdef A_ALTCHARSET
+    C_NEWCS("A_ALTCHARSET",                   A_ALTCHARSET);
+#endif
+#ifdef A_ATTRIBUTES
+    C_NEWCS("A_ATTRIBUTES",                   A_ATTRIBUTES);
+#endif
+#ifdef A_BLINK
+    C_NEWCS("A_BLINK",                        A_BLINK);
+#endif
+#ifdef A_BOLD
+    C_NEWCS("A_BOLD",                         A_BOLD);
+#endif
+#ifdef A_CHARTEXT
+    C_NEWCS("A_CHARTEXT",                     A_CHARTEXT);
+#endif
+#ifdef A_COLOR
+    C_NEWCS("A_COLOR",                        A_COLOR);
+#endif
+#ifdef A_DIM
+    C_NEWCS("A_DIM",                          A_DIM);
+#endif
+#ifdef A_INVIS
+    C_NEWCS("A_INVIS",                        A_INVIS);
+#endif
+#ifdef A_NORMAL
+    C_NEWCS("A_NORMAL",                       A_NORMAL);
+#endif
+#ifdef A_PROTECT
+    C_NEWCS("A_PROTECT",                      A_PROTECT);
+#endif
+#ifdef A_REVERSE
+    C_NEWCS("A_REVERSE",                      A_REVERSE);
+#endif
+#ifdef A_STANDOUT
+    C_NEWCS("A_STANDOUT",                     A_STANDOUT);
+#endif
+#ifdef A_UNDERLINE
+    C_NEWCS("A_UNDERLINE",                    A_UNDERLINE);
+#endif
+#ifdef COLOR_BLACK
+    C_NEWCS("COLOR_BLACK",                    COLOR_BLACK);
+#endif
+#ifdef COLOR_BLUE
+    C_NEWCS("COLOR_BLUE",                     COLOR_BLUE);
+#endif
+#ifdef COLOR_CYAN
+    C_NEWCS("COLOR_CYAN",                     COLOR_CYAN);
+#endif
+#ifdef COLOR_GREEN
+    C_NEWCS("COLOR_GREEN",                    COLOR_GREEN);
+#endif
+#ifdef COLOR_MAGENTA
+    C_NEWCS("COLOR_MAGENTA",                  COLOR_MAGENTA);
+#endif
+#ifdef COLOR_RED
+    C_NEWCS("COLOR_RED",                      COLOR_RED);
+#endif
+#ifdef COLOR_WHITE
+    C_NEWCS("COLOR_WHITE",                    COLOR_WHITE);
+#endif
+#ifdef COLOR_YELLOW
+    C_NEWCS("COLOR_YELLOW",                   COLOR_YELLOW);
+#endif
+#ifdef KEY_A1
+    C_NEWCS("KEY_A1",                         KEY_A1);
+#endif
+#ifdef KEY_A3
+    C_NEWCS("KEY_A3",                         KEY_A3);
+#endif
+#ifdef KEY_B2
+    C_NEWCS("KEY_B2",                         KEY_B2);
+#endif
+#ifdef KEY_BACKSPACE
+    C_NEWCS("KEY_BACKSPACE",                  KEY_BACKSPACE);
+#endif
+#ifdef KEY_BEG
+    C_NEWCS("KEY_BEG",                        KEY_BEG);
+#endif
+#ifdef KEY_BREAK
+    C_NEWCS("KEY_BREAK",                      KEY_BREAK);
+#endif
+#ifdef KEY_BTAB
+    C_NEWCS("KEY_BTAB",                       KEY_BTAB);
+#endif
+#ifdef KEY_C1
+    C_NEWCS("KEY_C1",                         KEY_C1);
+#endif
+#ifdef KEY_C3
+    C_NEWCS("KEY_C3",                         KEY_C3);
+#endif
+#ifdef KEY_CANCEL
+    C_NEWCS("KEY_CANCEL",                     KEY_CANCEL);
+#endif
+#ifdef KEY_CATAB
+    C_NEWCS("KEY_CATAB",                      KEY_CATAB);
+#endif
+#ifdef KEY_CLEAR
+    C_NEWCS("KEY_CLEAR",                      KEY_CLEAR);
+#endif
+#ifdef KEY_CLOSE
+    C_NEWCS("KEY_CLOSE",                      KEY_CLOSE);
+#endif
+#ifdef KEY_COMMAND
+    C_NEWCS("KEY_COMMAND",                    KEY_COMMAND);
+#endif
+#ifdef KEY_COPY
+    C_NEWCS("KEY_COPY",                       KEY_COPY);
+#endif
+#ifdef KEY_CREATE
+    C_NEWCS("KEY_CREATE",                     KEY_CREATE);
+#endif
+#ifdef KEY_CTAB
+    C_NEWCS("KEY_CTAB",                       KEY_CTAB);
+#endif
+#ifdef KEY_DC
+    C_NEWCS("KEY_DC",                         KEY_DC);
+#endif
+#ifdef KEY_DL
+    C_NEWCS("KEY_DL",                         KEY_DL);
+#endif
+#ifdef KEY_DOWN
+    C_NEWCS("KEY_DOWN",                       KEY_DOWN);
+#endif
+#ifdef KEY_EIC
+    C_NEWCS("KEY_EIC",                        KEY_EIC);
+#endif
+#ifdef KEY_END
+    C_NEWCS("KEY_END",                        KEY_END);
+#endif
+#ifdef KEY_ENTER
+    C_NEWCS("KEY_ENTER",                      KEY_ENTER);
+#endif
+#ifdef KEY_EOL
+    C_NEWCS("KEY_EOL",                        KEY_EOL);
+#endif
+#ifdef KEY_EOS
+    C_NEWCS("KEY_EOS",                        KEY_EOS);
+#endif
+#ifdef KEY_EXIT
+    C_NEWCS("KEY_EXIT",                       KEY_EXIT);
+#endif
+#ifdef KEY_F0
+    C_NEWCS("KEY_F0",                         KEY_F0);
+#endif
+#ifdef KEY_FIND
+    C_NEWCS("KEY_FIND",                       KEY_FIND);
+#endif
+#ifdef KEY_HELP
+    C_NEWCS("KEY_HELP",                       KEY_HELP);
+#endif
+#ifdef KEY_HOME
+    C_NEWCS("KEY_HOME",                       KEY_HOME);
+#endif
+#ifdef KEY_IC
+    C_NEWCS("KEY_IC",                         KEY_IC);
+#endif
+#ifdef KEY_IL
+    C_NEWCS("KEY_IL",                         KEY_IL);
+#endif
+#ifdef KEY_LEFT
+    C_NEWCS("KEY_LEFT",                       KEY_LEFT);
+#endif
+#ifdef KEY_LL
+    C_NEWCS("KEY_LL",                         KEY_LL);
+#endif
+#ifdef KEY_MARK
+    C_NEWCS("KEY_MARK",                       KEY_MARK);
+#endif
+#ifdef KEY_MAX
+    C_NEWCS("KEY_MAX",                        KEY_MAX);
+#endif
+#ifdef KEY_MESSAGE
+    C_NEWCS("KEY_MESSAGE",                    KEY_MESSAGE);
+#endif
+#ifdef KEY_MIN
+    C_NEWCS("KEY_MIN",                        KEY_MIN);
+#endif
+#ifdef KEY_MOVE
+    C_NEWCS("KEY_MOVE",                       KEY_MOVE);
+#endif
+#ifdef KEY_NEXT
+    C_NEWCS("KEY_NEXT",                       KEY_NEXT);
+#endif
+#ifdef KEY_NPAGE
+    C_NEWCS("KEY_NPAGE",                      KEY_NPAGE);
+#endif
+#ifdef KEY_OPEN
+    C_NEWCS("KEY_OPEN",                       KEY_OPEN);
+#endif
+#ifdef KEY_OPTIONS
+    C_NEWCS("KEY_OPTIONS",                    KEY_OPTIONS);
+#endif
+#ifdef KEY_PPAGE
+    C_NEWCS("KEY_PPAGE",                      KEY_PPAGE);
+#endif
+#ifdef KEY_PREVIOUS
+    C_NEWCS("KEY_PREVIOUS",                   KEY_PREVIOUS);
+#endif
+#ifdef KEY_PRINT
+    C_NEWCS("KEY_PRINT",                      KEY_PRINT);
+#endif
+#ifdef KEY_REDO
+    C_NEWCS("KEY_REDO",                       KEY_REDO);
+#endif
+#ifdef KEY_REFERENCE
+    C_NEWCS("KEY_REFERENCE",                  KEY_REFERENCE);
+#endif
+#ifdef KEY_REFRESH
+    C_NEWCS("KEY_REFRESH",                    KEY_REFRESH);
+#endif
+#ifdef KEY_REPLACE
+    C_NEWCS("KEY_REPLACE",                    KEY_REPLACE);
+#endif
+#ifdef KEY_RESET
+    C_NEWCS("KEY_RESET",                      KEY_RESET);
+#endif
+#ifdef KEY_RESTART
+    C_NEWCS("KEY_RESTART",                    KEY_RESTART);
+#endif
+#ifdef KEY_RESUME
+    C_NEWCS("KEY_RESUME",                     KEY_RESUME);
+#endif
+#ifdef KEY_RIGHT
+    C_NEWCS("KEY_RIGHT",                      KEY_RIGHT);
+#endif
+#ifdef KEY_SAVE
+    C_NEWCS("KEY_SAVE",                       KEY_SAVE);
+#endif
+#ifdef KEY_SBEG
+    C_NEWCS("KEY_SBEG",                       KEY_SBEG);
+#endif
+#ifdef KEY_SCANCEL
+    C_NEWCS("KEY_SCANCEL",                    KEY_SCANCEL);
+#endif
+#ifdef KEY_SCOMMAND
+    C_NEWCS("KEY_SCOMMAND",                   KEY_SCOMMAND);
+#endif
+#ifdef KEY_SCOPY
+    C_NEWCS("KEY_SCOPY",                      KEY_SCOPY);
+#endif
+#ifdef KEY_SCREATE
+    C_NEWCS("KEY_SCREATE",                    KEY_SCREATE);
+#endif
+#ifdef KEY_SDC
+    C_NEWCS("KEY_SDC",                        KEY_SDC);
+#endif
+#ifdef KEY_SDL
+    C_NEWCS("KEY_SDL",                        KEY_SDL);
+#endif
+#ifdef KEY_SELECT
+    C_NEWCS("KEY_SELECT",                     KEY_SELECT);
+#endif
+#ifdef KEY_SEND
+    C_NEWCS("KEY_SEND",                       KEY_SEND);
+#endif
+#ifdef KEY_SEOL
+    C_NEWCS("KEY_SEOL",                       KEY_SEOL);
+#endif
+#ifdef KEY_SEXIT
+    C_NEWCS("KEY_SEXIT",                      KEY_SEXIT);
+#endif
+#ifdef KEY_SF
+    C_NEWCS("KEY_SF",                         KEY_SF);
+#endif
+#ifdef KEY_SFIND
+    C_NEWCS("KEY_SFIND",                      KEY_SFIND);
+#endif
+#ifdef KEY_SHELP
+    C_NEWCS("KEY_SHELP",                      KEY_SHELP);
+#endif
+#ifdef KEY_SHOME
+    C_NEWCS("KEY_SHOME",                      KEY_SHOME);
+#endif
+#ifdef KEY_SIC
+    C_NEWCS("KEY_SIC",                        KEY_SIC);
+#endif
+#ifdef KEY_SLEFT
+    C_NEWCS("KEY_SLEFT",                      KEY_SLEFT);
+#endif
+#ifdef KEY_SMESSAGE
+    C_NEWCS("KEY_SMESSAGE",                   KEY_SMESSAGE);
+#endif
+#ifdef KEY_SMOVE
+    C_NEWCS("KEY_SMOVE",                      KEY_SMOVE);
+#endif
+#ifdef KEY_SNEXT
+    C_NEWCS("KEY_SNEXT",                      KEY_SNEXT);
+#endif
+#ifdef KEY_SOPTIONS
+    C_NEWCS("KEY_SOPTIONS",                   KEY_SOPTIONS);
+#endif
+#ifdef KEY_SPREVIOUS
+    C_NEWCS("KEY_SPREVIOUS",                  KEY_SPREVIOUS);
+#endif
+#ifdef KEY_SPRINT
+    C_NEWCS("KEY_SPRINT",                     KEY_SPRINT);
+#endif
+#ifdef KEY_SR
+    C_NEWCS("KEY_SR",                         KEY_SR);
+#endif
+#ifdef KEY_SREDO
+    C_NEWCS("KEY_SREDO",                      KEY_SREDO);
+#endif
+#ifdef KEY_SREPLACE
+    C_NEWCS("KEY_SREPLACE",                   KEY_SREPLACE);
+#endif
+#ifdef KEY_SRESET
+    C_NEWCS("KEY_SRESET",                     KEY_SRESET);
+#endif
+#ifdef KEY_SRIGHT
+    C_NEWCS("KEY_SRIGHT",                     KEY_SRIGHT);
+#endif
+#ifdef KEY_SRSUME
+    C_NEWCS("KEY_SRSUME",                     KEY_SRSUME);
+#endif
+#ifdef KEY_SSAVE
+    C_NEWCS("KEY_SSAVE",                      KEY_SSAVE);
+#endif
+#ifdef KEY_SSUSPEND
+    C_NEWCS("KEY_SSUSPEND",                   KEY_SSUSPEND);
+#endif
+#ifdef KEY_STAB
+    C_NEWCS("KEY_STAB",                       KEY_STAB);
+#endif
+#ifdef KEY_SUNDO
+    C_NEWCS("KEY_SUNDO",                      KEY_SUNDO);
+#endif
+#ifdef KEY_SUSPEND
+    C_NEWCS("KEY_SUSPEND",                    KEY_SUSPEND);
+#endif
+#ifdef KEY_UNDO
+    C_NEWCS("KEY_UNDO",                       KEY_UNDO);
+#endif
+#ifdef KEY_UP
+    C_NEWCS("KEY_UP",                         KEY_UP);
+#endif
+#ifdef KEY_MOUSE
+    C_NEWCS("KEY_MOUSE",                      KEY_MOUSE);
+#endif
+#ifdef KEY_RESIZE
+    C_NEWCS("KEY_RESIZE",                     KEY_RESIZE);
+#endif
+#ifdef KEY_EVENT
+    C_NEWCS("KEY_EVENT",                      KEY_EVENT);
+#endif
+#ifdef BUTTON1_RELEASED
+    C_NEWCS("BUTTON1_RELEASED",               BUTTON1_RELEASED);
+#endif
+#ifdef BUTTON1_PRESSED
+    C_NEWCS("BUTTON1_PRESSED",                BUTTON1_PRESSED);
+#endif
+#ifdef BUTTON1_CLICKED
+    C_NEWCS("BUTTON1_CLICKED",                BUTTON1_CLICKED);
+#endif
+#ifdef BUTTON1_DOUBLE_CLICKED
+    C_NEWCS("BUTTON1_DOUBLE_CLICKED",         BUTTON1_DOUBLE_CLICKED);
+#endif
+#ifdef BUTTON1_TRIPLE_CLICKED
+    C_NEWCS("BUTTON1_TRIPLE_CLICKED",         BUTTON1_TRIPLE_CLICKED);
+#endif
+#ifdef BUTTON1_RESERVED_EVENT
+    C_NEWCS("BUTTON1_RESERVED_EVENT",         BUTTON1_RESERVED_EVENT);
+#endif
+#ifdef BUTTON2_RELEASED
+    C_NEWCS("BUTTON2_RELEASED",               BUTTON2_RELEASED);
+#endif
+#ifdef BUTTON2_PRESSED
+    C_NEWCS("BUTTON2_PRESSED",                BUTTON2_PRESSED);
+#endif
+#ifdef BUTTON2_CLICKED
+    C_NEWCS("BUTTON2_CLICKED",                BUTTON2_CLICKED);
+#endif
+#ifdef BUTTON2_DOUBLE_CLICKED
+    C_NEWCS("BUTTON2_DOUBLE_CLICKED",         BUTTON2_DOUBLE_CLICKED);
+#endif
+#ifdef BUTTON2_TRIPLE_CLICKED
+    C_NEWCS("BUTTON2_TRIPLE_CLICKED",         BUTTON2_TRIPLE_CLICKED);
+#endif
+#ifdef BUTTON2_RESERVED_EVENT
+    C_NEWCS("BUTTON2_RESERVED_EVENT",         BUTTON2_RESERVED_EVENT);
+#endif
+#ifdef BUTTON3_RELEASED
+    C_NEWCS("BUTTON3_RELEASED",               BUTTON3_RELEASED);
+#endif
+#ifdef BUTTON3_PRESSED
+    C_NEWCS("BUTTON3_PRESSED",                BUTTON3_PRESSED);
+#endif
+#ifdef BUTTON3_CLICKED
+    C_NEWCS("BUTTON3_CLICKED",                BUTTON3_CLICKED);
+#endif
+#ifdef BUTTON3_DOUBLE_CLICKED
+    C_NEWCS("BUTTON3_DOUBLE_CLICKED",         BUTTON3_DOUBLE_CLICKED);
+#endif
+#ifdef BUTTON3_TRIPLE_CLICKED
+    C_NEWCS("BUTTON3_TRIPLE_CLICKED",         BUTTON3_TRIPLE_CLICKED);
+#endif
+#ifdef BUTTON3_RESERVED_EVENT
+    C_NEWCS("BUTTON3_RESERVED_EVENT",         BUTTON3_RESERVED_EVENT);
+#endif
+#ifdef BUTTON4_RELEASED
+    C_NEWCS("BUTTON4_RELEASED",               BUTTON4_RELEASED);
+#endif
+#ifdef BUTTON4_PRESSED
+    C_NEWCS("BUTTON4_PRESSED",                BUTTON4_PRESSED);
+#endif
+#ifdef BUTTON4_CLICKED
+    C_NEWCS("BUTTON4_CLICKED",                BUTTON4_CLICKED);
+#endif
+#ifdef BUTTON4_DOUBLE_CLICKED
+    C_NEWCS("BUTTON4_DOUBLE_CLICKED",         BUTTON4_DOUBLE_CLICKED);
+#endif
+#ifdef BUTTON4_TRIPLE_CLICKED
+    C_NEWCS("BUTTON4_TRIPLE_CLICKED",         BUTTON4_TRIPLE_CLICKED);
+#endif
+#ifdef BUTTON4_RESERVED_EVENT
+    C_NEWCS("BUTTON4_RESERVED_EVENT",         BUTTON4_RESERVED_EVENT);
+#endif
+#ifdef BUTTON_CTRL
+    C_NEWCS("BUTTON_CTRL",                    BUTTON_CTRL);
+#endif
+#ifdef BUTTON_SHIFT
+    C_NEWCS("BUTTON_SHIFT",                   BUTTON_SHIFT);
+#endif
+#ifdef BUTTON_ALT
+    C_NEWCS("BUTTON_ALT",                     BUTTON_ALT);
+#endif
+#ifdef ALL_MOUSE_EVENTS
+    C_NEWCS("ALL_MOUSE_EVENTS",               ALL_MOUSE_EVENTS);
+#endif
+#ifdef REPORT_MOUSE_POSITION
+    C_NEWCS("REPORT_MOUSE_POSITION",          REPORT_MOUSE_POSITION);
+#endif
+#ifdef NCURSES_MOUSE_VERSION
+    C_NEWCS("NCURSES_MOUSE_VERSION",          NCURSES_MOUSE_VERSION);
+#endif
+#ifdef E_OK
+    C_NEWCS("E_OK",                           E_OK);
+#endif
+#ifdef E_SYSTEM_ERROR
+    C_NEWCS("E_SYSTEM_ERROR",                 E_SYSTEM_ERROR);
+#endif
+#ifdef E_BAD_ARGUMENT
+    C_NEWCS("E_BAD_ARGUMENT",                 E_BAD_ARGUMENT);
+#endif
+#ifdef E_POSTED
+    C_NEWCS("E_POSTED",                       E_POSTED);
+#endif
+#ifdef E_CONNECTED
+    C_NEWCS("E_CONNECTED",                    E_CONNECTED);
+#endif
+#ifdef E_BAD_STATE
+    C_NEWCS("E_BAD_STATE",                    E_BAD_STATE);
+#endif
+#ifdef E_NO_ROOM
+    C_NEWCS("E_NO_ROOM",                      E_NO_ROOM);
+#endif
+#ifdef E_NOT_POSTED
+    C_NEWCS("E_NOT_POSTED",                   E_NOT_POSTED);
+#endif
+#ifdef E_UNKNOWN_COMMAND
+    C_NEWCS("E_UNKNOWN_COMMAND",              E_UNKNOWN_COMMAND);
+#endif
+#ifdef E_NO_MATCH
+    C_NEWCS("E_NO_MATCH",                     E_NO_MATCH);
+#endif
+#ifdef E_NOT_SELECTABLE
+    C_NEWCS("E_NOT_SELECTABLE",               E_NOT_SELECTABLE);
+#endif
+#ifdef E_NOT_CONNECTED
+    C_NEWCS("E_NOT_CONNECTED",                E_NOT_CONNECTED);
+#endif
+#ifdef E_REQUEST_DENIED
+    C_NEWCS("E_REQUEST_DENIED",               E_REQUEST_DENIED);
+#endif
+#ifdef E_INVALID_FIELD
+    C_NEWCS("E_INVALID_FIELD",                E_INVALID_FIELD);
+#endif
+#ifdef E_CURRENT
+    C_NEWCS("E_CURRENT",                      E_CURRENT);
+#endif
+#ifdef REQ_LEFT_ITEM
+    C_NEWCS("REQ_LEFT_ITEM",                  REQ_LEFT_ITEM);
+#endif
+#ifdef REQ_RIGHT_ITEM
+    C_NEWCS("REQ_RIGHT_ITEM",                 REQ_RIGHT_ITEM);
+#endif
+#ifdef REQ_UP_ITEM
+    C_NEWCS("REQ_UP_ITEM",                    REQ_UP_ITEM);
+#endif
+#ifdef REQ_DOWN_ITEM
+    C_NEWCS("REQ_DOWN_ITEM",                  REQ_DOWN_ITEM);
+#endif
+#ifdef REQ_SCR_ULINE
+    C_NEWCS("REQ_SCR_ULINE",                  REQ_SCR_ULINE);
+#endif
+#ifdef REQ_SCR_DLINE
+    C_NEWCS("REQ_SCR_DLINE",                  REQ_SCR_DLINE);
+#endif
+#ifdef REQ_SCR_DPAGE
+    C_NEWCS("REQ_SCR_DPAGE",                  REQ_SCR_DPAGE);
+#endif
+#ifdef REQ_SCR_UPAGE
+    C_NEWCS("REQ_SCR_UPAGE",                  REQ_SCR_UPAGE);
+#endif
+#ifdef REQ_FIRST_ITEM
+    C_NEWCS("REQ_FIRST_ITEM",                 REQ_FIRST_ITEM);
+#endif
+#ifdef REQ_LAST_ITEM
+    C_NEWCS("REQ_LAST_ITEM",                  REQ_LAST_ITEM);
+#endif
+#ifdef REQ_NEXT_ITEM
+    C_NEWCS("REQ_NEXT_ITEM",                  REQ_NEXT_ITEM);
+#endif
+#ifdef REQ_PREV_ITEM
+    C_NEWCS("REQ_PREV_ITEM",                  REQ_PREV_ITEM);
+#endif
+#ifdef REQ_TOGGLE_ITEM
+    C_NEWCS("REQ_TOGGLE_ITEM",                REQ_TOGGLE_ITEM);
+#endif
+#ifdef REQ_CLEAR_PATTERN
+    C_NEWCS("REQ_CLEAR_PATTERN",              REQ_CLEAR_PATTERN);
+#endif
+#ifdef REQ_BACK_PATTERN
+    C_NEWCS("REQ_BACK_PATTERN",               REQ_BACK_PATTERN);
+#endif
+#ifdef REQ_NEXT_MATCH
+    C_NEWCS("REQ_NEXT_MATCH",                 REQ_NEXT_MATCH);
+#endif
+#ifdef REQ_PREV_MATCH
+    C_NEWCS("REQ_PREV_MATCH",                 REQ_PREV_MATCH);
+#endif
+#ifdef MIN_MENU_COMMAND
+    C_NEWCS("MIN_MENU_COMMAND",               MIN_MENU_COMMAND);
+#endif
+#ifdef MAX_MENU_COMMAND
+    C_NEWCS("MAX_MENU_COMMAND",               MAX_MENU_COMMAND);
+#endif
+#ifdef O_ONEVALUE
+    C_NEWCS("O_ONEVALUE",                     O_ONEVALUE);
+#endif
+#ifdef O_SHOWDESC
+    C_NEWCS("O_SHOWDESC",                     O_SHOWDESC);
+#endif
+#ifdef O_ROWMAJOR
+    C_NEWCS("O_ROWMAJOR",                     O_ROWMAJOR);
+#endif
+#ifdef O_IGNORECASE
+    C_NEWCS("O_IGNORECASE",                   O_IGNORECASE);
+#endif
+#ifdef O_SHOWMATCH
+    C_NEWCS("O_SHOWMATCH",                    O_SHOWMATCH);
+#endif
+#ifdef O_NONCYCLIC
+    C_NEWCS("O_NONCYCLIC",                    O_NONCYCLIC);
+#endif
+#ifdef O_SELECTABLE
+    C_NEWCS("O_SELECTABLE",                   O_SELECTABLE);
+#endif
+#ifdef REQ_NEXT_PAGE
+    C_NEWCS("REQ_NEXT_PAGE",                  REQ_NEXT_PAGE);
+#endif
+#ifdef REQ_PREV_PAGE
+    C_NEWCS("REQ_PREV_PAGE",                  REQ_PREV_PAGE);
+#endif
+#ifdef REQ_FIRST_PAGE
+    C_NEWCS("REQ_FIRST_PAGE",                 REQ_FIRST_PAGE);
+#endif
+#ifdef REQ_LAST_PAGE
+    C_NEWCS("REQ_LAST_PAGE",                  REQ_LAST_PAGE);
+#endif
+#ifdef REQ_NEXT_FIELD
+    C_NEWCS("REQ_NEXT_FIELD",                 REQ_NEXT_FIELD);
+#endif
+#ifdef REQ_PREV_FIELD
+    C_NEWCS("REQ_PREV_FIELD",                 REQ_PREV_FIELD);
+#endif
+#ifdef REQ_FIRST_FIELD
+    C_NEWCS("REQ_FIRST_FIELD",                REQ_FIRST_FIELD);
+#endif
+#ifdef REQ_LAST_FIELD
+    C_NEWCS("REQ_LAST_FIELD",                 REQ_LAST_FIELD);
+#endif
+#ifdef REQ_SNEXT_FIELD
+    C_NEWCS("REQ_SNEXT_FIELD",                REQ_SNEXT_FIELD);
+#endif
+#ifdef REQ_SPREV_FIELD
+    C_NEWCS("REQ_SPREV_FIELD",                REQ_SPREV_FIELD);
+#endif
+#ifdef REQ_SFIRST_FIELD
+    C_NEWCS("REQ_SFIRST_FIELD",               REQ_SFIRST_FIELD);
+#endif
+#ifdef REQ_SLAST_FIELD
+    C_NEWCS("REQ_SLAST_FIELD",                REQ_SLAST_FIELD);
+#endif
+#ifdef REQ_LEFT_FIELD
+    C_NEWCS("REQ_LEFT_FIELD",                 REQ_LEFT_FIELD);
+#endif
+#ifdef REQ_RIGHT_FIELD
+    C_NEWCS("REQ_RIGHT_FIELD",                REQ_RIGHT_FIELD);
+#endif
+#ifdef REQ_UP_FIELD
+    C_NEWCS("REQ_UP_FIELD",                   REQ_UP_FIELD);
+#endif
+#ifdef REQ_DOWN_FIELD
+    C_NEWCS("REQ_DOWN_FIELD",                 REQ_DOWN_FIELD);
+#endif
+#ifdef REQ_NEXT_CHAR
+    C_NEWCS("REQ_NEXT_CHAR",                  REQ_NEXT_CHAR);
+#endif
+#ifdef REQ_PREV_CHAR
+    C_NEWCS("REQ_PREV_CHAR",                  REQ_PREV_CHAR);
+#endif
+#ifdef REQ_NEXT_LINE
+    C_NEWCS("REQ_NEXT_LINE",                  REQ_NEXT_LINE);
+#endif
+#ifdef REQ_PREV_LINE
+    C_NEWCS("REQ_PREV_LINE",                  REQ_PREV_LINE);
+#endif
+#ifdef REQ_NEXT_WORD
+    C_NEWCS("REQ_NEXT_WORD",                  REQ_NEXT_WORD);
+#endif
+#ifdef REQ_PREV_WORD
+    C_NEWCS("REQ_PREV_WORD",                  REQ_PREV_WORD);
+#endif
+#ifdef REQ_BEG_FIELD
+    C_NEWCS("REQ_BEG_FIELD",                  REQ_BEG_FIELD);
+#endif
+#ifdef REQ_END_FIELD
+    C_NEWCS("REQ_END_FIELD",                  REQ_END_FIELD);
+#endif
+#ifdef REQ_BEG_LINE
+    C_NEWCS("REQ_BEG_LINE",                   REQ_BEG_LINE);
+#endif
+#ifdef REQ_END_LINE
+    C_NEWCS("REQ_END_LINE",                   REQ_END_LINE);
+#endif
+#ifdef REQ_LEFT_CHAR
+    C_NEWCS("REQ_LEFT_CHAR",                  REQ_LEFT_CHAR);
+#endif
+#ifdef REQ_RIGHT_CHAR
+    C_NEWCS("REQ_RIGHT_CHAR",                 REQ_RIGHT_CHAR);
+#endif
+#ifdef REQ_UP_CHAR
+    C_NEWCS("REQ_UP_CHAR",                    REQ_UP_CHAR);
+#endif
+#ifdef REQ_DOWN_CHAR
+    C_NEWCS("REQ_DOWN_CHAR",                  REQ_DOWN_CHAR);
+#endif
+#ifdef REQ_NEW_LINE
+    C_NEWCS("REQ_NEW_LINE",                   REQ_NEW_LINE);
+#endif
+#ifdef REQ_INS_CHAR
+    C_NEWCS("REQ_INS_CHAR",                   REQ_INS_CHAR);
+#endif
+#ifdef REQ_INS_LINE
+    C_NEWCS("REQ_INS_LINE",                   REQ_INS_LINE);
+#endif
+#ifdef REQ_DEL_CHAR
+    C_NEWCS("REQ_DEL_CHAR",                   REQ_DEL_CHAR);
+#endif
+#ifdef REQ_DEL_PREV
+    C_NEWCS("REQ_DEL_PREV",                   REQ_DEL_PREV);
+#endif
+#ifdef REQ_DEL_LINE
+    C_NEWCS("REQ_DEL_LINE",                   REQ_DEL_LINE);
+#endif
+#ifdef REQ_DEL_WORD
+    C_NEWCS("REQ_DEL_WORD",                   REQ_DEL_WORD);
+#endif
+#ifdef REQ_CLR_EOL
+    C_NEWCS("REQ_CLR_EOL",                    REQ_CLR_EOL);
+#endif
+#ifdef REQ_CLR_EOF
+    C_NEWCS("REQ_CLR_EOF",                    REQ_CLR_EOF);
+#endif
+#ifdef REQ_CLR_FIELD
+    C_NEWCS("REQ_CLR_FIELD",                  REQ_CLR_FIELD);
+#endif
+#ifdef REQ_OVL_MODE
+    C_NEWCS("REQ_OVL_MODE",                   REQ_OVL_MODE);
+#endif
+#ifdef REQ_INS_MODE
+    C_NEWCS("REQ_INS_MODE",                   REQ_INS_MODE);
+#endif
+#ifdef REQ_SCR_FLINE
+    C_NEWCS("REQ_SCR_FLINE",                  REQ_SCR_FLINE);
+#endif
+#ifdef REQ_SCR_BLINE
+    C_NEWCS("REQ_SCR_BLINE",                  REQ_SCR_BLINE);
+#endif
+#ifdef REQ_SCR_FPAGE
+    C_NEWCS("REQ_SCR_FPAGE",                  REQ_SCR_FPAGE);
+#endif
+#ifdef REQ_SCR_BPAGE
+    C_NEWCS("REQ_SCR_BPAGE",                  REQ_SCR_BPAGE);
+#endif
+#ifdef REQ_SCR_FHPAGE
+    C_NEWCS("REQ_SCR_FHPAGE",                 REQ_SCR_FHPAGE);
+#endif
+#ifdef REQ_SCR_BHPAGE
+    C_NEWCS("REQ_SCR_BHPAGE",                 REQ_SCR_BHPAGE);
+#endif
+#ifdef REQ_SCR_FCHAR
+    C_NEWCS("REQ_SCR_FCHAR",                  REQ_SCR_FCHAR);
+#endif
+#ifdef REQ_SCR_BCHAR
+    C_NEWCS("REQ_SCR_BCHAR",                  REQ_SCR_BCHAR);
+#endif
+#ifdef REQ_SCR_HFLINE
+    C_NEWCS("REQ_SCR_HFLINE",                 REQ_SCR_HFLINE);
+#endif
+#ifdef REQ_SCR_HBLINE
+    C_NEWCS("REQ_SCR_HBLINE",                 REQ_SCR_HBLINE);
+#endif
+#ifdef REQ_SCR_HFHALF
+    C_NEWCS("REQ_SCR_HFHALF",                 REQ_SCR_HFHALF);
+#endif
+#ifdef REQ_SCR_HBHALF
+    C_NEWCS("REQ_SCR_HBHALF",                 REQ_SCR_HBHALF);
+#endif
+#ifdef REQ_VALIDATION
+    C_NEWCS("REQ_VALIDATION",                 REQ_VALIDATION);
+#endif
+#ifdef REQ_NEXT_CHOICE
+    C_NEWCS("REQ_NEXT_CHOICE",                REQ_NEXT_CHOICE);
+#endif
+#ifdef REQ_PREV_CHOICE
+    C_NEWCS("REQ_PREV_CHOICE",                REQ_PREV_CHOICE);
+#endif
+#ifdef MIN_FORM_COMMAND
+    C_NEWCS("MIN_FORM_COMMAND",               MIN_FORM_COMMAND);
+#endif
+#ifdef MAX_FORM_COMMAND
+    C_NEWCS("MAX_FORM_COMMAND",               MAX_FORM_COMMAND);
+#endif
+#ifdef NO_JUSTIFICATION
+    C_NEWCS("NO_JUSTIFICATION",               NO_JUSTIFICATION);
+#endif
+#ifdef JUSTIFY_LEFT
+    C_NEWCS("JUSTIFY_LEFT",                   JUSTIFY_LEFT);
+#endif
+#ifdef JUSTIFY_CENTER
+    C_NEWCS("JUSTIFY_CENTER",                 JUSTIFY_CENTER);
+#endif
+#ifdef JUSTIFY_RIGHT
+    C_NEWCS("JUSTIFY_RIGHT",                  JUSTIFY_RIGHT);
+#endif
+#ifdef O_VISIBLE
+    C_NEWCS("O_VISIBLE",                      O_VISIBLE);
+#endif
+#ifdef O_ACTIVE
+    C_NEWCS("O_ACTIVE",                       O_ACTIVE);
+#endif
+#ifdef O_PUBLIC
+    C_NEWCS("O_PUBLIC",                       O_PUBLIC);
+#endif
+#ifdef O_EDIT
+    C_NEWCS("O_EDIT",                         O_EDIT);
+#endif
+#ifdef O_WRAP
+    C_NEWCS("O_WRAP",                         O_WRAP);
+#endif
+#ifdef O_BLANK
+    C_NEWCS("O_BLANK",                        O_BLANK);
+#endif
+#ifdef O_AUTOSKIP
+    C_NEWCS("O_AUTOSKIP",                     O_AUTOSKIP);
+#endif
+#ifdef O_NULLOK
+    C_NEWCS("O_NULLOK",                       O_NULLOK);
+#endif
+#ifdef O_PASSOK
+    C_NEWCS("O_PASSOK",                       O_PASSOK);
+#endif
+#ifdef O_STATIC
+    C_NEWCS("O_STATIC",                       O_STATIC);
+#endif
+#ifdef O_NL_OVERLOAD
+    C_NEWCS("O_NL_OVERLOAD",                  O_NL_OVERLOAD);
+#endif
+#ifdef O_BS_OVERLOAD
+    C_NEWCS("O_BS_OVERLOAD",                  O_BS_OVERLOAD);
+#endif
+
+    /* traceon(); */
+    ST(0) = &PL_sv_yes;
+    XSRETURN(1);
+}
@@ -0,0 +1,438 @@
+/*  This file can be automatically generated; changes may be lost.
+**
+**
+**  CursesCon.c -- non-trivial constants
+**
+**  This is an inclusion for Curses.c
+**
+**  Copyright (c) 1994-2000  William Setzer
+**
+**  You may distribute under the terms of either the Artistic License
+**  or the GNU General Public License, as specified in the README file.
+*/
+
+XS(XS_Curses_ACS_BLOCK)
+{
+    dXSARGS;
+#ifdef ACS_BLOCK
+    {
+	int	ret = ACS_BLOCK;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_BLOCK");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_BOARD)
+{
+    dXSARGS;
+#ifdef ACS_BOARD
+    {
+	int	ret = ACS_BOARD;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_BOARD");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_BTEE)
+{
+    dXSARGS;
+#ifdef ACS_BTEE
+    {
+	int	ret = ACS_BTEE;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_BTEE");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_BULLET)
+{
+    dXSARGS;
+#ifdef ACS_BULLET
+    {
+	int	ret = ACS_BULLET;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_BULLET");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_CKBOARD)
+{
+    dXSARGS;
+#ifdef ACS_CKBOARD
+    {
+	int	ret = ACS_CKBOARD;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_CKBOARD");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_DARROW)
+{
+    dXSARGS;
+#ifdef ACS_DARROW
+    {
+	int	ret = ACS_DARROW;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_DARROW");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_DEGREE)
+{
+    dXSARGS;
+#ifdef ACS_DEGREE
+    {
+	int	ret = ACS_DEGREE;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_DEGREE");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_DIAMOND)
+{
+    dXSARGS;
+#ifdef ACS_DIAMOND
+    {
+	int	ret = ACS_DIAMOND;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_DIAMOND");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_HLINE)
+{
+    dXSARGS;
+#ifdef ACS_HLINE
+    {
+	int	ret = ACS_HLINE;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_HLINE");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_LANTERN)
+{
+    dXSARGS;
+#ifdef ACS_LANTERN
+    {
+	int	ret = ACS_LANTERN;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_LANTERN");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_LARROW)
+{
+    dXSARGS;
+#ifdef ACS_LARROW
+    {
+	int	ret = ACS_LARROW;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_LARROW");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_LLCORNER)
+{
+    dXSARGS;
+#ifdef ACS_LLCORNER
+    {
+	int	ret = ACS_LLCORNER;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_LLCORNER");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_LRCORNER)
+{
+    dXSARGS;
+#ifdef ACS_LRCORNER
+    {
+	int	ret = ACS_LRCORNER;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_LRCORNER");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_LTEE)
+{
+    dXSARGS;
+#ifdef ACS_LTEE
+    {
+	int	ret = ACS_LTEE;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_LTEE");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_PLMINUS)
+{
+    dXSARGS;
+#ifdef ACS_PLMINUS
+    {
+	int	ret = ACS_PLMINUS;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_PLMINUS");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_PLUS)
+{
+    dXSARGS;
+#ifdef ACS_PLUS
+    {
+	int	ret = ACS_PLUS;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_PLUS");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_RARROW)
+{
+    dXSARGS;
+#ifdef ACS_RARROW
+    {
+	int	ret = ACS_RARROW;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_RARROW");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_RTEE)
+{
+    dXSARGS;
+#ifdef ACS_RTEE
+    {
+	int	ret = ACS_RTEE;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_RTEE");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_S1)
+{
+    dXSARGS;
+#ifdef ACS_S1
+    {
+	int	ret = ACS_S1;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_S1");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_S9)
+{
+    dXSARGS;
+#ifdef ACS_S9
+    {
+	int	ret = ACS_S9;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_S9");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_TTEE)
+{
+    dXSARGS;
+#ifdef ACS_TTEE
+    {
+	int	ret = ACS_TTEE;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_TTEE");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_UARROW)
+{
+    dXSARGS;
+#ifdef ACS_UARROW
+    {
+	int	ret = ACS_UARROW;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_UARROW");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_ULCORNER)
+{
+    dXSARGS;
+#ifdef ACS_ULCORNER
+    {
+	int	ret = ACS_ULCORNER;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_ULCORNER");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_URCORNER)
+{
+    dXSARGS;
+#ifdef ACS_URCORNER
+    {
+	int	ret = ACS_URCORNER;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_URCORNER");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ACS_VLINE)
+{
+    dXSARGS;
+#ifdef ACS_VLINE
+    {
+	int	ret = ACS_VLINE;
+
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_con_not_there("ACS_VLINE");
+    XSRETURN(0);
+#endif
+}
+
@@ -0,0 +1,6941 @@
+/*  This is an inclusion for Curses.c.
+**
+**
+**  CursesFun.c -- the functions
+**
+**  This is an inclusion for Curses.c
+**
+**  Copyright (c) 1994-2000  William Setzer
+**
+**  You may distribute under the terms of either the Artistic License
+**  or the GNU General Public License, as specified in the README file.
+*/
+
+/* curs_addch */
+
+XS(XS_Curses_addch)
+{
+    dXSARGS;
+#ifdef C_ADDCH
+    c_countargs("addch", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ch  = c_sv2chtype(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : waddch(win, ch);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("addch");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_echochar)
+{
+    dXSARGS;
+#ifdef C_ECHOCHAR
+    c_countargs("echochar", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ch  = c_sv2chtype(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : wechochar(win, ch);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("echochar");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_addchstr */
+
+XS(XS_Curses_addchstr)
+{
+    dXSARGS;
+#ifdef C_ADDCHSTR
+    c_countargs("addchstr", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype *str = (chtype *)SvPV_nolen(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : waddchstr(win, str);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("addchstr");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_addchnstr)
+{
+    dXSARGS;
+#ifdef C_ADDCHNSTR
+    c_countargs("addchnstr", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype *str = (chtype *)SvPV_nolen(ST(c_arg));
+    int n   = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : waddchnstr(win, str, n);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("addchnstr");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_addstr */
+
+XS(XS_Curses_addstr)
+{
+    dXSARGS;
+#ifdef C_ADDSTR
+    c_countargs("addstr", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    char *  str = (char *)SvPV_nolen(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : waddstr(win, str);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("addstr");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_addnstr)
+{
+    dXSARGS;
+#ifdef C_ADDNSTR
+    c_countargs("addnstr", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    char *  str = (char *)SvPV_nolen(ST(c_arg));
+    int n   = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : waddnstr(win, str, n);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("addnstr");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_attr */
+
+XS(XS_Curses_attroff)
+{
+    dXSARGS;
+#ifdef C_ATTROFF
+    c_countargs("attroff", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int attrs   = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : wattroff(win, attrs);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("attroff");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_attron)
+{
+    dXSARGS;
+#ifdef C_ATTRON
+    c_countargs("attron", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int attrs   = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : wattron(win, attrs);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("attron");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_attrset)
+{
+    dXSARGS;
+#ifdef C_ATTRSET
+    c_countargs("attrset", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int attrs   = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : wattrset(win, attrs);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("attrset");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_standend)
+{
+    dXSARGS;
+#ifdef C_STANDEND
+    c_countargs("standend", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : (int)wstandend(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("standend");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_standout)
+{
+    dXSARGS;
+#ifdef C_STANDOUT
+    c_countargs("standout", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : (int)wstandout(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("standout");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_attr_get)
+{
+    dXSARGS;
+#ifdef C_ATTR_GET
+    c_countargs("attr_get", items, 3);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    attr_t  attrs   = 0;
+    short   color   = 0;
+    void *  opts    = 0;
+    int ret = c_mret == ERR ? ERR : wattr_get(win, &attrs, &color, opts);
+    
+    sv_setiv(ST(c_arg), (IV)attrs);;
+    sv_setiv(ST(c_arg+1), (IV)color);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("attr_get");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_attr_off)
+{
+    dXSARGS;
+#ifdef C_ATTR_OFF
+    c_countargs("attr_off", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    attr_t  attrs   = (attr_t)SvIV(ST(c_arg));
+    void *  opts    = 0;
+    int ret = c_mret == ERR ? ERR : wattr_off(win, attrs, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("attr_off");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_attr_on)
+{
+    dXSARGS;
+#ifdef C_ATTR_ON
+    c_countargs("attr_on", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    attr_t  attrs   = (attr_t)SvIV(ST(c_arg));
+    void *  opts    = 0;
+    int ret = c_mret == ERR ? ERR : wattr_on(win, attrs, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("attr_on");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_attr_set)
+{
+    dXSARGS;
+#ifdef C_ATTR_SET
+    c_countargs("attr_set", items, 3);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    attr_t  attrs   = (attr_t)SvIV(ST(c_arg));
+    short   color   = (short)SvIV(ST(c_arg+1));
+    void *  opts    = 0;
+    int ret = c_mret == ERR ? ERR : wattr_set(win, attrs, color, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("attr_set");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_chgat)
+{
+    dXSARGS;
+#ifdef C_CHGAT
+    /* Our 4th argument is meaningless.  It mirrors the meaningless "opts"
+       argument in the Curses C library.
+
+       In Perl Curses 1.16, we tried reducing this to 3 as a user thought
+       a 3-argument call ought to work, and we thought this number might
+       just be the _minimum_ argument count.  Well, it's not.  So for
+       backward compatibility if nothing else, it has to be 4.  Fixed
+       back to 4 in 1.18.
+    */
+    c_countargs("chgat", items, 4);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int n   = (int)SvIV(ST(c_arg));
+    attr_t  attrs   = (attr_t)SvIV(ST(c_arg+1));
+    short   color   = (short)SvIV(ST(c_arg+2));
+    void *  opts    = 0;
+    int ret = c_mret == ERR ? ERR : wchgat(win, n, attrs, color, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("chgat");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_COLOR_PAIR)
+{
+    dXSARGS;
+#ifdef C_COLOR_PAIR
+    c_exactargs("COLOR_PAIR", items, 1);
+    {
+    int n   = (int)SvIV(ST(0));
+    int ret = COLOR_PAIR(n);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("COLOR_PAIR");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_PAIR_NUMBER)
+{
+    dXSARGS;
+#ifdef C_PAIR_NUMBER
+    c_exactargs("PAIR_NUMBER", items, 1);
+    {
+    int attrs   = (int)SvIV(ST(0));
+    int ret = PAIR_NUMBER(attrs);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("PAIR_NUMBER");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_beep */
+
+XS(XS_Curses_beep)
+{
+    dXSARGS;
+#ifdef C_BEEP
+    c_exactargs("beep", items, 0);
+    {
+    int ret = beep();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("beep");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_flash)
+{
+    dXSARGS;
+#ifdef C_FLASH
+    c_exactargs("flash", items, 0);
+    {
+    int ret = flash();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("flash");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_bkgd */
+
+XS(XS_Curses_bkgd)
+{
+    dXSARGS;
+#ifdef C_BKGD
+    c_countargs("bkgd", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ch  = c_sv2chtype(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : wbkgd(win, ch);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("bkgd");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_bkgdset)
+{
+    dXSARGS;
+#ifdef C_BKGDSET
+    c_countargs("bkgdset", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ch  = c_sv2chtype(ST(c_arg));
+    
+    if (c_mret == OK) { wbkgdset(win, ch); }
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("bkgdset");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_getbkgd)
+{
+    dXSARGS;
+#ifdef C_GETBKGD
+    c_countargs("getbkgd", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ret = c_mret == ERR ? ERR : getbkgd(win);
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("getbkgd");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_border */
+
+XS(XS_Curses_border)
+{
+    dXSARGS;
+#ifdef C_BORDER
+    c_countargs("border", items, 8);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ls  = c_sv2chtype(ST(c_arg));
+    chtype  rs_ = c_sv2chtype(ST(c_arg+1));
+    chtype  ts  = c_sv2chtype(ST(c_arg+2));
+    chtype  bs  = c_sv2chtype(ST(c_arg+3));
+    chtype  tl  = c_sv2chtype(ST(c_arg+4));
+    chtype  tr  = c_sv2chtype(ST(c_arg+5));
+    chtype  bl  = c_sv2chtype(ST(c_arg+6));
+    chtype  br  = c_sv2chtype(ST(c_arg+7));
+    int ret = c_mret == ERR ? ERR : wborder(win, ls, rs_, ts, bs, tl, tr, bl, br);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("border");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_box)
+{
+    dXSARGS;
+#ifdef C_BOX
+    c_countargs("box", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  verch   = c_sv2chtype(ST(c_arg));
+    chtype  horch   = c_sv2chtype(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : box(win, verch, horch);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("box");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_hline)
+{
+    dXSARGS;
+#ifdef C_HLINE
+    c_countargs("hline", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ch  = c_sv2chtype(ST(c_arg));
+    int n   = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : whline(win, ch, n);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("hline");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_vline)
+{
+    dXSARGS;
+#ifdef C_VLINE
+    c_countargs("vline", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ch  = c_sv2chtype(ST(c_arg));
+    int n   = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : wvline(win, ch, n);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("vline");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_clear */
+
+XS(XS_Curses_erase)
+{
+    dXSARGS;
+#ifdef C_ERASE
+    c_countargs("erase", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : werase(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("erase");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_clear)
+{
+    dXSARGS;
+#ifdef C_CLEAR
+    c_countargs("clear", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : wclear(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("clear");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_clrtobot)
+{
+    dXSARGS;
+#ifdef C_CLRTOBOT
+    c_countargs("clrtobot", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : wclrtobot(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("clrtobot");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_clrtoeol)
+{
+    dXSARGS;
+#ifdef C_CLRTOEOL
+    c_countargs("clrtoeol", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : wclrtoeol(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("clrtoeol");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_color */
+
+XS(XS_Curses_start_color)
+{
+    dXSARGS;
+#ifdef C_START_COLOR
+    c_exactargs("start_color", items, 0);
+    {
+    int ret = start_color();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("start_color");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_init_pair)
+{
+    dXSARGS;
+#ifdef C_INIT_PAIR
+    c_exactargs("init_pair", items, 3);
+    {
+    short   pair    = (short)SvIV(ST(0));
+    short   f   = (short)SvIV(ST(1));
+    short   b   = (short)SvIV(ST(2));
+    int ret = init_pair(pair, f, b);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("init_pair");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_init_color)
+{
+    dXSARGS;
+#ifdef C_INIT_COLOR
+    c_exactargs("init_color", items, 4);
+    {
+    short   color   = (short)SvIV(ST(0));
+    short   r   = (short)SvIV(ST(1));
+    short   g   = (short)SvIV(ST(2));
+    short   b   = (short)SvIV(ST(3));
+    int ret = init_color(color, r, g, b);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("init_color");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_has_colors)
+{
+    dXSARGS;
+#ifdef C_HAS_COLORS
+    c_exactargs("has_colors", items, 0);
+    {
+    bool    ret = has_colors();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("has_colors");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_can_change_color)
+{
+    dXSARGS;
+#ifdef C_CAN_CHANGE_COLOR
+    c_exactargs("can_change_color", items, 0);
+    {
+    bool    ret = can_change_color();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("can_change_color");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_color_content)
+{
+    dXSARGS;
+#ifdef C_COLOR_CONTENT
+    c_exactargs("color_content", items, 4);
+    {
+    short   color   = (short)SvIV(ST(0));
+    short   r   = 0;
+    short   g   = 0;
+    short   b   = 0;
+    int ret = color_content(color, &r, &g, &b);
+    
+    sv_setiv(ST(1), (IV)r);;
+    sv_setiv(ST(2), (IV)g);;
+    sv_setiv(ST(3), (IV)b);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("color_content");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_pair_content)
+{
+    dXSARGS;
+#ifdef C_PAIR_CONTENT
+    c_exactargs("pair_content", items, 3);
+    {
+    short   pair    = (short)SvIV(ST(0));
+    short   f   = 0;
+    short   b   = 0;
+    int ret = pair_content(pair, &f, &b);
+    
+    sv_setiv(ST(1), (IV)f);;
+    sv_setiv(ST(2), (IV)b);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("pair_content");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_delch */
+
+XS(XS_Curses_delch)
+{
+    dXSARGS;
+#ifdef C_DELCH
+    c_countargs("delch", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : wdelch(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("delch");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_deleteln */
+
+XS(XS_Curses_deleteln)
+{
+    dXSARGS;
+#ifdef C_DELETELN
+    c_countargs("deleteln", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : wdeleteln(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("deleteln");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_insdelln)
+{
+    dXSARGS;
+#ifdef C_INSDELLN
+    c_countargs("insdelln", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int n   = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : winsdelln(win, n);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("insdelln");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_insertln)
+{
+    dXSARGS;
+#ifdef C_INSERTLN
+    c_countargs("insertln", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : winsertln(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("insertln");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_getch */
+
+XS(XS_Curses_getch)
+{
+    dXSARGS;
+#ifdef C_GETCH
+    c_countargs("getch", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ret = c_mret == ERR ? ERR : wgetch(win);
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("getch");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ungetch)
+{
+    dXSARGS;
+#ifdef C_UNGETCH
+    c_exactargs("ungetch", items, 1);
+    {
+    chtype  ch  = c_sv2chtype(ST(0));
+    int ret = ungetch(ch);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("ungetch");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_has_key)
+{
+    dXSARGS;
+#ifdef C_HAS_KEY
+    c_exactargs("has_key", items, 1);
+    {
+    int ch  = (int)SvIV(ST(0));
+    int ret = has_key(ch);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("has_key");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_KEY_F)
+{
+    dXSARGS;
+#ifdef C_KEY_F
+    c_exactargs("KEY_F", items, 1);
+    {
+    int n   = (int)SvIV(ST(0));
+    chtype  ret = KEY_F(n);
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("KEY_F");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_getstr */
+
+XS(XS_Curses_getstr)
+{
+    dXSARGS;
+#ifdef C_GETSTR
+    c_countargs("getstr", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    char *  str = (char *)sv_grow(ST(c_arg), 250);
+    int ret = c_mret == ERR ? ERR : wgetstr(win, str);
+    
+    c_setchar(ST(c_arg), str);
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("getstr");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_getnstr)
+{
+    dXSARGS;
+#ifdef C_GETNSTR
+    c_countargs("getnstr", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int n   = (int)SvIV(ST(c_arg+1));
+    char *  str = (char *)sv_grow(ST(c_arg), n+1);
+    int ret = c_mret == ERR ? ERR : wgetnstr(win, str, n);
+    
+    c_setchar(ST(c_arg), str);
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("getnstr");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_getyx */
+
+XS(XS_Curses_getyx)
+{
+    dXSARGS;
+#ifdef C_GETYX
+    c_countargs("getyx", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int y   = 0;
+    int x   = 0;
+    
+    if (c_mret == OK) { getyx(win, y, x); }
+    sv_setiv(ST(c_arg), (IV)y);;
+    sv_setiv(ST(c_arg+1), (IV)x);;
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("getyx");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_getparyx)
+{
+    dXSARGS;
+#ifdef C_GETPARYX
+    c_countargs("getparyx", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int y   = 0;
+    int x   = 0;
+    
+    if (c_mret == OK) { getparyx(win, y, x); }
+    sv_setiv(ST(c_arg), (IV)y);;
+    sv_setiv(ST(c_arg+1), (IV)x);;
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("getparyx");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_getbegyx)
+{
+    dXSARGS;
+#ifdef C_GETBEGYX
+    c_countargs("getbegyx", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int y   = 0;
+    int x   = 0;
+    
+    if (c_mret == OK) { getbegyx(win, y, x); }
+    sv_setiv(ST(c_arg), (IV)y);;
+    sv_setiv(ST(c_arg+1), (IV)x);;
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("getbegyx");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_getmaxyx)
+{
+    dXSARGS;
+#ifdef C_GETMAXYX
+    c_countargs("getmaxyx", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int y   = 0;
+    int x   = 0;
+    
+    if (c_mret == OK) { getmaxyx(win, y, x); }
+    sv_setiv(ST(c_arg), (IV)y);;
+    sv_setiv(ST(c_arg+1), (IV)x);;
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("getmaxyx");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_inch */
+
+XS(XS_Curses_inch)
+{
+    dXSARGS;
+#ifdef C_INCH
+    c_countargs("inch", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ret = c_mret == ERR ? ERR : winch(win);
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("inch");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_inchstr */
+
+XS(XS_Curses_inchstr)
+{
+    dXSARGS;
+#ifdef C_INCHSTR
+    c_countargs("inchstr", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype *str = (chtype *)sv_grow(ST(c_arg), (250)*sizeof(chtype));
+    int ret = c_mret == ERR ? ERR : winchstr(win, str);
+    
+    c_setchtype(ST(c_arg), str);
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("inchstr");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_inchnstr)
+{
+    dXSARGS;
+#ifdef C_INCHNSTR
+    c_countargs("inchnstr", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int n   = (int)SvIV(ST(c_arg+1));
+    chtype *str = (chtype *)sv_grow(ST(c_arg), (n+1)*sizeof(chtype));
+    int ret = c_mret == ERR ? ERR : winchnstr(win, str, n);
+    
+    c_setchtype(ST(c_arg), str);
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("inchnstr");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_initscr */
+
+XS(XS_Curses_initscr)
+{
+    dXSARGS;
+#ifdef C_INITSCR
+    c_exactargs("initscr", items, 0);
+    {
+    WINDOW *    ret = initscr();
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("initscr");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_endwin)
+{
+    dXSARGS;
+#ifdef C_ENDWIN
+    c_exactargs("endwin", items, 0);
+    {
+    int ret = endwin();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("endwin");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_isendwin)
+{
+    dXSARGS;
+#ifdef C_ISENDWIN
+    c_exactargs("isendwin", items, 0);
+    {
+    int ret = isendwin();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("isendwin");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_newterm)
+{
+    dXSARGS;
+#ifdef C_NEWTERM
+    c_exactargs("newterm", items, 3);
+    {
+    char *  type    = ST(0) != &PL_sv_undef ? (char *)SvPV_nolen(ST(0)) : NULL;
+
+    /* IoIFP() returns a FILE * with some Perl cores, and PerlIo with
+       others.  We need FILE *.  PerlIO_findFILE() takes either a FILE * or
+       PerlIo as input and returns a FILE *.
+    */
+    FILE *  outfd   = PerlIO_findFILE(IoIFP(sv_2io(ST(1))));
+    FILE *  infd    = PerlIO_findFILE(IoIFP(sv_2io(ST(2))));
+    SCREEN *    ret = newterm(type, outfd, infd);
+    
+    ST(0) = sv_newmortal();
+    c_screen2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("newterm");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_set_term)
+{
+    dXSARGS;
+#ifdef C_SET_TERM
+    c_exactargs("set_term", items, 1);
+    {
+    SCREEN *new = c_sv2screen(ST(0), 0);
+    SCREEN *    ret = set_term(new);
+    
+    ST(0) = sv_newmortal();
+    c_screen2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_term");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_delscreen)
+{
+    dXSARGS;
+#ifdef C_DELSCREEN
+    c_exactargs("delscreen", items, 1);
+    {
+    SCREEN *sp  = c_sv2screen(ST(0), 0);
+    
+    delscreen(sp);
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("delscreen");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_inopts */
+
+#ifdef C_INTCBREAK
+XS(XS_Curses_cbreak)
+{
+    dXSARGS;
+#ifdef C_CBREAK
+    c_exactargs("cbreak", items, 0);
+    {
+    int ret = cbreak();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("cbreak");
+    XSRETURN(0);
+#endif
+}
+
+#else
+XS(XS_Curses_cbreak)
+{
+    dXSARGS;
+#ifdef C_CBREAK
+    c_exactargs("cbreak", items, 0);
+    {
+    cbreak();
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("cbreak");
+    XSRETURN(0);
+#endif
+}
+
+#endif
+#ifdef C_INTNOCBREAK
+XS(XS_Curses_nocbreak)
+{
+    dXSARGS;
+#ifdef C_NOCBREAK
+    c_exactargs("nocbreak", items, 0);
+    {
+    int ret = nocbreak();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("nocbreak");
+    XSRETURN(0);
+#endif
+}
+
+#else
+XS(XS_Curses_nocbreak)
+{
+    dXSARGS;
+#ifdef C_NOCBREAK
+    c_exactargs("nocbreak", items, 0);
+    {
+    nocbreak();
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("nocbreak");
+    XSRETURN(0);
+#endif
+}
+
+#endif
+#ifdef C_INTECHO
+XS(XS_Curses_echo)
+{
+    dXSARGS;
+#ifdef C_ECHO
+    c_exactargs("echo", items, 0);
+    {
+    int ret = echo();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("echo");
+    XSRETURN(0);
+#endif
+}
+
+#else
+XS(XS_Curses_echo)
+{
+    dXSARGS;
+#ifdef C_ECHO
+    c_exactargs("echo", items, 0);
+    {
+    echo();
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("echo");
+    XSRETURN(0);
+#endif
+}
+
+#endif
+#ifdef C_INTNOECHO
+XS(XS_Curses_noecho)
+{
+    dXSARGS;
+#ifdef C_NOECHO
+    c_exactargs("noecho", items, 0);
+    {
+    int ret = noecho();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("noecho");
+    XSRETURN(0);
+#endif
+}
+
+#else
+XS(XS_Curses_noecho)
+{
+    dXSARGS;
+#ifdef C_NOECHO
+    c_exactargs("noecho", items, 0);
+    {
+    noecho();
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("noecho");
+    XSRETURN(0);
+#endif
+}
+
+#endif
+XS(XS_Curses_halfdelay)
+{
+    dXSARGS;
+#ifdef C_HALFDELAY
+    c_exactargs("halfdelay", items, 1);
+    {
+    int tenths  = (int)SvIV(ST(0));
+    int ret = halfdelay(tenths);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("halfdelay");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_intrflush)
+{
+    dXSARGS;
+#ifdef C_INTRFLUSH
+    c_countargs("intrflush", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : intrflush(win, bf);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("intrflush");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_keypad)
+{
+    dXSARGS;
+#ifdef C_KEYPAD
+    c_countargs("keypad", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : keypad(win, bf);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("keypad");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_meta)
+{
+    dXSARGS;
+#ifdef C_META
+    c_countargs("meta", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : meta(win, bf);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("meta");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_nodelay)
+{
+    dXSARGS;
+#ifdef C_NODELAY
+    c_countargs("nodelay", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : nodelay(win, bf);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("nodelay");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_notimeout)
+{
+    dXSARGS;
+#ifdef C_NOTIMEOUT
+    c_countargs("notimeout", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : notimeout(win, bf);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("notimeout");
+    XSRETURN(0);
+#endif
+}
+
+#ifdef C_INTRAW
+XS(XS_Curses_raw)
+{
+    dXSARGS;
+#ifdef C_RAW
+    c_exactargs("raw", items, 0);
+    {
+    int ret = raw();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("raw");
+    XSRETURN(0);
+#endif
+}
+
+#else
+XS(XS_Curses_raw)
+{
+    dXSARGS;
+#ifdef C_RAW
+    c_exactargs("raw", items, 0);
+    {
+    raw();
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("raw");
+    XSRETURN(0);
+#endif
+}
+
+#endif
+#ifdef C_INTNORAW
+XS(XS_Curses_noraw)
+{
+    dXSARGS;
+#ifdef C_NORAW
+    c_exactargs("noraw", items, 0);
+    {
+    int ret = noraw();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("noraw");
+    XSRETURN(0);
+#endif
+}
+
+#else
+XS(XS_Curses_noraw)
+{
+    dXSARGS;
+#ifdef C_NORAW
+    c_exactargs("noraw", items, 0);
+    {
+    noraw();
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("noraw");
+    XSRETURN(0);
+#endif
+}
+
+#endif
+XS(XS_Curses_qiflush)
+{
+    dXSARGS;
+#ifdef C_QIFLUSH
+    c_exactargs("qiflush", items, 0);
+    {
+    qiflush();
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("qiflush");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_noqiflush)
+{
+    dXSARGS;
+#ifdef C_NOQIFLUSH
+    c_exactargs("noqiflush", items, 0);
+    {
+    noqiflush();
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("noqiflush");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_timeout)
+{
+    dXSARGS;
+#ifdef C_TIMEOUT
+    c_countargs("timeout", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int delay   = (int)SvIV(ST(c_arg));
+    
+    if (c_mret == OK) { wtimeout(win, delay); }
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("timeout");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_typeahead)
+{
+    dXSARGS;
+#ifdef C_TYPEAHEAD
+    c_exactargs("typeahead", items, 1);
+    {
+    int fd  = (int)SvIV(ST(0));
+    int ret = typeahead(fd);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("typeahead");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_insch */
+
+XS(XS_Curses_insch)
+{
+    dXSARGS;
+#ifdef C_INSCH
+    c_countargs("insch", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ch  = c_sv2chtype(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : winsch(win, ch);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("insch");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_insstr */
+
+XS(XS_Curses_insstr)
+{
+    dXSARGS;
+#ifdef C_INSSTR
+    c_countargs("insstr", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    char *  str = (char *)SvPV_nolen(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : winsstr(win, str);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("insstr");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_insnstr)
+{
+    dXSARGS;
+#ifdef C_INSNSTR
+    c_countargs("insnstr", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    char *  str = (char *)SvPV_nolen(ST(c_arg));
+    int n   = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : winsnstr(win, str, n);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("insnstr");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_instr */
+
+XS(XS_Curses_instr)
+{
+    dXSARGS;
+#ifdef C_INSTR
+    c_countargs("instr", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    char *  str = (char *)sv_grow(ST(c_arg), 250);
+    int ret = c_mret == ERR ? ERR : winstr(win, str);
+    
+    c_setchar(ST(c_arg), str);
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("instr");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_innstr)
+{
+    dXSARGS;
+#ifdef C_INNSTR
+    c_countargs("innstr", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int n   = (int)SvIV(ST(c_arg+1));
+    char *  str = (char *)sv_grow(ST(c_arg), n+1);
+    int ret = c_mret == ERR ? ERR : winnstr(win, str, n);
+    
+    c_setchar(ST(c_arg), str);
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("innstr");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_kernel */
+
+XS(XS_Curses_def_prog_mode)
+{
+    dXSARGS;
+#ifdef C_DEF_PROG_MODE
+    c_exactargs("def_prog_mode", items, 0);
+    {
+    int ret = def_prog_mode();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("def_prog_mode");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_def_shell_mode)
+{
+    dXSARGS;
+#ifdef C_DEF_SHELL_MODE
+    c_exactargs("def_shell_mode", items, 0);
+    {
+    int ret = def_shell_mode();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("def_shell_mode");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_reset_prog_mode)
+{
+    dXSARGS;
+#ifdef C_RESET_PROG_MODE
+    c_exactargs("reset_prog_mode", items, 0);
+    {
+    int ret = reset_prog_mode();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("reset_prog_mode");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_reset_shell_mode)
+{
+    dXSARGS;
+#ifdef C_RESET_SHELL_MODE
+    c_exactargs("reset_shell_mode", items, 0);
+    {
+    int ret = reset_shell_mode();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("reset_shell_mode");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_resetty)
+{
+    dXSARGS;
+#ifdef C_RESETTY
+    c_exactargs("resetty", items, 0);
+    {
+    int ret = resetty();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("resetty");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_savetty)
+{
+    dXSARGS;
+#ifdef C_SAVETTY
+    c_exactargs("savetty", items, 0);
+    {
+    int ret = savetty();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("savetty");
+    XSRETURN(0);
+#endif
+}
+
+#ifdef C_INTGETSYX
+XS(XS_Curses_getsyx)
+{
+    dXSARGS;
+#ifdef C_GETSYX
+    c_exactargs("getsyx", items, 2);
+    {
+    int y   = 0;
+    int x   = 0;
+    int ret = getsyx(y, x);
+    
+    sv_setiv(ST(0), (IV)y);;
+    sv_setiv(ST(1), (IV)x);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("getsyx");
+    XSRETURN(0);
+#endif
+}
+
+#else
+XS(XS_Curses_getsyx)
+{
+    dXSARGS;
+#ifdef C_GETSYX
+    c_exactargs("getsyx", items, 2);
+    {
+    int y   = 0;
+    int x   = 0;
+    
+    getsyx(y, x);
+    sv_setiv(ST(0), (IV)y);;
+    sv_setiv(ST(1), (IV)x);;
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("getsyx");
+    XSRETURN(0);
+#endif
+}
+
+#endif
+#ifdef C_INTSETSYX
+XS(XS_Curses_setsyx)
+{
+    dXSARGS;
+#ifdef C_SETSYX
+    c_exactargs("setsyx", items, 2);
+    {
+    int y   = (int)SvIV(ST(0));
+    int x   = (int)SvIV(ST(1));
+    int ret = setsyx(y, x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("setsyx");
+    XSRETURN(0);
+#endif
+}
+
+#else
+XS(XS_Curses_setsyx)
+{
+    dXSARGS;
+#ifdef C_SETSYX
+    c_exactargs("setsyx", items, 2);
+    {
+    int y   = (int)SvIV(ST(0));
+    int x   = (int)SvIV(ST(1));
+    
+    setsyx(y, x);
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("setsyx");
+    XSRETURN(0);
+#endif
+}
+
+#endif
+XS(XS_Curses_curs_set)
+{
+    dXSARGS;
+#ifdef C_CURS_SET
+    c_exactargs("curs_set", items, 1);
+    {
+    int visibility  = (int)SvIV(ST(0));
+    int ret = curs_set(visibility);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("curs_set");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_napms)
+{
+    dXSARGS;
+#ifdef C_NAPMS
+    c_exactargs("napms", items, 1);
+    {
+    int ms  = (int)SvIV(ST(0));
+    int ret = napms(ms);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("napms");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_move */
+
+XS(XS_Curses_move)
+{
+    dXSARGS;
+#ifdef C_MOVE
+    c_countargs("move", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int y   = (int)SvIV(ST(c_arg));
+    int x   = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : wmove(win, y, x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("move");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_outopts */
+
+XS(XS_Curses_clearok)
+{
+    dXSARGS;
+#ifdef C_CLEAROK
+    c_countargs("clearok", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : clearok(win, bf);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("clearok");
+    XSRETURN(0);
+#endif
+}
+
+#ifdef C_INTIDLOK
+XS(XS_Curses_idlok)
+{
+    dXSARGS;
+#ifdef C_IDLOK
+    c_countargs("idlok", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : idlok(win, bf);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("idlok");
+    XSRETURN(0);
+#endif
+}
+
+#else
+XS(XS_Curses_idlok)
+{
+    dXSARGS;
+#ifdef C_IDLOK
+    c_countargs("idlok", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    
+    if (c_mret == OK) { idlok(win, bf); }
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("idlok");
+    XSRETURN(0);
+#endif
+}
+
+#endif
+XS(XS_Curses_idcok)
+{
+    dXSARGS;
+#ifdef C_IDCOK
+    c_countargs("idcok", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    
+    if (c_mret == OK) { idcok(win, bf); }
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("idcok");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_immedok)
+{
+    dXSARGS;
+#ifdef C_IMMEDOK
+    c_countargs("immedok", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    
+    if (c_mret == OK) { immedok(win, bf); }
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("immedok");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_leaveok)
+{
+    dXSARGS;
+#ifdef C_LEAVEOK
+    c_countargs("leaveok", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : leaveok(win, bf);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("leaveok");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_setscrreg)
+{
+    dXSARGS;
+#ifdef C_SETSCRREG
+    c_countargs("setscrreg", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int top = (int)SvIV(ST(c_arg));
+    int bot = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : wsetscrreg(win, top, bot);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("setscrreg");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_scrollok)
+{
+    dXSARGS;
+#ifdef C_SCROLLOK
+    c_countargs("scrollok", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : scrollok(win, bf);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("scrollok");
+    XSRETURN(0);
+#endif
+}
+
+#ifdef C_INTNL
+XS(XS_Curses_nl)
+{
+    dXSARGS;
+#ifdef C_NL
+    c_exactargs("nl", items, 0);
+    {
+    int ret = nl();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("nl");
+    XSRETURN(0);
+#endif
+}
+
+#else
+XS(XS_Curses_nl)
+{
+    dXSARGS;
+#ifdef C_NL
+    c_exactargs("nl", items, 0);
+    {
+    nl();
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("nl");
+    XSRETURN(0);
+#endif
+}
+
+#endif
+#ifdef C_INTNONL
+XS(XS_Curses_nonl)
+{
+    dXSARGS;
+#ifdef C_NONL
+    c_exactargs("nonl", items, 0);
+    {
+    int ret = nonl();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("nonl");
+    XSRETURN(0);
+#endif
+}
+
+#else
+XS(XS_Curses_nonl)
+{
+    dXSARGS;
+#ifdef C_NONL
+    c_exactargs("nonl", items, 0);
+    {
+    nonl();
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("nonl");
+    XSRETURN(0);
+#endif
+}
+
+#endif
+
+/* curs_overlay */
+
+XS(XS_Curses_overlay)
+{
+    dXSARGS;
+#ifdef C_OVERLAY
+    c_exactargs("overlay", items, 2);
+    {
+    WINDOW *srcwin  = c_sv2window(ST(0), 0);
+    WINDOW *dstwin  = c_sv2window(ST(1), 1);
+    int ret = overlay(srcwin, dstwin);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("overlay");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_overwrite)
+{
+    dXSARGS;
+#ifdef C_OVERWRITE
+    c_exactargs("overwrite", items, 2);
+    {
+    WINDOW *srcwin  = c_sv2window(ST(0), 0);
+    WINDOW *dstwin  = c_sv2window(ST(1), 1);
+    int ret = overwrite(srcwin, dstwin);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("overwrite");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_copywin)
+{
+    dXSARGS;
+#ifdef C_COPYWIN
+    c_exactargs("copywin", items, 9);
+    {
+    WINDOW *srcwin  = c_sv2window(ST(0), 0);
+    WINDOW *dstwin  = c_sv2window(ST(1), 1);
+    int sminrow = (int)SvIV(ST(2));
+    int smincol = (int)SvIV(ST(3));
+    int dminrow = (int)SvIV(ST(4));
+    int dmincol = (int)SvIV(ST(5));
+    int dmaxrow = (int)SvIV(ST(6));
+    int dmaxcol = (int)SvIV(ST(7));
+    int overlay = (int)SvIV(ST(8));
+    int ret = copywin(srcwin, dstwin, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, overlay);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("copywin");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_pad */
+
+XS(XS_Curses_newpad)
+{
+    dXSARGS;
+#ifdef C_NEWPAD
+    c_exactargs("newpad", items, 2);
+    {
+    int lines_  = (int)SvIV(ST(0));
+    int cols    = (int)SvIV(ST(1));
+    WINDOW *    ret = newpad(lines_, cols);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("newpad");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_subpad)
+{
+    dXSARGS;
+#ifdef C_SUBPAD
+    c_exactargs("subpad", items, 5);
+    {
+    WINDOW *orig    = c_sv2window(ST(0), 0);
+    int lines_  = (int)SvIV(ST(1));
+    int cols    = (int)SvIV(ST(2));
+    int beginy  = (int)SvIV(ST(3));
+    int beginx  = (int)SvIV(ST(4));
+    WINDOW *    ret = subpad(orig, lines_, cols, beginy, beginx);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("subpad");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_prefresh)
+{
+    dXSARGS;
+#ifdef C_PREFRESH
+    c_exactargs("prefresh", items, 7);
+    {
+    WINDOW *pad = c_sv2window(ST(0), 0);
+    int pminrow = (int)SvIV(ST(1));
+    int pmincol = (int)SvIV(ST(2));
+    int sminrow = (int)SvIV(ST(3));
+    int smincol = (int)SvIV(ST(4));
+    int smaxrow = (int)SvIV(ST(5));
+    int smaxcol = (int)SvIV(ST(6));
+    int ret = prefresh(pad, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("prefresh");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_pnoutrefresh)
+{
+    dXSARGS;
+#ifdef C_PNOUTREFRESH
+    c_exactargs("pnoutrefresh", items, 7);
+    {
+    WINDOW *pad = c_sv2window(ST(0), 0);
+    int pminrow = (int)SvIV(ST(1));
+    int pmincol = (int)SvIV(ST(2));
+    int sminrow = (int)SvIV(ST(3));
+    int smincol = (int)SvIV(ST(4));
+    int smaxrow = (int)SvIV(ST(5));
+    int smaxcol = (int)SvIV(ST(6));
+    int ret = pnoutrefresh(pad, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("pnoutrefresh");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_pechochar)
+{
+    dXSARGS;
+#ifdef C_PECHOCHAR
+    c_exactargs("pechochar", items, 2);
+    {
+    WINDOW *pad = c_sv2window(ST(0), 0);
+    chtype  ch  = c_sv2chtype(ST(1));
+    int ret = pechochar(pad, ch);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("pechochar");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_printw */
+
+/* done in perl */
+
+/* curs_refresh */
+
+XS(XS_Curses_refresh)
+{
+    dXSARGS;
+#ifdef C_REFRESH
+    c_countargs("refresh", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : wrefresh(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("refresh");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_noutrefresh)
+{
+    dXSARGS;
+#ifdef C_NOUTREFRESH
+    c_countargs("noutrefresh", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : wnoutrefresh(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("noutrefresh");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_doupdate)
+{
+    dXSARGS;
+#ifdef C_DOUPDATE
+    c_exactargs("doupdate", items, 0);
+    {
+    int ret = doupdate();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("doupdate");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_redrawwin)
+{
+    dXSARGS;
+#ifdef C_REDRAWWIN
+    c_countargs("redrawwin", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : redrawwin(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("redrawwin");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_redrawln)
+{
+    dXSARGS;
+#ifdef C_REDRAWLN
+    c_countargs("redrawln", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int beg_line    = (int)SvIV(ST(c_arg));
+    int num_lines   = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : wredrawln(win, beg_line, num_lines);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("redrawln");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_scanw */
+
+/* done in perl */
+
+/* curs_scr_dump */
+
+XS(XS_Curses_scr_dump)
+{
+    dXSARGS;
+#ifdef C_SCR_DUMP
+    c_exactargs("scr_dump", items, 1);
+    {
+    char *  filename    = (char *)SvPV_nolen(ST(0));
+    int ret = scr_dump(filename);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("scr_dump");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_scr_restore)
+{
+    dXSARGS;
+#ifdef C_SCR_RESTORE
+    c_exactargs("scr_restore", items, 1);
+    {
+    char *  filename    = (char *)SvPV_nolen(ST(0));
+    int ret = scr_restore(filename);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("scr_restore");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_scr_init)
+{
+    dXSARGS;
+#ifdef C_SCR_INIT
+    c_exactargs("scr_init", items, 1);
+    {
+    char *  filename    = (char *)SvPV_nolen(ST(0));
+    int ret = scr_init(filename);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("scr_init");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_scr_set)
+{
+    dXSARGS;
+#ifdef C_SCR_SET
+    c_exactargs("scr_set", items, 1);
+    {
+    char *  filename    = (char *)SvPV_nolen(ST(0));
+    int ret = scr_set(filename);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("scr_set");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_scroll */
+
+XS(XS_Curses_scroll)
+{
+    dXSARGS;
+#ifdef C_SCROLL
+    c_countargs("scroll", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : scroll(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("scroll");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_scrl)
+{
+    dXSARGS;
+#ifdef C_SCRL
+    c_countargs("scrl", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int n   = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : wscrl(win, n);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("scrl");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_slk */
+
+XS(XS_Curses_slk_init)
+{
+    dXSARGS;
+#ifdef C_SLK_INIT
+    c_exactargs("slk_init", items, 1);
+    {
+    int fmt = (int)SvIV(ST(0));
+    int ret = slk_init(fmt);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("slk_init");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_slk_set)
+{
+    dXSARGS;
+#ifdef C_SLK_SET
+    c_exactargs("slk_set", items, 3);
+    {
+    int labnum  = (int)SvIV(ST(0));
+    char *  label   = (char *)SvPV_nolen(ST(1));
+    int fmt = (int)SvIV(ST(2));
+    int ret = slk_set(labnum, label, fmt);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("slk_set");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_slk_refresh)
+{
+    dXSARGS;
+#ifdef C_SLK_REFRESH
+    c_exactargs("slk_refresh", items, 0);
+    {
+    int ret = slk_refresh();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("slk_refresh");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_slk_noutrefresh)
+{
+    dXSARGS;
+#ifdef C_SLK_NOUTREFRESH
+    c_exactargs("slk_noutrefresh", items, 0);
+    {
+    int ret = slk_noutrefresh();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("slk_noutrefresh");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_slk_label)
+{
+    dXSARGS;
+#ifdef C_SLK_LABEL
+    c_exactargs("slk_label", items, 1);
+    {
+    int labnum  = (int)SvIV(ST(0));
+    char *  ret = slk_label(labnum);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("slk_label");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_slk_clear)
+{
+    dXSARGS;
+#ifdef C_SLK_CLEAR
+    c_exactargs("slk_clear", items, 0);
+    {
+    int ret = slk_clear();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("slk_clear");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_slk_restore)
+{
+    dXSARGS;
+#ifdef C_SLK_RESTORE
+    c_exactargs("slk_restore", items, 0);
+    {
+    int ret = slk_restore();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("slk_restore");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_slk_touch)
+{
+    dXSARGS;
+#ifdef C_SLK_TOUCH
+    c_exactargs("slk_touch", items, 0);
+    {
+    int ret = slk_touch();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("slk_touch");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_slk_attron)
+{
+    dXSARGS;
+#ifdef C_SLK_ATTRON
+    c_exactargs("slk_attron", items, 1);
+    {
+    chtype  attrs   = c_sv2chtype(ST(0));
+    int ret = slk_attron(attrs);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("slk_attron");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_slk_attrset)
+{
+    dXSARGS;
+#ifdef C_SLK_ATTRSET
+    c_exactargs("slk_attrset", items, 1);
+    {
+    chtype  attrs   = c_sv2chtype(ST(0));
+    int ret = slk_attrset(attrs);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("slk_attrset");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_slk_attr)
+{
+    dXSARGS;
+#ifdef C_SLK_ATTR
+    c_exactargs("slk_attr", items, 0);
+    {
+    attr_t  ret = slk_attr();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("slk_attr");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_slk_attroff)
+{
+    dXSARGS;
+#ifdef C_SLK_ATTROFF
+    c_exactargs("slk_attroff", items, 1);
+    {
+    chtype  attrs   = c_sv2chtype(ST(0));
+    int ret = slk_attroff(attrs);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("slk_attroff");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_slk_color)
+{
+    dXSARGS;
+#ifdef C_SLK_COLOR
+    c_exactargs("slk_color", items, 1);
+    {
+    short   color_pair_number   = (short)SvIV(ST(0));
+    int ret = slk_color(color_pair_number);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("slk_color");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_termattrs */
+
+XS(XS_Curses_baudrate)
+{
+    dXSARGS;
+#ifdef C_BAUDRATE
+    c_exactargs("baudrate", items, 0);
+    {
+    int ret = baudrate();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("baudrate");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_erasechar)
+{
+    dXSARGS;
+#ifdef C_ERASECHAR
+    c_exactargs("erasechar", items, 0);
+    {
+    char    ret = erasechar();
+    
+    ST(0) = sv_newmortal();
+    sv_setpvn(ST(0), (char *)&ret, 1);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("erasechar");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_has_ic)
+{
+    dXSARGS;
+#ifdef C_HAS_IC
+    c_exactargs("has_ic", items, 0);
+    {
+    int ret = has_ic();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("has_ic");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_has_il)
+{
+    dXSARGS;
+#ifdef C_HAS_IL
+    c_exactargs("has_il", items, 0);
+    {
+    int ret = has_il();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("has_il");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_killchar)
+{
+    dXSARGS;
+#ifdef C_KILLCHAR
+    c_exactargs("killchar", items, 0);
+    {
+    char    ret = killchar();
+    
+    ST(0) = sv_newmortal();
+    sv_setpvn(ST(0), (char *)&ret, 1);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("killchar");
+    XSRETURN(0);
+#endif
+}
+
+#ifdef C_LONG0ARGS
+XS(XS_Curses_longname)
+{
+    dXSARGS;
+#ifdef C_LONGNAME
+    c_exactargs("longname", items, 0);
+    {
+    char *  ret = longname();
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("longname");
+    XSRETURN(0);
+#endif
+}
+
+#else
+XS(XS_Curses_longname)
+{
+    dXSARGS;
+#ifdef C_LONGNAME
+    c_exactargs("longname", items, 2);
+    {
+    char *  a   = (char *)SvPV_nolen(ST(0));
+    char *  b   = (char *)SvPV_nolen(ST(1));
+    char *  ret = longname(a, b);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("longname");
+    XSRETURN(0);
+#endif
+}
+
+#endif
+
+XS(XS_Curses_termattrs)
+{
+    dXSARGS;
+#ifdef C_TERMATTRS
+    c_exactargs("termattrs", items, 0);
+    {
+    chtype  ret = termattrs();
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("termattrs");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_termname)
+{
+    dXSARGS;
+#ifdef C_TERMNAME
+    c_exactargs("termname", items, 0);
+    {
+    char *  ret = termname();
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("termname");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_touch */
+
+XS(XS_Curses_touchwin)
+{
+    dXSARGS;
+#ifdef C_TOUCHWIN
+    c_countargs("touchwin", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : touchwin(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("touchwin");
+    XSRETURN(0);
+#endif
+}
+
+#ifdef C_TOUCH3ARGS
+XS(XS_Curses_touchline)
+{
+    dXSARGS;
+#ifdef C_TOUCHLINE
+    c_countargs("touchline", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int start   = (int)SvIV(ST(c_arg));
+    int count   = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : touchline(win, start, count);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("touchline");
+    XSRETURN(0);
+#endif
+}
+
+#else
+XS(XS_Curses_touchline)
+{
+    dXSARGS;
+#ifdef C_TOUCHLINE
+    c_countargs("touchline", items, 3);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int y   = (int)SvIV(ST(c_arg));
+    int sx  = (int)SvIV(ST(c_arg+1));
+    int ex  = (int)SvIV(ST(c_arg+2));
+    int ret = c_mret == ERR ? ERR : touchline(win, y, sx, ex);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("touchline");
+    XSRETURN(0);
+#endif
+}
+
+#endif
+
+XS(XS_Curses_untouchwin)
+{
+    dXSARGS;
+#ifdef C_UNTOUCHWIN
+    c_countargs("untouchwin", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : untouchwin(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("untouchwin");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_touchln)
+{
+    dXSARGS;
+#ifdef C_TOUCHLN
+    c_countargs("touchln", items, 3);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int y   = (int)SvIV(ST(c_arg));
+    int n   = (int)SvIV(ST(c_arg+1));
+    int changed = (int)SvIV(ST(c_arg+2));
+    int ret = c_mret == ERR ? ERR : wtouchln(win, y, n, changed);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("touchln");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_is_linetouched)
+{
+    dXSARGS;
+#ifdef C_IS_LINETOUCHED
+    c_countargs("is_linetouched", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int line    = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : is_linetouched(win, line);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("is_linetouched");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_is_wintouched)
+{
+    dXSARGS;
+#ifdef C_IS_WINTOUCHED
+    c_countargs("is_wintouched", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : is_wintouched(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("is_wintouched");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_util */
+
+
+
+XS(XS_Curses_unctrl) {
+
+    dXSARGS;
+#ifdef C_UNCTRL
+    c_exactargs("unctrl", items, 1);
+    {
+        chtype const ch = c_sv2chtype(ST(0));
+        const char * const ret = unctrl(ch);
+    
+        ST(0) = sv_newmortal();
+        sv_setpv((SV*)ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("unctrl");
+    XSRETURN(0);
+#endif
+}
+
+
+
+XS(XS_Curses_keyname)
+{
+    dXSARGS;
+#ifdef C_KEYNAME
+    c_exactargs("keyname", items, 1);
+    {
+    int k   = (int)SvIV(ST(0));
+    char *  ret = (char *)keyname(k);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("keyname");
+    XSRETURN(0);
+#endif
+}
+
+#ifdef C_INTFILTER
+XS(XS_Curses_filter)
+{
+    dXSARGS;
+#ifdef C_FILTER
+    c_exactargs("filter", items, 0);
+    {
+    int ret = filter();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("filter");
+    XSRETURN(0);
+#endif
+}
+
+#else
+XS(XS_Curses_filter)
+{
+    dXSARGS;
+#ifdef C_FILTER
+    c_exactargs("filter", items, 0);
+    {
+    filter();
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("filter");
+    XSRETURN(0);
+#endif
+}
+
+#endif
+XS(XS_Curses_use_env)
+{
+    dXSARGS;
+#ifdef C_USE_ENV
+    c_exactargs("use_env", items, 1);
+    {
+    bool    bf  = (int)SvIV(ST(0));
+    
+    use_env(bf);
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("use_env");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_putwin)
+{
+    dXSARGS;
+#ifdef C_PUTWIN
+    c_exactargs("putwin", items, 2);
+    {
+    WINDOW *win = c_sv2window(ST(0), 0);
+    /* See explanation of PerlIO_findFILE in newterm() */
+    FILE *  filep   = PerlIO_findFILE(IoIFP(sv_2io(ST(1))));
+    int ret = putwin(win, filep);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("putwin");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_getwin)
+{
+    dXSARGS;
+#ifdef C_GETWIN
+    c_exactargs("getwin", items, 1);
+    {
+    /* See explanation of PerlIO_findFILE in newterm() */
+    FILE *  filep   = PerlIO_findFILE(IoIFP(sv_2io(ST(0))));
+    WINDOW *    ret = getwin(filep);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("getwin");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_delay_output)
+{
+    dXSARGS;
+#ifdef C_DELAY_OUTPUT
+    c_exactargs("delay_output", items, 1);
+    {
+    int ms  = (int)SvIV(ST(0));
+    int ret = delay_output(ms);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("delay_output");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_flushinp)
+{
+    dXSARGS;
+#ifdef C_FLUSHINP
+    c_exactargs("flushinp", items, 0);
+    {
+    int ret = flushinp();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("flushinp");
+    XSRETURN(0);
+#endif
+}
+
+
+/* curs_window */
+
+XS(XS_Curses_newwin)
+{
+    dXSARGS;
+#ifdef C_NEWWIN
+    c_exactargs("newwin", items, 4);
+    {
+    int nlines  = (int)SvIV(ST(0));
+    int ncols   = (int)SvIV(ST(1));
+    int beginy  = (int)SvIV(ST(2));
+    int beginx  = (int)SvIV(ST(3));
+    WINDOW *    ret = newwin(nlines, ncols, beginy, beginx);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("newwin");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_delwin)
+{
+    dXSARGS;
+#ifdef C_DELWIN
+    c_countargs("delwin", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : delwin(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("delwin");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_mvwin)
+{
+    dXSARGS;
+#ifdef C_MVWIN
+    c_countargs("mvwin", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int y   = (int)SvIV(ST(c_arg));
+    int x   = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : mvwin(win, y, x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("mvwin");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_subwin)
+{
+    dXSARGS;
+#ifdef C_SUBWIN
+    c_countargs("subwin", items, 4);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int nlines  = (int)SvIV(ST(c_arg));
+    int ncols   = (int)SvIV(ST(c_arg+1));
+    int beginy  = (int)SvIV(ST(c_arg+2));
+    int beginx  = (int)SvIV(ST(c_arg+3));
+    WINDOW *    ret = c_mret == ERR ? NULL : subwin(win, nlines, ncols, beginy, beginx);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("subwin");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_derwin)
+{
+    dXSARGS;
+#ifdef C_DERWIN
+    c_countargs("derwin", items, 4);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int nlines  = (int)SvIV(ST(c_arg));
+    int ncols   = (int)SvIV(ST(c_arg+1));
+    int beginy  = (int)SvIV(ST(c_arg+2));
+    int beginx  = (int)SvIV(ST(c_arg+3));
+    WINDOW *    ret = c_mret == ERR ? NULL : derwin(win, nlines, ncols, beginy, beginx);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("derwin");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_mvderwin)
+{
+    dXSARGS;
+#ifdef C_MVDERWIN
+    c_countargs("mvderwin", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int par_y   = (int)SvIV(ST(c_arg));
+    int par_x   = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : mvderwin(win, par_y, par_x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("mvderwin");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_dupwin)
+{
+    dXSARGS;
+#ifdef C_DUPWIN
+    c_countargs("dupwin", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    WINDOW *    ret = c_mret == ERR ? NULL : dupwin(win);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("dupwin");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_syncup)
+{
+    dXSARGS;
+#ifdef C_SYNCUP
+    c_countargs("syncup", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    
+    if (c_mret == OK) { wsyncup(win); }
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("syncup");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_syncok)
+{
+    dXSARGS;
+#ifdef C_SYNCOK
+    c_countargs("syncok", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : syncok(win, bf);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("syncok");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_cursyncup)
+{
+    dXSARGS;
+#ifdef C_CURSYNCUP
+    c_countargs("cursyncup", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    
+    if (c_mret == OK) { wcursyncup(win); }
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("cursyncup");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_syncdown)
+{
+    dXSARGS;
+#ifdef C_SYNCDOWN
+    c_countargs("syncdown", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    
+    if (c_mret == OK) { wsyncdown(win); }
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("syncdown");
+    XSRETURN(0);
+#endif
+}
+
+
+/* ncurses extension functions */
+
+XS(XS_Curses_getmouse)
+{
+    dXSARGS;
+#ifdef C_GETMOUSE
+    c_exactargs("getmouse", items, 1);
+    {
+    MEVENT *event   = (MEVENT *)sv_grow(ST(0), 2 * sizeof(MEVENT));
+    int ret = getmouse(event);
+    
+    c_setmevent(ST(0));
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("getmouse");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_ungetmouse)
+{
+    dXSARGS;
+#ifdef C_UNGETMOUSE
+    c_exactargs("ungetmouse", items, 1);
+    {
+    MEVENT *event   = (MEVENT *)SvPV_nolen(ST(0));
+    int ret = ungetmouse(event);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("ungetmouse");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_mousemask)
+{
+    dXSARGS;
+#ifdef C_MOUSEMASK
+    c_exactargs("mousemask", items, 2);
+    {
+    mmask_t newmask = (mmask_t)SvIV(ST(0));
+    mmask_t oldmask = 0;
+    mmask_t ret = mousemask(newmask, &oldmask);
+    
+    sv_setiv(ST(1), (IV)oldmask);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("mousemask");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_enclose)
+{
+    dXSARGS;
+#ifdef C_ENCLOSE
+    c_countargs("enclose", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int y   = (int)SvIV(ST(c_arg));
+    int x   = (int)SvIV(ST(c_arg+1));
+    bool    ret = c_mret == ERR ? ERR : wenclose(win, y, x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("enclose");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_mouse_trafo)
+{
+    dXSARGS;
+#ifdef C_MOUSE_TRAFO
+    c_countargs("mouse_trafo", items, 3);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int pY  = 0;
+    int pX  = 0;
+    bool    to_screen   = (int)SvIV(ST(c_arg+2));
+    bool    ret = c_mret == ERR ? ERR : wmouse_trafo(win, &pY, &pX, to_screen);
+    
+    sv_setiv(ST(c_arg), (IV)pY);;
+    sv_setiv(ST(c_arg+1), (IV)pX);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("mouse_trafo");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_mouseinterval)
+{
+    dXSARGS;
+#ifdef C_MOUSEINTERVAL
+    c_exactargs("mouseinterval", items, 1);
+    {
+    int erval   = (int)SvIV(ST(0));
+    int ret = mouseinterval(erval);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("mouseinterval");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_BUTTON_RELEASE)
+{
+    dXSARGS;
+#ifdef C_BUTTON_RELEASE
+    c_exactargs("BUTTON_RELEASE", items, 2);
+    {
+    mmask_t e   = (mmask_t)SvIV(ST(0));
+    int x   = (int)SvIV(ST(1));
+    int ret = BUTTON_RELEASE(e, x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("BUTTON_RELEASE");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_BUTTON_PRESS)
+{
+    dXSARGS;
+#ifdef C_BUTTON_PRESS
+    c_exactargs("BUTTON_PRESS", items, 2);
+    {
+    mmask_t e   = (mmask_t)SvIV(ST(0));
+    int x   = (int)SvIV(ST(1));
+    int ret = BUTTON_PRESS(e, x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("BUTTON_PRESS");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_BUTTON_CLICK)
+{
+    dXSARGS;
+#ifdef C_BUTTON_CLICK
+    c_exactargs("BUTTON_CLICK", items, 2);
+    {
+    mmask_t e   = (mmask_t)SvIV(ST(0));
+    int x   = (int)SvIV(ST(1));
+    int ret = BUTTON_CLICK(e, x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("BUTTON_CLICK");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_BUTTON_DOUBLE_CLICK)
+{
+    dXSARGS;
+#ifdef C_BUTTON_DOUBLE_CLICK
+    c_exactargs("BUTTON_DOUBLE_CLICK", items, 2);
+    {
+    mmask_t e   = (mmask_t)SvIV(ST(0));
+    int x   = (int)SvIV(ST(1));
+    int ret = BUTTON_DOUBLE_CLICK(e, x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("BUTTON_DOUBLE_CLICK");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_BUTTON_TRIPLE_CLICK)
+{
+    dXSARGS;
+#ifdef C_BUTTON_TRIPLE_CLICK
+    c_exactargs("BUTTON_TRIPLE_CLICK", items, 2);
+    {
+    mmask_t e   = (mmask_t)SvIV(ST(0));
+    int x   = (int)SvIV(ST(1));
+    int ret = BUTTON_TRIPLE_CLICK(e, x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("BUTTON_TRIPLE_CLICK");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_BUTTON_RESERVED_EVENT)
+{
+    dXSARGS;
+#ifdef C_BUTTON_RESERVED_EVENT
+    c_exactargs("BUTTON_RESERVED_EVENT", items, 2);
+    {
+    mmask_t e   = (mmask_t)SvIV(ST(0));
+    int x   = (int)SvIV(ST(1));
+    int ret = BUTTON_RESERVED_EVENT(e, x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("BUTTON_RESERVED_EVENT");
+    XSRETURN(0);
+#endif
+}
+
+
+XS(XS_Curses_use_default_colors)
+{
+    dXSARGS;
+#ifdef C_USE_DEFAULT_COLORS
+    c_exactargs("use_default_colors", items, 0);
+    {
+    int ret = use_default_colors();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("use_default_colors");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_assume_default_colors)
+{
+    dXSARGS;
+#ifdef C_ASSUME_DEFAULT_COLORS
+    c_exactargs("assume_default_colors", items, 2);
+    {
+    int fg  = (int)SvIV(ST(0));
+    int bg  = (int)SvIV(ST(1));
+    int ret = assume_default_colors(fg, bg);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("assume_default_colors");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_define_key)
+{
+    dXSARGS;
+#ifdef C_DEFINE_KEY
+    c_exactargs("define_key", items, 2);
+    {
+    char *  definition  = (char *)SvPV_nolen(ST(0));
+    int keycode = (int)SvIV(ST(1));
+    int ret = define_key(definition, keycode);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("define_key");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_keybound)
+{
+    dXSARGS;
+#ifdef C_KEYBOUND
+    c_exactargs("keybound", items, 2);
+    {
+    int keycode = (int)SvIV(ST(0));
+    int count   = (int)SvIV(ST(1));
+    char *  ret = keybound(keycode, count);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("keybound");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_keyok)
+{
+    dXSARGS;
+#ifdef C_KEYOK
+    c_exactargs("keyok", items, 2);
+    {
+    int keycode = (int)SvIV(ST(0));
+    bool    enable  = (int)SvIV(ST(1));
+    int ret = keyok(keycode, enable);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("keyok");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_resizeterm)
+{
+    dXSARGS;
+#ifdef C_RESIZETERM
+    c_exactargs("resizeterm", items, 2);
+    {
+    int lines   = (int)SvIV(ST(0));
+    int cols    = (int)SvIV(ST(1));
+    int ret = resizeterm(lines, cols);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("resizeterm");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_resize)
+{
+    dXSARGS;
+#ifdef C_RESIZE
+    c_countargs("resize", items, 2);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int lines_  = (int)SvIV(ST(c_arg));
+    int columns = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : wresize(win, lines_, columns);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("resize");
+    XSRETURN(0);
+#endif
+}
+
+
+/* DEC curses, I think */
+
+XS(XS_Curses_getmaxy)
+{
+    dXSARGS;
+#ifdef C_GETMAXY
+    c_countargs("getmaxy", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : getmaxy(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("getmaxy");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_getmaxx)
+{
+    dXSARGS;
+#ifdef C_GETMAXX
+    c_countargs("getmaxx", items, 0);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : getmaxx(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("getmaxx");
+    XSRETURN(0);
+#endif
+}
+
+
+/* old BSD curses calls */
+
+XS(XS_Curses_flusok)
+{
+    dXSARGS;
+#ifdef C_FLUSOK
+    c_countargs("flusok", items, 1);
+    {
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    
+    if (c_mret == OK) { flusok(win, bf); }
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("flusok");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_getcap)
+{
+    dXSARGS;
+#ifdef C_GETCAP
+    c_exactargs("getcap", items, 1);
+    {
+    char *  term    = (char *)SvPV_nolen(ST(0));
+    char *  ret = (char *)getcap(term);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("getcap");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_touchoverlap)
+{
+    dXSARGS;
+#ifdef C_TOUCHOVERLAP
+    c_exactargs("touchoverlap", items, 2);
+    {
+    WINDOW *src = c_sv2window(ST(0), 0);
+    WINDOW *dst = c_sv2window(ST(1), 1);
+    int ret = touchoverlap(src, dst);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("touchoverlap");
+    XSRETURN(0);
+#endif
+}
+
+
+/* Panel functions */
+
+XS(XS_Curses_new_panel)
+{
+    dXSARGS;
+#ifdef C_NEW_PANEL
+    c_exactargs("new_panel", items, 1);
+    {
+    WINDOW *win = c_sv2window(ST(0), 0);
+    PANEL * ret = new_panel(win);
+    
+    ST(0) = sv_newmortal();
+    c_panel2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("new_panel");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_bottom_panel)
+{
+    dXSARGS;
+#ifdef C_BOTTOM_PANEL
+    c_exactargs("bottom_panel", items, 1);
+    {
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    int ret = bottom_panel(pan);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("bottom_panel");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_top_panel)
+{
+    dXSARGS;
+#ifdef C_TOP_PANEL
+    c_exactargs("top_panel", items, 1);
+    {
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    int ret = top_panel(pan);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("top_panel");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_show_panel)
+{
+    dXSARGS;
+#ifdef C_SHOW_PANEL
+    c_exactargs("show_panel", items, 1);
+    {
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    int ret = show_panel(pan);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("show_panel");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_update_panels)
+{
+    dXSARGS;
+#ifdef C_UPDATE_PANELS
+    c_exactargs("update_panels", items, 0);
+    {
+    update_panels();
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("update_panels");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_hide_panel)
+{
+    dXSARGS;
+#ifdef C_HIDE_PANEL
+    c_exactargs("hide_panel", items, 1);
+    {
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    int ret = hide_panel(pan);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("hide_panel");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_panel_window)
+{
+    dXSARGS;
+#ifdef C_PANEL_WINDOW
+    c_exactargs("panel_window", items, 1);
+    {
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    WINDOW *    ret = panel_window(pan);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("panel_window");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_replace_panel)
+{
+    dXSARGS;
+#ifdef C_REPLACE_PANEL
+    c_exactargs("replace_panel", items, 2);
+    {
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    WINDOW *window  = c_sv2window(ST(1), 1);
+    int ret = replace_panel(pan, window);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("replace_panel");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_move_panel)
+{
+    dXSARGS;
+#ifdef C_MOVE_PANEL
+    c_exactargs("move_panel", items, 3);
+    {
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    int starty  = (int)SvIV(ST(1));
+    int startx  = (int)SvIV(ST(2));
+    int ret = move_panel(pan, starty, startx);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("move_panel");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_panel_hidden)
+{
+    dXSARGS;
+#ifdef C_PANEL_HIDDEN
+    c_exactargs("panel_hidden", items, 1);
+    {
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    int ret = panel_hidden(pan);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("panel_hidden");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_panel_above)
+{
+    dXSARGS;
+#ifdef C_PANEL_ABOVE
+    c_exactargs("panel_above", items, 1);
+    {
+    PANEL * pan = ST(0) != &PL_sv_undef ? c_sv2panel(ST(0), 0) : NULL;
+    PANEL * ret = panel_above(pan);
+    
+    ST(0) = sv_newmortal();
+    c_panel2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("panel_above");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_panel_below)
+{
+    dXSARGS;
+#ifdef C_PANEL_BELOW
+    c_exactargs("panel_below", items, 1);
+    {
+    PANEL * pan = ST(0) != &PL_sv_undef ? c_sv2panel(ST(0), 0) : NULL;
+    PANEL * ret = panel_below(pan);
+    
+    ST(0) = sv_newmortal();
+    c_panel2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("panel_below");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_set_panel_userptr)
+{
+    dXSARGS;
+#ifdef C_SET_PANEL_USERPTR
+    c_exactargs("set_panel_userptr", items, 2);
+    {
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    char *  ptr = (char *)SvPV_nolen(ST(1));
+    int ret = set_panel_userptr(pan, ptr);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_panel_userptr");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_panel_userptr)
+{
+    dXSARGS;
+#ifdef C_PANEL_USERPTR
+    c_exactargs("panel_userptr", items, 1);
+    {
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    char *  ret = (char *)panel_userptr(pan);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("panel_userptr");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_del_panel)
+{
+    dXSARGS;
+#ifdef C_DEL_PANEL
+    c_exactargs("del_panel", items, 1);
+    {
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    int ret = del_panel(pan);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("del_panel");
+    XSRETURN(0);
+#endif
+}
+
+
+/* Menu functions */
+
+/* menu_attributes */
+
+XS(XS_Curses_set_menu_fore)
+{
+    dXSARGS;
+#ifdef C_SET_MENU_FORE
+    c_exactargs("set_menu_fore", items, 2);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    chtype  attr    = c_sv2chtype(ST(1));
+    int ret = set_menu_fore(menu, attr);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_menu_fore");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_menu_fore)
+{
+    dXSARGS;
+#ifdef C_MENU_FORE
+    c_exactargs("menu_fore", items, 1);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    chtype  ret = menu_fore(menu);
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("menu_fore");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_set_menu_back)
+{
+    dXSARGS;
+#ifdef C_SET_MENU_BACK
+    c_exactargs("set_menu_back", items, 2);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    chtype  attr    = c_sv2chtype(ST(1));
+    int ret = set_menu_back(menu, attr);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_menu_back");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_menu_back)
+{
+    dXSARGS;
+#ifdef C_MENU_BACK
+    c_exactargs("menu_back", items, 1);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    chtype  ret = menu_back(menu);
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("menu_back");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_set_menu_grey)
+{
+    dXSARGS;
+#ifdef C_SET_MENU_GREY
+    c_exactargs("set_menu_grey", items, 2);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    chtype  attr    = c_sv2chtype(ST(1));
+    int ret = set_menu_grey(menu, attr);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_menu_grey");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_menu_grey)
+{
+    dXSARGS;
+#ifdef C_MENU_GREY
+    c_exactargs("menu_grey", items, 1);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    chtype  ret = menu_grey(menu);
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("menu_grey");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_set_menu_pad)
+{
+    dXSARGS;
+#ifdef C_SET_MENU_PAD
+    c_exactargs("set_menu_pad", items, 2);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int pad = (int)SvIV(ST(1));
+    int ret = set_menu_pad(menu, pad);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_menu_pad");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_menu_pad)
+{
+    dXSARGS;
+#ifdef C_MENU_PAD
+    c_exactargs("menu_pad", items, 1);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int ret = menu_pad(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("menu_pad");
+    XSRETURN(0);
+#endif
+}
+
+
+/* menu_cursor */
+
+XS(XS_Curses_pos_menu_cursor)
+{
+    dXSARGS;
+#ifdef C_POS_MENU_CURSOR
+    c_exactargs("pos_menu_cursor", items, 1);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int ret = pos_menu_cursor(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("pos_menu_cursor");
+    XSRETURN(0);
+#endif
+}
+
+
+/* menu_driver */
+
+XS(XS_Curses_menu_driver)
+{
+    dXSARGS;
+#ifdef C_MENU_DRIVER
+    c_exactargs("menu_driver", items, 2);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int c   = (int)SvIV(ST(1));
+    int ret = menu_driver(menu, c);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("menu_driver");
+    XSRETURN(0);
+#endif
+}
+
+
+/* menu_format */
+
+XS(XS_Curses_set_menu_format)
+{
+    dXSARGS;
+#ifdef C_SET_MENU_FORMAT
+    c_exactargs("set_menu_format", items, 3);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int rows    = (int)SvIV(ST(1));
+    int cols    = (int)SvIV(ST(2));
+    int ret = set_menu_format(menu, rows, cols);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_menu_format");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_menu_format)
+{
+    dXSARGS;
+#ifdef C_MENU_FORMAT
+    c_exactargs("menu_format", items, 3);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int rows    = 0;
+    int cols    = 0;
+    
+    menu_format(menu, &rows, &cols);
+    sv_setiv(ST(1), (IV)rows);;
+    sv_setiv(ST(2), (IV)cols);;
+    }
+    XSRETURN(0);
+#else
+    c_fun_not_there("menu_format");
+    XSRETURN(0);
+#endif
+}
+
+
+/* menu_items */
+
+XS(XS_Curses_set_menu_items)
+{
+    dXSARGS;
+#ifdef C_SET_MENU_ITEMS
+    c_exactargs("set_menu_items", items, 2);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    ITEM ** items   = (ITEM **)SvPV_nolen(ST(1));
+    int ret = set_menu_items(menu, items);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_menu_items");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_menu_items)
+{
+    dXSARGS;
+#ifdef C_MENU_ITEMS
+    c_exactargs("menu_items", items, 1);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    ITEM ** ret = menu_items(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), (char *)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("menu_items");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_item_count)
+{
+    dXSARGS;
+#ifdef C_ITEM_COUNT
+    c_exactargs("item_count", items, 1);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int ret = item_count(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("item_count");
+    XSRETURN(0);
+#endif
+}
+
+
+/* menu_mark */
+
+XS(XS_Curses_set_menu_mark)
+{
+    dXSARGS;
+#ifdef C_SET_MENU_MARK
+    c_exactargs("set_menu_mark", items, 2);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    char *  mark    = (char *)SvPV_nolen(ST(1));
+    int ret = set_menu_mark(menu, mark);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_menu_mark");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_menu_mark)
+{
+    dXSARGS;
+#ifdef C_MENU_MARK
+    c_exactargs("menu_mark", items, 1);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    char *  ret = (char *)menu_mark(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("menu_mark");
+    XSRETURN(0);
+#endif
+}
+
+
+/* menu_new */
+
+XS(XS_Curses_new_menu)
+{
+    dXSARGS;
+#ifdef C_NEW_MENU
+    c_exactargs("new_menu", items, 1);
+    {
+    ITEM ** items   = (ITEM **)SvPV_nolen(ST(0));
+    MENU *  ret = new_menu(items);
+    
+    ST(0) = sv_newmortal();
+    c_menu2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("new_menu");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_free_menu)
+{
+    dXSARGS;
+#ifdef C_FREE_MENU
+    c_exactargs("free_menu", items, 1);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int ret = free_menu(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("free_menu");
+    XSRETURN(0);
+#endif
+}
+
+
+/* menu_opts */
+
+XS(XS_Curses_menu_opts)
+{
+    dXSARGS;
+#ifdef C_MENU_OPTS
+    c_exactargs("menu_opts", items, 1);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int ret = menu_opts(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("menu_opts");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_set_menu_opts)
+{
+    dXSARGS;
+#ifdef C_SET_MENU_OPTS
+    c_exactargs("set_menu_opts", items, 2);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = set_menu_opts(menu, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_menu_opts");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_menu_opts_on)
+{
+    dXSARGS;
+#ifdef C_MENU_OPTS_ON
+    c_exactargs("menu_opts_on", items, 2);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = menu_opts_on(menu, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("menu_opts_on");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_menu_opts_off)
+{
+    dXSARGS;
+#ifdef C_MENU_OPTS_OFF
+    c_exactargs("menu_opts_off", items, 2);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = menu_opts_off(menu, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("menu_opts_off");
+    XSRETURN(0);
+#endif
+}
+
+
+/* menu_pattern */
+
+XS(XS_Curses_set_menu_pattern)
+{
+    dXSARGS;
+#ifdef C_SET_MENU_PATTERN
+    c_exactargs("set_menu_pattern", items, 2);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    char *  pattern = (char *)SvPV_nolen(ST(1));
+    int ret = set_menu_pattern(menu, pattern);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_menu_pattern");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_menu_pattern)
+{
+    dXSARGS;
+#ifdef C_MENU_PATTERN
+    c_exactargs("menu_pattern", items, 1);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    char *  ret = menu_pattern(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("menu_pattern");
+    XSRETURN(0);
+#endif
+}
+
+
+/* menu_post */
+
+XS(XS_Curses_post_menu)
+{
+    dXSARGS;
+#ifdef C_POST_MENU
+    c_exactargs("post_menu", items, 1);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int ret = post_menu(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("post_menu");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_unpost_menu)
+{
+    dXSARGS;
+#ifdef C_UNPOST_MENU
+    c_exactargs("unpost_menu", items, 1);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int ret = unpost_menu(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("unpost_menu");
+    XSRETURN(0);
+#endif
+}
+
+
+/* menu_userptr */
+
+XS(XS_Curses_set_menu_userptr)
+{
+    dXSARGS;
+#ifdef C_SET_MENU_USERPTR
+    c_exactargs("set_menu_userptr", items, 2);
+    {
+    MENU *  item    = c_sv2menu(ST(0), 0);
+    char *  userptr = (char *)SvPV_nolen(ST(1));
+    int ret = set_menu_userptr(item, userptr);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_menu_userptr");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_menu_userptr)
+{
+    dXSARGS;
+#ifdef C_MENU_USERPTR
+    c_exactargs("menu_userptr", items, 1);
+    {
+    MENU *  item    = c_sv2menu(ST(0), 0);
+    char *  ret = menu_userptr(item);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("menu_userptr");
+    XSRETURN(0);
+#endif
+}
+
+
+/* menu_win */
+
+XS(XS_Curses_set_menu_win)
+{
+    dXSARGS;
+#ifdef C_SET_MENU_WIN
+    c_exactargs("set_menu_win", items, 2);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    WINDOW *win = c_sv2window(ST(1), 1);
+    int ret = set_menu_win(menu, win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_menu_win");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_menu_win)
+{
+    dXSARGS;
+#ifdef C_MENU_WIN
+    c_exactargs("menu_win", items, 1);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    WINDOW *    ret = menu_win(menu);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("menu_win");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_set_menu_sub)
+{
+    dXSARGS;
+#ifdef C_SET_MENU_SUB
+    c_exactargs("set_menu_sub", items, 2);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    WINDOW *win = c_sv2window(ST(1), 1);
+    int ret = set_menu_sub(menu, win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_menu_sub");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_menu_sub)
+{
+    dXSARGS;
+#ifdef C_MENU_SUB
+    c_exactargs("menu_sub", items, 1);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    WINDOW *    ret = menu_sub(menu);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("menu_sub");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_scale_menu)
+{
+    dXSARGS;
+#ifdef C_SCALE_MENU
+    c_exactargs("scale_menu", items, 3);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int rows    = 0;
+    int cols    = 0;
+    int ret = scale_menu(menu, &rows, &cols);
+    
+    sv_setiv(ST(1), (IV)rows);;
+    sv_setiv(ST(2), (IV)cols);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("scale_menu");
+    XSRETURN(0);
+#endif
+}
+
+
+/* menu_item_current */
+
+XS(XS_Curses_set_current_item)
+{
+    dXSARGS;
+#ifdef C_SET_CURRENT_ITEM
+    c_exactargs("set_current_item", items, 2);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    ITEM *  item    = c_sv2item(ST(1), 1);
+    int ret = set_current_item(menu, item);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_current_item");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_current_item)
+{
+    dXSARGS;
+#ifdef C_CURRENT_ITEM
+    c_exactargs("current_item", items, 1);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    ITEM *  ret = current_item(menu);
+    
+    ST(0) = sv_newmortal();
+    c_item2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("current_item");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_set_top_row)
+{
+    dXSARGS;
+#ifdef C_SET_TOP_ROW
+    c_exactargs("set_top_row", items, 2);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int row = (int)SvIV(ST(1));
+    int ret = set_top_row(menu, row);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_top_row");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_top_row)
+{
+    dXSARGS;
+#ifdef C_TOP_ROW
+    c_exactargs("top_row", items, 1);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int ret = top_row(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("top_row");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_item_index)
+{
+    dXSARGS;
+#ifdef C_ITEM_INDEX
+    c_exactargs("item_index", items, 1);
+    {
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    int ret = item_index(item);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("item_index");
+    XSRETURN(0);
+#endif
+}
+
+
+/* menu_item_name */
+
+XS(XS_Curses_item_name)
+{
+    dXSARGS;
+#ifdef C_ITEM_NAME
+    c_exactargs("item_name", items, 1);
+    {
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    char *  ret = (char *)item_name(item);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("item_name");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_item_description)
+{
+    dXSARGS;
+#ifdef C_ITEM_DESCRIPTION
+    c_exactargs("item_description", items, 1);
+    {
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    char *  ret = (char *)item_description(item);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("item_description");
+    XSRETURN(0);
+#endif
+}
+
+
+/* menu_item_new */
+
+XS(XS_Curses_new_item)
+{
+    dXSARGS;
+#ifdef C_NEW_ITEM
+    c_exactargs("new_item", items, 2);
+    {
+    char *  name    = (char *)SvPV_nolen(ST(0));
+    char *  descr   = (char *)SvPV_nolen(ST(1));
+    ITEM *  ret = new_item(name, descr);
+    
+    ST(0) = sv_newmortal();
+    c_item2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("new_item");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_free_item)
+{
+    dXSARGS;
+#ifdef C_FREE_ITEM
+    c_exactargs("free_item", items, 1);
+    {
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    int ret = free_item(item);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("free_item");
+    XSRETURN(0);
+#endif
+}
+
+
+/* menu_item_opts */
+
+XS(XS_Curses_set_item_opts)
+{
+    dXSARGS;
+#ifdef C_SET_ITEM_OPTS
+    c_exactargs("set_item_opts", items, 2);
+    {
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = set_item_opts(item, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_item_opts");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_item_opts_on)
+{
+    dXSARGS;
+#ifdef C_ITEM_OPTS_ON
+    c_exactargs("item_opts_on", items, 2);
+    {
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = item_opts_on(item, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("item_opts_on");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_item_opts_off)
+{
+    dXSARGS;
+#ifdef C_ITEM_OPTS_OFF
+    c_exactargs("item_opts_off", items, 2);
+    {
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = item_opts_off(item, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("item_opts_off");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_item_opts)
+{
+    dXSARGS;
+#ifdef C_ITEM_OPTS
+    c_exactargs("item_opts", items, 1);
+    {
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    int ret = item_opts(item);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("item_opts");
+    XSRETURN(0);
+#endif
+}
+
+
+/* menu_item_userptr */
+
+XS(XS_Curses_item_userptr)
+{
+    dXSARGS;
+#ifdef C_ITEM_USERPTR
+    c_exactargs("item_userptr", items, 1);
+    {
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    char *  ret = (char *)item_userptr(item);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("item_userptr");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_set_item_userptr)
+{
+    dXSARGS;
+#ifdef C_SET_ITEM_USERPTR
+    c_exactargs("set_item_userptr", items, 2);
+    {
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    char *  ptr = (char *)SvPV_nolen(ST(1));
+    int ret = set_item_userptr(item, ptr);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_item_userptr");
+    XSRETURN(0);
+#endif
+}
+
+
+/* menu_item_value */
+
+XS(XS_Curses_set_item_value)
+{
+    dXSARGS;
+#ifdef C_SET_ITEM_VALUE
+    c_exactargs("set_item_value", items, 2);
+    {
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    bool    val = (int)SvIV(ST(1));
+    int ret = set_item_value(item, val);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_item_value");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_item_value)
+{
+    dXSARGS;
+#ifdef C_ITEM_VALUE
+    c_exactargs("item_value", items, 1);
+    {
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    bool    ret = item_value(item);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("item_value");
+    XSRETURN(0);
+#endif
+}
+
+
+/* menu_item_visible */
+
+XS(XS_Curses_item_visible)
+{
+    dXSARGS;
+#ifdef C_ITEM_VISIBLE
+    c_exactargs("item_visible", items, 1);
+    {
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    bool    ret = item_visible(item);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("item_visible");
+    XSRETURN(0);
+#endif
+}
+
+
+/* ncurses menu extension functions */
+
+XS(XS_Curses_menu_request_name)
+{
+    dXSARGS;
+#ifdef C_MENU_REQUEST_NAME
+    c_exactargs("menu_request_name", items, 1);
+    {
+    int request = (int)SvIV(ST(0));
+    char *  ret = (char *)menu_request_name(request);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("menu_request_name");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_menu_request_by_name)
+{
+    dXSARGS;
+#ifdef C_MENU_REQUEST_BY_NAME
+    c_exactargs("menu_request_by_name", items, 1);
+    {
+    char *  name    = (char *)SvPV_nolen(ST(0));
+    int ret = menu_request_by_name(name);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("menu_request_by_name");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_set_menu_spacing)
+{
+    dXSARGS;
+#ifdef C_SET_MENU_SPACING
+    c_exactargs("set_menu_spacing", items, 4);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int descr   = (int)SvIV(ST(1));
+    int rows    = (int)SvIV(ST(2));
+    int cols    = (int)SvIV(ST(3));
+    int ret = set_menu_spacing(menu, descr, rows, cols);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_menu_spacing");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_menu_spacing)
+{
+    dXSARGS;
+#ifdef C_MENU_SPACING
+    c_exactargs("menu_spacing", items, 4);
+    {
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int descr   = 0;
+    int rows    = 0;
+    int cols    = 0;
+    int ret = menu_spacing(menu, &descr, &rows, &cols);
+    
+    sv_setiv(ST(1), (IV)descr);;
+    sv_setiv(ST(2), (IV)rows);;
+    sv_setiv(ST(3), (IV)cols);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("menu_spacing");
+    XSRETURN(0);
+#endif
+}
+
+
+/* Form functions */
+
+/* form_cursor */
+
+XS(XS_Curses_pos_form_cursor)
+{
+    dXSARGS;
+#ifdef C_POS_FORM_CURSOR
+    c_exactargs("pos_form_cursor", items, 1);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int ret = pos_form_cursor(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("pos_form_cursor");
+    XSRETURN(0);
+#endif
+}
+
+
+/* form_data */
+
+XS(XS_Curses_data_ahead)
+{
+    dXSARGS;
+#ifdef C_DATA_AHEAD
+    c_exactargs("data_ahead", items, 1);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    bool    ret = data_ahead(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("data_ahead");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_data_behind)
+{
+    dXSARGS;
+#ifdef C_DATA_BEHIND
+    c_exactargs("data_behind", items, 1);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    bool    ret = data_behind(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("data_behind");
+    XSRETURN(0);
+#endif
+}
+
+
+/* form_driver */
+
+XS(XS_Curses_form_driver)
+{
+    dXSARGS;
+#ifdef C_FORM_DRIVER
+    c_exactargs("form_driver", items, 2);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int c   = (int)SvIV(ST(1));
+    int ret = form_driver(form, c);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("form_driver");
+    XSRETURN(0);
+#endif
+}
+
+
+/* form_field */
+
+XS(XS_Curses_set_form_fields)
+{
+    dXSARGS;
+#ifdef C_SET_FORM_FIELDS
+    c_exactargs("set_form_fields", items, 2);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    FIELD **fields  = (FIELD **)SvPV_nolen(ST(1));
+    int ret = set_form_fields(form, fields);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_form_fields");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_form_fields)
+{
+    dXSARGS;
+#ifdef C_FORM_FIELDS
+    c_exactargs("form_fields", items, 1);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    FIELD **    ret = form_fields(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), (char *)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("form_fields");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_field_count)
+{
+    dXSARGS;
+#ifdef C_FIELD_COUNT
+    c_exactargs("field_count", items, 1);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int ret = field_count(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("field_count");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_move_field)
+{
+    dXSARGS;
+#ifdef C_MOVE_FIELD
+    c_exactargs("move_field", items, 3);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int frow    = (int)SvIV(ST(1));
+    int fcol    = (int)SvIV(ST(2));
+    int ret = move_field(field, frow, fcol);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("move_field");
+    XSRETURN(0);
+#endif
+}
+
+
+/* form_new */
+
+XS(XS_Curses_new_form) {
+    dXSARGS;
+#ifdef C_NEW_FORM
+    c_exactargs("new_form", items, 1);
+    {
+        FIELD ** fields  = (FIELD **)SvPV_nolen(ST(0));
+        FORM *  ret = new_form(fields);
+        
+        ST(0) = sv_newmortal();
+        c_form2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("new_form");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_free_form)
+{
+    dXSARGS;
+#ifdef C_FREE_FORM
+    c_exactargs("free_form", items, 1);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int ret = free_form(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("free_form");
+    XSRETURN(0);
+#endif
+}
+
+
+/* form_new_page */
+
+XS(XS_Curses_set_new_page)
+{
+    dXSARGS;
+#ifdef C_SET_NEW_PAGE
+    c_exactargs("set_new_page", items, 2);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    bool    new_page_flag   = (int)SvIV(ST(1));
+    int ret = set_new_page(field, new_page_flag);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_new_page");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_new_page)
+{
+    dXSARGS;
+#ifdef C_NEW_PAGE
+    c_exactargs("new_page", items, 1);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    bool    ret = new_page(field);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("new_page");
+    XSRETURN(0);
+#endif
+}
+
+
+/* form_opts */
+
+XS(XS_Curses_set_form_opts)
+{
+    dXSARGS;
+#ifdef C_SET_FORM_OPTS
+    c_exactargs("set_form_opts", items, 2);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = set_form_opts(form, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_form_opts");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_form_opts_on)
+{
+    dXSARGS;
+#ifdef C_FORM_OPTS_ON
+    c_exactargs("form_opts_on", items, 2);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = form_opts_on(form, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("form_opts_on");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_form_opts_off)
+{
+    dXSARGS;
+#ifdef C_FORM_OPTS_OFF
+    c_exactargs("form_opts_off", items, 2);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = form_opts_off(form, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("form_opts_off");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_form_opts)
+{
+    dXSARGS;
+#ifdef C_FORM_OPTS
+    c_exactargs("form_opts", items, 1);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int ret = form_opts(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("form_opts");
+    XSRETURN(0);
+#endif
+}
+
+
+/* form_page */
+
+XS(XS_Curses_set_current_field)
+{
+    dXSARGS;
+#ifdef C_SET_CURRENT_FIELD
+    c_exactargs("set_current_field", items, 2);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    FIELD * field   = c_sv2field(ST(1), 1);
+    int ret = set_current_field(form, field);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_current_field");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_current_field)
+{
+    dXSARGS;
+#ifdef C_CURRENT_FIELD
+    c_exactargs("current_field", items, 1);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    FIELD * ret = current_field(form);
+    
+    ST(0) = sv_newmortal();
+    c_field2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("current_field");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_set_form_page)
+{
+    dXSARGS;
+#ifdef C_SET_FORM_PAGE
+    c_exactargs("set_form_page", items, 2);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int n   = (int)SvIV(ST(1));
+    int ret = set_form_page(form, n);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_form_page");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_form_page)
+{
+    dXSARGS;
+#ifdef C_FORM_PAGE
+    c_exactargs("form_page", items, 1);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int ret = form_page(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("form_page");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_field_index)
+{
+    dXSARGS;
+#ifdef C_FIELD_INDEX
+    c_exactargs("field_index", items, 1);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int ret = field_index(field);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("field_index");
+    XSRETURN(0);
+#endif
+}
+
+
+/* form_post */
+
+XS(XS_Curses_post_form)
+{
+    dXSARGS;
+#ifdef C_POST_FORM
+    c_exactargs("post_form", items, 1);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int ret = post_form(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("post_form");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_unpost_form)
+{
+    dXSARGS;
+#ifdef C_UNPOST_FORM
+    c_exactargs("unpost_form", items, 1);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int ret = unpost_form(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("unpost_form");
+    XSRETURN(0);
+#endif
+}
+
+
+/* form_userptr */
+
+XS(XS_Curses_set_form_userptr)
+{
+    dXSARGS;
+#ifdef C_SET_FORM_USERPTR
+    c_exactargs("set_form_userptr", items, 2);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    char *  userptr = (char *)SvPV_nolen(ST(1));
+    int ret = set_form_userptr(form, userptr);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_form_userptr");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_form_userptr)
+{
+    dXSARGS;
+#ifdef C_FORM_USERPTR
+    c_exactargs("form_userptr", items, 1);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    char *  ret = form_userptr(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("form_userptr");
+    XSRETURN(0);
+#endif
+}
+
+
+/* form_win */
+
+XS(XS_Curses_set_form_win)
+{
+    dXSARGS;
+#ifdef C_SET_FORM_WIN
+    c_exactargs("set_form_win", items, 2);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    WINDOW *win = c_sv2window(ST(1), 1);
+    int ret = set_form_win(form, win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_form_win");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_form_win)
+{
+    dXSARGS;
+#ifdef C_FORM_WIN
+    c_exactargs("form_win", items, 1);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    WINDOW *    ret = form_win(form);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("form_win");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_set_form_sub)
+{
+    dXSARGS;
+#ifdef C_SET_FORM_SUB
+    c_exactargs("set_form_sub", items, 2);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    WINDOW *sub = c_sv2window(ST(1), 1);
+    int ret = set_form_sub(form, sub);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_form_sub");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_form_sub)
+{
+    dXSARGS;
+#ifdef C_FORM_SUB
+    c_exactargs("form_sub", items, 1);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    WINDOW *    ret = form_sub(form);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("form_sub");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_scale_form)
+{
+    dXSARGS;
+#ifdef C_SCALE_FORM
+    c_exactargs("scale_form", items, 3);
+    {
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int rows    = 0;
+    int cols    = 0;
+    int ret = scale_form(form, &rows, &cols);
+    
+    sv_setiv(ST(1), (IV)rows);;
+    sv_setiv(ST(2), (IV)cols);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("scale_form");
+    XSRETURN(0);
+#endif
+}
+
+
+/* form_field_attributes */
+
+XS(XS_Curses_set_field_fore)
+{
+    dXSARGS;
+#ifdef C_SET_FIELD_FORE
+    c_exactargs("set_field_fore", items, 2);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    chtype  attr    = c_sv2chtype(ST(1));
+    int ret = set_field_fore(field, attr);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_field_fore");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_field_fore)
+{
+    dXSARGS;
+#ifdef C_FIELD_FORE
+    c_exactargs("field_fore", items, 1);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    chtype  ret = field_fore(field);
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("field_fore");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_set_field_back)
+{
+    dXSARGS;
+#ifdef C_SET_FIELD_BACK
+    c_exactargs("set_field_back", items, 2);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    chtype  attr    = c_sv2chtype(ST(1));
+    int ret = set_field_back(field, attr);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_field_back");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_field_back)
+{
+    dXSARGS;
+#ifdef C_FIELD_BACK
+    c_exactargs("field_back", items, 1);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    chtype  ret = field_back(field);
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("field_back");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_set_field_pad)
+{
+    dXSARGS;
+#ifdef C_SET_FIELD_PAD
+    c_exactargs("set_field_pad", items, 2);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int pad = (int)SvIV(ST(1));
+    int ret = set_field_pad(field, pad);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_field_pad");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_field_pad)
+{
+    dXSARGS;
+#ifdef C_FIELD_PAD
+    c_exactargs("field_pad", items, 1);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    chtype  ret = field_pad(field);
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("field_pad");
+    XSRETURN(0);
+#endif
+}
+
+
+/* form_field_buffer */
+
+XS(XS_Curses_set_field_buffer)
+{
+    dXSARGS;
+#ifdef C_SET_FIELD_BUFFER
+    c_exactargs("set_field_buffer", items, 3);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int buf = (int)SvIV(ST(1));
+    char *  value   = (char *)SvPV_nolen(ST(2));
+    int ret = set_field_buffer(field, buf, value);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_field_buffer");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_field_buffer)
+{
+    dXSARGS;
+#ifdef C_FIELD_BUFFER
+    c_exactargs("field_buffer", items, 2);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int buffer  = (int)SvIV(ST(1));
+    char *  ret = field_buffer(field, buffer);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("field_buffer");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_set_field_status)
+{
+    dXSARGS;
+#ifdef C_SET_FIELD_STATUS
+    c_exactargs("set_field_status", items, 2);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    bool    status  = (int)SvIV(ST(1));
+    int ret = set_field_status(field, status);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_field_status");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_field_status)
+{
+    dXSARGS;
+#ifdef C_FIELD_STATUS
+    c_exactargs("field_status", items, 1);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    bool    ret = field_status(field);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("field_status");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_set_max_field)
+{
+    dXSARGS;
+#ifdef C_SET_MAX_FIELD
+    c_exactargs("set_max_field", items, 2);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int max = (int)SvIV(ST(1));
+    int ret = set_max_field(field, max);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_max_field");
+    XSRETURN(0);
+#endif
+}
+
+
+/* form_field_info */
+
+XS(XS_Curses_field_info)
+{
+    dXSARGS;
+#ifdef C_FIELD_INFO
+    c_exactargs("field_info", items, 7);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int rows    = 0;
+    int cols    = 0;
+    int frow    = 0;
+    int fcol    = 0;
+    int nrow    = 0;
+    int nbuf    = 0;
+    int ret = field_info(field, &rows, &cols, &frow, &fcol, &nrow, &nbuf);
+    
+    sv_setiv(ST(1), (IV)rows);;
+    sv_setiv(ST(2), (IV)cols);;
+    sv_setiv(ST(3), (IV)frow);;
+    sv_setiv(ST(4), (IV)fcol);;
+    sv_setiv(ST(5), (IV)nrow);;
+    sv_setiv(ST(6), (IV)nbuf);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("field_info");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_dynamic_field_info)
+{
+    dXSARGS;
+#ifdef C_DYNAMIC_FIELD_INFO
+    c_exactargs("dynamic_field_info", items, 4);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int rows    = 0;
+    int cols    = 0;
+    int max = 0;
+    int ret = dynamic_field_info(field, &rows, &cols, &max);
+    
+    sv_setiv(ST(1), (IV)rows);;
+    sv_setiv(ST(2), (IV)cols);;
+    sv_setiv(ST(3), (IV)max);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("dynamic_field_info");
+    XSRETURN(0);
+#endif
+}
+
+
+/* form_field_just */
+
+XS(XS_Curses_set_field_just)
+{
+    dXSARGS;
+#ifdef C_SET_FIELD_JUST
+    c_exactargs("set_field_just", items, 2);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int justif  = (int)SvIV(ST(1));
+    int ret = set_field_just(field, justif);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_field_just");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_field_just)
+{
+    dXSARGS;
+#ifdef C_FIELD_JUST
+    c_exactargs("field_just", items, 1);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int ret = field_just(field);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("field_just");
+    XSRETURN(0);
+#endif
+}
+
+
+/* form_field_new */
+
+XS(XS_Curses_new_field)
+{
+    dXSARGS;
+#ifdef C_NEW_FIELD
+    c_exactargs("new_field", items, 6);
+    {
+        int const height    = (int)SvIV(ST(0));
+        int const width     = (int)SvIV(ST(1));
+        int const toprow    = (int)SvIV(ST(2));
+        int const leftcol   = (int)SvIV(ST(3));
+        int const offscreen = (int)SvIV(ST(4));
+        int const nbuffers  = (int)SvIV(ST(5));
+        FIELD * ret = new_field(height, width, toprow, leftcol, offscreen, nbuffers);
+        ST(0) = sv_newmortal();
+        c_field2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("new_field");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_dup_field)
+{
+    dXSARGS;
+#ifdef C_DUP_FIELD
+    c_exactargs("dup_field", items, 3);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int toprow  = (int)SvIV(ST(1));
+    int leftcol = (int)SvIV(ST(2));
+    FIELD * ret = dup_field(field, toprow, leftcol);
+    
+    ST(0) = sv_newmortal();
+    c_field2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("dup_field");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_link_field)
+{
+    dXSARGS;
+#ifdef C_LINK_FIELD
+    c_exactargs("link_field", items, 3);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int toprow  = (int)SvIV(ST(1));
+    int leftcol = (int)SvIV(ST(2));
+    FIELD * ret = link_field(field, toprow, leftcol);
+    
+    ST(0) = sv_newmortal();
+    c_field2sv(ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("link_field");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_free_field)
+{
+    dXSARGS;
+#ifdef C_FREE_FIELD
+    c_exactargs("free_field", items, 1);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int ret = free_field(field);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("free_field");
+    XSRETURN(0);
+#endif
+}
+
+
+/* form_field_opts */
+
+XS(XS_Curses_set_field_opts)
+{
+    dXSARGS;
+#ifdef C_SET_FIELD_OPTS
+    c_exactargs("set_field_opts", items, 2);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = set_field_opts(field, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_field_opts");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_field_opts_on)
+{
+    dXSARGS;
+#ifdef C_FIELD_OPTS_ON
+    c_exactargs("field_opts_on", items, 2);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = field_opts_on(field, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("field_opts_on");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_field_opts_off)
+{
+    dXSARGS;
+#ifdef C_FIELD_OPTS_OFF
+    c_exactargs("field_opts_off", items, 2);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = field_opts_off(field, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("field_opts_off");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_field_opts)
+{
+    dXSARGS;
+#ifdef C_FIELD_OPTS
+    c_exactargs("field_opts", items, 1);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int ret = field_opts(field);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("field_opts");
+    XSRETURN(0);
+#endif
+}
+
+
+/* form_field_userptr */
+
+XS(XS_Curses_set_field_userptr)
+{
+    dXSARGS;
+#ifdef C_SET_FIELD_USERPTR
+    c_exactargs("set_field_userptr", items, 2);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    char *  userptr = (char *)SvPV_nolen(ST(1));
+    int ret = set_field_userptr(field, userptr);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("set_field_userptr");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_field_userptr)
+{
+    dXSARGS;
+#ifdef C_FIELD_USERPTR
+    c_exactargs("field_userptr", items, 1);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    char *  ret = field_userptr(field);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("field_userptr");
+    XSRETURN(0);
+#endif
+}
+
+
+/* form_field_validation */
+
+XS(XS_Curses_field_arg)
+{
+    dXSARGS;
+#ifdef C_FIELD_ARG
+    c_exactargs("field_arg", items, 1);
+    {
+    FIELD * field   = c_sv2field(ST(0), 0);
+    char *  ret = field_arg(field);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("field_arg");
+    XSRETURN(0);
+#endif
+}
+
+
+/* ncurses form extension functions */
+
+XS(XS_Curses_form_request_name)
+{
+    dXSARGS;
+#ifdef C_FORM_REQUEST_NAME
+    c_exactargs("form_request_name", items, 1);
+    {
+    int request = (int)SvIV(ST(0));
+    char *  ret = (char *)form_request_name(request);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("form_request_name");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_form_request_by_name)
+{
+    dXSARGS;
+#ifdef C_FORM_REQUEST_BY_NAME
+    c_exactargs("form_request_by_name", items, 1);
+    {
+    char *  name    = (char *)SvPV_nolen(ST(0));
+    int ret = form_request_by_name(name);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
+    }
+    XSRETURN(1);
+#else
+    c_fun_not_there("form_request_by_name");
+    XSRETURN(0);
+#endif
+}
+
@@ -0,0 +1,212 @@
+/* This is an inclusion for Curses.c */
+
+/* Combined Normal/Wide-Character Functions */
+
+/* April 2014, Edgar Fuß, Mathematisches Institut der Universität Bonn,
+   <ef@math.uni-bonn.de>
+*/
+
+
+
+XS(XS_CURSES_getchar) {
+    dXSARGS;
+    c_countargs("getchar", items, 0);
+
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    if (c_x)
+        if (c_domove(win, ST(c_x-1), ST(c_x)) == ERR)
+            XSRETURN_UNDEF;
+#ifdef C_GET_WCH
+    wint_t wch;
+    int ret = wget_wch(win, &wch);
+    if (ret == OK) {
+        ST(0) = sv_newmortal();
+        c_wchar2sv(ST(0), wch);
+        XSRETURN(1);
+    } else if (ret == KEY_CODE_YES) {
+        XST_mUNDEF(0);
+        ST(1) = sv_newmortal();
+        sv_setiv(ST(1), (IV)wch);
+        XSRETURN(2);
+    } else {
+        XSRETURN_UNDEF;
+    }
+#else
+    int key = wgetch(win);
+    if (key == ERR) {
+        XSRETURN_UNDEF;
+    } else if (key < KEY_CODE_YES) {
+        ST(0) = sv_newmortal();
+        c_wchar2sv(ST(0), key);
+        XSRETURN(1);
+    } else {
+        XST_mUNDEF(0);
+        ST(1) = sv_newmortal();
+        sv_setiv(ST(1), (IV)key);
+        XSRETURN(2);
+    }
+#endif
+}
+
+XS(XS_CURSES_ungetchar) {
+    dXSARGS;
+    c_exactargs("ungetchar", items, 1);
+    wint_t wc = c_sv2wchar(ST(0));
+    if (wc == WEOF)
+        XSRETURN_NO;
+#ifdef C_UNGET_WCH
+    int ret;
+    ret = unget_wch(wc);
+    if (ret == OK)
+        XSRETURN_YES;
+    else
+        XSRETURN_NO;
+#else
+    if (wc > 0xff)
+        XSRETURN_NO;
+    else {
+        int ret;
+        ret = ungetch(wc);
+        if (ret == OK)
+            XSRETURN_YES;
+        else
+            XSRETURN_NO;
+    }
+#endif
+}
+
+XS(XS_CURSES_getstring) {
+    dXSARGS;
+    c_countargs("getstring", items, 0);
+
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    if (c_x)
+        if (c_domove(win, ST(c_x-1), ST(c_x)) == ERR)
+            XSRETURN_UNDEF;
+#ifdef C_GETN_WSTR
+    wchar_t buf[1000];
+    if (wgetn_wstr(win, (wint_t *)buf, (sizeof buf/sizeof *buf) - 1) == ERR)
+        XSRETURN_UNDEF;
+    ST(0) = sv_newmortal();
+    c_wstr2sv(ST(0), buf);
+    XSRETURN(1);
+#else
+    unsigned char buf[1000];
+    if (wgetnstr(win, (char *)buf, (sizeof buf/sizeof *buf) - 1) == ERR)
+        XSRETURN_UNDEF;
+    ST(0) = sv_newmortal();
+    c_bstr2sv(ST(0), buf);
+    XSRETURN(1);
+#endif
+}
+
+XS(XS_CURSES_addstring) {
+    dXSARGS;
+    c_countargs("addstring", items, 1);
+
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    if (c_x)
+        if (c_domove(win, ST(c_x-1), ST(c_x)) == ERR)
+            XSRETURN_NO;
+#ifdef C_ADDNWSTR
+    int ret;
+    size_t len;
+    wint_t *wstr = c_sv2wstr(ST(c_arg), &len);
+    if (wstr == NULL)
+        XSRETURN_NO;
+    ret = waddnwstr(win, wstr, len);
+    free(wstr);
+    if (ret == OK)
+        XSRETURN_YES;
+    else
+        XSRETURN_NO;
+#else
+    int ret;
+    size_t len;
+    int need_free;
+    unsigned char *bstr = c_sv2bstr(ST(c_arg), &len, &need_free);
+    if (bstr == NULL)
+        XSRETURN_NO;
+    ret = waddnstr(win, (char *)bstr, len);
+    if (need_free) free(bstr);
+    if (ret == OK)
+        XSRETURN_YES;
+    else
+        XSRETURN_NO;
+#endif
+}
+
+XS(XS_CURSES_insstring) {
+    dXSARGS;
+    c_countargs("insstring", items, 1);
+
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    if (c_x)
+        if (c_domove(win, ST(c_x-1), ST(c_x)) == ERR)
+            XSRETURN_NO;
+#ifdef C_INS_NWSTR
+    int ret;
+    size_t len;
+    wint_t *wstr = c_sv2wstr(ST(c_arg), &len);
+    if (wstr == NULL)
+        XSRETURN_NO;
+    ret = wins_nwstr(win, wstr, len);
+    free(wstr);
+    if (ret == OK)
+        XSRETURN_YES;
+    else
+        XSRETURN_NO;
+#else
+    int ret;
+    size_t len;
+    int need_free;
+    unsigned char *bstr = c_sv2bstr(ST(c_arg), &len, &need_free);
+    if (bstr == NULL)
+        XSRETURN_NO;
+    ret = winsnstr(win, (char *)bstr, len);
+    if (need_free) free(bstr);
+    if (ret == OK)
+        XSRETURN_YES;
+    else
+        XSRETURN_NO;
+#endif
+}
+
+XS(XS_CURSES_instring) {
+    int x, y;
+    dXSARGS;
+    c_countargs("instring", items, 0);
+
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    if (c_x)
+        if (c_domove(win, ST(c_x-1), ST(c_x)) == ERR)
+            XSRETURN_UNDEF;
+    getmaxyx(win, y, x); /* Macro: not &y, &x! */
+#ifdef C_INNWSTR
+    int ret;
+    wchar_t *buf = malloc((x + 1) * sizeof *buf);
+    if (buf == NULL) croak("insstring: malloc");
+    ret = winnwstr(win, buf, x);
+    if (ret == ERR) {
+        free(buf);
+        XSRETURN_UNDEF;
+    }
+    ST(0) = sv_newmortal();
+    c_wstr2sv(ST(0), buf);
+    free(buf);
+    XSRETURN(1);
+#else
+    int ret;
+    unsigned char *buf = malloc(x + 1);
+    if (buf == NULL) croak("insstring: malloc");
+    ret = winnstr(win, (char *)buf, x);
+    if (ret == ERR) {
+        free(buf);
+        XSRETURN_UNDEF;
+    }
+    ST(0) = sv_newmortal();
+    c_bstr2sv(ST(0), buf);
+    free(buf);
+    XSRETURN(1);
+#endif
+}
@@ -0,0 +1,52 @@
+/*=============================================================================
+                             CursesTyp.h
+===============================================================================
+  Define types that are missing from the Curses library, which other Curses
+  libraries define.  This way, we'll have a set of types that we can use
+  regardless of which Curses library we have.
+=============================================================================*/
+
+/* The C_xxx macros are defined by CursesDef.h, which was generated by
+   the build system based on its analysis of the Curses library on this
+   system.
+
+   C_xxx defined means the Curses library header files define type 'xxx'.
+*/
+
+#ifndef C_TYPATTR_T
+#define attr_t int
+#endif
+
+#if 0
+/* Disabled this in Curses.pm 1.21.  Why would we want 'bool' defined? */
+#ifndef C_TYPBOOL
+#define bool int
+#endif
+#endif
+
+#ifndef C_TYPCHTYPE
+#define chtype int
+#endif
+
+#ifndef C_TYPMEVENT
+#define MEVENT int
+#endif
+
+#ifndef C_TYPMMASK_T
+#define mmask_t int
+#endif
+
+#ifndef C_TYPSCREEN
+#define SCREEN int
+#endif
+
+
+
+/*
+**
+**  Copyright (c) 1994-2001  William Setzer
+**
+**  You may distribute under the terms of either the Artistic License
+**  or the GNU General Public License, as specified in the README file.
+*/
+
@@ -0,0 +1,270 @@
+/*  This file can be automatically generated; changes may be lost.
+**
+**
+**  CursesVar.c -- the variables
+**
+**  This is an inclusion for Curses.c
+**
+**  Copyright (c) 1994-2000  William Setzer
+**
+**  You may distribute under the terms of either the Artistic License
+**  or the GNU General Public License, as specified in the README file.
+*/
+
+XS(XS_Curses_LINES)
+{
+    dXSARGS;
+#ifdef C_LINES
+    c_exactargs("LINES", items, 0);
+    {
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)LINES);
+    }
+    XSRETURN(1);
+#else
+    c_var_not_there("LINES");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_COLS)
+{
+    dXSARGS;
+#ifdef C_COLS
+    c_exactargs("COLS", items, 0);
+    {
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)COLS);
+    }
+    XSRETURN(1);
+#else
+    c_var_not_there("COLS");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_stdscr)
+{
+    dXSARGS;
+#ifdef C_STDSCR
+    c_exactargs("stdscr", items, 0);
+    {
+	ST(0) = sv_newmortal();
+	c_window2sv(ST(0), stdscr);
+    }
+    XSRETURN(1);
+#else
+    c_var_not_there("stdscr");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_curscr)
+{
+    dXSARGS;
+#ifdef C_CURSCR
+    c_exactargs("curscr", items, 0);
+    {
+	ST(0) = sv_newmortal();
+	c_window2sv(ST(0), curscr);
+    }
+    XSRETURN(1);
+#else
+    c_var_not_there("curscr");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_COLORS)
+{
+    dXSARGS;
+#ifdef C_COLORS
+    c_exactargs("COLORS", items, 0);
+    {
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)COLORS);
+    }
+    XSRETURN(1);
+#else
+    c_var_not_there("COLORS");
+    XSRETURN(0);
+#endif
+}
+
+XS(XS_Curses_COLOR_PAIRS)
+{
+    dXSARGS;
+#ifdef C_COLOR_PAIRS
+    c_exactargs("COLOR_PAIRS", items, 0);
+    {
+	ST(0) = sv_newmortal();
+	sv_setiv(ST(0), (IV)COLOR_PAIRS);
+    }
+    XSRETURN(1);
+#else
+    c_var_not_there("COLOR_PAIRS");
+    XSRETURN(0);
+#endif
+}
+
+
+XS(XS_Curses_Vars_TIESCALAR)
+{
+    dXSARGS;
+    c_exactargs("TIESCALAR", items, 2);
+    {
+	char *	pack = (char *)SvPV_nolen(ST(0));
+	int	n    = (int)SvIV(ST(1));
+
+	ST(0) = sv_newmortal();
+	sv_setref_iv(ST(0), pack, n);
+    }
+    XSRETURN(1);
+}
+
+XS(XS_Curses_Vars_FETCH)
+{
+    dXSARGS;
+    {
+	int	num = (int)SvIV(SvRV((SV*)ST(0)));
+
+	ST(0) = sv_newmortal();
+	switch (num) {
+	case 1:
+#ifdef C_LINES
+	    sv_setiv(ST(0), (IV)LINES);
+#else
+	    c_var_not_there("LINES");
+#endif
+	    break;
+	case 2:
+#ifdef C_COLS
+	    sv_setiv(ST(0), (IV)COLS);
+#else
+	    c_var_not_there("COLS");
+#endif
+	    break;
+	case 3:
+#ifdef C_STDSCR
+	    c_window2sv(ST(0), stdscr);
+#else
+	    c_var_not_there("stdscr");
+#endif
+	    break;
+	case 4:
+#ifdef C_CURSCR
+	    c_window2sv(ST(0), curscr);
+#else
+	    c_var_not_there("curscr");
+#endif
+	    break;
+	case 5:
+#ifdef C_COLORS
+	    sv_setiv(ST(0), (IV)COLORS);
+#else
+	    c_var_not_there("COLORS");
+#endif
+	    break;
+	case 6:
+#ifdef C_COLOR_PAIRS
+	    sv_setiv(ST(0), (IV)COLOR_PAIRS);
+#else
+	    c_var_not_there("COLOR_PAIRS");
+#endif
+	    break;
+	default:
+	    croak("Curses::Vars::FETCH called with bad index");
+	    /* NOTREACHED */
+	}
+    }
+    XSRETURN(1);
+}
+
+XS(XS_Curses_Vars_STORE)
+{
+    dXSARGS;
+    {
+#ifdef ALLOW_VARS_STORE
+	int	num = (int)SvIV((SV*)SvRV(ST(0)));
+
+	switch (num) {
+	case 1:
+#ifdef C_LINES
+	    LINES = (int)SvIV(ST(1));
+#else
+	    c_var_not_there("LINES");
+#endif
+	    break;
+	case 2:
+#ifdef C_COLS
+	    COLS = (int)SvIV(ST(1));
+#else
+	    c_var_not_there("COLS");
+#endif
+	    break;
+	case 3:
+#ifdef C_STDSCR
+	    stdscr = c_sv2window(ST(1), -1);
+#else
+	    c_var_not_there("stdscr");
+#endif
+	    break;
+	case 4:
+#ifdef C_CURSCR
+	    curscr = c_sv2window(ST(1), -1);
+#else
+	    c_var_not_there("curscr");
+#endif
+	    break;
+	case 5:
+#ifdef C_COLORS
+	    COLORS = (int)SvIV(ST(1));
+#else
+	    c_var_not_there("COLORS");
+#endif
+	    break;
+	case 6:
+#ifdef C_COLOR_PAIRS
+	    COLOR_PAIRS = (int)SvIV(ST(1));
+#else
+	    c_var_not_there("COLOR_PAIRS");
+#endif
+	    break;
+	default:
+	    croak("Curses::Vars::STORE called with bad index");
+	    /* NOTREACHED */
+	}
+	ST(0) = &PL_sv_yes;
+#else
+    croak("Curses::Vars::STORE is not available in this version of "
+          "Curses.pm.  Setting of variables is not allowed in recent "
+          "Curses (C) libraries.");
+
+    /* In January 2010, we first saw a version of Ncurses that does not
+       allow setting of variables.  This has to do with making the library
+       re-entrant.  The variables do not exist, but code that refers to them
+       still works because the variable names are defined as macros that call
+       functions that retrieve the value.  For some of the variables, it
+       doesn't even make sense to set the variables, and we assume few programs
+       ever exploited this ability, so simply removed it by default for
+       everyone starting with the January 2010 release.
+    
+       If you have an old Ncurses library that allows setting of variables
+       and really want this function in Curses.pm, #define ALLOW_VARS_STORE
+       in your c-config.h.
+    */
+#endif
+    }
+    XSRETURN(1);
+}
+
+XS(XS_Curses_Vars_DESTROY)
+{
+    dXSARGS;
+    {
+	SV *	rv = ST(0);
+
+	ST(0) = &PL_sv_yes;
+    }
+    XSRETURN(1);
+}
@@ -0,0 +1,250 @@
+/* This is an inclusion for Curses.c */
+
+
+/* Combined Normal/Wide-Character helper functions */
+
+/* April 2014, Edgar Fuß, Mathematisches Institut der Universität Bonn,
+  <ef@math.uni-bonn.de> 
+*/
+
+#include <wchar.h>
+
+#if HAVE_PERL_UVCHR_TO_UTF8
+  #define UVCHR_TO_UTF8 uvchr_to_utf8
+#elif HAVE_PERL_UV_TO_UTF8
+  #define UVCHR_TO_UTF8 uv_to_utf8
+#else
+  #error CursesWide.c cannot be compiled on this system; no uv[chr]_to_utf8
+#endif
+
+
+
+static UV
+utf8_to_uvchr_buf_x(U8 *     s,
+                    U8 *     end,
+                    STRLEN * lenP) {
+
+#if HAVE_PERL_UTF8_TO_UVCHR_BUF
+    return utf8_to_uvchr_buf(s, end, lenP);
+#elif HAVE_PERL_UTF8_TO_UVCHR
+    return utf8_to_uvchr(s, lenP);
+#elif HAVE_PERL_UTF8_TO_UV
+    return utf8_to_uv(s, end - s, lenP, 0);
+#else
+    #error CursesWide.c cannot compile because \
+           there is no utf8_to_uvchr_buf, etc.
+#endif
+}
+    
+
+
+static void
+c_wchar2sv(SV *    const sv,
+           wchar_t const wc) {
+/*----------------------------------------------------------------------------
+  Set SV to a one-character (not -byte!) Perl string holding a given wide
+  character
+-----------------------------------------------------------------------------*/
+    if (wc <= 0xff) {
+        char s[] = { wc, 0 };
+        sv_setpv(sv, s);
+        SvPOK_on(sv);
+        SvUTF8_off(sv);
+    } else {
+        char s[UTF8_MAXBYTES + 1] = { 0 };
+        char *s_end = (char *)UVCHR_TO_UTF8((U8 *)s, wc);
+        *s_end = 0;
+        sv_setpv(sv, s);
+        SvPOK_on(sv);
+        SvUTF8_on(sv);
+    }
+}
+
+static void
+c_bstr2sv(SV *            const sv,
+          unsigned char * const bs) {
+/*----------------------------------------------------------------------------
+  Set SV to a Perl string holding a given byte string
+-----------------------------------------------------------------------------*/
+    SvPOK_on(sv);
+    sv_setpv(sv, (char *)bs);
+    SvUTF8_off(sv);
+}
+
+static void
+c_wstr2sv(SV *      const sv,
+          wchar_t * const ws) {
+/*----------------------------------------------------------------------------
+  Set SV to a Perl string holding a given wide string
+-----------------------------------------------------------------------------*/
+    wint_t *ws_p;
+    int need_utf8 = 0;
+    size_t ws_len = wcslen(ws);
+    
+    for (ws_p = ws; *ws_p; ws_p++) {
+        if (*ws_p > 0xff) {
+            need_utf8 = 1;
+            break;
+        }
+    }
+    SvPOK_on(sv);
+    if (need_utf8) {
+        U8 *u8, *u8_p;
+        u8 = (U8 *)sv_grow(sv, (ws_len + 1) * UTF8_MAXBYTES);
+        for (ws_p = ws, u8_p = u8; *ws_p; ws_p++)
+            u8_p = UVCHR_TO_UTF8(u8_p, *ws_p);
+        *u8_p = 0;
+        SvCUR_set(sv, u8_p - u8);
+        SvUTF8_on(sv);
+    } else {
+        U8 *u8, *u8_p;
+        u8 = (U8 *)sv_grow(sv, ws_len + 1);
+        for (ws_p = ws, u8_p = u8; *ws_p; ws_p++, u8_p++)
+            *u8_p = *ws_p;
+        *u8_p = 0;
+        SvCUR_set(sv, ws_len);
+        SvUTF8_off(sv);
+    }
+}
+
+static wint_t
+c_sv2wchar(SV * const sv) {
+/*----------------------------------------------------------------------------
+   Extract a wide character from a SV holding a one-character Perl string
+
+   Fails (returning WEOF) if SV doesn't hold a string or the string is not one
+   character long.
+-----------------------------------------------------------------------------*/
+    U8 *s;
+    STRLEN s_len;
+    if (!SvPOK(sv))
+        return WEOF;
+    s = (U8 *)SvPV(sv, s_len);
+    if (s_len == 0)
+        return WEOF;
+    if (SvUTF8(sv)) {
+        STRLEN len;
+        UV uv = utf8_to_uvchr_buf_x(s, s + s_len, &len);
+        if (len != s_len)
+            return WEOF;
+        return (wint_t) uv;
+    } else {
+        if (s_len != 1)
+            return WEOF;
+        return *s;
+    }
+}
+
+static unsigned char *
+c_sv2bstr(SV *     const sv,
+          size_t * const b_len,
+          int *    const need_free) {
+/*----------------------------------------------------------------------------
+  Extract a char (byte) string from a SV holding a Perl string
+
+  Fails (returning NULL) if SV doesn't hold a string or the string has
+  characters not fitting into a byte or doesn't UTF-8 decode
+
+  Set b_len to length of result.
+
+   Caller must free() result if we set need_free.
+-----------------------------------------------------------------------------*/
+    U8 *s, *s_p, *s_end;
+    STRLEN s_len;
+    unsigned char *bs, *bs_p;
+
+    if (!SvPOK(sv)) {
+        *need_free = 0;
+        return NULL;
+    }
+    s = (U8 *)SvPV(sv, s_len);
+    s_p = s;
+    s_end = s + s_len;
+    if (SvUTF8(sv)) {
+        bs = malloc(s_len + 1);
+            /* number of bytes is an upper bound on the number of characters */
+        if (bs == NULL) croak("c_sv2bstr: malloc");
+        bs_p = bs;
+        while (s_p < s_end) {
+            if (UTF8_IS_INVARIANT(*s_p)) {
+                *bs_p++ = *s_p++;
+            } else {
+                STRLEN len;
+                UV uv = utf8_to_uvchr_buf_x(s_p, s_end, &len);
+                if (uv > 0xff) {
+                    *need_free = 0;
+                    *b_len = 0;
+                    return NULL;
+                }
+                *bs_p++ = uv;
+                s_p += len;
+            }
+        }
+        if (s_p != s_end) {
+            *need_free = 0;
+            *b_len = 0;
+            return NULL;
+        }
+        *bs_p = 0;
+        *b_len = s_len;
+        *need_free = 1;
+        return bs;
+    } else {
+        *need_free = 0;
+        *b_len = s_len;
+        return (unsigned char *)s;
+    }
+
+}
+
+static wint_t *
+c_sv2wstr(SV *     const sv,
+          size_t * const w_len) {
+/*----------------------------------------------------------------------------
+   Extract a wide char string from a SV holding a Perl string.
+
+   Fails (returning NULL) if SV doesn't hold a string or doesn't UTF-8
+   decode.
+
+   set w_len s to length of result.
+
+   Caller must free() result
+-----------------------------------------------------------------------------*/
+    U8 *s, *s_p, *s_end;
+    STRLEN s_len;
+    wint_t *ws, *ws_p;
+
+    if (!SvPOK(sv)) return NULL;
+    s = (U8 *)SvPV(sv, s_len);
+    s_p = s;
+    s_end = s + s_len;
+    ws = malloc((s_len + 1) * sizeof(*ws));
+        /* number of bytes is an upper bound on the number of characters */
+    if (ws == NULL) croak("c_sv2wstr: malloc");
+    ws_p = ws;
+    if (SvUTF8(sv)) {
+        while (s_p < s_end) {
+            if (UTF8_IS_INVARIANT(*s_p)) {
+                *ws_p++ = *s_p++;
+            } else {
+                STRLEN len;
+                *ws_p++ = utf8_to_uvchr_buf_x(s_p, s_end, &len);
+                s_p += len;
+            }
+        }
+        if (s_p != s_end) {
+            free(ws);
+            *w_len = 0;
+            return NULL;
+        }
+    } else {
+        s_p = s;
+        while (s_p < s_end) {
+            *ws_p++ = *s_p++;
+        }
+    }
+    *ws_p = 0;
+    *w_len = s_len;
+    return ws;
+}
+
@@ -0,0 +1,284 @@
+The Curses Perl module was created by William Setzer (William_Setzer
+at ncsu.edu) in 1994.  William maintained it up until July 2001, when he
+stopped having time to do so.
+
+In September 2004, Bryan Henderson (bryanh@giraffe-data.com) took over
+maintainership of it, after confirming with William that he did not
+plan to continue.
+
+The module has always been distributed via CPAN.
+
+Curses itself is much older than the Perl implementation.  Curses was
+originally only a C programming library.
+
+New in 1.30 (Released April 19, 2014)
+
+  Fix build failure: Use older substitutes if Perl is too old to have
+  the 'utf8_to_uvchr_buf' function they use; don't include the wide character
+  functions if Perl is even too old to have the substitutes.  Broken in 1.29.
+
+  Fix "constant not provided by your vendor" message when you refer to a
+  function that does not exist in the Curses module.
+
+  Minor fixes to documentation of new wide character functions.
+
+  Fix warning about extra argument to c_setmevent .
+
+  Fix documentation for "not defined in your Curses library" errors.
+  (broken in 1.28).
+
+  Fix demo programs' recognition of "not defined in your Curses library"
+  errors (broken in 1.28).
+
+New in 1.29 (Released April 6, 2014)
+
+  Add an alternate set of functions (getchar, ungetchar, getstring,
+  instring, addstring, insstring) providing a more Perl-like interface,
+  converting from and to Perl strings (instead of passing data to the C
+  library verbatim) and using wide character functions if available in the
+  underlying curses library.
+
+  Written by Edgar Fu%81ß, Mathematisches Institut der Uni Bonn,
+  <ef@math.uni-bonn.de>
+
+New in 1.28 (Released January 27, 2010)
+
+  Disable Curses::Var::STORE.  It doesn't work (doesn't even compile) with
+  newer Ncurses (due to updates to make Ncurses reentrant).  One can
+  re-enable it by defining ALLOW_VARS_STORE in c-config.h.
+
+  Improve "not provided by your vendor" message.
+
+New in 1.27 (Released January 20, 2009)
+
+  Extraneous .i and .s files in 1.26 removed.  'make clean' cleans all
+  .i and .s too.
+
+  'gen' directory is replaced by gen.tar file, so CPAN doesn't index
+  the stuff in there.  That directory is stuff for developing the Curses
+  package, not stuff for users.
+
+New in 1.26 (Released January 3, 2009)
+
+  newterm() is available and putwin() and getwin() work in newer Perl (with
+  PerlIO).  We now use PerlIO_findFile().
+
+1.25 doesn't exist (The name got burned in a CPAN upload mistake).
+
+New in 1.24 (Released September 10, 2008)
+
+  Export KEY_RESIZE, KEY_EVENT.
+
+  For Netbsd, allow both Netbsd and BSD guesses via CURSES_LIBTYPE,
+  and default to Ncurses.  Used to guess only BSD.  From Ulrich Habel
+  rhaen@NetBSD.org .
+
+  Add guess capability for Dragonfly.  From Ulrich Habel
+  rhaen@NetBSD.org .
+
+New in 1.23 (Released March 9, 2008)
+
+  Fix crash of Makefile.PL on Windows.
+
+New in 1.22 (Released February 29, 2008)
+
+  Nothing.  Just a packaging fix.
+
+New in 1.21 (Released February 15, 2008)
+
+  Don't undefine 'bool' macro in c-darwin hints file.
+
+New in 1.20 (Released November 19, 2007)
+
+  Fix missing comment delimiter.
+
+New in 1.19 (Released November 18, 2007)
+
+  Make it work on 5.005 again, using ppport.h (Devel::PPPort).
+  From Slaven Rezic - slaven <at> rezic <dot> de .
+
+  Fix uninitialized value in Makefile.PL on a system without BSD Curses or
+  Ncurses in a common place.
+
+  Reverse change to chgat() in 1.16.  Make expected argument count 4.
+
+There was never a 1.18 release; problems with PAUSE prevent using that
+release number.
+
+New in 1.17 (Released October 14, 2007)
+
+  Fix bug - can't find c-config.h on a system with ncursesw.
+
+  Make cdemo work on Windows.
+
+  Don't undefine SP macro with Pdcurses.  (Otherwise it won't compile;
+  don't know why we used to undefine SP).
+
+  In Windows hints file, #include curses.h instead of pdcurses.h.  It
+  seems to be called curses.h these days.
+
+New in 1.16 (August 7, 2007)
+
+  Use Ncursesw (Ncurses with wide character functions) instead of
+  Ncurses if available.
+
+  Undefine "tab" macro, defined by Curses header file.  It interferes
+  with perl.h.
+
+  Fix demo.form to use L! instead of J in the pack template that generates
+  the new_form() argument.  Apparently, J is something from older Perl
+  and doesn't exist in current Perl.
+
+  Put some documentation of the library in comments in demo.form.
+
+  Use L! instead of I in the pack template in demo.menu.
+
+  Change SvPV(X,PL_na) to SvPV_nolen(X) to get with the times.
+
+  Change #!/usr/local/bin/perl to #! /usr/bin/perl .
+
+  Fix bug: chgat() requires an extra, meaningless, argument.  Fix changes
+  expected argument count from 4 to 3.
+
+New in 1.15 (October 8, 2006)
+
+  Add a simple load test 00-load.t.
+
+  Makefile.PL: use cdemo.obj instead of cdemo.o on Windows.
+
+  Makefile.PL: Guess ncurses/bsd based on what .h files exist.
+
+  Fix bug in Makefile.PL: doesn't use curses type in guess at c-config.h
+  (e.g. tries to use c-freebsd.h when it should use c-freebsd.bsd.h).
+
+  Change all sv_isa() to sv_derived_from() so you can use subclasses.
+  Thanks Leigh <leighbrown@hsbc.com>.
+
+  Rename default Darwin (Mac OS X) hints file (ca 2001) to c-darwin.old, and
+  the newer one ca 2004) to c-darwin.old so as to be the default.  We're
+  guessing that the newer one applies to more systems today.
+
+New in 1.14 (June 3, 2006)
+
+  Make demo.form work on 64 bit machine.
+
+  Add some narration to Makefile.PL to help with diagnosis.
+
+  Move undef of 'instr' from individual hint files to Curses.c and add
+  explanation.
+
+  Use perl -w instead of 'use warnings' in Makefile.PL so it works with
+  older Perl.
+
+New in 1.13 (October 10, 2005)
+
+  Fix so it builds on current Cygwin.
+
+  Some kind of build fix to get panels, forms, and menu functions to build.
+
+New in 1.12 (March 17, 2005)
+
+  Build bug fixed: panel, forms, menu libs not found in build.
+
+  Build bug fixed: Curses.pm treats version as number, so 1.10 == 1.1 .
+
+New in 1.11 (March 12, 2005)
+
+  Various cleanup and improved diagnostics in the build.
+
+New in 1.10 (March 11, 2005)
+
+  Build bug fixed: Makefile has undefined variable $libtyp.
+
+  Build bug fixed: Makefile computes wrong guess hint file name.
+
+New in 1.09 (March 6, 2005)
+
+  - Makefile.PL searches for curses header files instead of assuming
+    based on $OSNAME.
+
+  - Makefile.PL warns user to reconfigure environment when form.h is
+    in /usr/include rather than just add -I/usr/include to the compile
+    (this concerns the problem with the conflicting Perl form.h file).
+
+New in 1.08 (November 2004)
+
+  - perl.syms more verbose so you can diagnose failures.
+
+  - You can use environment variables instead of modifying Makefile.PL
+    to set your -I, -L, etc. options for the Curses libraries.
+
+  - c-linux.ncurses.h hints file includes ncurses.h, not curses.h.
+
+  - New c-darwin-thread-multi-2level.h hints file.
+
+New in 1.07 (September 2004)
+
+  - Call to Perl_sv_isa() changed to sv_isa() because the former doesn't
+    work on some systems (causes a build failure).
+
+New in 1.06 (July 2001)
+
+ o Now requires perl5.005 or better to run.  (You can probably run it
+   in perl5.002-perl5.004 by grabbing newCONSTSUB out of the IO
+   distribution on CPAN and editing all uses of "foreach my $var" in
+   my perl scripts.)
+
+ o Did lots of fiddling with the file generation in an effort to make
+   it more comprehensible.  In doing so, I moved around the way some
+   things were done and probably broke it on some systems with weird
+   compilers.  Please let me know.
+
+ o changed the "Curses->new()" function to be a bit less clever.
+
+ o Works with libmenu!  Many thanks to Yury Pshenichny <yura at zp.ua>
+   who did most of the actual work.
+
+   Update: Well, sort of works.  For some reason beyond my ken, it
+   doesn't work with Solaris (2.6) libmenu. (The items won't attach to
+   the menu.)  ncurses menu, both 1.9.9 and 5.2, seem to work fine.
+
+ o Works with libform too.  Ho hum.  ;)  This one does appear to
+   work with Solaris libform.
+
+ o Added the following ncurses extension functions:
+
+   use_default_colors()
+   assume_default_colors()
+   define_key()
+   keybound()
+   keyok()
+   resizeterm()
+
+   (Thanks to neild at misago.org, hans at kolej.mff.cuni.cz)
+
+ o Re-enabled the functions:
+
+   attr_get()
+   attr_off()
+   attr_on()
+   attr_set()
+
+ o Between the functions exposed and the functions listed in the
+   pod as not exposeded, those are all the ones I know about.
+   Got any more?  Let me know.
+
+ o Fixed 64 bit issue with getch() and possibly others, truncating
+   returns of `chtype' to 32 bits.  Note that this could possibly
+   break some OSes.  Please let me know.
+   (Thanks to Randall.G.Steiner at bankofamerica.com)
+
+ o Fixed bug where @ARGV was always being cleared, and so no arguments
+   ever got to MakeMaker.
+   (Thanks to bdlow at nortelnetworks.com)
+
+ o Added hints for Darwin/Mac OS X system.
+   (Thanks to sdietrich at emlab.com)
+
+ o Added note to NETBSD users at the bottom of this README.
+
+ o Added a security notice to the README and pod.
+   (Thanks to connor at ing.umu.se)
+
+ o Has anyone successfully used the mouse event stuff?
+
@@ -0,0 +1,280 @@
+This package requires at least perl5.005.  You're on your own before
+then.
+
+1) Make sure you've got the prerequisites
+
+1.1) Make sure perl has been built.  
+
+1.2) Make sure you have a Curses C library installed.  Either original 
+     BSD Curses or newer Ncurses will do.  Pdcurses (public domain Curses
+     code that works in DOS, Windows, and X11) almost works.  See
+     PDCURSES section below.
+
+2) Chdir into the Curses source directory (which you unpacked from the
+   .tgz file you downloaded from CPAN)
+
+3) Want to see if maybe the package can autoconfigure itself?  It's
+   pretty dumb about it, but give it a try and skip to (5).
+
+4) Configure the build for your system.
+
+4.1)
+
+   Look in the "hints" directory to see if any of the hint files are
+   appropriate to your machine's OS.  If so, symlink or copy it to the
+   file "c-config.h" in the current ("Curses") directory.  If not,
+   copy "hints/c-none.h" to "c-config.h" in the current directory.
+   Then edit "c-config.h" and follow the directions.  If you have to
+   "roll your own", be sure to save a copy.  A "make clean" will
+   delete "c-config.h".  If you "rolled your own", please send me a
+   copy so I can include it in future distributions (see
+   "hints/c-isc.h" for an example of a user-contributed "c-config.h").
+
+4.2)
+
+   Curses has an interface header file named form.h.  If on your system
+   this is in a system header file directory such as /usr/include, you
+   have a problem.  That's because Perl also has a file named form.h
+   in a directory that is searched before the system directories in the
+   compile of the Perl Curses module.
+
+   So you'll have to fix that.  It's better to have your Curses stuff
+   in its own directory.  /usr/include/ncurses is conventional.  Move
+   all your Curses header files (curses.h, ncurses.h, form.h, menu.h,
+   panel.h) into this directory.  If you use /usr/include/ncurses,
+   Makefile.PL will find them there.  Otherwise, set the _CFLAGS
+   environment variables below accordingly.
+
+   Alternatively, you can just edit c-config.h, after running
+   Makefile.PL.  Replace the line
+
+     #include <form.h>
+
+   with something like
+
+     #include "/usr/include/form.h"
+
+   explicitly specifying the Ncurses version of form.h.
+
+   You can ignore all this if you're not building forms capability
+   into the Perl Curses module (by specifying "FORMS" as an option to
+   Makefile.PL below).
+
+4.3)
+
+   Set environment variables telling the compiler and linker where your
+   Curses C libraries are:
+
+      CURSES_CFLAGS: -I and -D options needed at compile time for access to
+        the basic Curses library (libcurses).
+      CURSES_LDFLAGS: -L and -l options needed at link time for access to 
+        the basic Curses library (libcurses).  (this really
+        must be only -L and -l options; Makefile.PL parses it.  Furthermore,
+        there can't be any space between the -L or -l and its value).
+
+      CURSES_PANEL_CFLAGS
+      CURSES_PANEL_LDFLAGS
+      CURSES_MENU_CFLAGS
+      CURSES_MENU_LDFLAGS
+      CURSES_FORM_CFLAGS
+      CURSES_FORM_LDFLAGS
+
+      These are analogous, but for the panel, menu, and form specialty
+      Curses libraries, respectively.
+
+   You can set these in your shell and export them, e.g.
+
+      export CURSES_CFLAGS="-I/usr/include/ncurses"
+      export CURSES_LDFLAGS="-L/usr/lib/ncurses -lncurses"
+
+   Or you can set them right on the 'perl Makefile.PL' command.
+
+
+5) perl Makefile.PL [PANELS] [MENUS] [FORMS]  [options]
+
+   PANELS means to include Curses panel function.
+
+   MENUS means to include Curses menu functions.
+
+   FORMS means to include Curses form function.
+
+   For PANELS, MENUS, and FORMS, you must have the associated C library on
+   your system (libpanel, libmenu, libform).  Choosing one of these options
+   without having the library will prevent this package from compiling.
+
+   Currently, PANELS, MENUS, and FORMS don't work for the BSD 
+   hints files (c-*.bsd.h), because I'm not aware of any panel, menu,
+   or form libraries for BSD curses.
+
+   This package needs the perl header files.  If you've already
+   installed perl, the "Makefile.PL" will magically know where they
+   are.  If you haven't installed perl, you may need to tell the
+   "Makefile.PL" where the header files are.  You can do this with the
+   "PERL_SRC=<source directory>" option.
+
+     perl Makefile.PL PERL_SRC=/local/src/perl
+
+   The "Makefile.PL", as with just about every other perl module, uses
+   the "ExtUtils::MakeMaker" package to generate a make file (named
+   "Makefile").  I highly recommend reading the "ExtUtils::MakeMaker"
+   man page, as there are lots of neat options you can specify.
+
+   If Makefile.PL tells you that it can't do something (it prints out
+   "I'm sorry" and some more stuff), then you'll need to go back to
+   step (4) and try configuring by hand.
+
+6) make
+
+   `make' will first run a perl script called `test.syms' that investigates
+   what the Curses libraries are like on your system and records the
+   results in the file "CursesDef.h".
+
+   test.syms is very brittle -- it works via test compiles, and if any
+   number of things goes wrong with the test compile, it makes bad
+   assumptions, usually that you don't have a certain function in your
+   Curses library.  If test.syms tells you it can't find functions that
+   you think you have, run test.syms manually with the -v (verbose) option.
+   That will show you the error messages from the test compiles and you
+   can figure out what's going wrong and fix it.  Typically, you'll find
+   that you need to do better on your CURSES_* environment variables
+   (see above).
+
+   Alternatively, if you see that test.syms is picking the wrong
+   values, you can edit "CursesDef.h" by hand and follow the
+   directions.  If you have to "roll your own", be sure to save a
+   copy.  A "make clean" will delete "CursesDef.h".
+
+   `make' will then try to compile "Curses.c".  If you get any
+   undefined curses symbols, it means that your curses really doesn't
+   have those functions, and you should edit "CursesDef.h" and/or
+   "c-config.h" and change the #define to #undef for that function.
+
+   If you get other compile errors, it is probably because the curses
+   include file and the perl include files are conflicting.  You'll
+   have to figure out what's wrong and add proper C code to
+   "c-config.h".  See "hints/c-sunos.sysv.h" for an example of how to
+   do this.
+
+7) Test the distribution:
+
+   perl demo
+   perl gdc
+   perl demo2       [stuff that has a 50/50 chance of showing up right]
+   perl demo.panel  [if you enabled panel function]
+   perl demo.menu   [if you enabled menu function]
+   perl demo.form   [if you enabled form function]
+
+   "gdc" is a digital clock ported from the "ncurses" distribution.
+
+   As mentioned in the "README", the demo is not intended to be an
+   exhaustive test of all the possible Curses functions.  If it
+   doesn't do all the functions correctly, it may be a Curses bug or
+   it may be a problem with your system's "libcurses.a".  There's no
+   getting around the fact that you need to be conversant in how your
+   system's "libcurses.a" works to be able to use Curses most
+   effectively.
+
+   For "demo", you can try:
+
+   make cdemo
+
+   This will try to compile a pure-C version of the "demo".  If you
+   see the same errors in it that you see in "demo", it means there's
+   a bug in your libcurses.
+   
+8) Doing a :
+
+   make install
+
+   will install everything in the "standard" perl places, just like
+   stuff from the base perl distribution.
+
+9) Enjoy!
+
+   If your enjoyment is ruined (:-) because the module doesn't work
+   right, peruse the Curses pod document (located at the end of
+   "Curses.pm") for incompatibilities with other Perl programs.  Also
+   check the end of the "README" for problems that may exist for your
+   particular libcurses.a or operating system.
+
+
+HP-UX
+-----
+
+HP-UX has two Curses libraries.  According to HP:
+
+  Libraries libcur_colr.a and libcur_colr.sl, and commands
+  captoinfo_colr, infocmp_colr, tput_colr, and tic_colr are
+  part of HP-UX Color-Curses package used for color-management.
+
+And there is apparently also a library with the standard names.
+The Curses Perl module builds using the standard library by default.
+If you want to use the "color" versions, set the CURSES_CFLAGS and
+CURSES_LDFLAGS environment variables accordingly.
+
+HP recommends using the HP ANSI C compiler for everything but
+compiling the kernel, but the one for compling the kernel is the
+default.  (Seems ridiculous, but an HP user said so).  I don't know
+what difference it makes for the Perl Curses module, but if you
+want to use the ANSI compiler, add this to Makefile.PL's arguments:
+
+  CC=/opt/ansic/bin/cc
+
+
+PDCURSES
+--------
+
+Pdcurses is a public domain Curses implementation that works on DOS,
+OS/2, Win32, and X11.  http://pdcurses.sourceforge.net .
+
+Dave C reported success using Perl Curses with Pdcurses on Windows
+in September 2007.  He gave these notes:
+
+  Environment:
+    Perl Version 5.8.1 built for MSWin32-x86-multi-thread
+    MSVS 2003 Visual C++ 7
+    Windows XP
+    Perl module Curses-1.16
+    Pdcurses 3.3
+
+  Instructions:
+
+  - Set environment variables (for Perl Curses Makefile.PL):
+
+      CURSES_CFLAGS='-Ic:\dev\pdc33'
+      CURSES_LDFLAGS='-Lc:\dev\pdc33 pdcurses.lib'
+    
+  -  Build and Test
+
+       > Makefile.PL
+       > nmake test
+
+       ignore MOUSE_MOVED redefined warning
+       MOUSE_MOVED is never used in Curses 1.16
+
+  - Install:
+
+       > nmake install
+
+
+  - Test:
+
+       demo, demo2, demo.panel scripts successfully run
+
+       > nmake cdemo
+       > cdemo
+
+
+Alexandr Ciornii on September 22, 2006, reported that he had some success
+using Perl Curses with Pdcurses, with these notes:
+
+    I've encountered several problems with it:
+    
+    1. 'pdcurses.h' does not exist; only 'curses.h'.  Renamed it.
+    2. 'curses.h' also defines chtype and attr_t.  Commented out there.
+    3. 'curses.h' also defines SCREEN.  Commented out in 'CursesTyp.h'.
+    4. `perl demo` fails
+    
+        Curses function 'TIESCALAR' called with too few arguments at
+        C:\cpan\Curses-1.14\blib\lib/Curses.pm line 82.
+        Compilation failed in require at demo line 11.
@@ -0,0 +1,82 @@
+These are notes for the maintainer.
+
+Steps to release:
+
+  - Test the build:
+
+    make realclean
+    Set up environment variables, c-config.h if required.
+    perl Makefile.PL PANELS MENUS FORMS
+    make
+    perl -Mblib -MCurses -e1
+
+  - make realclean
+
+  - Update HISTORY file with description of new stuff and release date.
+
+  - Update version number in Curses.pm (search for VERSION).
+
+  - Make a tarball with something like this:
+
+    tar --file=/tmp/Curses-1.07.tgz --gzip --create Curses-1.07
+
+  - Upload via pause.perl.org.  Use "upload a file to CPAN" link.
+    You have to login to make that link appear.
+
+    It goes into CPAN in the directory belonging to the user who
+    uploaded it.  PAUSE gives you various options for uploading, tells
+    you how to follow the progress of the uploading and indexing, and
+    sends you emails about it.
+
+  - PAUSE will automatically extract the README file from the tarball
+    and install it as e.g. Curses-1.07.readme
+
+  - PAUSE will open the tarball automatically and index the packages it finds
+    in there by name (Curses::Window, Curses::Screen, etc.).
+
+
+For Bryan's Giraffe test system:
+
+  export CURSES_LDFLAGS="-L/usr/link/ncurses -lncurses -ldl"
+  export CURSES_CFLAGS="-I/usr/include/ncurses"
+
+For Bryan's Rhino test system:
+
+  Copy hints/c-linux.ncurses.h as c-config.h and edit it
+  to say #include "/usr/include/form.h"
+
+
+GEN
+---
+
+The package is designed to have all the distributed code files
+(Curses.pm, CursesFun.c, etc.) generated by the programs in gen.tar .
+This is supposed to handle the myriad Ncurses functions with less
+tedium than manually editing the files.
+
+However, Bryan doesn't know how the Gen stuff works, so he has been
+making the small updates necessary directly to the distributed files.
+But the changes are modest, so it should be possible some day to
+generate new files, diff to see what changed, and put those changes
+into the Gen programs.
+
+Originally, what is in gen.tar was a directory name 'gen' in the Curses
+package on CPAN, and CPAN unfortunately indexes the Perl modules in there as
+public modules.  And because make.Curses.pm contains the perldoc stuff for
+Curses.pm, people have even been mislead into using that unmaintained file
+for documentation of the functions in Curses.pm.
+
+Since I don't know how to stop CPAN from doing that, I solved that problem
+by tarring up the directory.
+
+
+ppport.h
+--------
+
+You generate this by running the function Devel::PPPort::WriteFile().
+
+There shouldn't be any need to generate a new one unless there are
+updates to the Devel::PPPort package.
+
+A comment in ppport.h says it was generated by Perl 5.006002.  That's
+a lie.
@@ -0,0 +1,56 @@
+Artistic
+Copying
+Curses.c
+Curses.pm
+CursesBoot.c
+CursesCon.c
+CursesFun.c
+CursesTyp.h
+CursesVar.c
+INSTALL
+MANIFEST
+Makefile.PL
+README
+cdemo.c
+demo
+demo.form
+demo.menu
+demo.panel
+demo2
+gdc
+hints/c-MSWin32.borland.h
+hints/c-MSWin32.visualc.h
+hints/c-aix.h
+hints/c-bsd386.h
+hints/c-bsdos.h
+hints/c-cygwin.h
+hints/c-darwin.h
+hints/c-dec_osf.h
+hints/c-dgux.h
+hints/c-dynixptx.h
+hints/c-freebsd.bsd.h
+hints/c-freebsd.ncurses.h
+hints/c-hpux.h
+hints/c-irix.bsd.h
+hints/c-irix.ncurses.h
+hints/c-isc.h
+hints/c-linux.bsd.h
+hints/c-linux.ncurses.h
+hints/c-netbsd.h
+hints/c-next.h
+hints/c-none.h
+hints/c-openbsd.h
+hints/c-os2.ncurses.h
+hints/c-sco.h
+hints/c-solaris.h
+hints/c-sunos.bsd.h
+hints/c-sunos.ncurses.h
+hints/c-sunos.sysv.h
+hints/c-svr4.h
+hints/c-vms.h
+list.syms
+ppport.h
+test.syms
+testint.c
+testsym.c
+testtyp.c
@@ -0,0 +1,657 @@
+#! /usr/bin/perl -w
+##
+##  Makefile.PL
+##
+##  Copyright (c) 1994-2000  William Setzer
+##
+##  You may distribute under the terms of either the Artistic License
+##  or the GNU General Public License, as specified in the README file.
+
+require 5.005;
+use strict;
+#use warnings;   Can't use; new since Perl 5.005; use perl -w instead
+use ExtUtils::MakeMaker;
+use English;
+use Config;
+
+#  Here are the arguments defined for this file:
+#
+#    PANELS   -- enable panel functions
+#    MENUS    -- enable menus functions
+#    FORMS    -- enable forms functions
+#    GEN      -- add generation function to Makefile (developers only!)
+#
+#  Ex:  "perl Makefile.PL PANELS MENUS GEN"
+
+#  Environment variables tell us how one accesses the Curses library
+#  on this system.
+#
+#    CURSES_LIBTYPE
+#                'bsd', 'ncurses', or 'ncursesw' on most systems.
+#                In some environments, there are other possibilities.
+#
+#    CURSES_CFLAGS
+#    CURSES_PANEL_CFLAGS
+#    CURSES_MENUS_CFLAGS
+#    CURSES_FORMS_CFLAGS
+#                contains any includes or defines (-I or -D) that are
+#                needed to compile libcurses applications
+#
+#    CURSES_LDFLAGS
+#    CURSES_PANEL_LDFLAGS
+#    CURSES_MENUS_LDFLAGS
+#    CURSES_FORMS_LDFLAGS
+#                contains any libraries or library paths (-l or -L) that are
+#                needed to compile libcurses applications.  This must be
+#                -l and -L options only -- we parse it.  Note that if you
+#                specify something that doesn't result in MakeMaker finding
+#                a library, your value just gets silently ignored -- it
+#                won't show up in the make file.
+
+
+#  If these environment variables aren't set, we try in a fairly
+#  stupid fashion to pick them for you, along with a "c-config.h" file.
+
+my $libType = $ENV{'CURSES_LIBTYPE'};
+
+my $inc = $ENV{'CURSES_CFLAGS'};
+my $libs = $ENV{'CURSES_LDFLAGS'};
+
+my $panel_inc = $ENV{'CURSES_PANEL_CFLAGS'} || '';
+my $panel_libs = $ENV{'CURSES_PANEL_LDFLAGS'} || '';
+
+my $menu_inc = $ENV{'CURSES_MENU_CFLAGS'} || '';
+my $menu_libs = $ENV{'CURSES_MENU_LDFLAGS'} || '';
+
+my $form_inc = $ENV{'CURSES_FORM_CFLAGS'} || '';
+my $form_libs = $ENV{'CURSES_FORM_LDFLAGS'} || '';
+
+#  If you want to see examples of what needs to go in the $inc and
+#  $libs variables, check out the `guess_cfg' tables of values below.
+#  In fact, one way to set the variables would be to add or modify an
+#  entry for your 'osname'.  If you're not sure what the osname is for
+#  your machine, you can use the following at your command line to
+#  print it out:
+#
+#    perl -MConfig -le 'print $^O'
+#
+#  Some lines have multiple versions (such as `freebsd' and `linux'),
+#  representing different versions of curses that an OS might have.
+#  You can pick the version you want by setting the `default' entry.
+
+#  Here are some notes provided by the hint providers for certain of the
+#  OSes.  You should scan them first to see if they apply to you.
+#
+#  Notes for FreeBSD ncurses:
+#    [Courtesy of "Andrew V. Stesin" <stesin@elvisti.kiev.ua>]
+#    FreeBSD-2.0.5 ncurses + mytinfo    NOTE! Straight curses works much
+#                                       better for me!
+#
+#  Notes for Solaris:
+#    Under 2.3, it was reported that to get the module to compile properly
+#    with gcc, you must add `-DSYSV=1' to $inc.  This will disable the
+#    redefinition of memcpy to bcopy that is present in /usr/include/curses.h.
+#    [Courtesy of Dave Blaszyk <dvb@ycc.Kodak.COM>]
+#
+#    $inc also contained "-I/usr/include", but this seems to cause a great
+#    deal of trouble for gcc under perl5.002, so I removed it by default.
+#    I have tested Curses-a9 with perl5.002 and gcc263 and Sun's unbundled
+#    cc on Solaris 2.4 with an empty $inc and had no problems, but your
+#    mileage may vary.
+#
+#    If you are having trouble compiling under Solaris, try various
+#    combinations of "-I/usr/include" and "-DSYSV=1" in $inc to see if
+#    it fixes things.
+
+##   OS            default guess for $inc      default guess for $libs
+#
+my $guess_cfg = {
+  'aix'       => [ ''                       , '-lcurses -ltermcap'        ],
+  'bsd386'    => [ ''                       , '-lcurses -ltermcap'        ],
+  'bsdos'     => [ ''                       , '-lcurses -ltermcap'        ],
+  'cygwin'    => [ '-I/usr/include/ncurses' , '-lncurses'                 ],
+  'darwin'    => [ ''                       , '-lcurses'                  ],
+  'dec_osf'   => [ ''                       , '-lcurses -ltermcap'        ],
+  'dgux'      => [ ''                       , '-lcurses -ltermcap'        ],
+  'dynixptx'  => [ ''                       , '-lcurses -lc'              ],
+  'freebsd'   => {
+    'bsd'     => [ ''                       , '-lcurses -ltermcap'        ],
+    'ncurses' => [ ''                       , '-lncurses'                 ],
+    'default' =>   'bsd'
+  },
+  'dragonfly' => {
+    'bsd'     => [ ''                       => '-lcurses -ltermcap'        ],
+    'ncurses' => [ ''                       => '-lncurses'                 ],
+    'default' =>   'bsd'
+  },
+
+  'hpux'      => [ ''                       , '-lcurses -ltermcap'        ],
+# See INSTALL file for information about a different Curses library on HPUX.
+  'irix'      => {
+    'bsd'     => [ ''                       , '-lcurses -ltermcap'        ],
+    'ncurses' => [ ''                       , '-lncurses'                 ],
+    'default' =>   'bsd'
+  },
+  'isc'       => [ ''                       , '-lcurses -ltermcap'        ],
+  'linux'     => {
+    'bsd'     => [ ''                       ,  '-lcurses -ltermcap'       ],
+    'ncurses' => [ '-I/usr/include/ncurses' ,  '-lncurses'                ],
+    'default' =>   'ncurses'
+  },
+  'netbsd'   => {
+    'bsd'     => [ ''                       => '-lcurses -ltermcap'        ],
+    'ncurses' => [ ''                       => '-lncurses'                 ],
+    'default' =>   'ncurses'
+  },
+  'next'      => [ ''                       , '-lcurses -ltermcap'        ],
+  'openbsd'   => [ ''                       , '-lcurses -ltermcap'        ],  
+  'os2'       => {
+    'bsd'     => [ ''                       , '-lcurses -ltermcap'        ],
+    'ncurses' => [ ''                       , '-lncurses'                 ],
+    'default' =>   'ncurses'
+  },
+  'sco'       => [ ''                       , '-lcurses -ltermcap'        ],
+  'solaris'   => [ ''                       , '-L/usr/ccs/lib -lcurses'   ],
+  'sunos'     => {
+    'bsd'     => [ ''                       , '-lcurses -ltermcap'        ],
+    'sysv'    => [ '-I/usr/5include'        , '-L/usr/5lib -lcurses'      ],
+    'ncurses' => [ ''                       , '-lncurses'                 ],
+    'default' =>   'sysv'
+  },
+  'VMS'       => [ ''                       , 'sys$library:vaxccurse.olb' ],
+  'svr4'      => [ ''                       , '-lcurses'                  ],
+  'MSWin32'   => {
+    'borland' => [ '-w- -Id:\bc5\include'   , '-Ld:\bc5\lib pdcurses.lib' ],
+    'visualc' => [ ''                       , 'pdcurses'                  ],
+    'default' =>   'visualc'
+  },
+  ''          =>   undef
+};
+
+###
+## You shouldn't need to change anything below
+#
+
+my $TRUE = 1; my $FALSE = 0;
+
+
+sub nCursesIsInstalled() {
+
+    if (-f('/usr/include/ncurses/ncurses.h')) {
+        return $TRUE;
+    } elsif (-f('/usr/include/ncurses.h')) {
+        return $TRUE;
+    } else {
+        return $FALSE;
+    }
+}
+
+
+sub bsdIsInstalled() {
+
+    if (-f('/usr/include/curses/curses.h')) {
+        return $TRUE;
+    } elsif (-f('/usr/include/curses.h')) {
+        return $TRUE;
+    } else {
+        return $FALSE;
+    }
+}
+
+
+
+sub chooseLibraryType($$) {
+    my ($typeList, $libtypR) = @_;
+#-----------------------------------------------------------------------------
+#  Assuming this is a platform on which there may be multiple versions of
+#  Curses, choose one.
+#
+#  Return the choice as $$libtypR.
+#
+#  We prefer Ncurses, so choose that if it appears to be installed.
+#  If it doesn't, but BSD appears to be installed, we choose that.  If
+#  we don't see either, we choose $libtypDefault.
+#-----------------------------------------------------------------------------
+    if (0) {
+    } elsif ($typeList->{'ncurses'} && nCursesIsInstalled()) {
+        $$libtypR = 'ncurses';
+    } elsif ($typeList->{'bsd'} && bsdIsInstalled()) {
+        $$libtypR = 'bsd';
+    } else {
+        $$libtypR = $typeList->{'default'};
+    }
+}
+
+
+
+sub guessAtCursesLocation($$$) {
+    my ($libtypR, $incR, $libsR) = @_;
+#-----------------------------------------------------------------------------
+#  Return as $$libtypR the type of Curses library we should use, e.g.
+#  'ncurses', 'ncursesw' or 'bsd'.  May be undefined if we don't think
+#  we have to choose between those on this system.
+#
+#  Return as $$incR the -I option we think is appropriate to get the
+#  Curses interface header files.
+#
+#  Return as $$libsR the -L and -l options we think are needed to link
+#  the main Curses library (doesn't cover panels/menus/forms).
+#-----------------------------------------------------------------------------
+    print qq{Making a guess for -I and -L/-l options...\n};
+
+    # We need to move away from the inflexible $guess_cfg thing.  For
+    # starters, we don't use it when the system looks like one with
+    # wide-character Ncurses.
+
+    if (-f('/usr/include/ncursesw/ncurses.h')) {
+        $$incR = '-I/usr/include/ncursesw';
+        $$libsR = '-lncursesw';
+        $$libtypR = 'ncursesw';
+    } else {
+        my $guess1 = $guess_cfg->{$OSNAME};
+        my $libtyp;
+            # typically 'bsd' or 'ncurses'.  Undefined if we think
+            # there's no choice of Curses version on this platform.
+
+        my $guess;
+        if (ref $guess1 eq 'HASH') {
+            # For this platform, we have a choice of Curses library.
+
+            chooseLibraryType($guess1, \$libtyp);
+            $guess = $guess1->{$libtyp};
+        } else {
+            $guess = $guess1;
+        }
+        if (not defined $guess) {
+            print STDERR <<"EOW";
+
+I'm sorry, but I could not make a good guess for the includes and
+libraries that are needed.  You will need to set the CURSES_
+environment variables as described in the INSTALL file.
+OSNAME=$OSNAME
+EOW
+            exit 1;
+        }
+        if (ref $guess ne 'ARRAY') {
+            die "FATAL: internal error: guess_cfg is bad";
+        }
+
+        if (!defined($libtyp)) {
+            if (0) {
+            } elsif (-f('/usr/include/ncurses/ncurses.h')) {
+                $inc = '-I/usr/include/ncurses';
+            } elsif (-f('/usr/include/curses/curses.h')) {
+                $inc = '-I/usr/include/curses';
+            } elsif (-f('/usr/include/ncurses.h')) {
+                $inc = '';
+            } elsif (-f('/usr/include/curses.h')) {
+                $inc = '';
+            } else {
+                $inc  = $guess->[0];
+            }
+        } else {
+            if ($libtyp eq 'ncurses') {
+                if (-f('/usr/include/ncurses/ncurses.h')) {
+                    $inc = '-I/usr/include/ncurses';
+                } elsif (-f('/usr/include/ncurses.h')) {
+                    $inc = '';
+                } else {
+                    $inc  = $guess->[0];
+                }
+            } else {
+                if (-f('/usr/include/curses/curses.h')) {
+                    $inc = '-I/usr/include/curses';
+                } elsif (-f('/usr/include/curses.h')) {
+                    $inc = '';
+                } else {
+                    $inc  = $guess->[0];
+                }
+            }
+        }
+        $libs = $guess->[1];
+
+        $$libtypR   = $libtyp;
+        $$incR      = $inc;
+        $$libsR     = $libs;
+    }
+    print("Guesses:\n");
+    print("  includes:    '$$incR'\n");
+    print("  libs:        '$$libsR'\n");
+    if (defined($$libtypR)) {
+        print("  Curses type: $$libtypR");
+    } else {
+        print("  Curses type: irrelevant");
+    }
+    print("\n");
+}
+
+
+
+sub defaultLibTypeForOs($) {
+    my ($osname) = @_;
+#-----------------------------------------------------------------------------
+#  Return the default library type for OS named '$osname'; if we don't think
+#  there is a choice of library type on this OS, return undef.
+#-----------------------------------------------------------------------------
+    my $libType;
+
+    my $guess  = $guess_cfg->{$OSNAME};
+
+    if (ref $guess eq 'HASH') {
+        # For this platform, we have a choice of Curses library.
+        
+        $libType = $guess->{'default'};
+    }
+    return $libType;
+}
+
+
+# A "library class" is a more abstract categorization than a "library type."
+# The difference between two library types is just compiler and linker
+# options to choose the right library, but different library classes
+# have bigger differences and can have different hints files.  The
+# library class is part of the hint file name.
+
+my %libClass = (
+                'bsd'      => 'bsd',
+                'ncurses'  => 'ncurses',
+                'ncursesw' => 'ncurses',
+                'sysv'     => 'sysv',
+                'visualc'  => 'visualc',
+                'borland'  => 'borland',
+);
+
+
+
+sub makeConfigH($) {
+    my ($libType) = @_;
+#-----------------------------------------------------------------------------
+#  $libType is the kind of Curses library we are using - e.g. 'bsd',
+#  'ncurses', or 'ncursesw'.  It may be undefined if there is no
+#  choice on this system.
+#-----------------------------------------------------------------------------
+    print qq{Making a guess for "c-config.h"...\n};
+
+    my $libClass;
+
+    if (defined($libType)) {
+        $libClass = $libClass{$libType};
+
+        if (!defined($libClass)) {
+            print STDERR ("Internal error: invalid library type '$libType' " .
+                          "in makeConfigH()\n");
+            exit 1;
+        }
+    }
+    my $hintsfile;
+    if (defined($libType) && -f("hints/c-$OSNAME.$libType.h")) {
+        $hintsfile = "hints/c-$OSNAME.$libType.h";
+    } elsif (defined($libClass) && -f("hints/c-$OSNAME.$libClass.h")) {
+        $hintsfile = "hints/c-$OSNAME.$libClass.h";
+    } else {
+        my $candidate = "hints/c-$OSNAME.h";
+        if (-f($candidate)) {
+            $hintsfile = $candidate;
+        } else {
+            print STDERR <<"EOW";
+
+I'm sorry, but I couldn't find a hints file that was configured for
+your OS (named $candidate).  You will need to create and configure a 
+"c-config.h" file for yourself.  Please see the "INSTALL" directions 
+for pointers on how to do this.
+EOW
+            exit 1;
+        }
+    }
+
+    print("Choosing hints file '$hintsfile'\n");
+
+    eval "require File::Copy;";
+    if (! $@) {
+        &File::Copy::copy($hintsfile, "c-config.h");
+    } else {
+        my $cp;
+
+        if    ($OSNAME eq 'MSWin32') { $cp = "perl -MExtUtils::Command -e cp" }
+        elsif ($OSNAME eq 'VMS')     { $cp = "copy/log"                       }
+        else                         { $cp = "cp"                             }
+
+        my $sys = "$cp $hintsfile c-config.h";
+        if ($sys =~ m!([^\\:\w/. -])!) {
+            print STDERR <<"EOW";
+
+I'm sorry.  I was going to try to create a "c-config.h" for you, but it
+looks like there are some non-standard characters in the exec string.
+I'm feeling rather paranoid, so I'll let you look at the line and do
+it by hand if it looks OK.  I wanted to execute a copy and thought I
+might be able to use:
+
+   $sys
+
+but it has the (possibly) naughty character '$1' in it.      '
+EOW
+            exit 1;
+        } else {
+            system($sys);
+        }
+    }
+}
+
+
+
+
+sub guessPanelMenuFormLibs($$$$$) {
+
+    my ($ncursesLibSearch, $libType, $panelLibsR, $menuLibsR, $formLibsR) = @_;
+
+    my ($panelLibGuess, $menuLibGuess, $formLibGuess);
+
+    if (defined($libType) && $libType eq "ncursesw") {
+        $panelLibGuess = -lpanelw;
+        $menuLibGuess  = -lmenuw;
+        $formLibGuess  = -lformw;
+    } else {
+        $panelLibGuess = -lpanel;
+        $menuLibGuess  = -lmenu;
+        $formLibGuess  = -lform;
+    }
+    $$panelLibsR = "$ncursesLibSearch $panelLibGuess";
+    $$menuLibsR  = "$ncursesLibSearch $menuLibGuess";
+    $$formLibsR  = "$ncursesLibSearch $formLibGuess";
+}
+
+
+
+my $gen;
+my $panels;
+my $menus;
+my $forms;
+
+my @argv;
+while (@ARGV) {
+    my $arg = shift;
+
+    if    ($arg eq 'GEN')    { $gen    = $arg   }
+    elsif ($arg eq 'PANELS') { $panels = $arg   }
+    elsif ($arg eq 'MENUS')  { $menus  = $arg   }
+    elsif ($arg eq 'FORMS')  { $forms  = $arg   }
+    else                     { push @argv, $arg }
+}
+@ARGV = @argv;   # pass non-Curses arguments to MakeMaker
+
+print "GEN    function:  ", ($gen    ? "enabled" : "not applicable"), "\n";
+print "PANELS functions: ", ($panels ? "enabled" : "not enabled"), "\n";
+print "MENUS  functions: ", ($menus  ? "enabled" : "not enabled"), "\n";
+print "FORMS  functions: ", ($forms  ? "enabled" : "not enabled"), "\n";
+print "\n";
+
+if (defined($inc) && defined($libs)) {
+    # We have the info we need
+    if (!defined($libType)) {
+        $libType = defaultLibTypeForOs($OSNAME);
+    }
+} elsif (defined($inc) || defined($libs)) {
+    die("You must specify both CURSES_LDFLAGS and CURSES_CFLAGS " .
+        "environment variables or neither.  ");
+} elsif (defined($libType)) {
+    die("If you specify CURSES_LIBTYPE, you must also specify " .
+        "CURSES_LDFLAGS and CURSES_CFLAGS");
+} else {
+    guessAtCursesLocation(\$libType, \$inc, \$libs);
+}
+
+if (not -e "c-config.h") {
+    makeConfigH($libType);
+}
+
+#  Major cheese alert.  Any -L for the curses library is probably
+#  also needed for the panels library.
+#
+
+my $ncursesLibSearch;
+
+$ncursesLibSearch = '';  # initial value
+
+while ($libs =~ m{(-L\S+)}g) {
+    $ncursesLibSearch .= $1 . ' ';
+}
+
+guessPanelMenuFormLibs($ncursesLibSearch, $libType,
+                       \my $panelGuess, \my $menuGuess, \my $formGuess);
+
+
+if ($panels and not $panel_libs) {
+    $panel_libs = $panelGuess;
+}
+
+if ($menus and not $menu_libs) {
+    $menu_libs = $menuGuess;
+}
+
+if ($forms and not $form_libs) {
+    $form_libs = $formGuess;
+}
+# Both Perl and Ncurses have a form.h.  We have to include the Perl
+# header files in our search path, but don't need form.h itself.
+# Because the Curses form library header directory comes before the
+# perl header directory in our search path, that isn't normally a
+# problem.  EXCEPT: when there is no specific Curses form library
+# directory, and the Curses form.h is instead in the general system
+# search path, e.g.  /usr/include/form.h.  The system directories come
+# after the Perl directory in the search.  There used to be a
+# workaround here where we would simply add /usr/include to the front
+# of the search path, but that is not only gross, but ineffective with
+# some compilers, which ignore a -I option that adds a directory that
+# is a system directory (e.g. gcc 3).
+
+# To deal with this, we make a rough check for the problem, and if it
+# appears to exist, we tell the user to fix it.
+
+if ($forms and $form_inc !~ m{-I} and -f('/usr/include/form.h')) {
+    print("WARNING: Your Curses form.h file appears to be in the default\n");
+    print("system search path, which will not work for us because of\n");
+    print("the conflicting Perl form.h file.  This means your 'make' will\n");
+    print("probably fail unless you fix this, as described in the INSTALL\n");
+    print("file.\n");
+}
+
+my $clean = 'CursesDef.h c-config.h cdemo testsym testint testtyp *.i *.s';
+my $realc = $gen
+    ? 'list.syms Curses.pm ' . 
+      'CursesFun.c CursesVar.c CursesCon.c CursesTyp.h CursesBoot.c'
+    : "";
+
+my $components =
+    ($panels ? " PANELS " : "") .
+    ($menus  ? " MENUS "  : "") .
+    ($forms  ? " FORMS "  : "");
+
+WriteMakefile(NAME         => 'Curses',
+              INC          => "$panel_inc $menu_inc $form_inc $inc",
+              LIBS         => [ "$panel_libs $menu_libs $form_libs $libs" ],
+              H            => [ 'CursesDef.h'                   ],
+              clean        => { FILES      => $clean              },
+              realclean    => { FILES      => $realc              },
+              dist         => { COMPRESS   => 'gzip -9f'          },
+              postamble    => { COMPONENTS => $components         },
+              VERSION_FROM => 'Curses.pm',
+);
+
+sub MY::postamble {
+
+    my ($this, %args) = @_;
+
+    my $echo = $OSNAME eq 'VMS' ? 'write sys$output' : 'echo';
+    my $objext = $OSNAME eq 'MSWin32' ? 'obj' : 'o';
+    my $mf   = <<EOM;
+CursesDef.h: c-config.h Makefile.PL list.syms
+	\$(PERL) test.syms $args{COMPONENTS}
+
+c-config.h:
+	@ $echo "You need to make a c-config.h.  See the INSTALL document.";
+	@ exit 1
+cdemo: cdemo.$objext c-config.h
+EOM
+
+    if ($OSNAME eq 'VMS') {
+        $mf .= <<EOM;
+	\$(CC) \$(INC) cdemo.c
+	\$(LD) cdemo\$(OBJ_EXT), \$(LDLOADLIBS), CURSES2.OPT/opt
+EOM
+    }
+    else {
+        $mf .= <<EOM;
+	\$(CC) \$(INC) -o cdemo cdemo.c \$(LDLOADLIBS)
+EOM
+    }
+
+    if ($gen) {
+        $mf .= <<EOM;
+
+Curses.c    :: \\
+  CursesWide.c \\
+  CursesFun.c \\
+  CursesFunWide.c \\
+  CursesVar.c \\
+  CursesCon.c \\
+  CursesTyp.h \\
+  CursesBoot.c
+	@\$(NOOP)
+
+config      :: \\
+  list.syms \\
+  Curses.pm \\
+  CursesFun.c \\
+  CursesFunWide.c \\
+  CursesVar.c \\
+  CursesCon.c \\
+  CursesTyp.h \\
+  CursesBoot.c
+
+list.syms    : gen/make.list.syms gen/list.fun gen/list.var gen/list.typ
+	\$(PERL) gen/make.list.syms
+
+Curses.pm    : gen/make.Curses.pm gen/list.fun gen/list.var gen/list.con
+	\$(PERL) gen/make.Curses.pm
+
+CursesFun.c  : gen/make.CursesFun.c gen/list.fun
+	\$(PERL) gen/make.CursesFun.c
+
+CursesVar.c  : gen/make.CursesVar.c gen/list.var
+	\$(PERL) gen/make.CursesVar.c
+
+CursesCon.c  : gen/make.CursesCon.c gen/list.con
+	\$(PERL) gen/make.CursesCon.c
+
+CursesTyp.h : gen/make.CursesTyp.h gen/list.typ
+	\$(PERL) gen/make.CursesTyp.h
+
+CursesBoot.c : gen/make.CursesBoot.c gen/list.fun gen/list.var gen/list.con
+	\$(PERL) gen/make.CursesBoot.c
+
+EOM
+    }
+
+    return $mf;
+}
+__END__
@@ -0,0 +1,131 @@
+                           The Curses Perl Module
+
+
+============================================================
+COPYRIGHT AND LICENSE INFORMATION IS AT THE END OF THIS FILE
+============================================================
+
+This is a dynamic loadable curses module for perl.  You can get this
+package at any CPAN archive.
+
+Please see the INSTALL document for how to install it on your system,
+the Curses pod (located at the end of "Curses.pm") for known
+incompatibilities with other Perl programs, and the end of this
+document for known compile or install problems.
+
+RECENT CHANGES
+--------------
+
+The change history is in the file HISTORY.
+ 
+
+BINARY DISTRIBUTIONS
+--------------------
+
+There is a binary package for Cygwin at
+
+  ftp://sunsite.dk/projects/cygwinports/release/perl/perl-Curses
+
+The maintainer of this CPAN source package doesn't know of any others,
+but if you do, let him know and he will add them here.
+
+
+DEMO PROGRAMS
+-------------
+
+The "demo" program is for demonstration purposes only.  If it
+references a function your version of curses doesn't have, wrap it in
+an "eval" and try again.  Same goes double for the "gdc" program.
+You can type "make cdemo" to make a C language version of the demo.
+If you get the same results via "demo" and "cdemo", but they don't
+look right, then it's a bug in your libcurses, not in Curses.
+
+
+MAINTENANCE
+-----------
+
+Bryan Henderson maintains the Perl Curses module.  Bryan doesn't actually
+know much about it, and is functioning mainly as a coordinator.  Go ahead
+and report bugs to and ask technical questions of Bryan, but don't hold
+your breath.  If you should have a fix or enhancement, though, Bryan will
+incorporate it into the package promptly.
+
+Email Bryan at bryanh@giraffe-data.com.  Do not use the CPAN bug
+database to report a bug.  It's more work for both parties and Bryan
+doesn't know a bug has been opened except when he occasionally goes to
+look.
+
+
+*** SECURITY NOTICE ***
+
+It has always been the case with the curses functions, but please note
+that the following functions:
+
+    getstr()   (and optional wgetstr(), mvgetstr(), and mvwgetstr())
+    inchstr()  (and optional winchstr(), mvinchstr(), and mvwinchstr())
+    instr()    (and optional winstr(), mvinstr(), and mvwinstr())
+
+are subject to buffer overflow attack.  This is because you pass in
+the buffer to be filled in, which has to be of finite length, but
+there is no way to stop a bad guy from typing.
+
+In order to avoid this problem, use the alternate functions:
+
+   getnstr()
+   inchnstr()
+   innstr()
+
+which take an extra "size of buffer" argument or the wide-character-aware
+getstring() and instring() versions.
+
+
+Known Problems
+--------------
+NCurses
+   getch() and getstr() don't work right under very old versions of
+   ncurses (around v1.8.5).
+
+   panel_hidden() test is reversed in v1.9.9g.
+
+   Actually, there are several problems in v1.9.9g.
+
+NETBSD
+
+   William reported as of 2001: I continue to get conflicting reports
+   about the correct number of arguments for longname() and
+   touchline(), controlled via the file `hints/c-netbsd.h'.  Before
+   compiling, you may want to look them up yourself, confirm them, and
+   then editing `hints/c-netbsd.h'.
+
+Solaris 2.6
+
+   The menu stuff doesn't appear to work.  I have no idea why.
+
+
+
+COPYRIGHT AND LICENSE INFORMATION
+---------------------------------
+
+	 Copyright (c) 1994-2000  William Setzer
+                   All rights reserved.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the same terms as perl, specifically:
+
+        a) the GNU General Public License as published by the Free
+        Software Foundation; either version 1, or (at your option) any
+        later version, or
+
+        b) the "Artistic License" which comes with this Kit.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    Artistic License for more details. 
+
+    You should have received a copy of the Artistic License with this
+    Kit, in the file named "Artistic".  If not, I'll be glad to provide one.
+
+    You should also have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software Foundation,
+    Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
@@ -0,0 +1,135 @@
+/*  cdemo.c
+**
+**  Copyright (c) 1994-2000  William Setzer
+**
+**  You may distribute under the terms of either the Artistic License
+**  or the GNU General Public License, as specified in the README file.
+*/
+
+#include "CursesDef.h"
+#include "c-config.h"
+#ifdef VMS
+#include <unistd.h>  /* not in perl.h ??? */
+#endif
+#ifdef WIN32
+#include <Windows.h>
+#endif
+
+static void
+sleepSeconds(unsigned int seconds) {
+
+#ifdef WIN32
+    Sleep(seconds * 1000);
+#else
+    sleep(seconds);
+#endif
+}
+
+
+
+int
+main(unsigned int  const argc,
+     const char ** const argv) {
+
+    WINDOW *b;
+    chtype ch;
+    char str[250];
+    int m, n;
+
+    initscr();
+    b = subwin(stdscr, 10, 20, 3, 3);
+
+    noecho();
+    cbreak();
+
+    move(0, 0);
+    addstr("ref b = <something C won't do>");
+    move(1, 1);
+    addstr("fooalpha");
+
+#ifdef C_ATTRON
+#  ifdef A_BOLD
+    attron(A_BOLD);
+#  endif
+#endif
+    move(2, 5);
+    addstr("bold  ");
+#ifdef C_ATTRON
+#  ifdef A_REVERSE
+    attron(A_REVERSE);
+#  endif
+#endif
+    addstr("bold+reverse");
+#ifdef C_ATTRSET
+#  ifdef A_NORMAL
+    attrset(A_NORMAL);
+#  endif
+#endif
+    addstr("  normal  (if your curses can do these modes)");
+
+    move(6, 1);
+    addstr("do12345678901234567890n't worry be happy");
+#ifdef C_BOX
+    box(b, '|', '-');
+#endif
+    wstandout(b);
+    move(2, 2);
+    waddstr(b, "ping");
+    wstandend(b);
+    move(4, 4);
+    waddstr(b, "pong");
+
+    wmove(b, 3, 3);
+    move(6, 3);
+    wdeleteln(b);
+    insertln();
+
+    move(4, 5);
+    wdelch(b);
+    move(7, 8);
+    insch('a');
+
+#ifdef C_KEYPAD
+    keypad(stdscr, 1);
+#endif
+    move(14, 0);
+    addstr("hit a key: ");
+    refresh();
+    ch = getch();
+    move(15, 0);
+    printw("you typed: >>%c<<", ch);
+    move(17, 0);
+    addstr("enter string: ");
+    refresh();
+    getstr(str);
+
+    move(18, 0);
+    printw("you typed: >>%s<<", str);
+    getyx(stdscr, m, n);
+    move(19, 4);
+    printw("y == %d (should be 18), x == %d", m, n);
+
+    ch = mvinch(19, 7);
+    move(20, 0);
+    printw("The character at (19,7) is an '%c' (should be an '=')", ch);
+
+    move(21, 0);
+    addstr("testing KEY_*.  Hit the up arrow on your keyboard: ");
+    refresh();
+    ch = getch();
+
+#ifdef KEY_UP
+    if (ch == KEY_UP) { mvaddstr(22, 0, "KEY_UP was pressed!");         }
+    else              { mvaddstr(22, 0, "Something else was pressed."); }
+#else
+    move(22, 0);
+    addstr("You don't seem to have the KEY_UP macro");
+#endif
+
+    move(LINES - 1, 0);
+    refresh();
+
+    sleepSeconds(5);
+
+    endwin();
+}
@@ -0,0 +1,79 @@
+#! /usr/bin/perl
+##
+##  demo -- do some curses stuff
+##
+##  Copyright (c) 1994-2000  William Setzer
+##
+##  You may distribute under the terms of either the Artistic License
+##  or the GNU General Public License, as specified in the README file.
+
+use ExtUtils::testlib;
+use Curses;
+
+initscr();
+$b = subwin(10, 20, 3, 3);
+
+noecho();
+cbreak();
+
+addstr(0, 0, "ref b = " . ref $b);
+addstr(1, 1, "fooalpha");
+
+eval { attron(A_BOLD) };
+addstr(2, 5, "bold  ");
+eval { attron(A_REVERSE) };
+addstr("bold+reverse");
+eval { attrset(A_NORMAL) };
+addstr("  normal  (if your curses has these modes)");
+
+addstr(6, 1, "do12345678901234567890n't worry be happy");
+eval { box($b, '|', '-') };
+
+standout($b);
+addstr($b, 2, 2, "ping");
+standend($b);
+addstr($b, 4, 4, "pong");
+
+move($b, 3, 3);
+move(6, 3);
+deleteln($b);
+insertln();
+
+delch($b, 4, 5);
+insch(7, 8, ord(a));
+
+eval { keypad(1) };
+addstr(14, 0, "hit a key: ");
+refresh();
+$ch = getch();
+
+addstr(15, 0, "you typed: >>");
+addch($ch);
+addstr("<< and perl thinks you typed: >>$ch<<");
+
+addstr(17, 0, "enter string: ");
+refresh();
+getstr($str);
+
+addstr(18, 0, "you typed: >>$str<<");
+getyx($m, $n);
+addstr(19, 4, "y == $m (should be 18), x == $n (should be "
+         . (15 + length $str) . ")");
+
+$ch = inch(19, 7);
+addstr(20, 0, "The character at (19,7) is an '$ch' (should be an '=')");
+
+addstr(21, 0, "testing KEY_*.  Hit the up arrow on your keyboard: ");
+refresh();
+$ch = getch();
+eval
+{ 
+    if ($ch == KEY_UP) { addstr(22, 0, "KEY_UP was pressed!") }
+    else               { addstr(22, 0, "Something else was pressed.") }
+    1;
+} || addstr(22, 0, "You don't seem to have the KEY_UP macro");
+
+move($LINES - 1, 0);
+refresh();
+sleep 2;
+endwin();
@@ -0,0 +1,199 @@
+#! /usr//bin/perl
+##
+
+use ExtUtils::testlib;
+use Curses;
+
+
+sub fatal {
+    clrtobot(0, 0);
+    addstr(0, 0, "@_\n");
+    refresh();
+    sleep 2;
+    exit 1;
+}
+
+
+
+sub driveForm($$) {
+    my ($fwin, $form) = @_;
+
+    while (1) {
+        my $ch = getch($fwin);
+        if ($ch == KEY_UP) {
+            form_driver($form, REQ_PREV_FIELD);
+        }  elsif ($ch == KEY_DOWN or $ch eq "\t" or
+                  $ch eq "\r" or $ch eq "\n") {
+            form_driver($form, REQ_NEXT_FIELD);
+        } elsif ($ch == KEY_LEFT) {
+            form_driver($form, REQ_LEFT_CHAR);
+        } elsif ($ch == KEY_RIGHT) {
+            form_driver($form, REQ_RIGHT_CHAR);
+        } elsif ($ch == KEY_NPAGE) {
+            form_driver($form, REQ_NEXT_PAGE);
+        } elsif ($ch == KEY_PPAGE) {
+            form_driver($form, REQ_PREV_PAGE);
+        }  elsif ($ch == KEY_DC or ord($ch) == 8 or ord($ch) == 127) {
+            form_driver($form, REQ_DEL_PREV);
+        } elsif ($ch == KEY_F(1)) {
+            last;
+        } elsif ($ch =~ /^\S$/) {
+            form_driver($form, ord($ch));
+        } else {
+            beep();
+        }
+    }
+}
+
+
+
+sub makeFields() {
+
+    my $flist = [
+                 [ 'L', 0,  0,  0,  8, "Form"        ],
+                 [ 'L', 0,  0,  2,  0, "First Name"  ],
+                 [ 'F', 1, 15,  2, 12, "F Name"      ],
+                 [ 'L', 0,  0,  3,  0, "Last Name"   ],
+                 [ 'F', 1, 15,  3, 12, "L Name"      ],
+                 [ 'L', 0,  0,  5,  8, "Form (pt 2)" ],
+                 [ 'L', 0,  0,  7,  0, "# Tuits"     ],
+                 [ 'F', 1,  5,  7, 12, "Tuits"       ],
+                 [ 'L', 0,  0,  8,  0, "# Bleems"    ],
+                 [ 'F', 1,  5,  8, 12, "Bleems"      ]
+                 ];
+
+    my @fl;
+
+    foreach my $F (@$flist) {
+        my $field;
+            # This is a Perl reference to a scalar number variable.  The
+            # number is the numerical equivalent (cast) of the C pointer to the
+            # executable-Curses FIELD object.  The reference is blessed into
+            # package "Curses::Field", but don't confuse it with a Perl
+            # object.
+
+        if ($F->[0] eq 'L') {
+            $field = new_field(1, length($F->[5]), $F->[3], $F->[4], 0, 0);
+            if ($field eq '') {
+                fatal("new_field $F->[5] failed");
+            }
+            set_field_buffer($field, 0, $F->[5]);
+            field_opts_off($field, O_ACTIVE);
+            field_opts_off($field, O_EDIT);
+        } elsif ($F->[0] eq 'F') {
+            $field = new_field($F->[1], $F->[2], $F->[3], $F->[4], 0, 0);
+            if ($field eq '') {
+                fatal("new_field $F->[5] failed");
+            }
+            if ($F->[5] eq "Tuits") {
+                set_field_buffer($field, 0, $F->[5]);
+            }
+            set_field_back($field, A_UNDERLINE);
+        }
+
+        push(@fl, $field);
+    }
+    return @fl;
+}
+
+
+
+sub makeForm(@) {
+    
+    my @fl = @_;
+
+    my @pack;
+    foreach $fieldR (@fl) {
+        push(@pack, $ {$fieldR});
+    }
+    push(@pack, 0);
+
+    # new_form()'s argument is a list of fields.  Its form is amazingly
+    # complex:
+
+    # The argument is a string whose ASCII encoding is an array of C
+    # pointers.  Each pointer is to a FIELD object of the
+    # executable-Curses library, except the last is NULL to mark the
+    # end of the list.  For example, assume there are two fields and
+    # the executable-Curses library represents them with FIELD objects
+    # whose addresses (pointers) are 0x11223344 and 0x0004080C.  The
+    # argument to Curses::new_form() is a 12 character string whose
+    # ASCII encoding is 0x112233440004080C00000000 .
+
+    # Maybe some day we can provide an alternative where there is an
+    # actual Perl field object class and the argument is a reference to
+    # a Perl list of them.
+
+    my $form = new_form(pack('L!*', @pack));
+    if ($form eq '') {
+        fatal("new_form failed");
+    }
+    return $form;
+}
+
+
+
+sub demo() {
+
+    noecho();
+
+    eval { new_form() };
+    if ($@ =~ m{not defined in your Curses library}) {
+        print STDERR "Curses was not compiled with form function.\n";
+        exit 1;
+    }
+
+    my @fl = makeFields();
+
+    my $form = makeForm(@fl);
+
+    my $rows;
+    my $cols;
+
+    scale_form($form, $rows, $cols);
+
+    my $fwin = newwin($rows + 2, $cols + 4, 4, 0);
+    my $fsub = derwin($fwin, $rows, $cols, 1, 2);
+
+    set_form_win($form, $fwin);
+    set_form_sub($form, $fsub);
+
+    box($fwin, 0, 0);
+    keypad($fwin, 1);
+
+    post_form($form);
+
+    addstr(0, 0, "Use KEY_UP/KEY_DOWN/KEY_PPAGE/KEY_NPAGE to navigate");
+    addstr(1, 0, "Press 'ENTER' to select item, or 'F1' to exit");
+    addstr(2, 0, "Other alphanumeric characters will enter data");
+    refresh();
+
+    driveForm($fwin, $form);
+
+    unpost_form($form);
+    delwin($fwin);
+    free_form($form);
+    map { free_field($_) } @fl;
+}
+
+
+
+##############################################################################
+#                    MAINLINE
+##############################################################################
+
+initscr();
+
+# The eval makes sure if it croaks, we have a chance to restore the
+# terminal.
+
+eval { demo() };
+
+endwin();
+
+if ($@) {
+    print STDERR "Failed.  $@\n";
+    exit(1);
+}
+
+exit(0);
@@ -0,0 +1,121 @@
+#! /usr/bin/perl
+##
+##  This code contributed by Yury Pshenichny <yura@zp.ua>
+##  based on demo.panel by Chris Leach <leachcj@bp.com>
+##  and pretty much redone by me
+
+use ExtUtils::testlib;
+use Curses;
+
+eval { new_menu() };
+if ($@ =~ m{not defined in your Curses library}) {
+    print STDERR "Curses was not compiled with menu function.\n";
+    exit 1;
+}
+
+my $ilist = [
+    [ "AAA" => "A descr" ],
+    [ "BBB" => "B descr" ],
+    [ "CCC" => "C descr" ],
+    [ "DDD" => "D descr" ],
+    [ "EEE" => "E descr" ],
+    [ "FFF" => "F descr" ],
+    [ "GGG" => "G descr" ],
+    [ "HHH" => "H descr (This item has a very long descr) "]
+];
+
+initscr;
+noecho;
+
+my @il;
+my @pack;
+
+foreach my $I (@$ilist) {
+    my $item = new_item($I->[0], $I->[1]);
+
+    if ($item eq '') { fatal("new_item($I->[0], $I->[1]) failed: $item") }
+    push @il, $item;
+    push @pack, ${$item};
+}
+push @pack, 0;
+
+my $menu = new_menu(pack "L!*", @pack);
+if ($menu eq '') { fatal("new_menu failed") }
+
+my $rows;
+my $cols;
+
+set_menu_mark($menu, '->');
+set_menu_format($menu, 3, 1);
+scale_menu($menu, $rows, $cols);
+
+my $mwin = newwin($rows + 2, $cols + 2, 8, 15);
+my $msub = derwin($mwin, $rows, $cols, 1, 1);
+
+set_menu_win($menu, $mwin);
+set_menu_sub($menu, $msub);
+
+box($mwin, 0, 0);
+keypad($mwin, 1);
+
+post_menu($menu);
+
+addstr(0, 0, "Use KEY_UP/KEY_DOWN/KEY_PPAGE/KEY_NPAGE to navigate");
+addstr(1, 0, "Press 'ENTER' to select item, or 'F1' to exit");
+refresh();
+
+my $ci;
+while(1) {
+    my $ch = getch($mwin);
+    if ($ch == KEY_UP) {
+	menu_driver($menu, REQ_UP_ITEM);
+    }
+    elsif ($ch == KEY_DOWN) {
+	menu_driver($menu, REQ_DOWN_ITEM);
+    }
+    elsif ($ch == KEY_PPAGE) {
+	menu_driver($menu, REQ_SCR_UPAGE);
+    }
+    elsif ($ch == KEY_NPAGE) {
+	menu_driver($menu, REQ_SCR_DPAGE);
+    }
+    elsif ($ch == KEY_F(1)) {
+	last;
+    }
+    elsif ($ch eq "\r" or $ch eq "\n") {
+	$ci = current_item($menu);
+	last;
+    }
+    elsif ($ch =~ /^\S$/) {
+	menu_driver($menu, $ch);
+    }
+    else {
+	beep();
+    }
+}
+
+if ($ci) {
+    addstr(0, 0, "You selected " . item_name($ci) . "\n");
+}
+else {
+    addstr(0, 0, "You didn't select anything\n");
+}
+clrtoeol(1,0);
+refresh();
+sleep 2;
+
+unpost_menu($menu);
+delwin($mwin);
+free_menu($menu);
+map { free_item($_) } @il;
+endwin();
+
+exit 0;
+
+sub fatal {
+    clrtobot(0, 0);
+    addstr(0, 0, "@_\n");
+    refresh();
+    sleep 2;
+    exit 1;
+}
@@ -0,0 +1,80 @@
+#! /usr/bin/perl
+##
+##  This code contributed by Chris Leach <leachcj@bp.com>
+
+use ExtUtils::testlib;
+use Curses;
+
+eval { new_panel() };
+if ($@ =~ m{not defined in your Curses library}) {
+    print STDERR "Curses was not compiled with panel function.\n";
+    exit 1;
+}
+
+my $p1 = mkpanel("000");
+message("New Panel with 000's");
+
+my $p2 = mkpanel("+++");
+move_panel($p1, 8, 20);
+message("New Panel with +++'s");
+
+hide_panel($p1);
+message("Hiding 000's");
+message("000's hidden? ", panel_hidden($p1) ? "Yes" : "No");
+
+show_panel($p1);
+message("Showing 000's");
+
+my $p3 = mkpanel("XXX");
+move_panel($p3, 7, 34);
+message("New Panel with XXX's");
+
+top_panel(panel_above(panel_above(undef)));
+message("Moving the panel above the bottom panel to the top");
+
+bottom_panel(panel_below(panel_below(undef)));
+message("Moving the panel below the top panel to the bottom");
+
+my $w3 = panel_window($p3);
+del_panel($p3);
+message("Deleting panel with XXX's saving window");
+
+replace_panel($p1, $w3);
+message("Replacing 000's window");
+
+del_panel($p2);
+del_panel($p1);
+endwin(); 
+
+sub mkpanel {
+    my $s = shift;
+    my $w = Curses->new(10, 26, 12, 25);
+    die unless $w;
+
+    box($w, 0, 0);
+    my $p = new_panel($w);
+
+    if ($p) {
+        set_panel_userptr($p, $s);
+
+	foreach my $r (1..8) {
+	    addstr($w, $r, 3*$r-2, $s);
+	}
+    }
+    else {
+	fatal("new_panel failed");
+    }
+    $p;
+}
+
+sub message {
+    addstr(stdscr, 0, 0, "@_\n");
+    update_panels();
+    doupdate();
+    sleep 2;
+}
+
+sub fatal {
+    message("@_");
+    exit 1;
+}
@@ -0,0 +1,78 @@
+#! /usr/bin/perl
+##
+##  demo2  -- play around with some weird stuff, use object model
+##
+##  Copyright (c) 2000  William Setzer
+##
+##  You may distribute under the terms of either the Artistic License
+##  or the GNU General Public License, as specified in the README file.
+
+use ExtUtils::testlib;
+use Curses;
+
+sub message {
+    my $win = shift;
+
+    $win->addstr(0, 0, "@_\n");
+    $win->addstr(3, 4, "-->");
+    $win->move($LINES - 1, 0);
+    $win->refresh();
+    sleep 2;
+}
+
+my $win = Curses->new  or die "Can't get new window\n";
+
+##  You have to pack chtypes.  Be sure to get that trailing zero.
+#
+eval {
+    my $chstr = pack "I*",
+        ACS_BLOCK, ord(A), ACS_CKBOARD, ord(B), ACS_PLMINUS, 0;
+
+    $win->addchstr(3, 8, $chstr);
+    message $win, "addchstr: block, A, checkerboard, B, plus/minus";
+};
+
+$win->clrtoeol(3, 8);
+
+##  Attrs
+#
+eval {
+    $win->attron(A_BOLD|A_UNDERLINE);
+    $win->addstr(3, 8, "hello");
+    $win->attrset(0);
+    message $win, "attr: BOLD|UNDERLINE";
+    $win->attron(A_BOLD|A_UNDERLINE);
+    $win->attroff(A_BOLD);
+    $win->addstr(3, 8, "hello");
+    $win->attrset(0);
+    message $win, "attr: UNDERLINE";
+};
+
+$win->clrtoeol(3, 8);
+
+##  Color
+#
+eval {
+    start_color;
+    init_pair 1, COLOR_GREEN,  COLOR_BLACK;
+    init_pair 2, COLOR_RED,    COLOR_BLACK;
+
+    my $GREEN = COLOR_PAIR(1);
+    my $RED   = COLOR_PAIR(2);
+
+    $win->attron($RED);
+    $win->addstr(3, 8, "hello");
+    $win->attroff($RED);
+    message $win, "color: red";
+    $win->attron($GREEN);
+    $win->addstr(3, 8, "hello");
+    $win->attroff($GREEN);
+    message $win, "color: green";
+
+    my $chstr = $RED | ACS_CKBOARD;
+    $win->clrtoeol(3, 8);
+    $win->addch(3, 8, $chstr);
+    message $win, "addch: red checkerboard";
+};
+
+endwin();
@@ -0,0 +1,150 @@
+#! /usr/bin/perl
+
+# This file a port from test/gdc.c in the ncurses-1.9.8a distribution.
+# No copyright license is publicly offered, but I don't think the
+# writer would mind the port.  It's not exact, because I was
+# simplifying things to find a bug in my port.
+#
+# Also note that this is basically a direct port.  If it looks like C
+# written in perl, that's because it is.  :-)
+#
+# /*
+#  * Grand digital clock for curses compatible terminals
+#  * Usage: gdc [-s] [n]   -- run for n seconds (default infinity)
+#  * Flags: -s: scroll
+#  *
+#  * modified 10-18-89 for curses (jrl)
+#  * 10-18-89 added signal handling
+#  */
+
+use ExtUtils::testlib;
+use Curses;
+
+$YBASE   = 10;
+$XBASE   = 10;
+$YDEPTH  =  5;
+$XLENGTH = 54;
+
+@disp = (075557, 011111, 071747, 071717, 055711, 074717,
+	 074757, 071111, 075757, 075717, 002020);
+
+
+$SIG{INT}  = \&sighndl;
+$SIG{TERM} = \&sighndl;
+
+initscr();
+cbreak();
+noecho();
+clear();
+refresh();
+
+$n = -1;
+for (@ARGV) {
+    /-s/ and $scroll = 1;
+    $n = $_;
+}
+$hascolor = eval { has_colors() };
+
+if ($hascolor) {	
+    start_color();
+    init_pair(1, COLOR_BLACK, COLOR_RED);
+    init_pair(2, COLOR_RED, COLOR_BLACK);
+    init_pair(3, COLOR_WHITE, COLOR_BLACK);
+    attrset(COLOR_PAIR(3));
+
+    addch($YBASE - 1,  $XBASE - 1, ACS_ULCORNER);
+    hline(ACS_HLINE, $XLENGTH);
+    addch($YBASE - 1,  $XBASE + $XLENGTH, ACS_URCORNER);
+
+    addch($YBASE + $YDEPTH,  $XBASE - 1, ACS_LLCORNER);
+    hline(ACS_HLINE, $XLENGTH);
+    addch($YBASE + $YDEPTH,  $XBASE + $XLENGTH, ACS_LRCORNER);
+
+    move($YBASE,  $XBASE - 1);
+    vline(ACS_VLINE, $YDEPTH);
+
+    move($YBASE,  $XBASE + $XLENGTH);
+    vline(ACS_VLINE, $YDEPTH);
+
+    attrset(COLOR_PAIR(2));
+}
+
+while ($n--) {
+    $mask = 0;
+    $time = time;
+    my($sec, $min, $hour) = localtime $time;
+    set($sec  % 10,  0);
+    set($sec  / 10,  4);
+    set($min  % 10, 10);
+    set($min  / 10, 14);
+    set($hour % 10, 20);
+    set($hour / 10, 24);
+    set(10,          7);
+    set(10,         17);
+    foreach $k (0..5) {
+	if($scroll) {
+	    foreach $i (0..4) {
+		$new[$i] = ($new[$i] & ~$mask) | ($new[$i+1] & $mask);
+	    }
+	    $new[5] = ($new[5] & ~$mask) | ($next[$k] & $mask);
+	}
+	else { $new[$k] = ($new[$k] & ~$mask) | ($next[$k] & $mask) }
+	$next[$k] = 0;
+	for($s = 1; $s >= 0; $s--) {
+	    standt($s);
+	    foreach $i (0..5) {
+		if($a = (($new[$i] ^ $old[$i]) & ($s ? $new[$i] : $old[$i]))) {
+		    for ($j = 0, $t = 1 << 26; $t; $t >>= 1, $j++) {
+			if($a & $t) {
+			    if(!($a & ($t << 1))) {
+				move($YBASE + $i, $XBASE + 2*$j);
+			    }
+			    addstr("  ");
+			}
+		    }
+		}
+		if(!$s) { $old[$i] = $new[$i]; }
+	    }
+	}
+	refresh();
+    }
+#    /* this depends on the detailed format of ctime(3) */
+    my($ctime) = scalar localtime $time;
+    addstr(16, 30, substr($ctime, 0, 10) . substr($ctime, 19));
+    
+    move(0, 0);
+    refresh();
+    sleep(1);
+    if ($sigtermed) {
+	last;
+    }
+}
+standend();
+clear();
+refresh();
+endwin();
+print STDERR "gdc terminated by signal $sigtermed\n" if $sigtermed;
+
+sub set {
+    my($t, $n) = @_;
+    my($m)     = 7 << $n;
+
+    foreach $i (0..4) {
+	$next[$i] |= (($disp[$t] >> (4-$i)*3) & 07) << $n;
+	$mask     |= ($next[$i] ^ $old[$i]) & $m;
+    }
+    if ($mask & $m) { $mask |= $m }
+}
+
+sub standt {
+    my($on) = @_;
+
+    if ($on) { $hascolor ? attron(COLOR_PAIR(1)) : standout() }
+    else     { $hascolor ? attron(COLOR_PAIR(2)) : standend() }
+}
+
+sub sighndl {
+    local($sig) = @_;
+
+    $sigtermed = $sig;
+}
diff --git a/var/tmp/source/GIRAFFED/Curses-1.30/Curses-1.30/Curses/gen.tar b/var/tmp/source/GIRAFFED/Curses-1.30/Curses-1.30/Curses/gen.tar
new file mode 100644
index 00000000..9083e6ca
Binary files /dev/null and b/var/tmp/source/GIRAFFED/Curses-1.30/Curses-1.30/Curses/gen.tar differ
@@ -0,0 +1,38 @@
+/*  Hint file for the MSWin32 platform, Borland compiler.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* These hints thanks to Gurusamy Sarathy <gsar@engin.umich.edu> */
+
+/* We used to include <pdcurses.h>, but users found it is actually
+   installed as <curses.h>.  Maybe it changed at some point.
+   2007.09.29
+*/
+/* We used to undef macro SP, (which is defined by perl.h), but in September
+   2007, we found that a) SP is needed; and 2) SP doesn't hurt
+   the #includes below.
+*/
+
+#include <curses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#define C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,38 @@
+/*  Hint file for the MSWin32 platform, Visual C compiler.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* These hints thanks to Gurusamy Sarathy <gsar@engin.umich.edu> */
+
+/* We used to include <pdcurses.h>, but users found it is actually
+   installed as <curses.h>.  Maybe it changed at some point.
+   2007.09.29
+*/
+/* We used to undef macro SP, (which is defined by perl.h), but in September
+   2007, we found that a) SP is needed; and 2) SP doesn't hurt
+   the #includes below.
+*/
+
+#include <curses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#define C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,27 @@
+/*  Hint file for the AIX platform.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+#include <curses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#define C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,30 @@
+/*  Hint file for the BSD386 platform.
+ *  (Copy of the hint file for the FreeBSD platform, BSD version of libcurses.)
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* These hints thanks to "Andrew V. Stesin" <stesin@elvisti.kiev.ua> */
+
+#include <curses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#undef  C_LONG0ARGS
+#define C_LONG2ARGS
+
+#define C_TOUCHLINE
+#undef  C_TOUCH3ARGS
+#define C_TOUCH4ARGS
@@ -0,0 +1,29 @@
+/*  Hint file for the BSDOS platform.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* These hints thanks to Dean Karres <karres@southwind.net> */
+
+#include <curses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#undef  C_LONG0ARGS
+#define C_LONG2ARGS
+
+#define C_TOUCHLINE
+#undef  C_TOUCH3ARGS
+#define C_TOUCH4ARGS
@@ -0,0 +1,31 @@
+/*  Hint file for the Cygwin platform.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* These hints thanks to Federico Spinazzi <spinazzi@databankgroup.it>
+   (2001) and yselkowitz@users.sourceforge.net (October 2005)
+*/
+
+#include <ncurses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#undef  C_LONGNAME
+#undef  C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#undef  C_TOUCHLINE
+#undef  C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,29 @@
+/*  Hint file for Darwin Kernel Version 7.5.0, ncurses version of 
+    libcurses.  Based in FreeBSD, ncurses hints file
+
+    This file came from gene03@smalltime.com, September 2004.
+*/
+
+#include <ncurses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#define C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,29 @@
+/*  Hint file for the darwin platform.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* These hints thanks to Scott Dietrich <sdietrich@emlab.com> */
+
+#include <curses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#undef  C_LONG0ARGS
+#define C_LONG2ARGS
+
+#define C_TOUCHLINE
+#undef  C_TOUCH3ARGS
+#define C_TOUCH4ARGS
@@ -0,0 +1,30 @@
+/*  Hint file for the OSF1 platform.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* These hints thanks to Lamont Granquist <lamontg@becker1.u.washington.edu> */
+
+#include <curses.h>
+/* #include <term.h> */
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#undef  C_TOUCHLINE
+#undef  C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,29 @@
+/*  Hint file for the DGUX platform.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* These hints thanks to Shreeniwas N Sapre <sns@cs.unipune.ernet.in> */
+
+#include <curses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#define C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,29 @@
+/*  Hint file for the DYNIX/ptx platform.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+ /* These hints thanks to Carson Wilson <carson@Mcs.Net> */
+
+#include <curses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#define C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,17 @@
+/*  Hint file for the FreeBSD platform, BSD version of libcurses.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* These hints thanks to "Andrew V. Stesin" <stesin@elvisti.kiev.ua> */
+
+#include <curses.h>
+
+#define C_LONGNAME
+#undef  C_LONG0ARGS
+#define C_LONG2ARGS
+
+#define C_TOUCHLINE
+#undef  C_TOUCH3ARGS
+#define C_TOUCH4ARGS
@@ -0,0 +1,29 @@
+/*  Hint file for the FreeBSD platform, ncurses version of libcurses.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* These hints thanks to "Andrew V. Stesin" <stesin@elvisti.kiev.ua> */
+
+#include <ncurses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#define C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,27 @@
+/*  Hint file for the Debian GNU/kfreebsd platform
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+#include <ncurses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#define C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,27 @@
+/*  Hint file for the HP-UX platform.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+#include <curses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#define C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,17 @@
+/*  Hint file for the IRIX platform, tested for IRIX 5.3.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* These hints thanks to Sven Heinicke <sven@wired.com> */
+
+#include <curses.h>
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#define C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,30 @@
+/*  Hint file for the IRIX platform, ncurses version of libncurses,
+ *  tested for IRIX 6.2.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* Roland Walker <walker@ncbi.nlm.nih.gov> Feb 1999*/
+
+#include <ncurses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#define C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,29 @@
+/* c-isc.h:  Hint file for curses on Interactive System V, release 3.2.
+   This was tested on version 3.01, but probably will work for most
+   generic SysV curses.
+   Andy Dougherty	doughera@lafcol.lafayette.edu
+*/
+
+#include <curses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#define C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
+
+
@@ -0,0 +1,15 @@
+/*  Hint file for the Linux platform, BSD version of libcurses.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+#include <curses.h>
+
+#undef  C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#undef  C_TOUCH3ARGS
+#define C_TOUCH4ARGS
@@ -0,0 +1,27 @@
+/*  Hint file for the Linux platform, ncurses version of libcurses.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+#include <ncurses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#define C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,35 @@
+/*  Hint file for the NETBSD platform.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* These hints thanks to matthew green <mrg@mame.mu.oz.au> */
+
+/* Note to NETBSD users: I have gotten several conflicting reports
+ * about the correct number of arguments for longname() and
+ * touchline().  You may have to look them up and edit this file to
+ * reflect the reality for your system.
+ */
+
+#include <curses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME      /* Does longname() exist?               */
+#define C_LONG0ARGS     /* Does longname() take 0 arguments?    */
+#undef  C_LONG2ARGS     /* Does longname() take 2 arguments?    */
+
+#define C_TOUCHLINE     /* Does touchline() exist?              */
+#define C_TOUCH3ARGS    /* Does touchline() take 3 arguments?   */
+#undef  C_TOUCH4ARGS    /* Does touchline() take 4 arguments?   */
@@ -0,0 +1,29 @@
+/*  Hint file for the NeXT platform.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* These hints thanks to Anno Siegel <anno4000@w172zrz.zrz.tu-berlin.d400.de>*/
+
+#include <curses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#undef  C_LONG0ARGS
+#define C_LONG2ARGS
+
+#define C_TOUCHLINE
+#undef  C_TOUCH3ARGS
+#define C_TOUCH4ARGS
@@ -0,0 +1,40 @@
+/* Change <curses.h> below to the proper "include" file for curses. */
+#include <curses.h>
+
+/* Change <panel.h> below to the proper "include" file for panels. */
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+/* Change <menu.h> below to the proper "include" file for menus. */
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+/* Change <form.h> below to the proper "include" file for forms. */
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+/* Change each #undef below to #define if the answer to the question
+ * beside it is "yes".
+ */
+#undef  C_LONGNAME	/* Does longname() exist?		*/
+#undef  C_LONG0ARGS	/* Does longname() take 0 arguments?	*/
+#undef  C_LONG2ARGS	/* Does longname() take 2 arguments?	*/
+
+#undef  C_TOUCHLINE	/* Does touchline() exist?		*/
+#undef  C_TOUCH3ARGS	/* Does touchline() take 3 arguments?	*/
+#undef  C_TOUCH4ARGS	/* Does touchline() take 4 arguments?	*/
+
+/* Some Curses include files have problems interacting with perl,
+ * some are missing basic functionality, and some just plain do
+ * weird things.  Unfortunately, there's no way to anticipate all
+ * of the problems the curses include file + "perl.h" might create.
+ *
+ * If you find that you can't compile Curses.c because of these
+ * conflicts, you should insert C code before and after the "include"
+ * file above to try and fix the problems.  "See c-sunos.sysv.h"
+ * for an example of this.
+ */
+
@@ -0,0 +1,29 @@
+/*  Hint file for the OpenBSD platform.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* These hints thanks to Stanislav Grozev <sgrozev@orbitel.bg> */
+
+#include <curses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#define C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,29 @@
+/*  Hint file for the OS/2 platform, ncurses version of libcurses.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* These hints thanks to "Andrew V. Stesin" <stesin@elvisti.kiev.ua> */
+
+#include <curses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#define C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,29 @@
+/*  Hint file for the SCO Unix (3.2 and 4.2) platform.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* These hints thanks to Han Holl <100327.1632@compuserve.com> */
+
+#include <curses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#define C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,29 @@
+/*  Hint file for the Solaris platform.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* These hints thanks to Douglas Acker <acker@se01.wg2.waii.com> */
+
+#include <curses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#define C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,15 @@
+/*  Hint file for the SunOS platform, BSD version of libcurses.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+#include <curses.h>
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#define C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,29 @@
+/*  Hint file for the SunOS platform, ncurses version of libcurses.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* These hints thanks to Ivan Kohler <ivan@voicenet.com> */
+
+#include <ncurses.h>   /* or curses.h */
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#define C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,52 @@
+/*  Hint file for the SunOS platform, SysV version of libcurses.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* The combined set of lines below between * vvvv * and * ^^^^ *
+ * below is one example of how to fix compiler errors between the
+ * curses include file and the perl include files.  It turns out that
+ * for the SunOS platform, SysV curses, there were these problems:
+ *
+ * 1) sprintf() was declared as returning different types in <curses.h>
+ *    and "perl.h"
+ * 3) Lots of redefined warnings, because <sys/ioctl.h> was included by
+ *    both <curses.h> and "perl.h"
+ *
+ * You can see by looking at the fixes how each problem was resolved.
+ *
+ * Note that "perl.h" is always included after this file when deciding
+ * how to fix the conflicts.
+ */
+
+/* vvvv */
+#define sprintf stupid_stupid_stupid
+/* ^^^^ */
+
+#include <curses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+/* vvvv */
+#undef sprintf
+#define _sys_ioctl_h
+/* ^^^^ */
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#define C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,30 @@
+/*  Hint file for the NCR UNIX MP_RAS 3.02 platform.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* These hints thanks to James Bailey <James.Bailey@AtlantaGA.NCR.COM> */
+
+
+#include <curses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#define C_LONG0ARGS
+#undef  C_LONG2ARGS
+
+#define C_TOUCHLINE
+#define C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
@@ -0,0 +1,32 @@
+/*  Hint file for VMS.
+ *
+ *  If this configuration doesn't work, look at the file "c-none.h"
+ *  for how to set the configuration options.
+ */
+
+/* These hints thanks to Peter Prymmer <pvhp@forte.com> */
+
+#include <curses.h>
+
+#ifdef C_PANELFUNCTION
+#include <panel.h>
+#endif
+
+#ifdef C_MENUFUNCTION
+#include <menu.h>
+#endif
+
+#ifdef C_FORMFUNCTION
+#include <form.h>
+#endif
+
+#define C_LONGNAME
+#undef  C_LONG0ARGS
+#define C_LONG2ARGS
+
+#undef  C_TOUCHLINE
+#undef  C_TOUCH3ARGS
+#undef  C_TOUCH4ARGS
+
+#define cbreak()   crmode()
+#define nocbreak() nocrmode()
@@ -0,0 +1,355 @@
+## This file is automatically generated; changes will be lost.
+##
+##   V = variable existence check
+##   E = function existence check,
+##   I = function "returns int?" check
+##   T = typedef existence check
+
+E  waddch(stdscr,0)
+E  wechochar(stdscr,0)
+E  waddchstr(stdscr,0)
+E  waddchnstr(stdscr,0,0)
+E  waddstr(stdscr,0)
+E  waddnstr(stdscr,0,0)
+E  wattroff(stdscr,0)
+E  wattron(stdscr,0)
+E  wattrset(stdscr,0)
+E  wstandend(stdscr)
+E  wstandout(stdscr)
+E  wattr_get(stdscr,&LINES,&LINES,0)
+E  wattr_off(stdscr,0,0)
+E  wattr_on(stdscr,0,0)
+E  wattr_set(stdscr,0,0,0)
+E  wchgat(stdscr,0,0,0,0)
+E  COLOR_PAIR(0)
+E  PAIR_NUMBER(0)
+E  beep()
+E  flash()
+E  wbkgd(stdscr,0)
+E  wbkgdset(stdscr,0)
+E  getbkgd(stdscr)
+E  wborder(stdscr,0,0,0,0,0,0,0,0)
+E  box(stdscr,0,0)
+E  whline(stdscr,0,0)
+E  wvline(stdscr,0,0)
+E  werase(stdscr)
+E  wclear(stdscr)
+E  wclrtobot(stdscr)
+E  wclrtoeol(stdscr)
+E  start_color()
+E  init_pair(0,0,0)
+E  init_color(0,0,0,0)
+E  has_colors()
+E  can_change_color()
+E  color_content(0,&LINES,&LINES,&LINES)
+E  pair_content(0,&LINES,&LINES)
+E  wdelch(stdscr)
+E  wdeleteln(stdscr)
+E  winsdelln(stdscr,0)
+E  winsertln(stdscr)
+E  wgetch(stdscr)
+E  ungetch(0)
+E  has_key(0)
+E  KEY_F(0)
+E  wgetstr(stdscr,0)
+E  wgetnstr(stdscr,0,0)
+E  getyx(stdscr,LINES,LINES)
+E  getparyx(stdscr,LINES,LINES)
+E  getbegyx(stdscr,LINES,LINES)
+E  getmaxyx(stdscr,LINES,LINES)
+E  winch(stdscr)
+E  winchstr(stdscr,0)
+E  winchnstr(stdscr,0,0)
+E  initscr()
+E  endwin()
+E  isendwin()
+E  newterm(0,0,0)
+E  set_term(0)
+E  delscreen(0)
+E  cbreak()
+I  cbreak()
+E  nocbreak()
+I  nocbreak()
+E  echo()
+I  echo()
+E  noecho()
+I  noecho()
+E  halfdelay(0)
+E  intrflush(stdscr,0)
+E  keypad(stdscr,0)
+E  meta(stdscr,0)
+E  nodelay(stdscr,0)
+E  notimeout(stdscr,0)
+E  raw()
+I  raw()
+E  noraw()
+I  noraw()
+E  qiflush()
+E  noqiflush()
+E  wtimeout(stdscr,0)
+E  typeahead(0)
+E  winsch(stdscr,0)
+E  winsstr(stdscr,0)
+E  winsnstr(stdscr,0,0)
+E  winstr(stdscr,0)
+E  winnstr(stdscr,0,0)
+E  def_prog_mode()
+E  def_shell_mode()
+E  reset_prog_mode()
+E  reset_shell_mode()
+E  resetty()
+E  savetty()
+E  getsyx(LINES,LINES)
+I  getsyx(LINES,LINES)
+E  setsyx(0,0)
+I  setsyx(0,0)
+E  curs_set(0)
+E  napms(0)
+E  wmove(stdscr,0,0)
+E  clearok(stdscr,0)
+E  idlok(stdscr,0)
+I  idlok(stdscr,0)
+E  idcok(stdscr,0)
+E  immedok(stdscr,0)
+E  leaveok(stdscr,0)
+E  wsetscrreg(stdscr,0,0)
+E  scrollok(stdscr,0)
+E  nl()
+I  nl()
+E  nonl()
+I  nonl()
+E  overlay(stdscr,stdscr)
+E  overwrite(stdscr,stdscr)
+E  copywin(stdscr,stdscr,0,0,0,0,0,0,0)
+E  newpad(0,0)
+E  subpad(stdscr,0,0,0,0)
+E  prefresh(stdscr,0,0,0,0,0,0)
+E  pnoutrefresh(stdscr,0,0,0,0,0,0)
+E  pechochar(stdscr,0)
+E  wrefresh(stdscr)
+E  wnoutrefresh(stdscr)
+E  doupdate()
+E  redrawwin(stdscr)
+E  wredrawln(stdscr,0,0)
+E  scr_dump(0)
+E  scr_restore(0)
+E  scr_init(0)
+E  scr_set(0)
+E  scroll(stdscr)
+E  wscrl(stdscr,0)
+E  slk_init(0)
+E  slk_set(0,0,0)
+E  slk_refresh()
+E  slk_noutrefresh()
+E  slk_label(0)
+E  slk_clear()
+E  slk_restore()
+E  slk_touch()
+E  slk_attron(0)
+E  slk_attrset(0)
+E  slk_attr()
+E  slk_attroff(0)
+E  slk_color(0)
+E  baudrate()
+E  erasechar()
+E  has_ic()
+E  has_il()
+E  killchar()
+E  termattrs()
+E  termname()
+E  touchwin(stdscr)
+E  untouchwin(stdscr)
+E  wtouchln(stdscr,0,0,0)
+E  is_linetouched(stdscr,0)
+E  is_wintouched(stdscr)
+E  unctrl(0)
+E  keyname(0)
+E  filter()
+I  filter()
+E  use_env(0)
+E  putwin(stdscr,0)
+E  getwin(0)
+E  delay_output(0)
+E  flushinp()
+E  newwin(0,0,0,0)
+E  delwin(stdscr)
+E  mvwin(stdscr,0,0)
+E  subwin(stdscr,0,0,0,0)
+E  derwin(stdscr,0,0,0,0)
+E  mvderwin(stdscr,0,0)
+E  dupwin(stdscr)
+E  wsyncup(stdscr)
+E  syncok(stdscr,0)
+E  wcursyncup(stdscr)
+E  wsyncdown(stdscr)
+E  getmouse(0)
+E  ungetmouse(0)
+E  mousemask(0,&LINES)
+E  wenclose(stdscr,0,0)
+E  wmouse_trafo(stdscr,&LINES,&LINES,0)
+E  mouseinterval(0)
+E  BUTTON_RELEASE(0,0)
+E  BUTTON_PRESS(0,0)
+E  BUTTON_CLICK(0,0)
+E  BUTTON_DOUBLE_CLICK(0,0)
+E  BUTTON_TRIPLE_CLICK(0,0)
+E  BUTTON_RESERVED_EVENT(0,0)
+E  use_default_colors()
+E  assume_default_colors(0,0)
+E  define_key(0,0)
+E  keybound(0,0)
+E  keyok(0,0)
+E  resizeterm(0,0)
+E  wresize(stdscr,0,0)
+E  getmaxy(stdscr)
+E  getmaxx(stdscr)
+E  flusok(stdscr,0)
+E  getcap(0)
+E  touchoverlap(stdscr,stdscr)
+E  new_panel(stdscr)
+E  bottom_panel(0)
+E  top_panel(0)
+E  show_panel(0)
+E  update_panels()
+E  hide_panel(0)
+E  panel_window(0)
+E  replace_panel(0,stdscr)
+E  move_panel(0,0,0)
+E  panel_hidden(0)
+E  panel_above(0)
+E  panel_below(0)
+E  set_panel_userptr(0,0)
+E  panel_userptr(0)
+E  del_panel(0)
+E  set_menu_fore(0,0)
+E  menu_fore(0)
+E  set_menu_back(0,0)
+E  menu_back(0)
+E  set_menu_grey(0,0)
+E  menu_grey(0)
+E  set_menu_pad(0,0)
+E  menu_pad(0)
+E  pos_menu_cursor(0)
+E  menu_driver(0,0)
+E  set_menu_format(0,0,0)
+E  menu_format(0,&LINES,&LINES)
+E  set_menu_items(0,0)
+E  menu_items(0)
+E  item_count(0)
+E  set_menu_mark(0,0)
+E  menu_mark(0)
+E  new_menu(0)
+E  free_menu(0)
+E  menu_opts(0)
+E  set_menu_opts(0,0)
+E  menu_opts_on(0,0)
+E  menu_opts_off(0,0)
+E  set_menu_pattern(0,0)
+E  menu_pattern(0)
+E  post_menu(0)
+E  unpost_menu(0)
+E  set_menu_userptr(0,0)
+E  menu_userptr(0)
+E  set_menu_win(0,stdscr)
+E  menu_win(0)
+E  set_menu_sub(0,stdscr)
+E  menu_sub(0)
+E  scale_menu(0,&LINES,&LINES)
+E  set_current_item(0,0)
+E  current_item(0)
+E  set_top_row(0,0)
+E  top_row(0)
+E  item_index(0)
+E  item_name(0)
+E  item_description(0)
+E  new_item(0,0)
+E  free_item(0)
+E  set_item_opts(0,0)
+E  item_opts_on(0,0)
+E  item_opts_off(0,0)
+E  item_opts(0)
+E  item_userptr(0)
+E  set_item_userptr(0,0)
+E  set_item_value(0,0)
+E  item_value(0)
+E  item_visible(0)
+E  menu_request_name(0)
+E  menu_request_by_name(0)
+E  set_menu_spacing(0,0,0,0)
+E  menu_spacing(0,&LINES,&LINES,&LINES)
+E  pos_form_cursor(0)
+E  data_ahead(0)
+E  data_behind(0)
+E  form_driver(0,0)
+E  set_form_fields(0,0)
+E  form_fields(0)
+E  field_count(0)
+E  move_field(0,0,0)
+E  new_form(0)
+E  free_form(0)
+E  set_new_page(0,0)
+E  new_page(0)
+E  set_form_opts(0,0)
+E  form_opts_on(0,0)
+E  form_opts_off(0,0)
+E  form_opts(0)
+E  set_current_field(0,0)
+E  current_field(0)
+E  set_form_page(0,0)
+E  form_page(0)
+E  field_index(0)
+E  post_form(0)
+E  unpost_form(0)
+E  set_form_userptr(0,0)
+E  form_userptr(0)
+E  set_form_win(0,stdscr)
+E  form_win(0)
+E  set_form_sub(0,stdscr)
+E  form_sub(0)
+E  scale_form(0,&LINES,&LINES)
+E  set_field_fore(0,0)
+E  field_fore(0)
+E  set_field_back(0,0)
+E  field_back(0)
+E  set_field_pad(0,0)
+E  field_pad(0)
+E  set_field_buffer(0,0,0)
+E  field_buffer(0,0)
+E  set_field_status(0,0)
+E  field_status(0)
+E  set_max_field(0,0)
+E  field_info(0,&LINES,&LINES,&LINES,&LINES,&LINES,&LINES)
+E  dynamic_field_info(0,&LINES,&LINES,&LINES)
+E  set_field_just(0,0)
+E  field_just(0)
+E  new_field(0,0,0,0,0,0)
+E  dup_field(0,0,0)
+E  link_field(0,0,0)
+E  free_field(0)
+E  set_field_opts(0,0)
+E  field_opts_on(0,0)
+E  field_opts_off(0,0)
+E  field_opts(0)
+E  set_field_userptr(0,0)
+E  field_userptr(0)
+E  field_arg(0)
+E  form_request_name(0)
+E  form_request_by_name(0)
+V  LINES
+V  COLS
+V  stdscr
+V  curscr
+V  COLORS
+V  COLOR_PAIRS
+T  attr_t
+T  bool
+T  chtype
+T  MEVENT
+T  mmask_t
+T  SCREEN
+E  waddnwstr(stdscr,0,0)
+E  wget_wch(stdscr,0)
+E  wgetn_wstr(stdscr,0,0)
+E  winnwstr(stdscr,0,0)
+E  wins_nwstr(stdscr,0,0)
+E  unget_wch(0)
@@ -0,0 +1,6377 @@
+#if 0
+<<'SKIP';
+#endif
+/*
+----------------------------------------------------------------------
+
+    ppport.h -- Perl/Pollution/Portability Version 3.13
+
+    Automatically created by Devel::PPPort running under perl 5.006002.
+
+    Do NOT edit this file directly! -- Edit PPPort_pm.PL and the
+    includes in parts/inc/ instead.
+
+    Use 'perldoc ppport.h' to view the documentation below.
+
+----------------------------------------------------------------------
+
+SKIP
+
+=pod
+
+=head1 NAME
+
+ppport.h - Perl/Pollution/Portability version 3.13
+
+=head1 SYNOPSIS
+
+  perl ppport.h [options] [source files]
+
+  Searches current directory for files if no [source files] are given
+
+  --help                      show short help
+
+  --version                   show version
+
+  --patch=file                write one patch file with changes
+  --copy=suffix               write changed copies with suffix
+  --diff=program              use diff program and options
+
+  --compat-version=version    provide compatibility with Perl version
+  --cplusplus                 accept C++ comments
+
+  --quiet                     don't output anything except fatal errors
+  --nodiag                    don't show diagnostics
+  --nohints                   don't show hints
+  --nochanges                 don't suggest changes
+  --nofilter                  don't filter input files
+
+  --strip                     strip all script and doc functionality from
+                              ppport.h
+
+  --list-provided             list provided API
+  --list-unsupported          list unsupported API
+  --api-info=name             show Perl API portability information
+
+=head1 COMPATIBILITY
+
+This version of F<ppport.h> is designed to support operation with Perl
+installations back to 5.003, and has been tested up to 5.10.0.
+
+=head1 OPTIONS
+
+=head2 --help
+
+Display a brief usage summary.
+
+=head2 --version
+
+Display the version of F<ppport.h>.
+
+=head2 --patch=I<file>
+
+If this option is given, a single patch file will be created if
+any changes are suggested. This requires a working diff program
+to be installed on your system.
+
+=head2 --copy=I<suffix>
+
+If this option is given, a copy of each file will be saved with
+the given suffix that contains the suggested changes. This does
+not require any external programs. Note that this does not
+automagially add a dot between the original filename and the
+suffix. If you want the dot, you have to include it in the option
+argument.
+
+If neither C<--patch> or C<--copy> are given, the default is to
+simply print the diffs for each file. This requires either
+C<Text::Diff> or a C<diff> program to be installed.
+
+=head2 --diff=I<program>
+
+Manually set the diff program and options to use. The default
+is to use C<Text::Diff>, when installed, and output unified
+context diffs.
+
+=head2 --compat-version=I<version>
+
+Tell F<ppport.h> to check for compatibility with the given
+Perl version. The default is to check for compatibility with Perl
+version 5.003. You can use this option to reduce the output
+of F<ppport.h> if you intend to be backward compatible only
+down to a certain Perl version.
+
+=head2 --cplusplus
+
+Usually, F<ppport.h> will detect C++ style comments and
+replace them with C style comments for portability reasons.
+Using this option instructs F<ppport.h> to leave C++
+comments untouched.
+
+=head2 --quiet
+
+Be quiet. Don't print anything except fatal errors.
+
+=head2 --nodiag
+
+Don't output any diagnostic messages. Only portability
+alerts will be printed.
+
+=head2 --nohints
+
+Don't output any hints. Hints often contain useful portability
+notes. Warnings will still be displayed.
+
+=head2 --nochanges
+
+Don't suggest any changes. Only give diagnostic output and hints
+unless these are also deactivated.
+
+=head2 --nofilter
+
+Don't filter the list of input files. By default, files not looking
+like source code (i.e. not *.xs, *.c, *.cc, *.cpp or *.h) are skipped.
+
+=head2 --strip
+
+Strip all script and documentation functionality from F<ppport.h>.
+This reduces the size of F<ppport.h> dramatically and may be useful
+if you want to include F<ppport.h> in smaller modules without
+increasing their distribution size too much.
+
+The stripped F<ppport.h> will have a C<--unstrip> option that allows
+you to undo the stripping, but only if an appropriate C<Devel::PPPort>
+module is installed.
+
+=head2 --list-provided
+
+Lists the API elements for which compatibility is provided by
+F<ppport.h>. Also lists if it must be explicitly requested,
+if it has dependencies, and if there are hints or warnings for it.
+
+=head2 --list-unsupported
+
+Lists the API elements that are known not to be supported by
+F<ppport.h> and below which version of Perl they probably
+won't be available or work.
+
+=head2 --api-info=I<name>
+
+Show portability information for API elements matching I<name>.
+If I<name> is surrounded by slashes, it is interpreted as a regular
+expression.
+
+=head1 DESCRIPTION
+
+In order for a Perl extension (XS) module to be as portable as possible
+across differing versions of Perl itself, certain steps need to be taken.
+
+=over 4
+
+=item *
+
+Including this header is the first major one. This alone will give you
+access to a large part of the Perl API that hasn't been available in
+earlier Perl releases. Use
+
+    perl ppport.h --list-provided
+
+to see which API elements are provided by ppport.h.
+
+=item *
+
+You should avoid using deprecated parts of the API. For example, using
+global Perl variables without the C<PL_> prefix is deprecated. Also,
+some API functions used to have a C<perl_> prefix. Using this form is
+also deprecated. You can safely use the supported API, as F<ppport.h>
+will provide wrappers for older Perl versions.
+
+=item *
+
+If you use one of a few functions or variables that were not present in
+earlier versions of Perl, and that can't be provided using a macro, you
+have to explicitly request support for these functions by adding one or
+more C<#define>s in your source code before the inclusion of F<ppport.h>.
+
+These functions or variables will be marked C<explicit> in the list shown
+by C<--list-provided>.
+
+Depending on whether you module has a single or multiple files that
+use such functions or variables, you want either C<static> or global
+variants.
+
+For a C<static> function or variable (used only in a single source
+file), use:
+
+    #define NEED_function
+    #define NEED_variable
+
+For a global function or variable (used in multiple source files),
+use:
+
+    #define NEED_function_GLOBAL
+    #define NEED_variable_GLOBAL
+
+Note that you mustn't have more than one global request for the
+same function or variable in your project.
+
+    Function / Variable       Static Request               Global Request
+    -----------------------------------------------------------------------------------------
+    PL_signals                NEED_PL_signals              NEED_PL_signals_GLOBAL
+    eval_pv()                 NEED_eval_pv                 NEED_eval_pv_GLOBAL
+    grok_bin()                NEED_grok_bin                NEED_grok_bin_GLOBAL
+    grok_hex()                NEED_grok_hex                NEED_grok_hex_GLOBAL
+    grok_number()             NEED_grok_number             NEED_grok_number_GLOBAL
+    grok_numeric_radix()      NEED_grok_numeric_radix      NEED_grok_numeric_radix_GLOBAL
+    grok_oct()                NEED_grok_oct                NEED_grok_oct_GLOBAL
+    load_module()             NEED_load_module             NEED_load_module_GLOBAL
+    my_snprintf()             NEED_my_snprintf             NEED_my_snprintf_GLOBAL
+    my_strlcat()              NEED_my_strlcat              NEED_my_strlcat_GLOBAL
+    my_strlcpy()              NEED_my_strlcpy              NEED_my_strlcpy_GLOBAL
+    newCONSTSUB()             NEED_newCONSTSUB             NEED_newCONSTSUB_GLOBAL
+    newRV_noinc()             NEED_newRV_noinc             NEED_newRV_noinc_GLOBAL
+    newSVpvn_share()          NEED_newSVpvn_share          NEED_newSVpvn_share_GLOBAL
+    sv_2pv_flags()            NEED_sv_2pv_flags            NEED_sv_2pv_flags_GLOBAL
+    sv_2pvbyte()              NEED_sv_2pvbyte              NEED_sv_2pvbyte_GLOBAL
+    sv_catpvf_mg()            NEED_sv_catpvf_mg            NEED_sv_catpvf_mg_GLOBAL
+    sv_catpvf_mg_nocontext()  NEED_sv_catpvf_mg_nocontext  NEED_sv_catpvf_mg_nocontext_GLOBAL
+    sv_pvn_force_flags()      NEED_sv_pvn_force_flags      NEED_sv_pvn_force_flags_GLOBAL
+    sv_setpvf_mg()            NEED_sv_setpvf_mg            NEED_sv_setpvf_mg_GLOBAL
+    sv_setpvf_mg_nocontext()  NEED_sv_setpvf_mg_nocontext  NEED_sv_setpvf_mg_nocontext_GLOBAL
+    vload_module()            NEED_vload_module            NEED_vload_module_GLOBAL
+    vnewSVpvf()               NEED_vnewSVpvf               NEED_vnewSVpvf_GLOBAL
+    warner()                  NEED_warner                  NEED_warner_GLOBAL
+
+To avoid namespace conflicts, you can change the namespace of the
+explicitly exported functions / variables using the C<DPPP_NAMESPACE>
+macro. Just C<#define> the macro before including C<ppport.h>:
+
+    #define DPPP_NAMESPACE MyOwnNamespace_
+    #include "ppport.h"
+
+The default namespace is C<DPPP_>.
+
+=back
+
+The good thing is that most of the above can be checked by running
+F<ppport.h> on your source code. See the next section for
+details.
+
+=head1 EXAMPLES
+
+To verify whether F<ppport.h> is needed for your module, whether you
+should make any changes to your code, and whether any special defines
+should be used, F<ppport.h> can be run as a Perl script to check your
+source code. Simply say:
+
+    perl ppport.h
+
+The result will usually be a list of patches suggesting changes
+that should at least be acceptable, if not necessarily the most
+efficient solution, or a fix for all possible problems.
+
+If you know that your XS module uses features only available in
+newer Perl releases, if you're aware that it uses C++ comments,
+and if you want all suggestions as a single patch file, you could
+use something like this:
+
+    perl ppport.h --compat-version=5.6.0 --cplusplus --patch=test.diff
+
+If you only want your code to be scanned without any suggestions
+for changes, use:
+
+    perl ppport.h --nochanges
+
+You can specify a different C<diff> program or options, using
+the C<--diff> option:
+
+    perl ppport.h --diff='diff -C 10'
+
+This would output context diffs with 10 lines of context.
+
+If you want to create patched copies of your files instead, use:
+
+    perl ppport.h --copy=.new
+
+To display portability information for the C<newSVpvn> function,
+use:
+
+    perl ppport.h --api-info=newSVpvn
+
+Since the argument to C<--api-info> can be a regular expression,
+you can use
+
+    perl ppport.h --api-info=/_nomg$/
+
+to display portability information for all C<_nomg> functions or
+
+    perl ppport.h --api-info=/./
+
+to display information for all known API elements.
+
+=head1 BUGS
+
+If this version of F<ppport.h> is causing failure during
+the compilation of this module, please check if newer versions
+of either this module or C<Devel::PPPort> are available on CPAN
+before sending a bug report.
+
+If F<ppport.h> was generated using the latest version of
+C<Devel::PPPort> and is causing failure of this module, please
+file a bug report using the CPAN Request Tracker at L<http://rt.cpan.org/>.
+
+Please include the following information:
+
+=over 4
+
+=item 1.
+
+The complete output from running "perl -V"
+
+=item 2.
+
+This file.
+
+=item 3.
+
+The name and version of the module you were trying to build.
+
+=item 4.
+
+A full log of the build that failed.
+
+=item 5.
+
+Any other information that you think could be relevant.
+
+=back
+
+For the latest version of this code, please get the C<Devel::PPPort>
+module from CPAN.
+
+=head1 COPYRIGHT
+
+Version 3.x, Copyright (c) 2004-2007, Marcus Holland-Moritz.
+
+Version 2.x, Copyright (C) 2001, Paul Marquess.
+
+Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
+
+This program is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+See L<Devel::PPPort>.
+
+=cut
+
+use strict;
+
+# Disable broken TRIE-optimization
+BEGIN { eval '${^RE_TRIE_MAXBUF} = -1' if $] >= 5.009004 && $] <= 5.009005 }
+
+my $VERSION = 3.13;
+
+my %opt = (
+  quiet     => 0,
+  diag      => 1,
+  hints     => 1,
+  changes   => 1,
+  cplusplus => 0,
+  filter    => 1,
+  strip     => 0,
+  version   => 0,
+);
+
+my($ppport) = $0 =~ /([\w.]+)$/;
+my $LF = '(?:\r\n|[\r\n])';   # line feed
+my $HS = "[ \t]";             # horizontal whitespace
+
+# Never use C comments in this file!
+my $ccs  = '/'.'*';
+my $cce  = '*'.'/';
+my $rccs = quotemeta $ccs;
+my $rcce = quotemeta $cce;
+
+eval {
+  require Getopt::Long;
+  Getopt::Long::GetOptions(\%opt, qw(
+    help quiet diag! filter! hints! changes! cplusplus strip version
+    patch=s copy=s diff=s compat-version=s
+    list-provided list-unsupported api-info=s
+  )) or usage();
+};
+
+if ($@ and grep /^-/, @ARGV) {
+  usage() if "@ARGV" =~ /^--?h(?:elp)?$/;
+  die "Getopt::Long not found. Please don't use any options.\n";
+}
+
+if ($opt{version}) {
+  print "This is $0 $VERSION.\n";
+  exit 0;
+}
+
+usage() if $opt{help};
+strip() if $opt{strip};
+
+if (exists $opt{'compat-version'}) {
+  my($r,$v,$s) = eval { parse_version($opt{'compat-version'}) };
+  if ($@) {
+    die "Invalid version number format: '$opt{'compat-version'}'\n";
+  }
+  die "Only Perl 5 is supported\n" if $r != 5;
+  die "Invalid version number: $opt{'compat-version'}\n" if $v >= 1000 || $s >= 1000;
+  $opt{'compat-version'} = sprintf "%d.%03d%03d", $r, $v, $s;
+}
+else {
+  $opt{'compat-version'} = 5;
+}
+
+my %API = map { /^(\w+)\|([^|]*)\|([^|]*)\|(\w*)$/
+                ? ( $1 => {
+                      ($2                  ? ( base     => $2 ) : ()),
+                      ($3                  ? ( todo     => $3 ) : ()),
+                      (index($4, 'v') >= 0 ? ( varargs  => 1  ) : ()),
+                      (index($4, 'p') >= 0 ? ( provided => 1  ) : ()),
+                      (index($4, 'n') >= 0 ? ( nothxarg => 1  ) : ()),
+                    } )
+                : die "invalid spec: $_" } qw(
+AvFILLp|5.004050||p
+AvFILL|||
+CLASS|||n
+CX_CURPAD_SAVE|||
+CX_CURPAD_SV|||
+CopFILEAV|5.006000||p
+CopFILEGV_set|5.006000||p
+CopFILEGV|5.006000||p
+CopFILESV|5.006000||p
+CopFILE_set|5.006000||p
+CopFILE|5.006000||p
+CopSTASHPV_set|5.006000||p
+CopSTASHPV|5.006000||p
+CopSTASH_eq|5.006000||p
+CopSTASH_set|5.006000||p
+CopSTASH|5.006000||p
+CopyD|5.009002||p
+Copy|||
+CvPADLIST|||
+CvSTASH|||
+CvWEAKOUTSIDE|||
+DEFSV|5.004050||p
+END_EXTERN_C|5.005000||p
+ENTER|||
+ERRSV|5.004050||p
+EXTEND|||
+EXTERN_C|5.005000||p
+F0convert|||n
+FREETMPS|||
+GIMME_V||5.004000|n
+GIMME|||n
+GROK_NUMERIC_RADIX|5.007002||p
+G_ARRAY|||
+G_DISCARD|||
+G_EVAL|||
+G_NOARGS|||
+G_SCALAR|||
+G_VOID||5.004000|
+GetVars|||
+GvSV|||
+Gv_AMupdate|||
+HEf_SVKEY||5.004000|
+HeHASH||5.004000|
+HeKEY||5.004000|
+HeKLEN||5.004000|
+HePV||5.004000|
+HeSVKEY_force||5.004000|
+HeSVKEY_set||5.004000|
+HeSVKEY||5.004000|
+HeVAL||5.004000|
+HvNAME|||
+INT2PTR|5.006000||p
+IN_LOCALE_COMPILETIME|5.007002||p
+IN_LOCALE_RUNTIME|5.007002||p
+IN_LOCALE|5.007002||p
+IN_PERL_COMPILETIME|5.008001||p
+IS_NUMBER_GREATER_THAN_UV_MAX|5.007002||p
+IS_NUMBER_INFINITY|5.007002||p
+IS_NUMBER_IN_UV|5.007002||p
+IS_NUMBER_NAN|5.007003||p
+IS_NUMBER_NEG|5.007002||p
+IS_NUMBER_NOT_INT|5.007002||p
+IVSIZE|5.006000||p
+IVTYPE|5.006000||p
+IVdf|5.006000||p
+LEAVE|||
+LVRET|||
+MARK|||
+MULTICALL||5.009005|
+MY_CXT_CLONE|5.009002||p
+MY_CXT_INIT|5.007003||p
+MY_CXT|5.007003||p
+MoveD|5.009002||p
+Move|||
+NOOP|5.005000||p
+NUM2PTR|5.006000||p
+NVTYPE|5.006000||p
+NVef|5.006001||p
+NVff|5.006001||p
+NVgf|5.006001||p
+Newxc|5.009003||p
+Newxz|5.009003||p
+Newx|5.009003||p
+Nullav|||
+Nullch|||
+Nullcv|||
+Nullhv|||
+Nullsv|||
+ORIGMARK|||
+PAD_BASE_SV|||
+PAD_CLONE_VARS|||
+PAD_COMPNAME_FLAGS|||
+PAD_COMPNAME_GEN_set|||
+PAD_COMPNAME_GEN|||
+PAD_COMPNAME_OURSTASH|||
+PAD_COMPNAME_PV|||
+PAD_COMPNAME_TYPE|||
+PAD_RESTORE_LOCAL|||
+PAD_SAVE_LOCAL|||
+PAD_SAVE_SETNULLPAD|||
+PAD_SETSV|||
+PAD_SET_CUR_NOSAVE|||
+PAD_SET_CUR|||
+PAD_SVl|||
+PAD_SV|||
+PERL_ABS|5.008001||p
+PERL_BCDVERSION|5.009005||p
+PERL_GCC_BRACE_GROUPS_FORBIDDEN|5.008001||p
+PERL_HASH|5.004000||p
+PERL_INT_MAX|5.004000||p
+PERL_INT_MIN|5.004000||p
+PERL_LONG_MAX|5.004000||p
+PERL_LONG_MIN|5.004000||p
+PERL_MAGIC_arylen|5.007002||p
+PERL_MAGIC_backref|5.007002||p
+PERL_MAGIC_bm|5.007002||p
+PERL_MAGIC_collxfrm|5.007002||p
+PERL_MAGIC_dbfile|5.007002||p
+PERL_MAGIC_dbline|5.007002||p
+PERL_MAGIC_defelem|5.007002||p
+PERL_MAGIC_envelem|5.007002||p
+PERL_MAGIC_env|5.007002||p
+PERL_MAGIC_ext|5.007002||p
+PERL_MAGIC_fm|5.007002||p
+PERL_MAGIC_glob|5.009005||p
+PERL_MAGIC_isaelem|5.007002||p
+PERL_MAGIC_isa|5.007002||p
+PERL_MAGIC_mutex|5.009005||p
+PERL_MAGIC_nkeys|5.007002||p
+PERL_MAGIC_overload_elem|5.007002||p
+PERL_MAGIC_overload_table|5.007002||p
+PERL_MAGIC_overload|5.007002||p
+PERL_MAGIC_pos|5.007002||p
+PERL_MAGIC_qr|5.007002||p
+PERL_MAGIC_regdata|5.007002||p
+PERL_MAGIC_regdatum|5.007002||p
+PERL_MAGIC_regex_global|5.007002||p
+PERL_MAGIC_shared_scalar|5.007003||p
+PERL_MAGIC_shared|5.007003||p
+PERL_MAGIC_sigelem|5.007002||p
+PERL_MAGIC_sig|5.007002||p
+PERL_MAGIC_substr|5.007002||p
+PERL_MAGIC_sv|5.007002||p
+PERL_MAGIC_taint|5.007002||p
+PERL_MAGIC_tiedelem|5.007002||p
+PERL_MAGIC_tiedscalar|5.007002||p
+PERL_MAGIC_tied|5.007002||p
+PERL_MAGIC_utf8|5.008001||p
+PERL_MAGIC_uvar_elem|5.007003||p
+PERL_MAGIC_uvar|5.007002||p
+PERL_MAGIC_vec|5.007002||p
+PERL_MAGIC_vstring|5.008001||p
+PERL_QUAD_MAX|5.004000||p
+PERL_QUAD_MIN|5.004000||p
+PERL_REVISION|5.006000||p
+PERL_SCAN_ALLOW_UNDERSCORES|5.007003||p
+PERL_SCAN_DISALLOW_PREFIX|5.007003||p
+PERL_SCAN_GREATER_THAN_UV_MAX|5.007003||p
+PERL_SCAN_SILENT_ILLDIGIT|5.008001||p
+PERL_SHORT_MAX|5.004000||p
+PERL_SHORT_MIN|5.004000||p
+PERL_SIGNALS_UNSAFE_FLAG|5.008001||p
+PERL_SUBVERSION|5.006000||p
+PERL_UCHAR_MAX|5.004000||p
+PERL_UCHAR_MIN|5.004000||p
+PERL_UINT_MAX|5.004000||p
+PERL_UINT_MIN|5.004000||p
+PERL_ULONG_MAX|5.004000||p
+PERL_ULONG_MIN|5.004000||p
+PERL_UNUSED_ARG|5.009003||p
+PERL_UNUSED_CONTEXT|5.009004||p
+PERL_UNUSED_DECL|5.007002||p
+PERL_UNUSED_VAR|5.007002||p
+PERL_UQUAD_MAX|5.004000||p
+PERL_UQUAD_MIN|5.004000||p
+PERL_USE_GCC_BRACE_GROUPS|5.009004||p
+PERL_USHORT_MAX|5.004000||p
+PERL_USHORT_MIN|5.004000||p
+PERL_VERSION|5.006000||p
+PL_DBsignal|5.005000||p
+PL_DBsingle|||pn
+PL_DBsub|||pn
+PL_DBtrace|||pn
+PL_Sv|5.005000||p
+PL_compiling|5.004050||p
+PL_copline|5.009005||p
+PL_curcop|5.004050||p
+PL_curstash|5.004050||p
+PL_debstash|5.004050||p
+PL_defgv|5.004050||p
+PL_diehook|5.004050||p
+PL_dirty|5.004050||p
+PL_dowarn|||pn
+PL_errgv|5.004050||p
+PL_expect|5.009005||p
+PL_hexdigit|5.005000||p
+PL_hints|5.005000||p
+PL_last_in_gv|||n
+PL_laststatval|5.005000||p
+PL_modglobal||5.005000|n
+PL_na|5.004050||pn
+PL_no_modify|5.006000||p
+PL_ofs_sv|||n
+PL_perl_destruct_level|5.004050||p
+PL_perldb|5.004050||p
+PL_ppaddr|5.006000||p
+PL_rsfp_filters|5.004050||p
+PL_rsfp|5.004050||p
+PL_rs|||n
+PL_signals|5.008001||p
+PL_stack_base|5.004050||p
+PL_stack_sp|5.004050||p
+PL_statcache|5.005000||p
+PL_stdingv|5.004050||p
+PL_sv_arenaroot|5.004050||p
+PL_sv_no|5.004050||pn
+PL_sv_undef|5.004050||pn
+PL_sv_yes|5.004050||pn
+PL_tainted|5.004050||p
+PL_tainting|5.004050||p
+POP_MULTICALL||5.009005|
+POPi|||n
+POPl|||n
+POPn|||n
+POPpbytex||5.007001|n
+POPpx||5.005030|n
+POPp|||n
+POPs|||n
+PTR2IV|5.006000||p
+PTR2NV|5.006000||p
+PTR2UV|5.006000||p
+PTR2ul|5.007001||p
+PTRV|5.006000||p
+PUSHMARK|||
+PUSH_MULTICALL||5.009005|
+PUSHi|||
+PUSHmortal|5.009002||p
+PUSHn|||
+PUSHp|||
+PUSHs|||
+PUSHu|5.004000||p
+PUTBACK|||
+PerlIO_clearerr||5.007003|
+PerlIO_close||5.007003|
+PerlIO_context_layers||5.009004|
+PerlIO_eof||5.007003|
+PerlIO_error||5.007003|
+PerlIO_fileno||5.007003|
+PerlIO_fill||5.007003|
+PerlIO_flush||5.007003|
+PerlIO_get_base||5.007003|
+PerlIO_get_bufsiz||5.007003|
+PerlIO_get_cnt||5.007003|
+PerlIO_get_ptr||5.007003|
+PerlIO_read||5.007003|
+PerlIO_seek||5.007003|
+PerlIO_set_cnt||5.007003|
+PerlIO_set_ptrcnt||5.007003|
+PerlIO_setlinebuf||5.007003|
+PerlIO_stderr||5.007003|
+PerlIO_stdin||5.007003|
+PerlIO_stdout||5.007003|
+PerlIO_tell||5.007003|
+PerlIO_unread||5.007003|
+PerlIO_write||5.007003|
+Perl_signbit||5.009005|n
+PoisonFree|5.009004||p
+PoisonNew|5.009004||p
+PoisonWith|5.009004||p
+Poison|5.008000||p
+RETVAL|||n
+Renewc|||
+Renew|||
+SAVECLEARSV|||
+SAVECOMPPAD|||
+SAVEPADSV|||
+SAVETMPS|||
+SAVE_DEFSV|5.004050||p
+SPAGAIN|||
+SP|||
+START_EXTERN_C|5.005000||p
+START_MY_CXT|5.007003||p
+STMT_END|||p
+STMT_START|||p
+STR_WITH_LEN|5.009003||p
+ST|||
+SV_CONST_RETURN|5.009003||p
+SV_COW_DROP_PV|5.008001||p
+SV_COW_SHARED_HASH_KEYS|5.009005||p
+SV_GMAGIC|5.007002||p
+SV_HAS_TRAILING_NUL|5.009004||p
+SV_IMMEDIATE_UNREF|5.007001||p
+SV_MUTABLE_RETURN|5.009003||p
+SV_NOSTEAL|5.009002||p
+SV_SMAGIC|5.009003||p
+SV_UTF8_NO_ENCODING|5.008001||p
+SVf|5.006000||p
+SVt_IV|||
+SVt_NV|||
+SVt_PVAV|||
+SVt_PVCV|||
+SVt_PVHV|||
+SVt_PVMG|||
+SVt_PV|||
+Safefree|||
+Slab_Alloc|||
+Slab_Free|||
+Slab_to_rw|||
+StructCopy|||
+SvCUR_set|||
+SvCUR|||
+SvEND|||
+SvGAMAGIC||5.006001|
+SvGETMAGIC|5.004050||p
+SvGROW|||
+SvIOK_UV||5.006000|
+SvIOK_notUV||5.006000|
+SvIOK_off|||
+SvIOK_only_UV||5.006000|
+SvIOK_only|||
+SvIOK_on|||
+SvIOKp|||
+SvIOK|||
+SvIVX|||
+SvIV_nomg|5.009001||p
+SvIV_set|||
+SvIVx|||
+SvIV|||
+SvIsCOW_shared_hash||5.008003|
+SvIsCOW||5.008003|
+SvLEN_set|||
+SvLEN|||
+SvLOCK||5.007003|
+SvMAGIC_set|5.009003||p
+SvNIOK_off|||
+SvNIOKp|||
+SvNIOK|||
+SvNOK_off|||
+SvNOK_only|||
+SvNOK_on|||
+SvNOKp|||
+SvNOK|||
+SvNVX|||
+SvNV_set|||
+SvNVx|||
+SvNV|||
+SvOK|||
+SvOOK|||
+SvPOK_off|||
+SvPOK_only_UTF8||5.006000|
+SvPOK_only|||
+SvPOK_on|||
+SvPOKp|||
+SvPOK|||
+SvPVX_const|5.009003||p
+SvPVX_mutable|5.009003||p
+SvPVX|||
+SvPV_const|5.009003||p
+SvPV_flags_const_nolen|5.009003||p
+SvPV_flags_const|5.009003||p
+SvPV_flags_mutable|5.009003||p
+SvPV_flags|5.007002||p
+SvPV_force_flags_mutable|5.009003||p
+SvPV_force_flags_nolen|5.009003||p
+SvPV_force_flags|5.007002||p
+SvPV_force_mutable|5.009003||p
+SvPV_force_nolen|5.009003||p
+SvPV_force_nomg_nolen|5.009003||p
+SvPV_force_nomg|5.007002||p
+SvPV_force|||p
+SvPV_mutable|5.009003||p
+SvPV_nolen_const|5.009003||p
+SvPV_nolen|5.006000||p
+SvPV_nomg_const_nolen|5.009003||p
+SvPV_nomg_const|5.009003||p
+SvPV_nomg|5.007002||p
+SvPV_set|||
+SvPVbyte_force||5.009002|
+SvPVbyte_nolen||5.006000|
+SvPVbytex_force||5.006000|
+SvPVbytex||5.006000|
+SvPVbyte|5.006000||p
+SvPVutf8_force||5.006000|
+SvPVutf8_nolen||5.006000|
+SvPVutf8x_force||5.006000|
+SvPVutf8x||5.006000|
+SvPVutf8||5.006000|
+SvPVx|||
+SvPV|||
+SvREFCNT_dec|||
+SvREFCNT_inc_NN|5.009004||p
+SvREFCNT_inc_simple_NN|5.009004||p
+SvREFCNT_inc_simple_void_NN|5.009004||p
+SvREFCNT_inc_simple_void|5.009004||p
+SvREFCNT_inc_simple|5.009004||p
+SvREFCNT_inc_void_NN|5.009004||p
+SvREFCNT_inc_void|5.009004||p
+SvREFCNT_inc|||p
+SvREFCNT|||
+SvROK_off|||
+SvROK_on|||
+SvROK|||
+SvRV_set|5.009003||p
+SvRV|||
+SvRXOK||5.009005|
+SvRX||5.009005|
+SvSETMAGIC|||
+SvSHARED_HASH|5.009003||p
+SvSHARE||5.007003|
+SvSTASH_set|5.009003||p
+SvSTASH|||
+SvSetMagicSV_nosteal||5.004000|
+SvSetMagicSV||5.004000|
+SvSetSV_nosteal||5.004000|
+SvSetSV|||
+SvTAINTED_off||5.004000|
+SvTAINTED_on||5.004000|
+SvTAINTED||5.004000|
+SvTAINT|||
+SvTRUE|||
+SvTYPE|||
+SvUNLOCK||5.007003|
+SvUOK|5.007001|5.006000|p
+SvUPGRADE|||
+SvUTF8_off||5.006000|
+SvUTF8_on||5.006000|
+SvUTF8||5.006000|
+SvUVXx|5.004000||p
+SvUVX|5.004000||p
+SvUV_nomg|5.009001||p
+SvUV_set|5.009003||p
+SvUVx|5.004000||p
+SvUV|5.004000||p
+SvVOK||5.008001|
+SvVSTRING_mg|5.009004||p
+THIS|||n
+UNDERBAR|5.009002||p
+UTF8_MAXBYTES|5.009002||p
+UVSIZE|5.006000||p
+UVTYPE|5.006000||p
+UVXf|5.007001||p
+UVof|5.006000||p
+UVuf|5.006000||p
+UVxf|5.006000||p
+WARN_ALL|5.006000||p
+WARN_AMBIGUOUS|5.006000||p
+WARN_ASSERTIONS|5.009005||p
+WARN_BAREWORD|5.006000||p
+WARN_CLOSED|5.006000||p
+WARN_CLOSURE|5.006000||p
+WARN_DEBUGGING|5.006000||p
+WARN_DEPRECATED|5.006000||p
+WARN_DIGIT|5.006000||p
+WARN_EXEC|5.006000||p
+WARN_EXITING|5.006000||p
+WARN_GLOB|5.006000||p
+WARN_INPLACE|5.006000||p
+WARN_INTERNAL|5.006000||p
+WARN_IO|5.006000||p
+WARN_LAYER|5.008000||p
+WARN_MALLOC|5.006000||p
+WARN_MISC|5.006000||p
+WARN_NEWLINE|5.006000||p
+WARN_NUMERIC|5.006000||p
+WARN_ONCE|5.006000||p
+WARN_OVERFLOW|5.006000||p
+WARN_PACK|5.006000||p
+WARN_PARENTHESIS|5.006000||p
+WARN_PIPE|5.006000||p
+WARN_PORTABLE|5.006000||p
+WARN_PRECEDENCE|5.006000||p
+WARN_PRINTF|5.006000||p
+WARN_PROTOTYPE|5.006000||p
+WARN_QW|5.006000||p
+WARN_RECURSION|5.006000||p
+WARN_REDEFINE|5.006000||p
+WARN_REGEXP|5.006000||p
+WARN_RESERVED|5.006000||p
+WARN_SEMICOLON|5.006000||p
+WARN_SEVERE|5.006000||p
+WARN_SIGNAL|5.006000||p
+WARN_SUBSTR|5.006000||p
+WARN_SYNTAX|5.006000||p
+WARN_TAINT|5.006000||p
+WARN_THREADS|5.008000||p
+WARN_UNINITIALIZED|5.006000||p
+WARN_UNOPENED|5.006000||p
+WARN_UNPACK|5.006000||p
+WARN_UNTIE|5.006000||p
+WARN_UTF8|5.006000||p
+WARN_VOID|5.006000||p
+XCPT_CATCH|5.009002||p
+XCPT_RETHROW|5.009002||p
+XCPT_TRY_END|5.009002||p
+XCPT_TRY_START|5.009002||p
+XPUSHi|||
+XPUSHmortal|5.009002||p
+XPUSHn|||
+XPUSHp|||
+XPUSHs|||
+XPUSHu|5.004000||p
+XSRETURN_EMPTY|||
+XSRETURN_IV|||
+XSRETURN_NO|||
+XSRETURN_NV|||
+XSRETURN_PV|||
+XSRETURN_UNDEF|||
+XSRETURN_UV|5.008001||p
+XSRETURN_YES|||
+XSRETURN|||p
+XST_mIV|||
+XST_mNO|||
+XST_mNV|||
+XST_mPV|||
+XST_mUNDEF|||
+XST_mUV|5.008001||p
+XST_mYES|||
+XS_VERSION_BOOTCHECK|||
+XS_VERSION|||
+XSprePUSH|5.006000||p
+XS|||
+ZeroD|5.009002||p
+Zero|||
+_aMY_CXT|5.007003||p
+_pMY_CXT|5.007003||p
+aMY_CXT_|5.007003||p
+aMY_CXT|5.007003||p
+aTHXR_|5.009005||p
+aTHXR|5.009005||p
+aTHX_|5.006000||p
+aTHX|5.006000||p
+add_data|||n
+addmad|||
+allocmy|||
+amagic_call|||
+amagic_cmp_locale|||
+amagic_cmp|||
+amagic_i_ncmp|||
+amagic_ncmp|||
+any_dup|||
+ao|||
+append_elem|||
+append_list|||
+append_madprops|||
+apply_attrs_my|||
+apply_attrs_string||5.006001|
+apply_attrs|||
+apply|||
+atfork_lock||5.007003|n
+atfork_unlock||5.007003|n
+av_arylen_p||5.009003|
+av_clear|||
+av_create_and_push||5.009005|
+av_create_and_unshift_one||5.009005|
+av_delete||5.006000|
+av_exists||5.006000|
+av_extend|||
+av_fake|||
+av_fetch|||
+av_fill|||
+av_len|||
+av_make|||
+av_pop|||
+av_push|||
+av_reify|||
+av_shift|||
+av_store|||
+av_undef|||
+av_unshift|||
+ax|||n
+bad_type|||
+bind_match|||
+block_end|||
+block_gimme||5.004000|
+block_start|||
+boolSV|5.004000||p
+boot_core_PerlIO|||
+boot_core_UNIVERSAL|||
+boot_core_mro|||
+boot_core_xsutils|||
+bytes_from_utf8||5.007001|
+bytes_to_uni|||n
+bytes_to_utf8||5.006001|
+call_argv|5.006000||p
+call_atexit||5.006000|
+call_list||5.004000|
+call_method|5.006000||p
+call_pv|5.006000||p
+call_sv|5.006000||p
+calloc||5.007002|n
+cando|||
+cast_i32||5.006000|
+cast_iv||5.006000|
+cast_ulong||5.006000|
+cast_uv||5.006000|
+check_type_and_open|||
+check_uni|||
+checkcomma|||
+checkposixcc|||
+ckWARN|5.006000||p
+ck_anoncode|||
+ck_bitop|||
+ck_concat|||
+ck_defined|||
+ck_delete|||
+ck_die|||
+ck_eof|||
+ck_eval|||
+ck_exec|||
+ck_exists|||
+ck_exit|||
+ck_ftst|||
+ck_fun|||
+ck_glob|||
+ck_grep|||
+ck_index|||
+ck_join|||
+ck_lengthconst|||
+ck_lfun|||
+ck_listiob|||
+ck_match|||
+ck_method|||
+ck_null|||
+ck_open|||
+ck_readline|||
+ck_repeat|||
+ck_require|||
+ck_retarget|||
+ck_return|||
+ck_rfun|||
+ck_rvconst|||
+ck_sassign|||
+ck_select|||
+ck_shift|||
+ck_sort|||
+ck_spair|||
+ck_split|||
+ck_subr|||
+ck_substr|||
+ck_svconst|||
+ck_trunc|||
+ck_unpack|||
+ckwarn_d||5.009003|
+ckwarn||5.009003|
+cl_and|||n
+cl_anything|||n
+cl_init_zero|||n
+cl_init|||n
+cl_is_anything|||n
+cl_or|||n
+clear_placeholders|||
+closest_cop|||
+convert|||
+cop_free|||
+cr_textfilter|||
+create_eval_scope|||
+croak_nocontext|||vn
+croak|||v
+csighandler||5.009003|n
+curmad|||
+custom_op_desc||5.007003|
+custom_op_name||5.007003|
+cv_ckproto_len|||
+cv_ckproto|||
+cv_clone|||
+cv_const_sv||5.004000|
+cv_dump|||
+cv_undef|||
+cx_dump||5.005000|
+cx_dup|||
+cxinc|||
+dAXMARK|5.009003||p
+dAX|5.007002||p
+dITEMS|5.007002||p
+dMARK|||
+dMULTICALL||5.009003|
+dMY_CXT_SV|5.007003||p
+dMY_CXT|5.007003||p
+dNOOP|5.006000||p
+dORIGMARK|||
+dSP|||
+dTHR|5.004050||p
+dTHXR|5.009005||p
+dTHXa|5.006000||p
+dTHXoa|5.006000||p
+dTHX|5.006000||p
+dUNDERBAR|5.009002||p
+dVAR|5.009003||p
+dXCPT|5.009002||p
+dXSARGS|||
+dXSI32|||
+dXSTARG|5.006000||p
+deb_curcv|||
+deb_nocontext|||vn
+deb_stack_all|||
+deb_stack_n|||
+debop||5.005000|
+debprofdump||5.005000|
+debprof|||
+debstackptrs||5.007003|
+debstack||5.007003|
+debug_start_match|||
+deb||5.007003|v
+del_sv|||
+delete_eval_scope|||
+delimcpy||5.004000|
+deprecate_old|||
+deprecate|||
+despatch_signals||5.007001|
+destroy_matcher|||
+die_nocontext|||vn
+die_where|||
+die|||v
+dirp_dup|||
+div128|||
+djSP|||
+do_aexec5|||
+do_aexec|||
+do_aspawn|||
+do_binmode||5.004050|
+do_chomp|||
+do_chop|||
+do_close|||
+do_dump_pad|||
+do_eof|||
+do_exec3|||
+do_execfree|||
+do_exec|||
+do_gv_dump||5.006000|
+do_gvgv_dump||5.006000|
+do_hv_dump||5.006000|
+do_ipcctl|||
+do_ipcget|||
+do_join|||
+do_kv|||
+do_magic_dump||5.006000|
+do_msgrcv|||
+do_msgsnd|||
+do_oddball|||
+do_op_dump||5.006000|
+do_op_xmldump|||
+do_open9||5.006000|
+do_openn||5.007001|
+do_open||5.004000|
+do_pipe|||
+do_pmop_dump||5.006000|
+do_pmop_xmldump|||
+do_print|||
+do_readline|||
+do_seek|||
+do_semop|||
+do_shmio|||
+do_smartmatch|||
+do_spawn_nowait|||
+do_spawn|||
+do_sprintf|||
+do_sv_dump||5.006000|
+do_sysseek|||
+do_tell|||
+do_trans_complex_utf8|||
+do_trans_complex|||
+do_trans_count_utf8|||
+do_trans_count|||
+do_trans_simple_utf8|||
+do_trans_simple|||
+do_trans|||
+do_vecget|||
+do_vecset|||
+do_vop|||
+docatch_body|||
+docatch|||
+doeval|||
+dofile|||
+dofindlabel|||
+doform|||
+doing_taint||5.008001|n
+dooneliner|||
+doopen_pm|||
+doparseform|||
+dopoptoeval|||
+dopoptogiven|||
+dopoptolabel|||
+dopoptoloop|||
+dopoptosub_at|||
+dopoptosub|||
+dopoptowhen|||
+doref||5.009003|
+dounwind|||
+dowantarray|||
+dump_all||5.006000|
+dump_eval||5.006000|
+dump_exec_pos|||
+dump_fds|||
+dump_form||5.006000|
+dump_indent||5.006000|v
+dump_mstats|||
+dump_packsubs||5.006000|
+dump_sub||5.006000|
+dump_sv_child|||
+dump_trie_interim_list|||
+dump_trie_interim_table|||
+dump_trie|||
+dump_vindent||5.006000|
+dumpuntil|||
+dup_attrlist|||
+emulate_cop_io|||
+emulate_eaccess|||
+eval_pv|5.006000||p
+eval_sv|5.006000||p
+exec_failed|||
+expect_number|||
+fbm_compile||5.005000|
+fbm_instr||5.005000|
+fd_on_nosuid_fs|||
+feature_is_enabled|||
+filter_add|||
+filter_del|||
+filter_gets|||
+filter_read|||
+find_and_forget_pmops|||
+find_array_subscript|||
+find_beginning|||
+find_byclass|||
+find_hash_subscript|||
+find_in_my_stash|||
+find_runcv||5.008001|
+find_rundefsvoffset||5.009002|
+find_script|||
+find_uninit_var|||
+first_symbol|||n
+fold_constants|||
+forbid_setid|||
+force_ident|||
+force_list|||
+force_next|||
+force_version|||
+force_word|||
+forget_pmop|||
+form_nocontext|||vn
+form||5.004000|v
+fp_dup|||
+fprintf_nocontext|||vn
+free_global_struct|||
+free_tied_hv_pool|||
+free_tmps|||
+gen_constant_list|||
+get_arena|||
+get_av|5.006000||p
+get_context||5.006000|n
+get_cvn_flags||5.009005|
+get_cv|5.006000||p
+get_db_sub|||
+get_debug_opts|||
+get_hash_seed|||
+get_hv|5.006000||p
+get_mstats|||
+get_no_modify|||
+get_num|||
+get_op_descs||5.005000|
+get_op_names||5.005000|
+get_opargs|||
+get_ppaddr||5.006000|
+get_re_arg|||
+get_sv|5.006000||p
+get_vtbl||5.005030|
+getcwd_sv||5.007002|
+getenv_len|||
+glob_2number|||
+glob_2pv|||
+glob_assign_glob|||
+glob_assign_ref|||
+gp_dup|||
+gp_free|||
+gp_ref|||
+grok_bin|5.007003||p
+grok_hex|5.007003||p
+grok_number|5.007002||p
+grok_numeric_radix|5.007002||p
+grok_oct|5.007003||p
+group_end|||
+gv_AVadd|||
+gv_HVadd|||
+gv_IOadd|||
+gv_SVadd|||
+gv_autoload4||5.004000|
+gv_check|||
+gv_const_sv||5.009003|
+gv_dump||5.006000|
+gv_efullname3||5.004000|
+gv_efullname4||5.006001|
+gv_efullname|||
+gv_ename|||
+gv_fetchfile_flags||5.009005|
+gv_fetchfile|||
+gv_fetchmeth_autoload||5.007003|
+gv_fetchmethod_autoload||5.004000|
+gv_fetchmethod|||
+gv_fetchmeth|||
+gv_fetchpvn_flags||5.009002|
+gv_fetchpv|||
+gv_fetchsv||5.009002|
+gv_fullname3||5.004000|
+gv_fullname4||5.006001|
+gv_fullname|||
+gv_handler||5.007001|
+gv_init_sv|||
+gv_init|||
+gv_name_set||5.009004|
+gv_stashpvn|5.004000||p
+gv_stashpvs||5.009003|
+gv_stashpv|||
+gv_stashsv|||
+he_dup|||
+hek_dup|||
+hfreeentries|||
+hsplit|||
+hv_assert||5.009005|
+hv_auxinit|||n
+hv_backreferences_p|||
+hv_clear_placeholders||5.009001|
+hv_clear|||
+hv_copy_hints_hv|||
+hv_delayfree_ent||5.004000|
+hv_delete_common|||
+hv_delete_ent||5.004000|
+hv_delete|||
+hv_eiter_p||5.009003|
+hv_eiter_set||5.009003|
+hv_exists_ent||5.004000|
+hv_exists|||
+hv_fetch_common|||
+hv_fetch_ent||5.004000|
+hv_fetchs|5.009003||p
+hv_fetch|||
+hv_free_ent||5.004000|
+hv_iterinit|||
+hv_iterkeysv||5.004000|
+hv_iterkey|||
+hv_iternext_flags||5.008000|
+hv_iternextsv|||
+hv_iternext|||
+hv_iterval|||
+hv_kill_backrefs|||
+hv_ksplit||5.004000|
+hv_magic_check|||n
+hv_magic_uvar_xkey|||
+hv_magic|||
+hv_name_set||5.009003|
+hv_notallowed|||
+hv_placeholders_get||5.009003|
+hv_placeholders_p||5.009003|
+hv_placeholders_set||5.009003|
+hv_riter_p||5.009003|
+hv_riter_set||5.009003|
+hv_scalar||5.009001|
+hv_store_ent||5.004000|
+hv_store_flags||5.008000|
+hv_stores|5.009004||p
+hv_store|||
+hv_undef|||
+ibcmp_locale||5.004000|
+ibcmp_utf8||5.007003|
+ibcmp|||
+incl_perldb|||
+incline|||
+incpush_if_exists|||
+incpush|||
+ingroup|||
+init_argv_symbols|||
+init_debugger|||
+init_global_struct|||
+init_i18nl10n||5.006000|
+init_i18nl14n||5.006000|
+init_ids|||
+init_interp|||
+init_main_stash|||
+init_perllib|||
+init_postdump_symbols|||
+init_predump_symbols|||
+init_stacks||5.005000|
+init_tm||5.007002|
+instr|||
+intro_my|||
+intuit_method|||
+intuit_more|||
+invert|||
+io_close|||
+isALNUM|||
+isALPHA|||
+isDIGIT|||
+isLOWER|||
+isSPACE|||
+isUPPER|||
+is_an_int|||
+is_gv_magical_sv|||
+is_gv_magical|||
+is_handle_constructor|||n
+is_list_assignment|||
+is_lvalue_sub||5.007001|
+is_uni_alnum_lc||5.006000|
+is_uni_alnumc_lc||5.006000|
+is_uni_alnumc||5.006000|
+is_uni_alnum||5.006000|
+is_uni_alpha_lc||5.006000|
+is_uni_alpha||5.006000|
+is_uni_ascii_lc||5.006000|
+is_uni_ascii||5.006000|
+is_uni_cntrl_lc||5.006000|
+is_uni_cntrl||5.006000|
+is_uni_digit_lc||5.006000|
+is_uni_digit||5.006000|
+is_uni_graph_lc||5.006000|
+is_uni_graph||5.006000|
+is_uni_idfirst_lc||5.006000|
+is_uni_idfirst||5.006000|
+is_uni_lower_lc||5.006000|
+is_uni_lower||5.006000|
+is_uni_print_lc||5.006000|
+is_uni_print||5.006000|
+is_uni_punct_lc||5.006000|
+is_uni_punct||5.006000|
+is_uni_space_lc||5.006000|
+is_uni_space||5.006000|
+is_uni_upper_lc||5.006000|
+is_uni_upper||5.006000|
+is_uni_xdigit_lc||5.006000|
+is_uni_xdigit||5.006000|
+is_utf8_alnumc||5.006000|
+is_utf8_alnum||5.006000|
+is_utf8_alpha||5.006000|
+is_utf8_ascii||5.006000|
+is_utf8_char_slow|||n
+is_utf8_char||5.006000|
+is_utf8_cntrl||5.006000|
+is_utf8_common|||
+is_utf8_digit||5.006000|
+is_utf8_graph||5.006000|
+is_utf8_idcont||5.008000|
+is_utf8_idfirst||5.006000|
+is_utf8_lower||5.006000|
+is_utf8_mark||5.006000|
+is_utf8_print||5.006000|
+is_utf8_punct||5.006000|
+is_utf8_space||5.006000|
+is_utf8_string_loclen||5.009003|
+is_utf8_string_loc||5.008001|
+is_utf8_string||5.006001|
+is_utf8_upper||5.006000|
+is_utf8_xdigit||5.006000|
+isa_lookup|||
+items|||n
+ix|||n
+jmaybe|||
+join_exact|||
+keyword|||
+leave_scope|||
+lex_end|||
+lex_start|||
+linklist|||
+listkids|||
+list|||
+load_module_nocontext|||vn
+load_module|5.006000||pv
+localize|||
+looks_like_bool|||
+looks_like_number|||
+lop|||
+mPUSHi|5.009002||p
+mPUSHn|5.009002||p
+mPUSHp|5.009002||p
+mPUSHu|5.009002||p
+mXPUSHi|5.009002||p
+mXPUSHn|5.009002||p
+mXPUSHp|5.009002||p
+mXPUSHu|5.009002||p
+mad_free|||
+madlex|||
+madparse|||
+magic_clear_all_env|||
+magic_clearenv|||
+magic_clearhint|||
+magic_clearpack|||
+magic_clearsig|||
+magic_dump||5.006000|
+magic_existspack|||
+magic_freearylen_p|||
+magic_freeovrld|||
+magic_freeregexp|||
+magic_getarylen|||
+magic_getdefelem|||
+magic_getnkeys|||
+magic_getpack|||
+magic_getpos|||
+magic_getsig|||
+magic_getsubstr|||
+magic_gettaint|||
+magic_getuvar|||
+magic_getvec|||
+magic_get|||
+magic_killbackrefs|||
+magic_len|||
+magic_methcall|||
+magic_methpack|||
+magic_nextpack|||
+magic_regdata_cnt|||
+magic_regdatum_get|||
+magic_regdatum_set|||
+magic_scalarpack|||
+magic_set_all_env|||
+magic_setamagic|||
+magic_setarylen|||
+magic_setbm|||
+magic_setcollxfrm|||
+magic_setdbline|||
+magic_setdefelem|||
+magic_setenv|||
+magic_setfm|||
+magic_setglob|||
+magic_sethint|||
+magic_setisa|||
+magic_setmglob|||
+magic_setnkeys|||
+magic_setpack|||
+magic_setpos|||
+magic_setregexp|||
+magic_setsig|||
+magic_setsubstr|||
+magic_settaint|||
+magic_setutf8|||
+magic_setuvar|||
+magic_setvec|||
+magic_set|||
+magic_sizepack|||
+magic_wipepack|||
+magicname|||
+make_matcher|||
+make_trie_failtable|||
+make_trie|||
+malloced_size|||n
+malloc||5.007002|n
+markstack_grow|||
+matcher_matches_sv|||
+measure_struct|||
+memEQ|5.004000||p
+memNE|5.004000||p
+mem_collxfrm|||
+mess_alloc|||
+mess_nocontext|||vn
+mess||5.006000|v
+method_common|||
+mfree||5.007002|n
+mg_clear|||
+mg_copy|||
+mg_dup|||
+mg_find|||
+mg_free|||
+mg_get|||
+mg_length||5.005000|
+mg_localize|||
+mg_magical|||
+mg_set|||
+mg_size||5.005000|
+mini_mktime||5.007002|
+missingterm|||
+mode_from_discipline|||
+modkids|||
+mod|||
+more_bodies|||
+more_sv|||
+moreswitches|||
+mro_get_linear_isa_c3||5.009005|
+mro_get_linear_isa_dfs||5.009005|
+mro_get_linear_isa||5.009005|
+mro_isa_changed_in|||
+mro_meta_dup|||
+mro_meta_init|||
+mro_method_changed_in||5.009005|
+mul128|||
+mulexp10|||n
+my_atof2||5.007002|
+my_atof||5.006000|
+my_attrs|||
+my_bcopy|||n
+my_betoh16|||n
+my_betoh32|||n
+my_betoh64|||n
+my_betohi|||n
+my_betohl|||n
+my_betohs|||n
+my_bzero|||n
+my_chsize|||
+my_clearenv|||
+my_cxt_index|||
+my_cxt_init|||
+my_dirfd||5.009005|
+my_exit_jump|||
+my_exit|||
+my_failure_exit||5.004000|
+my_fflush_all||5.006000|
+my_fork||5.007003|n
+my_htobe16|||n
+my_htobe32|||n
+my_htobe64|||n
+my_htobei|||n
+my_htobel|||n
+my_htobes|||n
+my_htole16|||n
+my_htole32|||n
+my_htole64|||n
+my_htolei|||n
+my_htolel|||n
+my_htoles|||n
+my_htonl|||
+my_kid|||
+my_letoh16|||n
+my_letoh32|||n
+my_letoh64|||n
+my_letohi|||n
+my_letohl|||n
+my_letohs|||n
+my_lstat|||
+my_memcmp||5.004000|n
+my_memset|||n
+my_ntohl|||
+my_pclose||5.004000|
+my_popen_list||5.007001|
+my_popen||5.004000|
+my_setenv|||
+my_snprintf|5.009004||pvn
+my_socketpair||5.007003|n
+my_sprintf||5.009003|vn
+my_stat|||
+my_strftime||5.007002|
+my_strlcat|5.009004||pn
+my_strlcpy|5.009004||pn
+my_swabn|||n
+my_swap|||
+my_unexec|||
+my_vsnprintf||5.009004|n
+my|||
+need_utf8|||n
+newANONATTRSUB||5.006000|
+newANONHASH|||
+newANONLIST|||
+newANONSUB|||
+newASSIGNOP|||
+newATTRSUB||5.006000|
+newAVREF|||
+newAV|||
+newBINOP|||
+newCONDOP|||
+newCONSTSUB|5.004050||p
+newCVREF|||
+newDEFSVOP|||
+newFORM|||
+newFOROP|||
+newGIVENOP||5.009003|
+newGIVWHENOP|||
+newGP|||
+newGVOP|||
+newGVREF|||
+newGVgen|||
+newHVREF|||
+newHVhv||5.005000|
+newHV|||
+newIO|||
+newLISTOP|||
+newLOGOP|||
+newLOOPEX|||
+newLOOPOP|||
+newMADPROP|||
+newMADsv|||
+newMYSUB|||
+newNULLLIST|||
+newOP|||
+newPADOP|||
+newPMOP|||
+newPROG|||
+newPVOP|||
+newRANGE|||
+newRV_inc|5.004000||p
+newRV_noinc|5.004000||p
+newRV|||
+newSLICEOP|||
+newSTATEOP|||
+newSUB|||
+newSVOP|||
+newSVREF|||
+newSV_type||5.009005|
+newSVhek||5.009003|
+newSViv|||
+newSVnv|||
+newSVpvf_nocontext|||vn
+newSVpvf||5.004000|v
+newSVpvn_share|5.007001||p
+newSVpvn|5.004050||p
+newSVpvs_share||5.009003|
+newSVpvs|5.009003||p
+newSVpv|||
+newSVrv|||
+newSVsv|||
+newSVuv|5.006000||p
+newSV|||
+newTOKEN|||
+newUNOP|||
+newWHENOP||5.009003|
+newWHILEOP||5.009003|
+newXS_flags||5.009004|
+newXSproto||5.006000|
+newXS||5.006000|
+new_collate||5.006000|
+new_constant|||
+new_ctype||5.006000|
+new_he|||
+new_logop|||
+new_numeric||5.006000|
+new_stackinfo||5.005000|
+new_version||5.009000|
+new_warnings_bitfield|||
+next_symbol|||
+nextargv|||
+nextchar|||
+ninstr|||
+no_bareword_allowed|||
+no_fh_allowed|||
+no_op|||
+not_a_number|||
+nothreadhook||5.008000|
+nuke_stacks|||
+num_overflow|||n
+offer_nice_chunk|||
+oopsAV|||
+oopsCV|||
+oopsHV|||
+op_clear|||
+op_const_sv|||
+op_dump||5.006000|
+op_free|||
+op_getmad_weak|||
+op_getmad|||
+op_null||5.007002|
+op_refcnt_dec|||
+op_refcnt_inc|||
+op_refcnt_lock||5.009002|
+op_refcnt_unlock||5.009002|
+op_xmldump|||
+open_script|||
+pMY_CXT_|5.007003||p
+pMY_CXT|5.007003||p
+pTHX_|5.006000||p
+pTHX|5.006000||p
+packWARN|5.007003||p
+pack_cat||5.007003|
+pack_rec|||
+package|||
+packlist||5.008001|
+pad_add_anon|||
+pad_add_name|||
+pad_alloc|||
+pad_block_start|||
+pad_check_dup|||
+pad_compname_type|||
+pad_findlex|||
+pad_findmy|||
+pad_fixup_inner_anons|||
+pad_free|||
+pad_leavemy|||
+pad_new|||
+pad_peg|||n
+pad_push|||
+pad_reset|||
+pad_setsv|||
+pad_sv||5.009005|
+pad_swipe|||
+pad_tidy|||
+pad_undef|||
+parse_body|||
+parse_unicode_opts|||
+parser_dup|||
+parser_free|||
+path_is_absolute|||n
+peep|||
+pending_Slabs_to_ro|||
+perl_alloc_using|||n
+perl_alloc|||n
+perl_clone_using|||n
+perl_clone|||n
+perl_construct|||n
+perl_destruct||5.007003|n
+perl_free|||n
+perl_parse||5.006000|n
+perl_run|||n
+pidgone|||
+pm_description|||
+pmflag|||
+pmop_dump||5.006000|
+pmop_xmldump|||
+pmruntime|||
+pmtrans|||
+pop_scope|||
+pregcomp||5.009005|
+pregexec|||
+pregfree|||
+prepend_elem|||
+prepend_madprops|||
+printbuf|||
+printf_nocontext|||vn
+process_special_blocks|||
+ptr_table_clear||5.009005|
+ptr_table_fetch||5.009005|
+ptr_table_find|||n
+ptr_table_free||5.009005|
+ptr_table_new||5.009005|
+ptr_table_split||5.009005|
+ptr_table_store||5.009005|
+push_scope|||
+put_byte|||
+pv_display||5.006000|
+pv_escape||5.009004|
+pv_pretty||5.009004|
+pv_uni_display||5.007003|
+qerror|||
+qsortsvu|||
+re_compile||5.009005|
+re_croak2|||
+re_dup|||
+re_intuit_start||5.009005|
+re_intuit_string||5.006000|
+readpipe_override|||
+realloc||5.007002|n
+reentrant_free|||
+reentrant_init|||
+reentrant_retry|||vn
+reentrant_size|||
+ref_array_or_hash|||
+refcounted_he_chain_2hv|||
+refcounted_he_fetch|||
+refcounted_he_free|||
+refcounted_he_new|||
+refcounted_he_value|||
+refkids|||
+refto|||
+ref||5.009003|
+reg_check_named_buff_matched|||
+reg_named_buff_all||5.009005|
+reg_named_buff_exists||5.009005|
+reg_named_buff_fetch||5.009005|
+reg_named_buff_firstkey||5.009005|
+reg_named_buff_iter|||
+reg_named_buff_nextkey||5.009005|
+reg_named_buff_scalar||5.009005|
+reg_named_buff|||
+reg_namedseq|||
+reg_node|||
+reg_numbered_buff_fetch|||
+reg_numbered_buff_length|||
+reg_numbered_buff_store|||
+reg_qr_package|||
+reg_recode|||
+reg_scan_name|||
+reg_skipcomment|||
+reg_stringify||5.009005|
+reg_temp_copy|||
+reganode|||
+regatom|||
+regbranch|||
+regclass_swash||5.009004|
+regclass|||
+regcppop|||
+regcppush|||
+regcurly|||n
+regdump_extflags|||
+regdump||5.005000|
+regdupe_internal|||
+regexec_flags||5.005000|
+regfree_internal||5.009005|
+reghop3|||n
+reghop4|||n
+reghopmaybe3|||n
+reginclass|||
+reginitcolors||5.006000|
+reginsert|||
+regmatch|||
+regnext||5.005000|
+regpiece|||
+regpposixcc|||
+regprop|||
+regrepeat|||
+regtail_study|||
+regtail|||
+regtry|||
+reguni|||
+regwhite|||n
+reg|||
+repeatcpy|||
+report_evil_fh|||
+report_uninit|||
+require_pv||5.006000|
+require_tie_mod|||
+restore_magic|||
+rninstr|||
+rsignal_restore|||
+rsignal_save|||
+rsignal_state||5.004000|
+rsignal||5.004000|
+run_body|||
+run_user_filter|||
+runops_debug||5.005000|
+runops_standard||5.005000|
+rvpv_dup|||
+rxres_free|||
+rxres_restore|||
+rxres_save|||
+safesyscalloc||5.006000|n
+safesysfree||5.006000|n
+safesysmalloc||5.006000|n
+safesysrealloc||5.006000|n
+same_dirent|||
+save_I16||5.004000|
+save_I32|||
+save_I8||5.006000|
+save_aelem||5.004050|
+save_alloc||5.006000|
+save_aptr|||
+save_ary|||
+save_bool||5.008001|
+save_clearsv|||
+save_delete|||
+save_destructor_x||5.006000|
+save_destructor||5.006000|
+save_freeop|||
+save_freepv|||
+save_freesv|||
+save_generic_pvref||5.006001|
+save_generic_svref||5.005030|
+save_gp||5.004000|
+save_hash|||
+save_hek_flags|||n
+save_helem||5.004050|
+save_hints||5.005000|
+save_hptr|||
+save_int|||
+save_item|||
+save_iv||5.005000|
+save_lines|||
+save_list|||
+save_long|||
+save_magic|||
+save_mortalizesv||5.007001|
+save_nogv|||
+save_op|||
+save_padsv||5.007001|
+save_pptr|||
+save_re_context||5.006000|
+save_scalar_at|||
+save_scalar|||
+save_set_svflags||5.009000|
+save_shared_pvref||5.007003|
+save_sptr|||
+save_svref|||
+save_vptr||5.006000|
+savepvn|||
+savepvs||5.009003|
+savepv|||
+savesharedpvn||5.009005|
+savesharedpv||5.007003|
+savestack_grow_cnt||5.008001|
+savestack_grow|||
+savesvpv||5.009002|
+sawparens|||
+scalar_mod_type|||n
+scalarboolean|||
+scalarkids|||
+scalarseq|||
+scalarvoid|||
+scalar|||
+scan_bin||5.006000|
+scan_commit|||
+scan_const|||
+scan_formline|||
+scan_heredoc|||
+scan_hex|||
+scan_ident|||
+scan_inputsymbol|||
+scan_num||5.007001|
+scan_oct|||
+scan_pat|||
+scan_str|||
+scan_subst|||
+scan_trans|||
+scan_version||5.009001|
+scan_vstring||5.009005|
+scan_word|||
+scope|||
+screaminstr||5.005000|
+seed||5.008001|
+sequence_num|||
+sequence_tail|||
+sequence|||
+set_context||5.006000|n
+set_csh|||
+set_numeric_local||5.006000|
+set_numeric_radix||5.006000|
+set_numeric_standard||5.006000|
+setdefout|||
+setenv_getix|||
+share_hek_flags|||
+share_hek||5.004000|
+si_dup|||
+sighandler|||n
+simplify_sort|||
+skipspace0|||
+skipspace1|||
+skipspace2|||
+skipspace|||
+softref2xv|||
+sortcv_stacked|||
+sortcv_xsub|||
+sortcv|||
+sortsv_flags||5.009003|
+sortsv||5.007003|
+space_join_names_mortal|||
+ss_dup|||
+stack_grow|||
+start_force|||
+start_glob|||
+start_subparse||5.004000|
+stashpv_hvname_match||5.009005|
+stdize_locale|||
+strEQ|||
+strGE|||
+strGT|||
+strLE|||
+strLT|||
+strNE|||
+str_to_version||5.006000|
+strip_return|||
+strnEQ|||
+strnNE|||
+study_chunk|||
+sub_crush_depth|||
+sublex_done|||
+sublex_push|||
+sublex_start|||
+sv_2bool|||
+sv_2cv|||
+sv_2io|||
+sv_2iuv_common|||
+sv_2iuv_non_preserve|||
+sv_2iv_flags||5.009001|
+sv_2iv|||
+sv_2mortal|||
+sv_2nv|||
+sv_2pv_flags|5.007002||p
+sv_2pv_nolen|5.006000||p
+sv_2pvbyte_nolen|5.006000||p
+sv_2pvbyte|5.006000||p
+sv_2pvutf8_nolen||5.006000|
+sv_2pvutf8||5.006000|
+sv_2pv|||
+sv_2uv_flags||5.009001|
+sv_2uv|5.004000||p
+sv_add_arena|||
+sv_add_backref|||
+sv_backoff|||
+sv_bless|||
+sv_cat_decode||5.008001|
+sv_catpv_mg|5.004050||p
+sv_catpvf_mg_nocontext|||pvn
+sv_catpvf_mg|5.006000|5.004000|pv
+sv_catpvf_nocontext|||vn
+sv_catpvf||5.004000|v
+sv_catpvn_flags||5.007002|
+sv_catpvn_mg|5.004050||p
+sv_catpvn_nomg|5.007002||p
+sv_catpvn|||
+sv_catpvs|5.009003||p
+sv_catpv|||
+sv_catsv_flags||5.007002|
+sv_catsv_mg|5.004050||p
+sv_catsv_nomg|5.007002||p
+sv_catsv|||
+sv_catxmlpvn|||
+sv_catxmlsv|||
+sv_chop|||
+sv_clean_all|||
+sv_clean_objs|||
+sv_clear|||
+sv_cmp_locale||5.004000|
+sv_cmp|||
+sv_collxfrm|||
+sv_compile_2op||5.008001|
+sv_copypv||5.007003|
+sv_dec|||
+sv_del_backref|||
+sv_derived_from||5.004000|
+sv_does||5.009004|
+sv_dump|||
+sv_dup|||
+sv_eq|||
+sv_exp_grow|||
+sv_force_normal_flags||5.007001|
+sv_force_normal||5.006000|
+sv_free2|||
+sv_free_arenas|||
+sv_free|||
+sv_gets||5.004000|
+sv_grow|||
+sv_i_ncmp|||
+sv_inc|||
+sv_insert|||
+sv_isa|||
+sv_isobject|||
+sv_iv||5.005000|
+sv_kill_backrefs|||
+sv_len_utf8||5.006000|
+sv_len|||
+sv_magic_portable|5.009005|5.004000|p
+sv_magicext||5.007003|
+sv_magic|||
+sv_mortalcopy|||
+sv_ncmp|||
+sv_newmortal|||
+sv_newref|||
+sv_nolocking||5.007003|
+sv_nosharing||5.007003|
+sv_nounlocking|||
+sv_nv||5.005000|
+sv_peek||5.005000|
+sv_pos_b2u_midway|||
+sv_pos_b2u||5.006000|
+sv_pos_u2b_cached|||
+sv_pos_u2b_forwards|||n
+sv_pos_u2b_midway|||n
+sv_pos_u2b||5.006000|
+sv_pvbyten_force||5.006000|
+sv_pvbyten||5.006000|
+sv_pvbyte||5.006000|
+sv_pvn_force_flags|5.007002||p
+sv_pvn_force|||
+sv_pvn_nomg|5.007003||p
+sv_pvn|||
+sv_pvutf8n_force||5.006000|
+sv_pvutf8n||5.006000|
+sv_pvutf8||5.006000|
+sv_pv||5.006000|
+sv_recode_to_utf8||5.007003|
+sv_reftype|||
+sv_release_COW|||
+sv_replace|||
+sv_report_used|||
+sv_reset|||
+sv_rvweaken||5.006000|
+sv_setiv_mg|5.004050||p
+sv_setiv|||
+sv_setnv_mg|5.006000||p
+sv_setnv|||
+sv_setpv_mg|5.004050||p
+sv_setpvf_mg_nocontext|||pvn
+sv_setpvf_mg|5.006000|5.004000|pv
+sv_setpvf_nocontext|||vn
+sv_setpvf||5.004000|v
+sv_setpviv_mg||5.008001|
+sv_setpviv||5.008001|
+sv_setpvn_mg|5.004050||p
+sv_setpvn|||
+sv_setpvs|5.009004||p
+sv_setpv|||
+sv_setref_iv|||
+sv_setref_nv|||
+sv_setref_pvn|||
+sv_setref_pv|||
+sv_setref_uv||5.007001|
+sv_setsv_cow|||
+sv_setsv_flags||5.007002|
+sv_setsv_mg|5.004050||p
+sv_setsv_nomg|5.007002||p
+sv_setsv|||
+sv_setuv_mg|5.004050||p
+sv_setuv|5.004000||p
+sv_tainted||5.004000|
+sv_taint||5.004000|
+sv_true||5.005000|
+sv_unglob|||
+sv_uni_display||5.007003|
+sv_unmagic|||
+sv_unref_flags||5.007001|
+sv_unref|||
+sv_untaint||5.004000|
+sv_upgrade|||
+sv_usepvn_flags||5.009004|
+sv_usepvn_mg|5.004050||p
+sv_usepvn|||
+sv_utf8_decode||5.006000|
+sv_utf8_downgrade||5.006000|
+sv_utf8_encode||5.006000|
+sv_utf8_upgrade_flags||5.007002|
+sv_utf8_upgrade||5.007001|
+sv_uv|5.005000||p
+sv_vcatpvf_mg|5.006000|5.004000|p
+sv_vcatpvfn||5.004000|
+sv_vcatpvf|5.006000|5.004000|p
+sv_vsetpvf_mg|5.006000|5.004000|p
+sv_vsetpvfn||5.004000|
+sv_vsetpvf|5.006000|5.004000|p
+sv_xmlpeek|||
+svtype|||
+swallow_bom|||
+swap_match_buff|||
+swash_fetch||5.007002|
+swash_get|||
+swash_init||5.006000|
+sys_intern_clear|||
+sys_intern_dup|||
+sys_intern_init|||
+taint_env|||
+taint_proper|||
+tmps_grow||5.006000|
+toLOWER|||
+toUPPER|||
+to_byte_substr|||
+to_uni_fold||5.007003|
+to_uni_lower_lc||5.006000|
+to_uni_lower||5.007003|
+to_uni_title_lc||5.006000|
+to_uni_title||5.007003|
+to_uni_upper_lc||5.006000|
+to_uni_upper||5.007003|
+to_utf8_case||5.007003|
+to_utf8_fold||5.007003|
+to_utf8_lower||5.007003|
+to_utf8_substr|||
+to_utf8_title||5.007003|
+to_utf8_upper||5.007003|
+token_free|||
+token_getmad|||
+tokenize_use|||
+tokeq|||
+tokereport|||
+too_few_arguments|||
+too_many_arguments|||
+uiv_2buf|||n
+unlnk|||
+unpack_rec|||
+unpack_str||5.007003|
+unpackstring||5.008001|
+unshare_hek_or_pvn|||
+unshare_hek|||
+unsharepvn||5.004000|
+unwind_handler_stack|||
+update_debugger_info|||
+upg_version||5.009005|
+usage|||
+utf16_to_utf8_reversed||5.006001|
+utf16_to_utf8||5.006001|
+utf8_distance||5.006000|
+utf8_hop||5.006000|
+utf8_length||5.007001|
+utf8_mg_pos_cache_update|||
+utf8_to_bytes||5.006001|
+utf8_to_uvchr||5.007001|
+utf8_to_uvuni||5.007001|
+utf8n_to_uvchr|||
+utf8n_to_uvuni||5.007001|
+utilize|||
+uvchr_to_utf8_flags||5.007003|
+uvchr_to_utf8|||
+uvuni_to_utf8_flags||5.007003|
+uvuni_to_utf8||5.007001|
+validate_suid|||
+varname|||
+vcmp||5.009000|
+vcroak||5.006000|
+vdeb||5.007003|
+vdie_common|||
+vdie_croak_common|||
+vdie|||
+vform||5.006000|
+visit|||
+vivify_defelem|||
+vivify_ref|||
+vload_module|5.006000||p
+vmess||5.006000|
+vnewSVpvf|5.006000|5.004000|p
+vnormal||5.009002|
+vnumify||5.009000|
+vstringify||5.009000|
+vverify||5.009003|
+vwarner||5.006000|
+vwarn||5.006000|
+wait4pid|||
+warn_nocontext|||vn
+warner_nocontext|||vn
+warner|5.006000|5.004000|pv
+warn|||v
+watch|||
+whichsig|||
+write_no_mem|||
+write_to_stderr|||
+xmldump_all|||
+xmldump_attr|||
+xmldump_eval|||
+xmldump_form|||
+xmldump_indent|||v
+xmldump_packsubs|||
+xmldump_sub|||
+xmldump_vindent|||
+yyerror|||
+yylex|||
+yyparse|||
+yywarn|||
+);
+
+if (exists $opt{'list-unsupported'}) {
+  my $f;
+  for $f (sort { lc $a cmp lc $b } keys %API) {
+    next unless $API{$f}{todo};
+    print "$f ", '.'x(40-length($f)), " ", format_version($API{$f}{todo}), "\n";
+  }
+  exit 0;
+}
+
+# Scan for possible replacement candidates
+
+my(%replace, %need, %hints, %warnings, %depends);
+my $replace = 0;
+my($hint, $define, $function);
+
+sub find_api
+{
+  my $code = shift;
+  $code =~ s{
+    / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]*)
+  | "[^"\\]*(?:\\.[^"\\]*)*"
+  | '[^'\\]*(?:\\.[^'\\]*)*' }{}egsx;
+  grep { exists $API{$_} } $code =~ /(\w+)/mg;
+}
+
+while (<DATA>) {
+  if ($hint) {
+    my $h = $hint->[0] eq 'Hint' ? \%hints : \%warnings;
+    if (m{^\s*\*\s(.*?)\s*$}) {
+      for (@{$hint->[1]}) {
+        $h->{$_} ||= '';  # suppress warning with older perls
+        $h->{$_} .= "$1\n";
+      }
+    }
+    else { undef $hint }
+  }
+
+  $hint = [$1, [split /,?\s+/, $2]]
+      if m{^\s*$rccs\s+(Hint|Warning):\s+(\w+(?:,?\s+\w+)*)\s*$};
+
+  if ($define) {
+    if ($define->[1] =~ /\\$/) {
+      $define->[1] .= $_;
+    }
+    else {
+      if (exists $API{$define->[0]} && $define->[1] !~ /^DPPP_\(/) {
+        my @n = find_api($define->[1]);
+        push @{$depends{$define->[0]}}, @n if @n
+      }
+      undef $define;
+    }
+  }
+
+  $define = [$1, $2] if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(.*)};
+
+  if ($function) {
+    if (/^}/) {
+      if (exists $API{$function->[0]}) {
+        my @n = find_api($function->[1]);
+        push @{$depends{$function->[0]}}, @n if @n
+      }
+      undef $define;
+    }
+    else {
+      $function->[1] .= $_;
+    }
+  }
+
+  $function = [$1, ''] if m{^DPPP_\(my_(\w+)\)};
+
+  $replace     = $1 if m{^\s*$rccs\s+Replace:\s+(\d+)\s+$rcce\s*$};
+  $replace{$2} = $1 if $replace and m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+)};
+  $replace{$2} = $1 if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+).*$rccs\s+Replace\s+$rcce};
+  $replace{$1} = $2 if m{^\s*$rccs\s+Replace (\w+) with (\w+)\s+$rcce\s*$};
+
+  if (m{^\s*$rccs\s+(\w+)\s+depends\s+on\s+(\w+(\s*,\s*\w+)*)\s+$rcce\s*$}) {
+    push @{$depends{$1}}, map { s/\s+//g; $_ } split /,/, $2;
+  }
+
+  $need{$1} = 1 if m{^#if\s+defined\(NEED_(\w+)(?:_GLOBAL)?\)};
+}
+
+for (values %depends) {
+  my %s;
+  $_ = [sort grep !$s{$_}++, @$_];
+}
+
+if (exists $opt{'api-info'}) {
+  my $f;
+  my $count = 0;
+  my $match = $opt{'api-info'} =~ m!^/(.*)/$! ? $1 : "^\Q$opt{'api-info'}\E\$";
+  for $f (sort { lc $a cmp lc $b } keys %API) {
+    next unless $f =~ /$match/;
+    print "\n=== $f ===\n\n";
+    my $info = 0;
+    if ($API{$f}{base} || $API{$f}{todo}) {
+      my $base = format_version($API{$f}{base} || $API{$f}{todo});
+      print "Supported at least starting from perl-$base.\n";
+      $info++;
+    }
+    if ($API{$f}{provided}) {
+      my $todo = $API{$f}{todo} ? format_version($API{$f}{todo}) : "5.003";
+      print "Support by $ppport provided back to perl-$todo.\n";
+      print "Support needs to be explicitly requested by NEED_$f.\n" if exists $need{$f};
+      print "Depends on: ", join(', ', @{$depends{$f}}), ".\n" if exists $depends{$f};
+      print "\n$hints{$f}" if exists $hints{$f};
+      print "\nWARNING:\n$warnings{$f}" if exists $warnings{$f};
+      $info++;
+    }
+    print "No portability information available.\n" unless $info;
+    $count++;
+  }
+  $count or print "Found no API matching '$opt{'api-info'}'.";
+  print "\n";
+  exit 0;
+}
+
+if (exists $opt{'list-provided'}) {
+  my $f;
+  for $f (sort { lc $a cmp lc $b } keys %API) {
+    next unless $API{$f}{provided};
+    my @flags;
+    push @flags, 'explicit' if exists $need{$f};
+    push @flags, 'depend'   if exists $depends{$f};
+    push @flags, 'hint'     if exists $hints{$f};
+    push @flags, 'warning'  if exists $warnings{$f};
+    my $flags = @flags ? '  ['.join(', ', @flags).']' : '';
+    print "$f$flags\n";
+  }
+  exit 0;
+}
+
+my @files;
+my @srcext = qw( .xs .c .h .cc .cpp -c.inc -xs.inc );
+my $srcext = join '|', map { quotemeta $_ } @srcext;
+
+if (@ARGV) {
+  my %seen;
+  for (@ARGV) {
+    if (-e) {
+      if (-f) {
+        push @files, $_ unless $seen{$_}++;
+      }
+      else { warn "'$_' is not a file.\n" }
+    }
+    else {
+      my @new = grep { -f } glob $_
+          or warn "'$_' does not exist.\n";
+      push @files, grep { !$seen{$_}++ } @new;
+    }
+  }
+}
+else {
+  eval {
+    require File::Find;
+    File::Find::find(sub {
+      $File::Find::name =~ /($srcext)$/i
+          and push @files, $File::Find::name;
+    }, '.');
+  };
+  if ($@) {
+    @files = map { glob "*$_" } @srcext;
+  }
+}
+
+if (!@ARGV || $opt{filter}) {
+  my(@in, @out);
+  my %xsc = map { /(.*)\.xs$/ ? ("$1.c" => 1, "$1.cc" => 1) : () } @files;
+  for (@files) {
+    my $out = exists $xsc{$_} || /\b\Q$ppport\E$/i || !/($srcext)$/i;
+    push @{ $out ? \@out : \@in }, $_;
+  }
+  if (@ARGV && @out) {
+    warning("Skipping the following files (use --nofilter to avoid this):\n| ", join "\n| ", @out);
+  }
+  @files = @in;
+}
+
+die "No input files given!\n" unless @files;
+
+my(%files, %global, %revreplace);
+%revreplace = reverse %replace;
+my $filename;
+my $patch_opened = 0;
+
+for $filename (@files) {
+  unless (open IN, "<$filename") {
+    warn "Unable to read from $filename: $!\n";
+    next;
+  }
+
+  info("Scanning $filename ...");
+
+  my $c = do { local $/; <IN> };
+  close IN;
+
+  my %file = (orig => $c, changes => 0);
+
+  # Temporarily remove C/XS comments and strings from the code
+  my @ccom;
+
+  $c =~ s{
+    ( ^$HS*\#$HS*include\b[^\r\n]+\b(?:\Q$ppport\E|XSUB\.h)\b[^\r\n]*
+    | ^$HS*\#$HS*(?:define|elif|if(?:def)?)\b[^\r\n]* )
+  | ( ^$HS*\#[^\r\n]*
+    | "[^"\\]*(?:\\.[^"\\]*)*"
+    | '[^'\\]*(?:\\.[^'\\]*)*'
+    | / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]* ) )
+  }{ defined $2 and push @ccom, $2;
+     defined $1 ? $1 : "$ccs$#ccom$cce" }mgsex;
+
+  $file{ccom} = \@ccom;
+  $file{code} = $c;
+  $file{has_inc_ppport} = $c =~ /^$HS*#$HS*include[^\r\n]+\b\Q$ppport\E\b/m;
+
+  my $func;
+
+  for $func (keys %API) {
+    my $match = $func;
+    $match .= "|$revreplace{$func}" if exists $revreplace{$func};
+    if ($c =~ /\b(?:Perl_)?($match)\b/) {
+      $file{uses_replace}{$1}++ if exists $revreplace{$func} && $1 eq $revreplace{$func};
+      $file{uses_Perl}{$func}++ if $c =~ /\bPerl_$func\b/;
+      if (exists $API{$func}{provided}) {
+        $file{uses_provided}{$func}++;
+        if (!exists $API{$func}{base} || $API{$func}{base} > $opt{'compat-version'}) {
+          $file{uses}{$func}++;
+          my @deps = rec_depend($func);
+          if (@deps) {
+            $file{uses_deps}{$func} = \@deps;
+            for (@deps) {
+              $file{uses}{$_} = 0 unless exists $file{uses}{$_};
+            }
+          }
+          for ($func, @deps) {
+            $file{needs}{$_} = 'static' if exists $need{$_};
+          }
+        }
+      }
+      if (exists $API{$func}{todo} && $API{$func}{todo} > $opt{'compat-version'}) {
+        if ($c =~ /\b$func\b/) {
+          $file{uses_todo}{$func}++;
+        }
+      }
+    }
+  }
+
+  while ($c =~ /^$HS*#$HS*define$HS+(NEED_(\w+?)(_GLOBAL)?)\b/mg) {
+    if (exists $need{$2}) {
+      $file{defined $3 ? 'needed_global' : 'needed_static'}{$2}++;
+    }
+    else { warning("Possibly wrong #define $1 in $filename") }
+  }
+
+  for (qw(uses needs uses_todo needed_global needed_static)) {
+    for $func (keys %{$file{$_}}) {
+      push @{$global{$_}{$func}}, $filename;
+    }
+  }
+
+  $files{$filename} = \%file;
+}
+
+# Globally resolve NEED_'s
+my $need;
+for $need (keys %{$global{needs}}) {
+  if (@{$global{needs}{$need}} > 1) {
+    my @targets = @{$global{needs}{$need}};
+    my @t = grep $files{$_}{needed_global}{$need}, @targets;
+    @targets = @t if @t;
+    @t = grep /\.xs$/i, @targets;
+    @targets = @t if @t;
+    my $target = shift @targets;
+    $files{$target}{needs}{$need} = 'global';
+    for (@{$global{needs}{$need}}) {
+      $files{$_}{needs}{$need} = 'extern' if $_ ne $target;
+    }
+  }
+}
+
+for $filename (@files) {
+  exists $files{$filename} or next;
+
+  info("=== Analyzing $filename ===");
+
+  my %file = %{$files{$filename}};
+  my $func;
+  my $c = $file{code};
+  my $warnings = 0;
+
+  for $func (sort keys %{$file{uses_Perl}}) {
+    if ($API{$func}{varargs}) {
+      unless ($API{$func}{nothxarg}) {
+        my $changes = ($c =~ s{\b(Perl_$func\s*\(\s*)(?!aTHX_?)(\)|[^\s)]*\))}
+                              { $1 . ($2 eq ')' ? 'aTHX' : 'aTHX_ ') . $2 }ge);
+        if ($changes) {
+          warning("Doesn't pass interpreter argument aTHX to Perl_$func");
+          $file{changes} += $changes;
+        }
+      }
+    }
+    else {
+      warning("Uses Perl_$func instead of $func");
+      $file{changes} += ($c =~ s{\bPerl_$func(\s*)\((\s*aTHX_?)?\s*}
+                                {$func$1(}g);
+    }
+  }
+
+  for $func (sort keys %{$file{uses_replace}}) {
+    warning("Uses $func instead of $replace{$func}");
+    $file{changes} += ($c =~ s/\b$func\b/$replace{$func}/g);
+  }
+
+  for $func (sort keys %{$file{uses_provided}}) {
+    if ($file{uses}{$func}) {
+      if (exists $file{uses_deps}{$func}) {
+        diag("Uses $func, which depends on ", join(', ', @{$file{uses_deps}{$func}}));
+      }
+      else {
+        diag("Uses $func");
+      }
+    }
+    $warnings += hint($func);
+  }
+
+  unless ($opt{quiet}) {
+    for $func (sort keys %{$file{uses_todo}}) {
+      print "*** WARNING: Uses $func, which may not be portable below perl ",
+            format_version($API{$func}{todo}), ", even with '$ppport'\n";
+      $warnings++;
+    }
+  }
+
+  for $func (sort keys %{$file{needed_static}}) {
+    my $message = '';
+    if (not exists $file{uses}{$func}) {
+      $message = "No need to define NEED_$func if $func is never used";
+    }
+    elsif (exists $file{needs}{$func} && $file{needs}{$func} ne 'static') {
+      $message = "No need to define NEED_$func when already needed globally";
+    }
+    if ($message) {
+      diag($message);
+      $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_$func\b.*$LF//mg);
+    }
+  }
+
+  for $func (sort keys %{$file{needed_global}}) {
+    my $message = '';
+    if (not exists $global{uses}{$func}) {
+      $message = "No need to define NEED_${func}_GLOBAL if $func is never used";
+    }
+    elsif (exists $file{needs}{$func}) {
+      if ($file{needs}{$func} eq 'extern') {
+        $message = "No need to define NEED_${func}_GLOBAL when already needed globally";
+      }
+      elsif ($file{needs}{$func} eq 'static') {
+        $message = "No need to define NEED_${func}_GLOBAL when only used in this file";
+      }
+    }
+    if ($message) {
+      diag($message);
+      $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_${func}_GLOBAL\b.*$LF//mg);
+    }
+  }
+
+  $file{needs_inc_ppport} = keys %{$file{uses}};
+
+  if ($file{needs_inc_ppport}) {
+    my $pp = '';
+
+    for $func (sort keys %{$file{needs}}) {
+      my $type = $file{needs}{$func};
+      next if $type eq 'extern';
+      my $suffix = $type eq 'global' ? '_GLOBAL' : '';
+      unless (exists $file{"needed_$type"}{$func}) {
+        if ($type eq 'global') {
+          diag("Files [@{$global{needs}{$func}}] need $func, adding global request");
+        }
+        else {
+          diag("File needs $func, adding static request");
+        }
+        $pp .= "#define NEED_$func$suffix\n";
+      }
+    }
+
+    if ($pp && ($c =~ s/^(?=$HS*#$HS*define$HS+NEED_\w+)/$pp/m)) {
+      $pp = '';
+      $file{changes}++;
+    }
+
+    unless ($file{has_inc_ppport}) {
+      diag("Needs to include '$ppport'");
+      $pp .= qq(#include "$ppport"\n)
+    }
+
+    if ($pp) {
+      $file{changes} += ($c =~ s/^($HS*#$HS*define$HS+NEED_\w+.*?)^/$1$pp/ms)
+                     || ($c =~ s/^(?=$HS*#$HS*include.*\Q$ppport\E)/$pp/m)
+                     || ($c =~ s/^($HS*#$HS*include.*XSUB.*\s*?)^/$1$pp/m)
+                     || ($c =~ s/^/$pp/);
+    }
+  }
+  else {
+    if ($file{has_inc_ppport}) {
+      diag("No need to include '$ppport'");
+      $file{changes} += ($c =~ s/^$HS*?#$HS*include.*\Q$ppport\E.*?$LF//m);
+    }
+  }
+
+  # put back in our C comments
+  my $ix;
+  my $cppc = 0;
+  my @ccom = @{$file{ccom}};
+  for $ix (0 .. $#ccom) {
+    if (!$opt{cplusplus} && $ccom[$ix] =~ s!^//!!) {
+      $cppc++;
+      $file{changes} += $c =~ s/$rccs$ix$rcce/$ccs$ccom[$ix] $cce/;
+    }
+    else {
+      $c =~ s/$rccs$ix$rcce/$ccom[$ix]/;
+    }
+  }
+
+  if ($cppc) {
+    my $s = $cppc != 1 ? 's' : '';
+    warning("Uses $cppc C++ style comment$s, which is not portable");
+  }
+
+  my $s = $warnings != 1 ? 's' : '';
+  my $warn = $warnings ? " ($warnings warning$s)" : '';
+  info("Analysis completed$warn");
+
+  if ($file{changes}) {
+    if (exists $opt{copy}) {
+      my $newfile = "$filename$opt{copy}";
+      if (-e $newfile) {
+        error("'$newfile' already exists, refusing to write copy of '$filename'");
+      }
+      else {
+        local *F;
+        if (open F, ">$newfile") {
+          info("Writing copy of '$filename' with changes to '$newfile'");
+          print F $c;
+          close F;
+        }
+        else {
+          error("Cannot open '$newfile' for writing: $!");
+        }
+      }
+    }
+    elsif (exists $opt{patch} || $opt{changes}) {
+      if (exists $opt{patch}) {
+        unless ($patch_opened) {
+          if (open PATCH, ">$opt{patch}") {
+            $patch_opened = 1;
+          }
+          else {
+            error("Cannot open '$opt{patch}' for writing: $!");
+            delete $opt{patch};
+            $opt{changes} = 1;
+            goto fallback;
+          }
+        }
+        mydiff(\*PATCH, $filename, $c);
+      }
+      else {
+fallback:
+        info("Suggested changes:");
+        mydiff(\*STDOUT, $filename, $c);
+      }
+    }
+    else {
+      my $s = $file{changes} == 1 ? '' : 's';
+      info("$file{changes} potentially required change$s detected");
+    }
+  }
+  else {
+    info("Looks good");
+  }
+}
+
+close PATCH if $patch_opened;
+
+exit 0;
+
+
+sub try_use { eval "use @_;"; return $@ eq '' }
+
+sub mydiff
+{
+  local *F = shift;
+  my($file, $str) = @_;
+  my $diff;
+
+  if (exists $opt{diff}) {
+    $diff = run_diff($opt{diff}, $file, $str);
+  }
+
+  if (!defined $diff and try_use('Text::Diff')) {
+    $diff = Text::Diff::diff($file, \$str, { STYLE => 'Unified' });
+    $diff = <<HEADER . $diff;
+--- $file
++++ $file.patched
+HEADER
+  }
+
+  if (!defined $diff) {
+    $diff = run_diff('diff -u', $file, $str);
+  }
+
+  if (!defined $diff) {
+    $diff = run_diff('diff', $file, $str);
+  }
+
+  if (!defined $diff) {
+    error("Cannot generate a diff. Please install Text::Diff or use --copy.");
+    return;
+  }
+
+  print F $diff;
+}
+
+sub run_diff
+{
+  my($prog, $file, $str) = @_;
+  my $tmp = 'dppptemp';
+  my $suf = 'aaa';
+  my $diff = '';
+  local *F;
+
+  while (-e "$tmp.$suf") { $suf++ }
+  $tmp = "$tmp.$suf";
+
+  if (open F, ">$tmp") {
+    print F $str;
+    close F;
+
+    if (open F, "$prog $file $tmp |") {
+      while (<F>) {
+        s/\Q$tmp\E/$file.patched/;
+        $diff .= $_;
+      }
+      close F;
+      unlink $tmp;
+      return $diff;
+    }
+
+    unlink $tmp;
+  }
+  else {
+    error("Cannot open '$tmp' for writing: $!");
+  }
+
+  return undef;
+}
+
+sub rec_depend
+{
+  my($func, $seen) = @_;
+  return () unless exists $depends{$func};
+  $seen = {%{$seen||{}}};
+  return () if $seen->{$func}++;
+  my %s;
+  grep !$s{$_}++, map { ($_, rec_depend($_, $seen)) } @{$depends{$func}};
+}
+
+sub parse_version
+{
+  my $ver = shift;
+
+  if ($ver =~ /^(\d+)\.(\d+)\.(\d+)$/) {
+    return ($1, $2, $3);
+  }
+  elsif ($ver !~ /^\d+\.[\d_]+$/) {
+    die "cannot parse version '$ver'\n";
+  }
+
+  $ver =~ s/_//g;
+  $ver =~ s/$/000000/;
+
+  my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/;
+
+  $v = int $v;
+  $s = int $s;
+
+  if ($r < 5 || ($r == 5 && $v < 6)) {
+    if ($s % 10) {
+      die "cannot parse version '$ver'\n";
+    }
+  }
+
+  return ($r, $v, $s);
+}
+
+sub format_version
+{
+  my $ver = shift;
+
+  $ver =~ s/$/000000/;
+  my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/;
+
+  $v = int $v;
+  $s = int $s;
+
+  if ($r < 5 || ($r == 5 && $v < 6)) {
+    if ($s % 10) {
+      die "invalid version '$ver'\n";
+    }
+    $s /= 10;
+
+    $ver = sprintf "%d.%03d", $r, $v;
+    $s > 0 and $ver .= sprintf "_%02d", $s;
+
+    return $ver;
+  }
+
+  return sprintf "%d.%d.%d", $r, $v, $s;
+}
+
+sub info
+{
+  $opt{quiet} and return;
+  print @_, "\n";
+}
+
+sub diag
+{
+  $opt{quiet} and return;
+  $opt{diag} and print @_, "\n";
+}
+
+sub warning
+{
+  $opt{quiet} and return;
+  print "*** ", @_, "\n";
+}
+
+sub error
+{
+  print "*** ERROR: ", @_, "\n";
+}
+
+my %given_hints;
+my %given_warnings;
+sub hint
+{
+  $opt{quiet} and return;
+  my $func = shift;
+  my $rv = 0;
+  if (exists $warnings{$func} && !$given_warnings{$func}++) {
+    my $warn = $warnings{$func};
+    $warn =~ s!^!*** !mg;
+    print "*** WARNING: $func\n", $warn;
+    $rv++;
+  }
+  if ($opt{hints} && exists $hints{$func} && !$given_hints{$func}++) {
+    my $hint = $hints{$func};
+    $hint =~ s/^/   /mg;
+    print "   --- hint for $func ---\n", $hint;
+  }
+  $rv;
+}
+
+sub usage
+{
+  my($usage) = do { local(@ARGV,$/)=($0); <> } =~ /^=head\d$HS+SYNOPSIS\s*^(.*?)\s*^=/ms;
+  my %M = ( 'I' => '*' );
+  $usage =~ s/^\s*perl\s+\S+/$^X $0/;
+  $usage =~ s/([A-Z])<([^>]+)>/$M{$1}$2$M{$1}/g;
+
+  print <<ENDUSAGE;
+
+Usage: $usage
+
+See perldoc $0 for details.
+
+ENDUSAGE
+
+  exit 2;
+}
+
+sub strip
+{
+  my $self = do { local(@ARGV,$/)=($0); <> };
+  my($copy) = $self =~ /^=head\d\s+COPYRIGHT\s*^(.*?)^=\w+/ms;
+  $copy =~ s/^(?=\S+)/    /gms;
+  $self =~ s/^$HS+Do NOT edit.*?(?=^-)/$copy/ms;
+  $self =~ s/^SKIP.*(?=^__DATA__)/SKIP
+if (\@ARGV && \$ARGV[0] eq '--unstrip') {
+  eval { require Devel::PPPort };
+  \$@ and die "Cannot require Devel::PPPort, please install.\\n";
+  if (\$Devel::PPPort::VERSION < $VERSION) {
+    die "$0 was originally generated with Devel::PPPort $VERSION.\\n"
+      . "Your Devel::PPPort is only version \$Devel::PPPort::VERSION.\\n"
+      . "Please install a newer version, or --unstrip will not work.\\n";
+  }
+  Devel::PPPort::WriteFile(\$0);
+  exit 0;
+}
+print <<END;
+
+Sorry, but this is a stripped version of \$0.
+
+To be able to use its original script and doc functionality,
+please try to regenerate this file using:
+
+  \$^X \$0 --unstrip
+
+END
+/ms;
+  my($pl, $c) = $self =~ /(.*^__DATA__)(.*)/ms;
+  $c =~ s{
+    / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]*)
+  | ( "[^"\\]*(?:\\.[^"\\]*)*"
+    | '[^'\\]*(?:\\.[^'\\]*)*' )
+  | ($HS+) }{ defined $2 ? ' ' : ($1 || '') }gsex;
+  $c =~ s!\s+$!!mg;
+  $c =~ s!^$LF!!mg;
+  $c =~ s!^\s*#\s*!#!mg;
+  $c =~ s!^\s+!!mg;
+
+  open OUT, ">$0" or die "cannot strip $0: $!\n";
+  print OUT "$pl$c\n";
+
+  exit 0;
+}
+
+__DATA__
+*/
+
+#ifndef _P_P_PORTABILITY_H_
+#define _P_P_PORTABILITY_H_
+
+#ifndef DPPP_NAMESPACE
+#  define DPPP_NAMESPACE DPPP_
+#endif
+
+#define DPPP_CAT2(x,y) CAT2(x,y)
+#define DPPP_(name) DPPP_CAT2(DPPP_NAMESPACE, name)
+
+#ifndef PERL_REVISION
+#  if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
+#    define PERL_PATCHLEVEL_H_IMPLICIT
+#    include <patchlevel.h>
+#  endif
+#  if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
+#    include <could_not_find_Perl_patchlevel.h>
+#  endif
+#  ifndef PERL_REVISION
+#    define PERL_REVISION       (5)
+     /* Replace: 1 */
+#    define PERL_VERSION        PATCHLEVEL
+#    define PERL_SUBVERSION     SUBVERSION
+     /* Replace PERL_PATCHLEVEL with PERL_VERSION */
+     /* Replace: 0 */
+#  endif
+#endif
+
+#define _dpppDEC2BCD(dec) ((((dec)/100)<<8)|((((dec)%100)/10)<<4)|((dec)%10))
+#define PERL_BCDVERSION ((_dpppDEC2BCD(PERL_REVISION)<<24)|(_dpppDEC2BCD(PERL_VERSION)<<12)|_dpppDEC2BCD(PERL_SUBVERSION))
+
+/* It is very unlikely that anyone will try to use this with Perl 6
+   (or greater), but who knows.
+ */
+#if PERL_REVISION != 5
+#  error ppport.h only works with Perl version 5
+#endif /* PERL_REVISION != 5 */
+
+#ifdef I_LIMITS
+#  include <limits.h>
+#endif
+
+#ifndef PERL_UCHAR_MIN
+#  define PERL_UCHAR_MIN ((unsigned char)0)
+#endif
+
+#ifndef PERL_UCHAR_MAX
+#  ifdef UCHAR_MAX
+#    define PERL_UCHAR_MAX ((unsigned char)UCHAR_MAX)
+#  else
+#    ifdef MAXUCHAR
+#      define PERL_UCHAR_MAX ((unsigned char)MAXUCHAR)
+#    else
+#      define PERL_UCHAR_MAX ((unsigned char)~(unsigned)0)
+#    endif
+#  endif
+#endif
+
+#ifndef PERL_USHORT_MIN
+#  define PERL_USHORT_MIN ((unsigned short)0)
+#endif
+
+#ifndef PERL_USHORT_MAX
+#  ifdef USHORT_MAX
+#    define PERL_USHORT_MAX ((unsigned short)USHORT_MAX)
+#  else
+#    ifdef MAXUSHORT
+#      define PERL_USHORT_MAX ((unsigned short)MAXUSHORT)
+#    else
+#      ifdef USHRT_MAX
+#        define PERL_USHORT_MAX ((unsigned short)USHRT_MAX)
+#      else
+#        define PERL_USHORT_MAX ((unsigned short)~(unsigned)0)
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifndef PERL_SHORT_MAX
+#  ifdef SHORT_MAX
+#    define PERL_SHORT_MAX ((short)SHORT_MAX)
+#  else
+#    ifdef MAXSHORT    /* Often used in <values.h> */
+#      define PERL_SHORT_MAX ((short)MAXSHORT)
+#    else
+#      ifdef SHRT_MAX
+#        define PERL_SHORT_MAX ((short)SHRT_MAX)
+#      else
+#        define PERL_SHORT_MAX ((short) (PERL_USHORT_MAX >> 1))
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifndef PERL_SHORT_MIN
+#  ifdef SHORT_MIN
+#    define PERL_SHORT_MIN ((short)SHORT_MIN)
+#  else
+#    ifdef MINSHORT
+#      define PERL_SHORT_MIN ((short)MINSHORT)
+#    else
+#      ifdef SHRT_MIN
+#        define PERL_SHORT_MIN ((short)SHRT_MIN)
+#      else
+#        define PERL_SHORT_MIN (-PERL_SHORT_MAX - ((3 & -1) == 3))
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifndef PERL_UINT_MAX
+#  ifdef UINT_MAX
+#    define PERL_UINT_MAX ((unsigned int)UINT_MAX)
+#  else
+#    ifdef MAXUINT
+#      define PERL_UINT_MAX ((unsigned int)MAXUINT)
+#    else
+#      define PERL_UINT_MAX (~(unsigned int)0)
+#    endif
+#  endif
+#endif
+
+#ifndef PERL_UINT_MIN
+#  define PERL_UINT_MIN ((unsigned int)0)
+#endif
+
+#ifndef PERL_INT_MAX
+#  ifdef INT_MAX
+#    define PERL_INT_MAX ((int)INT_MAX)
+#  else
+#    ifdef MAXINT    /* Often used in <values.h> */
+#      define PERL_INT_MAX ((int)MAXINT)
+#    else
+#      define PERL_INT_MAX ((int)(PERL_UINT_MAX >> 1))
+#    endif
+#  endif
+#endif
+
+#ifndef PERL_INT_MIN
+#  ifdef INT_MIN
+#    define PERL_INT_MIN ((int)INT_MIN)
+#  else
+#    ifdef MININT
+#      define PERL_INT_MIN ((int)MININT)
+#    else
+#      define PERL_INT_MIN (-PERL_INT_MAX - ((3 & -1) == 3))
+#    endif
+#  endif
+#endif
+
+#ifndef PERL_ULONG_MAX
+#  ifdef ULONG_MAX
+#    define PERL_ULONG_MAX ((unsigned long)ULONG_MAX)
+#  else
+#    ifdef MAXULONG
+#      define PERL_ULONG_MAX ((unsigned long)MAXULONG)
+#    else
+#      define PERL_ULONG_MAX (~(unsigned long)0)
+#    endif
+#  endif
+#endif
+
+#ifndef PERL_ULONG_MIN
+#  define PERL_ULONG_MIN ((unsigned long)0L)
+#endif
+
+#ifndef PERL_LONG_MAX
+#  ifdef LONG_MAX
+#    define PERL_LONG_MAX ((long)LONG_MAX)
+#  else
+#    ifdef MAXLONG
+#      define PERL_LONG_MAX ((long)MAXLONG)
+#    else
+#      define PERL_LONG_MAX ((long) (PERL_ULONG_MAX >> 1))
+#    endif
+#  endif
+#endif
+
+#ifndef PERL_LONG_MIN
+#  ifdef LONG_MIN
+#    define PERL_LONG_MIN ((long)LONG_MIN)
+#  else
+#    ifdef MINLONG
+#      define PERL_LONG_MIN ((long)MINLONG)
+#    else
+#      define PERL_LONG_MIN (-PERL_LONG_MAX - ((3 & -1) == 3))
+#    endif
+#  endif
+#endif
+
+#if defined(HAS_QUAD) && (defined(convex) || defined(uts))
+#  ifndef PERL_UQUAD_MAX
+#    ifdef ULONGLONG_MAX
+#      define PERL_UQUAD_MAX ((unsigned long long)ULONGLONG_MAX)
+#    else
+#      ifdef MAXULONGLONG
+#        define PERL_UQUAD_MAX ((unsigned long long)MAXULONGLONG)
+#      else
+#        define PERL_UQUAD_MAX (~(unsigned long long)0)
+#      endif
+#    endif
+#  endif
+
+#  ifndef PERL_UQUAD_MIN
+#    define PERL_UQUAD_MIN ((unsigned long long)0L)
+#  endif
+
+#  ifndef PERL_QUAD_MAX
+#    ifdef LONGLONG_MAX
+#      define PERL_QUAD_MAX ((long long)LONGLONG_MAX)
+#    else
+#      ifdef MAXLONGLONG
+#        define PERL_QUAD_MAX ((long long)MAXLONGLONG)
+#      else
+#        define PERL_QUAD_MAX ((long long) (PERL_UQUAD_MAX >> 1))
+#      endif
+#    endif
+#  endif
+
+#  ifndef PERL_QUAD_MIN
+#    ifdef LONGLONG_MIN
+#      define PERL_QUAD_MIN ((long long)LONGLONG_MIN)
+#    else
+#      ifdef MINLONGLONG
+#        define PERL_QUAD_MIN ((long long)MINLONGLONG)
+#      else
+#        define PERL_QUAD_MIN (-PERL_QUAD_MAX - ((3 & -1) == 3))
+#      endif
+#    endif
+#  endif
+#endif
+
+/* This is based on code from 5.003 perl.h */
+#ifdef HAS_QUAD
+#  ifdef cray
+#ifndef IVTYPE
+#  define IVTYPE                         int
+#endif
+
+#ifndef IV_MIN
+#  define IV_MIN                         PERL_INT_MIN
+#endif
+
+#ifndef IV_MAX
+#  define IV_MAX                         PERL_INT_MAX
+#endif
+
+#ifndef UV_MIN
+#  define UV_MIN                         PERL_UINT_MIN
+#endif
+
+#ifndef UV_MAX
+#  define UV_MAX                         PERL_UINT_MAX
+#endif
+
+#    ifdef INTSIZE
+#ifndef IVSIZE
+#  define IVSIZE                         INTSIZE
+#endif
+
+#    endif
+#  else
+#    if defined(convex) || defined(uts)
+#ifndef IVTYPE
+#  define IVTYPE                         long long
+#endif
+
+#ifndef IV_MIN
+#  define IV_MIN                         PERL_QUAD_MIN
+#endif
+
+#ifndef IV_MAX
+#  define IV_MAX                         PERL_QUAD_MAX
+#endif
+
+#ifndef UV_MIN
+#  define UV_MIN                         PERL_UQUAD_MIN
+#endif
+
+#ifndef UV_MAX
+#  define UV_MAX                         PERL_UQUAD_MAX
+#endif
+
+#      ifdef LONGLONGSIZE
+#ifndef IVSIZE
+#  define IVSIZE                         LONGLONGSIZE
+#endif
+
+#      endif
+#    else
+#ifndef IVTYPE
+#  define IVTYPE                         long
+#endif
+
+#ifndef IV_MIN
+#  define IV_MIN                         PERL_LONG_MIN
+#endif
+
+#ifndef IV_MAX
+#  define IV_MAX                         PERL_LONG_MAX
+#endif
+
+#ifndef UV_MIN
+#  define UV_MIN                         PERL_ULONG_MIN
+#endif
+
+#ifndef UV_MAX
+#  define UV_MAX                         PERL_ULONG_MAX
+#endif
+
+#      ifdef LONGSIZE
+#ifndef IVSIZE
+#  define IVSIZE                         LONGSIZE
+#endif
+
+#      endif
+#    endif
+#  endif
+#ifndef IVSIZE
+#  define IVSIZE                         8
+#endif
+
+#ifndef PERL_QUAD_MIN
+#  define PERL_QUAD_MIN                  IV_MIN
+#endif
+
+#ifndef PERL_QUAD_MAX
+#  define PERL_QUAD_MAX                  IV_MAX
+#endif
+
+#ifndef PERL_UQUAD_MIN
+#  define PERL_UQUAD_MIN                 UV_MIN
+#endif
+
+#ifndef PERL_UQUAD_MAX
+#  define PERL_UQUAD_MAX                 UV_MAX
+#endif
+
+#else
+#ifndef IVTYPE
+#  define IVTYPE                         long
+#endif
+
+#ifndef IV_MIN
+#  define IV_MIN                         PERL_LONG_MIN
+#endif
+
+#ifndef IV_MAX
+#  define IV_MAX                         PERL_LONG_MAX
+#endif
+
+#ifndef UV_MIN
+#  define UV_MIN                         PERL_ULONG_MIN
+#endif
+
+#ifndef UV_MAX
+#  define UV_MAX                         PERL_ULONG_MAX
+#endif
+
+#endif
+
+#ifndef IVSIZE
+#  ifdef LONGSIZE
+#    define IVSIZE LONGSIZE
+#  else
+#    define IVSIZE 4 /* A bold guess, but the best we can make. */
+#  endif
+#endif
+#ifndef UVTYPE
+#  define UVTYPE                         unsigned IVTYPE
+#endif
+
+#ifndef UVSIZE
+#  define UVSIZE                         IVSIZE
+#endif
+#ifndef sv_setuv
+#  define sv_setuv(sv, uv)               \
+               STMT_START {                         \
+                 UV TeMpUv = uv;                    \
+                 if (TeMpUv <= IV_MAX)              \
+                   sv_setiv(sv, TeMpUv);            \
+                 else                               \
+                   sv_setnv(sv, (double)TeMpUv);    \
+               } STMT_END
+#endif
+#ifndef newSVuv
+#  define newSVuv(uv)                    ((uv) <= IV_MAX ? newSViv((IV)uv) : newSVnv((NV)uv))
+#endif
+#ifndef sv_2uv
+#  define sv_2uv(sv)                     ((PL_Sv = (sv)), (UV) (SvNOK(PL_Sv) ? SvNV(PL_Sv) : sv_2nv(PL_Sv)))
+#endif
+
+#ifndef SvUVX
+#  define SvUVX(sv)                      ((UV)SvIVX(sv))
+#endif
+
+#ifndef SvUVXx
+#  define SvUVXx(sv)                     SvUVX(sv)
+#endif
+
+#ifndef SvUV
+#  define SvUV(sv)                       (SvIOK(sv) ? SvUVX(sv) : sv_2uv(sv))
+#endif
+
+#ifndef SvUVx
+#  define SvUVx(sv)                      ((PL_Sv = (sv)), SvUV(PL_Sv))
+#endif
+
+/* Hint: sv_uv
+ * Always use the SvUVx() macro instead of sv_uv().
+ */
+#ifndef sv_uv
+#  define sv_uv(sv)                      SvUVx(sv)
+#endif
+
+#if !defined(SvUOK) && defined(SvIOK_UV)
+#  define SvUOK(sv) SvIOK_UV(sv)
+#endif
+#ifndef XST_mUV
+#  define XST_mUV(i,v)                   (ST(i) = sv_2mortal(newSVuv(v))  )
+#endif
+
+#ifndef XSRETURN_UV
+#  define XSRETURN_UV(v)                 STMT_START { XST_mUV(0,v);  XSRETURN(1); } STMT_END
+#endif
+#ifndef PUSHu
+#  define PUSHu(u)                       STMT_START { sv_setuv(TARG, (UV)(u)); PUSHTARG;  } STMT_END
+#endif
+
+#ifndef XPUSHu
+#  define XPUSHu(u)                      STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END
+#endif
+
+#ifdef HAS_MEMCMP
+#ifndef memNE
+#  define memNE(s1,s2,l)                 (memcmp(s1,s2,l))
+#endif
+
+#ifndef memEQ
+#  define memEQ(s1,s2,l)                 (!memcmp(s1,s2,l))
+#endif
+
+#else
+#ifndef memNE
+#  define memNE(s1,s2,l)                 (bcmp(s1,s2,l))
+#endif
+
+#ifndef memEQ
+#  define memEQ(s1,s2,l)                 (!bcmp(s1,s2,l))
+#endif
+
+#endif
+#ifndef MoveD
+#  define MoveD(s,d,n,t)                 memmove((char*)(d),(char*)(s), (n) * sizeof(t))
+#endif
+
+#ifndef CopyD
+#  define CopyD(s,d,n,t)                 memcpy((char*)(d),(char*)(s), (n) * sizeof(t))
+#endif
+
+#ifdef HAS_MEMSET
+#ifndef ZeroD
+#  define ZeroD(d,n,t)                   memzero((char*)(d), (n) * sizeof(t))
+#endif
+
+#else
+#ifndef ZeroD
+#  define ZeroD(d,n,t)                   ((void)memzero((char*)(d), (n) * sizeof(t)), d)
+#endif
+
+#endif
+#ifndef PoisonWith
+#  define PoisonWith(d,n,t,b)            (void)memset((char*)(d), (U8)(b), (n) * sizeof(t))
+#endif
+
+#ifndef PoisonNew
+#  define PoisonNew(d,n,t)               PoisonWith(d,n,t,0xAB)
+#endif
+
+#ifndef PoisonFree
+#  define PoisonFree(d,n,t)              PoisonWith(d,n,t,0xEF)
+#endif
+
+#ifndef Poison
+#  define Poison(d,n,t)                  PoisonFree(d,n,t)
+#endif
+#ifndef Newx
+#  define Newx(v,n,t)                    New(0,v,n,t)
+#endif
+
+#ifndef Newxc
+#  define Newxc(v,n,t,c)                 Newc(0,v,n,t,c)
+#endif
+
+#ifndef Newxz
+#  define Newxz(v,n,t)                   Newz(0,v,n,t)
+#endif
+
+#ifndef PERL_UNUSED_DECL
+#  ifdef HASATTRIBUTE
+#    if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER)
+#      define PERL_UNUSED_DECL
+#    else
+#      define PERL_UNUSED_DECL __attribute__((unused))
+#    endif
+#  else
+#    define PERL_UNUSED_DECL
+#  endif
+#endif
+
+#ifndef PERL_UNUSED_ARG
+#  if defined(lint) && defined(S_SPLINT_S) /* www.splint.org */
+#    include <note.h>
+#    define PERL_UNUSED_ARG(x) NOTE(ARGUNUSED(x))
+#  else
+#    define PERL_UNUSED_ARG(x) ((void)x)
+#  endif
+#endif
+
+#ifndef PERL_UNUSED_VAR
+#  define PERL_UNUSED_VAR(x) ((void)x)
+#endif
+
+#ifndef PERL_UNUSED_CONTEXT
+#  ifdef USE_ITHREADS
+#    define PERL_UNUSED_CONTEXT PERL_UNUSED_ARG(my_perl)
+#  else
+#    define PERL_UNUSED_CONTEXT
+#  endif
+#endif
+#ifndef NOOP
+#  define NOOP                           /*EMPTY*/(void)0
+#endif
+
+#ifndef dNOOP
+#  define dNOOP                          extern int /*@unused@*/ Perl___notused PERL_UNUSED_DECL
+#endif
+
+#ifndef NVTYPE
+#  if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
+#    define NVTYPE long double
+#  else
+#    define NVTYPE double
+#  endif
+typedef NVTYPE NV;
+#endif
+
+#ifndef INT2PTR
+
+#  if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
+#    define PTRV                  UV
+#    define INT2PTR(any,d)        (any)(d)
+#  else
+#    if PTRSIZE == LONGSIZE
+#      define PTRV                unsigned long
+#    else
+#      define PTRV                unsigned
+#    endif
+#    define INT2PTR(any,d)        (any)(PTRV)(d)
+#  endif
+
+#  define NUM2PTR(any,d)  (any)(PTRV)(d)
+#  define PTR2IV(p)       INT2PTR(IV,p)
+#  define PTR2UV(p)       INT2PTR(UV,p)
+#  define PTR2NV(p)       NUM2PTR(NV,p)
+
+#  if PTRSIZE == LONGSIZE
+#    define PTR2ul(p)     (unsigned long)(p)
+#  else
+#    define PTR2ul(p)     INT2PTR(unsigned long,p)
+#  endif
+
+#endif /* !INT2PTR */
+
+#undef START_EXTERN_C
+#undef END_EXTERN_C
+#undef EXTERN_C
+#ifdef __cplusplus
+#  define START_EXTERN_C extern "C" {
+#  define END_EXTERN_C }
+#  define EXTERN_C extern "C"
+#else
+#  define START_EXTERN_C
+#  define END_EXTERN_C
+#  define EXTERN_C extern
+#endif
+
+#if defined(PERL_GCC_PEDANTIC)
+#  ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN
+#    define PERL_GCC_BRACE_GROUPS_FORBIDDEN
+#  endif
+#endif
+
+#if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && !defined(__cplusplus)
+#  ifndef PERL_USE_GCC_BRACE_GROUPS
+#    define PERL_USE_GCC_BRACE_GROUPS
+#  endif
+#endif
+
+#undef STMT_START
+#undef STMT_END
+#ifdef PERL_USE_GCC_BRACE_GROUPS
+#  define STMT_START	(void)(	/* gcc supports ``({ STATEMENTS; })'' */
+#  define STMT_END	)
+#else
+#  if defined(VOIDFLAGS) && (VOIDFLAGS) && (defined(sun) || defined(__sun__)) && !defined(__GNUC__)
+#    define STMT_START	if (1)
+#    define STMT_END	else (void)0
+#  else
+#    define STMT_START	do
+#    define STMT_END	while (0)
+#  endif
+#endif
+#ifndef boolSV
+#  define boolSV(b)                      ((b) ? &PL_sv_yes : &PL_sv_no)
+#endif
+
+/* DEFSV appears first in 5.004_56 */
+#ifndef DEFSV
+#  define DEFSV                          GvSV(PL_defgv)
+#endif
+
+#ifndef SAVE_DEFSV
+#  define SAVE_DEFSV                     SAVESPTR(GvSV(PL_defgv))
+#endif
+
+/* Older perls (<=5.003) lack AvFILLp */
+#ifndef AvFILLp
+#  define AvFILLp                        AvFILL
+#endif
+#ifndef ERRSV
+#  define ERRSV                          get_sv("@",FALSE)
+#endif
+#ifndef newSVpvn
+#  define newSVpvn(data,len)             ((data)                                              \
+                                    ? ((len) ? newSVpv((data), (len)) : newSVpv("", 0)) \
+                                    : newSV(0))
+#endif
+
+/* Hint: gv_stashpvn
+ * This function's backport doesn't support the length parameter, but
+ * rather ignores it. Portability can only be ensured if the length
+ * parameter is used for speed reasons, but the length can always be
+ * correctly computed from the string argument.
+ */
+#ifndef gv_stashpvn
+#  define gv_stashpvn(str,len,create)    gv_stashpv(str,create)
+#endif
+
+/* Replace: 1 */
+#ifndef get_cv
+#  define get_cv                         perl_get_cv
+#endif
+
+#ifndef get_sv
+#  define get_sv                         perl_get_sv
+#endif
+
+#ifndef get_av
+#  define get_av                         perl_get_av
+#endif
+
+#ifndef get_hv
+#  define get_hv                         perl_get_hv
+#endif
+
+/* Replace: 0 */
+#ifndef dUNDERBAR
+#  define dUNDERBAR                      dNOOP
+#endif
+
+#ifndef UNDERBAR
+#  define UNDERBAR                       DEFSV
+#endif
+#ifndef dAX
+#  define dAX                            I32 ax = MARK - PL_stack_base + 1
+#endif
+
+#ifndef dITEMS
+#  define dITEMS                         I32 items = SP - MARK
+#endif
+#ifndef dXSTARG
+#  define dXSTARG                        SV * targ = sv_newmortal()
+#endif
+#ifndef dAXMARK
+#  define dAXMARK                        I32 ax = POPMARK; \
+                               register SV ** const mark = PL_stack_base + ax++
+#endif
+#ifndef XSprePUSH
+#  define XSprePUSH                      (sp = PL_stack_base + ax - 1)
+#endif
+
+#if (PERL_BCDVERSION < 0x5005000)
+#  undef XSRETURN
+#  define XSRETURN(off)                                   \
+      STMT_START {                                        \
+          PL_stack_sp = PL_stack_base + ax + ((off) - 1); \
+          return;                                         \
+      } STMT_END
+#endif
+#ifndef PERL_ABS
+#  define PERL_ABS(x)                    ((x) < 0 ? -(x) : (x))
+#endif
+#ifndef dVAR
+#  define dVAR                           dNOOP
+#endif
+#ifndef SVf
+#  define SVf                            "_"
+#endif
+#ifndef UTF8_MAXBYTES
+#  define UTF8_MAXBYTES                  UTF8_MAXLEN
+#endif
+#ifndef PERL_HASH
+#  define PERL_HASH(hash,str,len)        \
+     STMT_START	{ \
+	const char *s_PeRlHaSh = str; \
+	I32 i_PeRlHaSh = len; \
+	U32 hash_PeRlHaSh = 0; \
+	while (i_PeRlHaSh--) \
+	    hash_PeRlHaSh = hash_PeRlHaSh * 33 + *s_PeRlHaSh++; \
+	(hash) = hash_PeRlHaSh; \
+    } STMT_END
+#endif
+
+#ifndef PERL_SIGNALS_UNSAFE_FLAG
+
+#define PERL_SIGNALS_UNSAFE_FLAG 0x0001
+
+#if (PERL_BCDVERSION < 0x5008000)
+#  define D_PPP_PERL_SIGNALS_INIT   PERL_SIGNALS_UNSAFE_FLAG
+#else
+#  define D_PPP_PERL_SIGNALS_INIT   0
+#endif
+
+#if defined(NEED_PL_signals)
+static U32 DPPP_(my_PL_signals) = D_PPP_PERL_SIGNALS_INIT;
+#elif defined(NEED_PL_signals_GLOBAL)
+U32 DPPP_(my_PL_signals) = D_PPP_PERL_SIGNALS_INIT;
+#else
+extern U32 DPPP_(my_PL_signals);
+#endif
+#define PL_signals DPPP_(my_PL_signals)
+
+#endif
+
+/* Hint: PL_ppaddr
+ * Calling an op via PL_ppaddr requires passing a context argument
+ * for threaded builds. Since the context argument is different for
+ * 5.005 perls, you can use aTHXR (supplied by ppport.h), which will
+ * automatically be defined as the correct argument.
+ */
+
+#if (PERL_BCDVERSION <= 0x5005005)
+/* Replace: 1 */
+#  define PL_ppaddr                 ppaddr
+#  define PL_no_modify              no_modify
+/* Replace: 0 */
+#endif
+
+#if (PERL_BCDVERSION <= 0x5004005)
+/* Replace: 1 */
+#  define PL_DBsignal               DBsignal
+#  define PL_DBsingle               DBsingle
+#  define PL_DBsub                  DBsub
+#  define PL_DBtrace                DBtrace
+#  define PL_Sv                     Sv
+#  define PL_compiling              compiling
+#  define PL_copline                copline
+#  define PL_curcop                 curcop
+#  define PL_curstash               curstash
+#  define PL_debstash               debstash
+#  define PL_defgv                  defgv
+#  define PL_diehook                diehook
+#  define PL_dirty                  dirty
+#  define PL_dowarn                 dowarn
+#  define PL_errgv                  errgv
+#  define PL_expect                 expect
+#  define PL_hexdigit               hexdigit
+#  define PL_hints                  hints
+#  define PL_laststatval            laststatval
+#  define PL_na                     na
+#  define PL_perl_destruct_level    perl_destruct_level
+#  define PL_perldb                 perldb
+#  define PL_rsfp_filters           rsfp_filters
+#  define PL_rsfp                   rsfp
+#  define PL_stack_base             stack_base
+#  define PL_stack_sp               stack_sp
+#  define PL_statcache              statcache
+#  define PL_stdingv                stdingv
+#  define PL_sv_arenaroot           sv_arenaroot
+#  define PL_sv_no                  sv_no
+#  define PL_sv_undef               sv_undef
+#  define PL_sv_yes                 sv_yes
+#  define PL_tainted                tainted
+#  define PL_tainting               tainting
+/* Replace: 0 */
+#endif
+
+/* Warning: PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters
+ * Do not use this variable. It is internal to the perl parser
+ * and may change or even be removed in the future. Note that
+ * as of perl 5.9.5 you cannot assign to this variable anymore.
+ */
+
+/* TODO: cannot assign to these vars; is it worth fixing? */
+#if (PERL_BCDVERSION >= 0x5009005)
+#  define PL_expect         (PL_parser ? PL_parser->expect : 0)
+#  define PL_copline        (PL_parser ? PL_parser->copline : 0)
+#  define PL_rsfp           (PL_parser ? PL_parser->rsfp : (PerlIO *) 0)
+#  define PL_rsfp_filters   (PL_parser ? PL_parser->rsfp_filters : (AV *) 0)
+#endif
+#ifndef dTHR
+#  define dTHR                           dNOOP
+#endif
+#ifndef dTHX
+#  define dTHX                           dNOOP
+#endif
+
+#ifndef dTHXa
+#  define dTHXa(x)                       dNOOP
+#endif
+#ifndef pTHX
+#  define pTHX                           void
+#endif
+
+#ifndef pTHX_
+#  define pTHX_
+#endif
+
+#ifndef aTHX
+#  define aTHX
+#endif
+
+#ifndef aTHX_
+#  define aTHX_
+#endif
+
+#if (PERL_BCDVERSION < 0x5006000)
+#  ifdef USE_THREADS
+#    define aTHXR  thr
+#    define aTHXR_ thr,
+#  else
+#    define aTHXR
+#    define aTHXR_
+#  endif
+#  define dTHXR  dTHR
+#else
+#  define aTHXR  aTHX
+#  define aTHXR_ aTHX_
+#  define dTHXR  dTHX
+#endif
+#ifndef dTHXoa
+#  define dTHXoa(x)                      dTHXa(x)
+#endif
+#ifndef PUSHmortal
+#  define PUSHmortal                     PUSHs(sv_newmortal())
+#endif
+
+#ifndef mPUSHp
+#  define mPUSHp(p,l)                    sv_setpvn_mg(PUSHmortal, (p), (l))
+#endif
+
+#ifndef mPUSHn
+#  define mPUSHn(n)                      sv_setnv_mg(PUSHmortal, (NV)(n))
+#endif
+
+#ifndef mPUSHi
+#  define mPUSHi(i)                      sv_setiv_mg(PUSHmortal, (IV)(i))
+#endif
+
+#ifndef mPUSHu
+#  define mPUSHu(u)                      sv_setuv_mg(PUSHmortal, (UV)(u))
+#endif
+#ifndef XPUSHmortal
+#  define XPUSHmortal                    XPUSHs(sv_newmortal())
+#endif
+
+#ifndef mXPUSHp
+#  define mXPUSHp(p,l)                   STMT_START { EXTEND(sp,1); sv_setpvn_mg(PUSHmortal, (p), (l)); } STMT_END
+#endif
+
+#ifndef mXPUSHn
+#  define mXPUSHn(n)                     STMT_START { EXTEND(sp,1); sv_setnv_mg(PUSHmortal, (NV)(n)); } STMT_END
+#endif
+
+#ifndef mXPUSHi
+#  define mXPUSHi(i)                     STMT_START { EXTEND(sp,1); sv_setiv_mg(PUSHmortal, (IV)(i)); } STMT_END
+#endif
+
+#ifndef mXPUSHu
+#  define mXPUSHu(u)                     STMT_START { EXTEND(sp,1); sv_setuv_mg(PUSHmortal, (UV)(u)); } STMT_END
+#endif
+
+/* Replace: 1 */
+#ifndef call_sv
+#  define call_sv                        perl_call_sv
+#endif
+
+#ifndef call_pv
+#  define call_pv                        perl_call_pv
+#endif
+
+#ifndef call_argv
+#  define call_argv                      perl_call_argv
+#endif
+
+#ifndef call_method
+#  define call_method                    perl_call_method
+#endif
+#ifndef eval_sv
+#  define eval_sv                        perl_eval_sv
+#endif
+#ifndef PERL_LOADMOD_DENY
+#  define PERL_LOADMOD_DENY              0x1
+#endif
+
+#ifndef PERL_LOADMOD_NOIMPORT
+#  define PERL_LOADMOD_NOIMPORT          0x2
+#endif
+
+#ifndef PERL_LOADMOD_IMPORT_OPS
+#  define PERL_LOADMOD_IMPORT_OPS        0x4
+#endif
+
+/* Replace: 0 */
+
+/* Replace perl_eval_pv with eval_pv */
+
+#ifndef eval_pv
+#if defined(NEED_eval_pv)
+static SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error);
+static
+#else
+extern SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error);
+#endif
+
+#ifdef eval_pv
+#  undef eval_pv
+#endif
+#define eval_pv(a,b) DPPP_(my_eval_pv)(aTHX_ a,b)
+#define Perl_eval_pv DPPP_(my_eval_pv)
+
+#if defined(NEED_eval_pv) || defined(NEED_eval_pv_GLOBAL)
+
+SV*
+DPPP_(my_eval_pv)(char *p, I32 croak_on_error)
+{
+    dSP;
+    SV* sv = newSVpv(p, 0);
+
+    PUSHMARK(sp);
+    eval_sv(sv, G_SCALAR);
+    SvREFCNT_dec(sv);
+
+    SPAGAIN;
+    sv = POPs;
+    PUTBACK;
+
+    if (croak_on_error && SvTRUE(GvSV(errgv)))
+	croak(SvPVx(GvSV(errgv), na));
+
+    return sv;
+}
+
+#endif
+#endif
+
+#ifndef vload_module
+#if defined(NEED_vload_module)
+static void DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args);
+static
+#else
+extern void DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args);
+#endif
+
+#ifdef vload_module
+#  undef vload_module
+#endif
+#define vload_module(a,b,c,d) DPPP_(my_vload_module)(aTHX_ a,b,c,d)
+#define Perl_vload_module DPPP_(my_vload_module)
+
+#if defined(NEED_vload_module) || defined(NEED_vload_module_GLOBAL)
+
+void
+DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args)
+{
+    dTHR;
+    dVAR;
+    OP *veop, *imop;
+
+    OP * const modname = newSVOP(OP_CONST, 0, name);
+    /* 5.005 has a somewhat hacky force_normal that doesn't croak on
+       SvREADONLY() if PL_compling is true. Current perls take care in
+       ck_require() to correctly turn off SvREADONLY before calling
+       force_normal_flags(). This seems a better fix than fudging PL_compling
+     */
+    SvREADONLY_off(((SVOP*)modname)->op_sv);
+    modname->op_private |= OPpCONST_BARE;
+    if (ver) {
+	veop = newSVOP(OP_CONST, 0, ver);
+    }
+    else
+	veop = NULL;
+    if (flags & PERL_LOADMOD_NOIMPORT) {
+	imop = sawparens(newNULLLIST());
+    }
+    else if (flags & PERL_LOADMOD_IMPORT_OPS) {
+	imop = va_arg(*args, OP*);
+    }
+    else {
+	SV *sv;
+	imop = NULL;
+	sv = va_arg(*args, SV*);
+	while (sv) {
+	    imop = append_elem(OP_LIST, imop, newSVOP(OP_CONST, 0, sv));
+	    sv = va_arg(*args, SV*);
+	}
+    }
+    {
+	const line_t ocopline = PL_copline;
+	COP * const ocurcop = PL_curcop;
+	const int oexpect = PL_expect;
+
+#if (PERL_BCDVERSION >= 0x5004000)
+	utilize(!(flags & PERL_LOADMOD_DENY), start_subparse(FALSE, 0),
+		veop, modname, imop);
+#else
+	utilize(!(flags & PERL_LOADMOD_DENY), start_subparse(),
+		modname, imop);
+#endif
+	PL_expect = oexpect;
+	PL_copline = ocopline;
+	PL_curcop = ocurcop;
+    }
+}
+
+#endif
+#endif
+
+#ifndef load_module
+#if defined(NEED_load_module)
+static void DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...);
+static
+#else
+extern void DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...);
+#endif
+
+#ifdef load_module
+#  undef load_module
+#endif
+#define load_module DPPP_(my_load_module)
+#define Perl_load_module DPPP_(my_load_module)
+
+#if defined(NEED_load_module) || defined(NEED_load_module_GLOBAL)
+
+void
+DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...)
+{
+    va_list args;
+    va_start(args, ver);
+    vload_module(flags, name, ver, &args);
+    va_end(args);
+}
+
+#endif
+#endif
+#ifndef newRV_inc
+#  define newRV_inc(sv)                  newRV(sv)   /* Replace */
+#endif
+
+#ifndef newRV_noinc
+#if defined(NEED_newRV_noinc)
+static SV * DPPP_(my_newRV_noinc)(SV *sv);
+static
+#else
+extern SV * DPPP_(my_newRV_noinc)(SV *sv);
+#endif
+
+#ifdef newRV_noinc
+#  undef newRV_noinc
+#endif
+#define newRV_noinc(a) DPPP_(my_newRV_noinc)(aTHX_ a)
+#define Perl_newRV_noinc DPPP_(my_newRV_noinc)
+
+#if defined(NEED_newRV_noinc) || defined(NEED_newRV_noinc_GLOBAL)
+SV *
+DPPP_(my_newRV_noinc)(SV *sv)
+{
+  SV *rv = (SV *)newRV(sv);
+  SvREFCNT_dec(sv);
+  return rv;
+}
+#endif
+#endif
+
+/* Hint: newCONSTSUB
+ * Returns a CV* as of perl-5.7.1. This return value is not supported
+ * by Devel::PPPort.
+ */
+
+/* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */
+#if (PERL_BCDVERSION < 0x5004063) && (PERL_BCDVERSION != 0x5004005)
+#if defined(NEED_newCONSTSUB)
+static void DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv);
+static
+#else
+extern void DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv);
+#endif
+
+#ifdef newCONSTSUB
+#  undef newCONSTSUB
+#endif
+#define newCONSTSUB(a,b,c) DPPP_(my_newCONSTSUB)(aTHX_ a,b,c)
+#define Perl_newCONSTSUB DPPP_(my_newCONSTSUB)
+
+#if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL)
+
+void
+DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv)
+{
+	U32 oldhints = PL_hints;
+	HV *old_cop_stash = PL_curcop->cop_stash;
+	HV *old_curstash = PL_curstash;
+	line_t oldline = PL_curcop->cop_line;
+	PL_curcop->cop_line = PL_copline;
+
+	PL_hints &= ~HINT_BLOCK_SCOPE;
+	if (stash)
+		PL_curstash = PL_curcop->cop_stash = stash;
+
+	newSUB(
+
+#if   (PERL_BCDVERSION < 0x5003022)
+		start_subparse(),
+#elif (PERL_BCDVERSION == 0x5003022)
+     		start_subparse(0),
+#else  /* 5.003_23  onwards */
+     		start_subparse(FALSE, 0),
+#endif
+
+		newSVOP(OP_CONST, 0, newSVpv((char *) name, 0)),
+		newSVOP(OP_CONST, 0, &PL_sv_no),   /* SvPV(&PL_sv_no) == "" -- GMB */
+		newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv))
+	);
+
+	PL_hints = oldhints;
+	PL_curcop->cop_stash = old_cop_stash;
+	PL_curstash = old_curstash;
+	PL_curcop->cop_line = oldline;
+}
+#endif
+#endif
+
+/*
+ * Boilerplate macros for initializing and accessing interpreter-local
+ * data from C.  All statics in extensions should be reworked to use
+ * this, if you want to make the extension thread-safe.  See ext/re/re.xs
+ * for an example of the use of these macros.
+ *
+ * Code that uses these macros is responsible for the following:
+ * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts"
+ * 2. Declare a typedef named my_cxt_t that is a structure that contains
+ *    all the data that needs to be interpreter-local.
+ * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t.
+ * 4. Use the MY_CXT_INIT macro such that it is called exactly once
+ *    (typically put in the BOOT: section).
+ * 5. Use the members of the my_cxt_t structure everywhere as
+ *    MY_CXT.member.
+ * 6. Use the dMY_CXT macro (a declaration) in all the functions that
+ *    access MY_CXT.
+ */
+
+#if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \
+    defined(PERL_CAPI)    || defined(PERL_IMPLICIT_CONTEXT)
+
+#ifndef START_MY_CXT
+
+/* This must appear in all extensions that define a my_cxt_t structure,
+ * right after the definition (i.e. at file scope).  The non-threads
+ * case below uses it to declare the data as static. */
+#define START_MY_CXT
+
+#if (PERL_BCDVERSION < 0x5004068)
+/* Fetches the SV that keeps the per-interpreter data. */
+#define dMY_CXT_SV \
+	SV *my_cxt_sv = get_sv(MY_CXT_KEY, FALSE)
+#else /* >= perl5.004_68 */
+#define dMY_CXT_SV \
+	SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY,		\
+				  sizeof(MY_CXT_KEY)-1, TRUE)
+#endif /* < perl5.004_68 */
+
+/* This declaration should be used within all functions that use the
+ * interpreter-local data. */
+#define dMY_CXT	\
+	dMY_CXT_SV;							\
+	my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv))
+
+/* Creates and zeroes the per-interpreter data.
+ * (We allocate my_cxtp in a Perl SV so that it will be released when
+ * the interpreter goes away.) */
+#define MY_CXT_INIT \
+	dMY_CXT_SV;							\
+	/* newSV() allocates one more than needed */			\
+	my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\
+	Zero(my_cxtp, 1, my_cxt_t);					\
+	sv_setuv(my_cxt_sv, PTR2UV(my_cxtp))
+
+/* This macro must be used to access members of the my_cxt_t structure.
+ * e.g. MYCXT.some_data */
+#define MY_CXT		(*my_cxtp)
+
+/* Judicious use of these macros can reduce the number of times dMY_CXT
+ * is used.  Use is similar to pTHX, aTHX etc. */
+#define pMY_CXT		my_cxt_t *my_cxtp
+#define pMY_CXT_	pMY_CXT,
+#define _pMY_CXT	,pMY_CXT
+#define aMY_CXT		my_cxtp
+#define aMY_CXT_	aMY_CXT,
+#define _aMY_CXT	,aMY_CXT
+
+#endif /* START_MY_CXT */
+
+#ifndef MY_CXT_CLONE
+/* Clones the per-interpreter data. */
+#define MY_CXT_CLONE \
+	dMY_CXT_SV;							\
+	my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\
+	Copy(INT2PTR(my_cxt_t*, SvUV(my_cxt_sv)), my_cxtp, 1, my_cxt_t);\
+	sv_setuv(my_cxt_sv, PTR2UV(my_cxtp))
+#endif
+
+#else /* single interpreter */
+
+#ifndef START_MY_CXT
+
+#define START_MY_CXT	static my_cxt_t my_cxt;
+#define dMY_CXT_SV	dNOOP
+#define dMY_CXT		dNOOP
+#define MY_CXT_INIT	NOOP
+#define MY_CXT		my_cxt
+
+#define pMY_CXT		void
+#define pMY_CXT_
+#define _pMY_CXT
+#define aMY_CXT
+#define aMY_CXT_
+#define _aMY_CXT
+
+#endif /* START_MY_CXT */
+
+#ifndef MY_CXT_CLONE
+#define MY_CXT_CLONE	NOOP
+#endif
+
+#endif
+
+#ifndef IVdf
+#  if IVSIZE == LONGSIZE
+#    define	IVdf      "ld"
+#    define	UVuf      "lu"
+#    define	UVof      "lo"
+#    define	UVxf      "lx"
+#    define	UVXf      "lX"
+#  else
+#    if IVSIZE == INTSIZE
+#      define	IVdf      "d"
+#      define	UVuf      "u"
+#      define	UVof      "o"
+#      define	UVxf      "x"
+#      define	UVXf      "X"
+#    endif
+#  endif
+#endif
+
+#ifndef NVef
+#  if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \
+      defined(PERL_PRIfldbl) /* Not very likely, but let's try anyway. */
+#    define NVef          PERL_PRIeldbl
+#    define NVff          PERL_PRIfldbl
+#    define NVgf          PERL_PRIgldbl
+#  else
+#    define NVef          "e"
+#    define NVff          "f"
+#    define NVgf          "g"
+#  endif
+#endif
+
+#ifndef SvREFCNT_inc
+#  ifdef PERL_USE_GCC_BRACE_GROUPS
+#    define SvREFCNT_inc(sv)		\
+      ({				\
+          SV * const _sv = (SV*)(sv);	\
+          if (_sv)			\
+               (SvREFCNT(_sv))++;	\
+          _sv;				\
+      })
+#  else
+#    define SvREFCNT_inc(sv)	\
+          ((PL_Sv=(SV*)(sv)) ? (++(SvREFCNT(PL_Sv)),PL_Sv) : NULL)
+#  endif
+#endif
+
+#ifndef SvREFCNT_inc_simple
+#  ifdef PERL_USE_GCC_BRACE_GROUPS
+#    define SvREFCNT_inc_simple(sv)	\
+      ({					\
+          if (sv)				\
+               (SvREFCNT(sv))++;		\
+          (SV *)(sv);				\
+      })
+#  else
+#    define SvREFCNT_inc_simple(sv) \
+          ((sv) ? (SvREFCNT(sv)++,(SV*)(sv)) : NULL)
+#  endif
+#endif
+
+#ifndef SvREFCNT_inc_NN
+#  ifdef PERL_USE_GCC_BRACE_GROUPS
+#    define SvREFCNT_inc_NN(sv)		\
+      ({					\
+          SV * const _sv = (SV*)(sv);	\
+          SvREFCNT(_sv)++;		\
+          _sv;				\
+      })
+#  else
+#    define SvREFCNT_inc_NN(sv) \
+          (PL_Sv=(SV*)(sv),++(SvREFCNT(PL_Sv)),PL_Sv)
+#  endif
+#endif
+
+#ifndef SvREFCNT_inc_void
+#  ifdef PERL_USE_GCC_BRACE_GROUPS
+#    define SvREFCNT_inc_void(sv)		\
+      ({					\
+          SV * const _sv = (SV*)(sv);	\
+          if (_sv)			\
+              (void)(SvREFCNT(_sv)++);	\
+      })
+#  else
+#    define SvREFCNT_inc_void(sv) \
+          (void)((PL_Sv=(SV*)(sv)) ? ++(SvREFCNT(PL_Sv)) : 0)
+#  endif
+#endif
+#ifndef SvREFCNT_inc_simple_void
+#  define SvREFCNT_inc_simple_void(sv)   STMT_START { if (sv) SvREFCNT(sv)++; } STMT_END
+#endif
+
+#ifndef SvREFCNT_inc_simple_NN
+#  define SvREFCNT_inc_simple_NN(sv)     (++SvREFCNT(sv), (SV*)(sv))
+#endif
+
+#ifndef SvREFCNT_inc_void_NN
+#  define SvREFCNT_inc_void_NN(sv)       (void)(++SvREFCNT((SV*)(sv)))
+#endif
+
+#ifndef SvREFCNT_inc_simple_void_NN
+#  define SvREFCNT_inc_simple_void_NN(sv) (void)(++SvREFCNT((SV*)(sv)))
+#endif
+
+/* Backwards compatibility stuff... :-( */
+#if !defined(NEED_sv_2pv_flags) && defined(NEED_sv_2pv_nolen)
+#  define NEED_sv_2pv_flags
+#endif
+#if !defined(NEED_sv_2pv_flags_GLOBAL) && defined(NEED_sv_2pv_nolen_GLOBAL)
+#  define NEED_sv_2pv_flags_GLOBAL
+#endif
+
+/* Hint: sv_2pv_nolen
+ * Use the SvPV_nolen() or SvPV_nolen_const() macros instead of sv_2pv_nolen().
+ */
+#ifndef sv_2pv_nolen
+#  define sv_2pv_nolen(sv)               SvPV_nolen(sv)
+#endif
+
+#ifdef SvPVbyte
+
+/* Hint: SvPVbyte
+ * Does not work in perl-5.6.1, ppport.h implements a version
+ * borrowed from perl-5.7.3.
+ */
+
+#if (PERL_BCDVERSION < 0x5007000)
+
+#if defined(NEED_sv_2pvbyte)
+static char * DPPP_(my_sv_2pvbyte)(pTHX_ SV * sv, STRLEN * lp);
+static
+#else
+extern char * DPPP_(my_sv_2pvbyte)(pTHX_ SV * sv, STRLEN * lp);
+#endif
+
+#ifdef sv_2pvbyte
+#  undef sv_2pvbyte
+#endif
+#define sv_2pvbyte(a,b) DPPP_(my_sv_2pvbyte)(aTHX_ a,b)
+#define Perl_sv_2pvbyte DPPP_(my_sv_2pvbyte)
+
+#if defined(NEED_sv_2pvbyte) || defined(NEED_sv_2pvbyte_GLOBAL)
+
+char *
+DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp)
+{
+  sv_utf8_downgrade(sv,0);
+  return SvPV(sv,*lp);
+}
+
+#endif
+
+/* Hint: sv_2pvbyte
+ * Use the SvPVbyte() macro instead of sv_2pvbyte().
+ */
+
+#undef SvPVbyte
+
+#define SvPVbyte(sv, lp)                                                \
+        ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK)                \
+         ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pvbyte(sv, &lp))
+
+#endif
+
+#else
+
+#  define SvPVbyte          SvPV
+#  define sv_2pvbyte        sv_2pv
+
+#endif
+#ifndef sv_2pvbyte_nolen
+#  define sv_2pvbyte_nolen(sv)           sv_2pv_nolen(sv)
+#endif
+
+/* Hint: sv_pvn
+ * Always use the SvPV() macro instead of sv_pvn().
+ */
+
+/* Hint: sv_pvn_force
+ * Always use the SvPV_force() macro instead of sv_pvn_force().
+ */
+
+/* If these are undefined, they're not handled by the core anyway */
+#ifndef SV_IMMEDIATE_UNREF
+#  define SV_IMMEDIATE_UNREF             0
+#endif
+
+#ifndef SV_GMAGIC
+#  define SV_GMAGIC                      0
+#endif
+
+#ifndef SV_COW_DROP_PV
+#  define SV_COW_DROP_PV                 0
+#endif
+
+#ifndef SV_UTF8_NO_ENCODING
+#  define SV_UTF8_NO_ENCODING            0
+#endif
+
+#ifndef SV_NOSTEAL
+#  define SV_NOSTEAL                     0
+#endif
+
+#ifndef SV_CONST_RETURN
+#  define SV_CONST_RETURN                0
+#endif
+
+#ifndef SV_MUTABLE_RETURN
+#  define SV_MUTABLE_RETURN              0
+#endif
+
+#ifndef SV_SMAGIC
+#  define SV_SMAGIC                      0
+#endif
+
+#ifndef SV_HAS_TRAILING_NUL
+#  define SV_HAS_TRAILING_NUL            0
+#endif
+
+#ifndef SV_COW_SHARED_HASH_KEYS
+#  define SV_COW_SHARED_HASH_KEYS        0
+#endif
+
+#if (PERL_BCDVERSION < 0x5007002)
+
+#if defined(NEED_sv_2pv_flags)
+static char * DPPP_(my_sv_2pv_flags)(pTHX_ SV * sv, STRLEN * lp, I32 flags);
+static
+#else
+extern char * DPPP_(my_sv_2pv_flags)(pTHX_ SV * sv, STRLEN * lp, I32 flags);
+#endif
+
+#ifdef sv_2pv_flags
+#  undef sv_2pv_flags
+#endif
+#define sv_2pv_flags(a,b,c) DPPP_(my_sv_2pv_flags)(aTHX_ a,b,c)
+#define Perl_sv_2pv_flags DPPP_(my_sv_2pv_flags)
+
+#if defined(NEED_sv_2pv_flags) || defined(NEED_sv_2pv_flags_GLOBAL)
+
+char *
+DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags)
+{
+  STRLEN n_a = (STRLEN) flags;
+  return sv_2pv(sv, lp ? lp : &n_a);
+}
+
+#endif
+
+#if defined(NEED_sv_pvn_force_flags)
+static char * DPPP_(my_sv_pvn_force_flags)(pTHX_ SV * sv, STRLEN * lp, I32 flags);
+static
+#else
+extern char * DPPP_(my_sv_pvn_force_flags)(pTHX_ SV * sv, STRLEN * lp, I32 flags);
+#endif
+
+#ifdef sv_pvn_force_flags
+#  undef sv_pvn_force_flags
+#endif
+#define sv_pvn_force_flags(a,b,c) DPPP_(my_sv_pvn_force_flags)(aTHX_ a,b,c)
+#define Perl_sv_pvn_force_flags DPPP_(my_sv_pvn_force_flags)
+
+#if defined(NEED_sv_pvn_force_flags) || defined(NEED_sv_pvn_force_flags_GLOBAL)
+
+char *
+DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags)
+{
+  STRLEN n_a = (STRLEN) flags;
+  return sv_pvn_force(sv, lp ? lp : &n_a);
+}
+
+#endif
+
+#endif
+#ifndef SvPV_const
+#  define SvPV_const(sv, lp)             SvPV_flags_const(sv, lp, SV_GMAGIC)
+#endif
+
+#ifndef SvPV_mutable
+#  define SvPV_mutable(sv, lp)           SvPV_flags_mutable(sv, lp, SV_GMAGIC)
+#endif
+#ifndef SvPV_flags
+#  define SvPV_flags(sv, lp, flags)      \
+                 ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
+                  ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pv_flags(sv, &lp, flags))
+#endif
+#ifndef SvPV_flags_const
+#  define SvPV_flags_const(sv, lp, flags) \
+                 ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
+                  ? ((lp = SvCUR(sv)), SvPVX_const(sv)) : \
+                  (const char*) sv_2pv_flags(sv, &lp, flags|SV_CONST_RETURN))
+#endif
+#ifndef SvPV_flags_const_nolen
+#  define SvPV_flags_const_nolen(sv, flags) \
+                 ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
+                  ? SvPVX_const(sv) : \
+                  (const char*) sv_2pv_flags(sv, 0, flags|SV_CONST_RETURN))
+#endif
+#ifndef SvPV_flags_mutable
+#  define SvPV_flags_mutable(sv, lp, flags) \
+                 ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
+                  ? ((lp = SvCUR(sv)), SvPVX_mutable(sv)) : \
+                  sv_2pv_flags(sv, &lp, flags|SV_MUTABLE_RETURN))
+#endif
+#ifndef SvPV_force
+#  define SvPV_force(sv, lp)             SvPV_force_flags(sv, lp, SV_GMAGIC)
+#endif
+
+#ifndef SvPV_force_nolen
+#  define SvPV_force_nolen(sv)           SvPV_force_flags_nolen(sv, SV_GMAGIC)
+#endif
+
+#ifndef SvPV_force_mutable
+#  define SvPV_force_mutable(sv, lp)     SvPV_force_flags_mutable(sv, lp, SV_GMAGIC)
+#endif
+
+#ifndef SvPV_force_nomg
+#  define SvPV_force_nomg(sv, lp)        SvPV_force_flags(sv, lp, 0)
+#endif
+
+#ifndef SvPV_force_nomg_nolen
+#  define SvPV_force_nomg_nolen(sv)      SvPV_force_flags_nolen(sv, 0)
+#endif
+#ifndef SvPV_force_flags
+#  define SvPV_force_flags(sv, lp, flags) \
+                 ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \
+                 ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_pvn_force_flags(sv, &lp, flags))
+#endif
+#ifndef SvPV_force_flags_nolen
+#  define SvPV_force_flags_nolen(sv, flags) \
+                 ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \
+                 ? SvPVX(sv) : sv_pvn_force_flags(sv, 0, flags))
+#endif
+#ifndef SvPV_force_flags_mutable
+#  define SvPV_force_flags_mutable(sv, lp, flags) \
+                 ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \
+                 ? ((lp = SvCUR(sv)), SvPVX_mutable(sv)) \
+                  : sv_pvn_force_flags(sv, &lp, flags|SV_MUTABLE_RETURN))
+#endif
+#ifndef SvPV_nolen
+#  define SvPV_nolen(sv)                 \
+                 ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
+                  ? SvPVX(sv) : sv_2pv_flags(sv, 0, SV_GMAGIC))
+#endif
+#ifndef SvPV_nolen_const
+#  define SvPV_nolen_const(sv)           \
+                 ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
+                  ? SvPVX_const(sv) : sv_2pv_flags(sv, 0, SV_GMAGIC|SV_CONST_RETURN))
+#endif
+#ifndef SvPV_nomg
+#  define SvPV_nomg(sv, lp)              SvPV_flags(sv, lp, 0)
+#endif
+
+#ifndef SvPV_nomg_const
+#  define SvPV_nomg_const(sv, lp)        SvPV_flags_const(sv, lp, 0)
+#endif
+
+#ifndef SvPV_nomg_const_nolen
+#  define SvPV_nomg_const_nolen(sv)      SvPV_flags_const_nolen(sv, 0)
+#endif
+#ifndef SvMAGIC_set
+#  define SvMAGIC_set(sv, val)           \
+                STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \
+                (((XPVMG*) SvANY(sv))->xmg_magic = (val)); } STMT_END
+#endif
+
+#if (PERL_BCDVERSION < 0x5009003)
+#ifndef SvPVX_const
+#  define SvPVX_const(sv)                ((const char*) (0 + SvPVX(sv)))
+#endif
+
+#ifndef SvPVX_mutable
+#  define SvPVX_mutable(sv)              (0 + SvPVX(sv))
+#endif
+#ifndef SvRV_set
+#  define SvRV_set(sv, val)              \
+                STMT_START { assert(SvTYPE(sv) >=  SVt_RV); \
+                (((XRV*) SvANY(sv))->xrv_rv = (val)); } STMT_END
+#endif
+
+#else
+#ifndef SvPVX_const
+#  define SvPVX_const(sv)                ((const char*)((sv)->sv_u.svu_pv))
+#endif
+
+#ifndef SvPVX_mutable
+#  define SvPVX_mutable(sv)              ((sv)->sv_u.svu_pv)
+#endif
+#ifndef SvRV_set
+#  define SvRV_set(sv, val)              \
+                STMT_START { assert(SvTYPE(sv) >=  SVt_RV); \
+                ((sv)->sv_u.svu_rv = (val)); } STMT_END
+#endif
+
+#endif
+#ifndef SvSTASH_set
+#  define SvSTASH_set(sv, val)           \
+                STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \
+                (((XPVMG*) SvANY(sv))->xmg_stash = (val)); } STMT_END
+#endif
+
+#if (PERL_BCDVERSION < 0x5004000)
+#ifndef SvUV_set
+#  define SvUV_set(sv, val)              \
+                STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \
+                (((XPVIV*) SvANY(sv))->xiv_iv = (IV) (val)); } STMT_END
+#endif
+
+#else
+#ifndef SvUV_set
+#  define SvUV_set(sv, val)              \
+                STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \
+                (((XPVUV*) SvANY(sv))->xuv_uv = (val)); } STMT_END
+#endif
+
+#endif
+
+#if (PERL_BCDVERSION >= 0x5004000) && !defined(vnewSVpvf)
+#if defined(NEED_vnewSVpvf)
+static SV * DPPP_(my_vnewSVpvf)(pTHX_ const char * pat, va_list * args);
+static
+#else
+extern SV * DPPP_(my_vnewSVpvf)(pTHX_ const char * pat, va_list * args);
+#endif
+
+#ifdef vnewSVpvf
+#  undef vnewSVpvf
+#endif
+#define vnewSVpvf(a,b) DPPP_(my_vnewSVpvf)(aTHX_ a,b)
+#define Perl_vnewSVpvf DPPP_(my_vnewSVpvf)
+
+#if defined(NEED_vnewSVpvf) || defined(NEED_vnewSVpvf_GLOBAL)
+
+SV *
+DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args)
+{
+  register SV *sv = newSV(0);
+  sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*));
+  return sv;
+}
+
+#endif
+#endif
+
+#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vcatpvf)
+#  define sv_vcatpvf(sv, pat, args)  sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*))
+#endif
+
+#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vsetpvf)
+#  define sv_vsetpvf(sv, pat, args)  sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*))
+#endif
+
+#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_catpvf_mg)
+#if defined(NEED_sv_catpvf_mg)
+static void DPPP_(my_sv_catpvf_mg)(pTHX_ SV * sv, const char * pat, ...);
+static
+#else
+extern void DPPP_(my_sv_catpvf_mg)(pTHX_ SV * sv, const char * pat, ...);
+#endif
+
+#define Perl_sv_catpvf_mg DPPP_(my_sv_catpvf_mg)
+
+#if defined(NEED_sv_catpvf_mg) || defined(NEED_sv_catpvf_mg_GLOBAL)
+
+void
+DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...)
+{
+  va_list args;
+  va_start(args, pat);
+  sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*));
+  SvSETMAGIC(sv);
+  va_end(args);
+}
+
+#endif
+#endif
+
+#ifdef PERL_IMPLICIT_CONTEXT
+#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_catpvf_mg_nocontext)
+#if defined(NEED_sv_catpvf_mg_nocontext)
+static void DPPP_(my_sv_catpvf_mg_nocontext)(SV * sv, const char * pat, ...);
+static
+#else
+extern void DPPP_(my_sv_catpvf_mg_nocontext)(SV * sv, const char * pat, ...);
+#endif
+
+#define sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext)
+#define Perl_sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext)
+
+#if defined(NEED_sv_catpvf_mg_nocontext) || defined(NEED_sv_catpvf_mg_nocontext_GLOBAL)
+
+void
+DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...)
+{
+  dTHX;
+  va_list args;
+  va_start(args, pat);
+  sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*));
+  SvSETMAGIC(sv);
+  va_end(args);
+}
+
+#endif
+#endif
+#endif
+
+/* sv_catpvf_mg depends on sv_catpvf_mg_nocontext */
+#ifndef sv_catpvf_mg
+#  ifdef PERL_IMPLICIT_CONTEXT
+#    define sv_catpvf_mg   Perl_sv_catpvf_mg_nocontext
+#  else
+#    define sv_catpvf_mg   Perl_sv_catpvf_mg
+#  endif
+#endif
+
+#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vcatpvf_mg)
+#  define sv_vcatpvf_mg(sv, pat, args)                                     \
+   STMT_START {                                                            \
+     sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*));  \
+     SvSETMAGIC(sv);                                                       \
+   } STMT_END
+#endif
+
+#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_setpvf_mg)
+#if defined(NEED_sv_setpvf_mg)
+static void DPPP_(my_sv_setpvf_mg)(pTHX_ SV * sv, const char * pat, ...);
+static
+#else
+extern void DPPP_(my_sv_setpvf_mg)(pTHX_ SV * sv, const char * pat, ...);
+#endif
+
+#define Perl_sv_setpvf_mg DPPP_(my_sv_setpvf_mg)
+
+#if defined(NEED_sv_setpvf_mg) || defined(NEED_sv_setpvf_mg_GLOBAL)
+
+void
+DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...)
+{
+  va_list args;
+  va_start(args, pat);
+  sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*));
+  SvSETMAGIC(sv);
+  va_end(args);
+}
+
+#endif
+#endif
+
+#ifdef PERL_IMPLICIT_CONTEXT
+#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_setpvf_mg_nocontext)
+#if defined(NEED_sv_setpvf_mg_nocontext)
+static void DPPP_(my_sv_setpvf_mg_nocontext)(SV * sv, const char * pat, ...);
+static
+#else
+extern void DPPP_(my_sv_setpvf_mg_nocontext)(SV * sv, const char * pat, ...);
+#endif
+
+#define sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext)
+#define Perl_sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext)
+
+#if defined(NEED_sv_setpvf_mg_nocontext) || defined(NEED_sv_setpvf_mg_nocontext_GLOBAL)
+
+void
+DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...)
+{
+  dTHX;
+  va_list args;
+  va_start(args, pat);
+  sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*));
+  SvSETMAGIC(sv);
+  va_end(args);
+}
+
+#endif
+#endif
+#endif
+
+/* sv_setpvf_mg depends on sv_setpvf_mg_nocontext */
+#ifndef sv_setpvf_mg
+#  ifdef PERL_IMPLICIT_CONTEXT
+#    define sv_setpvf_mg   Perl_sv_setpvf_mg_nocontext
+#  else
+#    define sv_setpvf_mg   Perl_sv_setpvf_mg
+#  endif
+#endif
+
+#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vsetpvf_mg)
+#  define sv_vsetpvf_mg(sv, pat, args)                                     \
+   STMT_START {                                                            \
+     sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*));  \
+     SvSETMAGIC(sv);                                                       \
+   } STMT_END
+#endif
+
+#ifndef newSVpvn_share
+
+#if defined(NEED_newSVpvn_share)
+static SV * DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash);
+static
+#else
+extern SV * DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash);
+#endif
+
+#ifdef newSVpvn_share
+#  undef newSVpvn_share
+#endif
+#define newSVpvn_share(a,b,c) DPPP_(my_newSVpvn_share)(aTHX_ a,b,c)
+#define Perl_newSVpvn_share DPPP_(my_newSVpvn_share)
+
+#if defined(NEED_newSVpvn_share) || defined(NEED_newSVpvn_share_GLOBAL)
+
+SV *
+DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash)
+{
+  SV *sv;
+  if (len < 0)
+    len = -len;
+  if (!hash)
+    PERL_HASH(hash, (char*) src, len);
+  sv = newSVpvn((char *) src, len);
+  sv_upgrade(sv, SVt_PVIV);
+  SvIVX(sv) = hash;
+  SvREADONLY_on(sv);
+  SvPOK_on(sv);
+  return sv;
+}
+
+#endif
+
+#endif
+#ifndef SvSHARED_HASH
+#  define SvSHARED_HASH(sv)              (0 + SvUVX(sv))
+#endif
+#ifndef WARN_ALL
+#  define WARN_ALL                       0
+#endif
+
+#ifndef WARN_CLOSURE
+#  define WARN_CLOSURE                   1
+#endif
+
+#ifndef WARN_DEPRECATED
+#  define WARN_DEPRECATED                2
+#endif
+
+#ifndef WARN_EXITING
+#  define WARN_EXITING                   3
+#endif
+
+#ifndef WARN_GLOB
+#  define WARN_GLOB                      4
+#endif
+
+#ifndef WARN_IO
+#  define WARN_IO                        5
+#endif
+
+#ifndef WARN_CLOSED
+#  define WARN_CLOSED                    6
+#endif
+
+#ifndef WARN_EXEC
+#  define WARN_EXEC                      7
+#endif
+
+#ifndef WARN_LAYER
+#  define WARN_LAYER                     8
+#endif
+
+#ifndef WARN_NEWLINE
+#  define WARN_NEWLINE                   9
+#endif
+
+#ifndef WARN_PIPE
+#  define WARN_PIPE                      10
+#endif
+
+#ifndef WARN_UNOPENED
+#  define WARN_UNOPENED                  11
+#endif
+
+#ifndef WARN_MISC
+#  define WARN_MISC                      12
+#endif
+
+#ifndef WARN_NUMERIC
+#  define WARN_NUMERIC                   13
+#endif
+
+#ifndef WARN_ONCE
+#  define WARN_ONCE                      14
+#endif
+
+#ifndef WARN_OVERFLOW
+#  define WARN_OVERFLOW                  15
+#endif
+
+#ifndef WARN_PACK
+#  define WARN_PACK                      16
+#endif
+
+#ifndef WARN_PORTABLE
+#  define WARN_PORTABLE                  17
+#endif
+
+#ifndef WARN_RECURSION
+#  define WARN_RECURSION                 18
+#endif
+
+#ifndef WARN_REDEFINE
+#  define WARN_REDEFINE                  19
+#endif
+
+#ifndef WARN_REGEXP
+#  define WARN_REGEXP                    20
+#endif
+
+#ifndef WARN_SEVERE
+#  define WARN_SEVERE                    21
+#endif
+
+#ifndef WARN_DEBUGGING
+#  define WARN_DEBUGGING                 22
+#endif
+
+#ifndef WARN_INPLACE
+#  define WARN_INPLACE                   23
+#endif
+
+#ifndef WARN_INTERNAL
+#  define WARN_INTERNAL                  24
+#endif
+
+#ifndef WARN_MALLOC
+#  define WARN_MALLOC                    25
+#endif
+
+#ifndef WARN_SIGNAL
+#  define WARN_SIGNAL                    26
+#endif
+
+#ifndef WARN_SUBSTR
+#  define WARN_SUBSTR                    27
+#endif
+
+#ifndef WARN_SYNTAX
+#  define WARN_SYNTAX                    28
+#endif
+
+#ifndef WARN_AMBIGUOUS
+#  define WARN_AMBIGUOUS                 29
+#endif
+
+#ifndef WARN_BAREWORD
+#  define WARN_BAREWORD                  30
+#endif
+
+#ifndef WARN_DIGIT
+#  define WARN_DIGIT                     31
+#endif
+
+#ifndef WARN_PARENTHESIS
+#  define WARN_PARENTHESIS               32
+#endif
+
+#ifndef WARN_PRECEDENCE
+#  define WARN_PRECEDENCE                33
+#endif
+
+#ifndef WARN_PRINTF
+#  define WARN_PRINTF                    34
+#endif
+
+#ifndef WARN_PROTOTYPE
+#  define WARN_PROTOTYPE                 35
+#endif
+
+#ifndef WARN_QW
+#  define WARN_QW                        36
+#endif
+
+#ifndef WARN_RESERVED
+#  define WARN_RESERVED                  37
+#endif
+
+#ifndef WARN_SEMICOLON
+#  define WARN_SEMICOLON                 38
+#endif
+
+#ifndef WARN_TAINT
+#  define WARN_TAINT                     39
+#endif
+
+#ifndef WARN_THREADS
+#  define WARN_THREADS                   40
+#endif
+
+#ifndef WARN_UNINITIALIZED
+#  define WARN_UNINITIALIZED             41
+#endif
+
+#ifndef WARN_UNPACK
+#  define WARN_UNPACK                    42
+#endif
+
+#ifndef WARN_UNTIE
+#  define WARN_UNTIE                     43
+#endif
+
+#ifndef WARN_UTF8
+#  define WARN_UTF8                      44
+#endif
+
+#ifndef WARN_VOID
+#  define WARN_VOID                      45
+#endif
+
+#ifndef WARN_ASSERTIONS
+#  define WARN_ASSERTIONS                46
+#endif
+#ifndef packWARN
+#  define packWARN(a)                    (a)
+#endif
+
+#ifndef ckWARN
+#  ifdef G_WARN_ON
+#    define  ckWARN(a)                  (PL_dowarn & G_WARN_ON)
+#  else
+#    define  ckWARN(a)                  PL_dowarn
+#  endif
+#endif
+
+#if (PERL_BCDVERSION >= 0x5004000) && !defined(warner)
+#if defined(NEED_warner)
+static void DPPP_(my_warner)(U32 err, const char *pat, ...);
+static
+#else
+extern void DPPP_(my_warner)(U32 err, const char *pat, ...);
+#endif
+
+#define Perl_warner DPPP_(my_warner)
+
+#if defined(NEED_warner) || defined(NEED_warner_GLOBAL)
+
+void
+DPPP_(my_warner)(U32 err, const char *pat, ...)
+{
+  SV *sv;
+  va_list args;
+
+  PERL_UNUSED_ARG(err);
+
+  va_start(args, pat);
+  sv = vnewSVpvf(pat, &args);
+  va_end(args);
+  sv_2mortal(sv);
+  warn("%s", SvPV_nolen(sv));
+}
+
+#define warner  Perl_warner
+
+#define Perl_warner_nocontext  Perl_warner
+
+#endif
+#endif
+
+/* concatenating with "" ensures that only literal strings are accepted as argument
+ * note that STR_WITH_LEN() can't be used as argument to macros or functions that
+ * under some configurations might be macros
+ */
+#ifndef STR_WITH_LEN
+#  define STR_WITH_LEN(s)                (s ""), (sizeof(s)-1)
+#endif
+#ifndef newSVpvs
+#  define newSVpvs(str)                  newSVpvn(str "", sizeof(str) - 1)
+#endif
+
+#ifndef sv_catpvs
+#  define sv_catpvs(sv, str)             sv_catpvn(sv, str "", sizeof(str) - 1)
+#endif
+
+#ifndef sv_setpvs
+#  define sv_setpvs(sv, str)             sv_setpvn(sv, str "", sizeof(str) - 1)
+#endif
+
+#ifndef hv_fetchs
+#  define hv_fetchs(hv, key, lval)       hv_fetch(hv, key "", sizeof(key) - 1, lval)
+#endif
+
+#ifndef hv_stores
+#  define hv_stores(hv, key, val)        hv_store(hv, key "", sizeof(key) - 1, val, 0)
+#endif
+#ifndef SvGETMAGIC
+#  define SvGETMAGIC(x)                  STMT_START { if (SvGMAGICAL(x)) mg_get(x); } STMT_END
+#endif
+#ifndef PERL_MAGIC_sv
+#  define PERL_MAGIC_sv                  '\0'
+#endif
+
+#ifndef PERL_MAGIC_overload
+#  define PERL_MAGIC_overload            'A'
+#endif
+
+#ifndef PERL_MAGIC_overload_elem
+#  define PERL_MAGIC_overload_elem       'a'
+#endif
+
+#ifndef PERL_MAGIC_overload_table
+#  define PERL_MAGIC_overload_table      'c'
+#endif
+
+#ifndef PERL_MAGIC_bm
+#  define PERL_MAGIC_bm                  'B'
+#endif
+
+#ifndef PERL_MAGIC_regdata
+#  define PERL_MAGIC_regdata             'D'
+#endif
+
+#ifndef PERL_MAGIC_regdatum
+#  define PERL_MAGIC_regdatum            'd'
+#endif
+
+#ifndef PERL_MAGIC_env
+#  define PERL_MAGIC_env                 'E'
+#endif
+
+#ifndef PERL_MAGIC_envelem
+#  define PERL_MAGIC_envelem             'e'
+#endif
+
+#ifndef PERL_MAGIC_fm
+#  define PERL_MAGIC_fm                  'f'
+#endif
+
+#ifndef PERL_MAGIC_regex_global
+#  define PERL_MAGIC_regex_global        'g'
+#endif
+
+#ifndef PERL_MAGIC_isa
+#  define PERL_MAGIC_isa                 'I'
+#endif
+
+#ifndef PERL_MAGIC_isaelem
+#  define PERL_MAGIC_isaelem             'i'
+#endif
+
+#ifndef PERL_MAGIC_nkeys
+#  define PERL_MAGIC_nkeys               'k'
+#endif
+
+#ifndef PERL_MAGIC_dbfile
+#  define PERL_MAGIC_dbfile              'L'
+#endif
+
+#ifndef PERL_MAGIC_dbline
+#  define PERL_MAGIC_dbline              'l'
+#endif
+
+#ifndef PERL_MAGIC_mutex
+#  define PERL_MAGIC_mutex               'm'
+#endif
+
+#ifndef PERL_MAGIC_shared
+#  define PERL_MAGIC_shared              'N'
+#endif
+
+#ifndef PERL_MAGIC_shared_scalar
+#  define PERL_MAGIC_shared_scalar       'n'
+#endif
+
+#ifndef PERL_MAGIC_collxfrm
+#  define PERL_MAGIC_collxfrm            'o'
+#endif
+
+#ifndef PERL_MAGIC_tied
+#  define PERL_MAGIC_tied                'P'
+#endif
+
+#ifndef PERL_MAGIC_tiedelem
+#  define PERL_MAGIC_tiedelem            'p'
+#endif
+
+#ifndef PERL_MAGIC_tiedscalar
+#  define PERL_MAGIC_tiedscalar          'q'
+#endif
+
+#ifndef PERL_MAGIC_qr
+#  define PERL_MAGIC_qr                  'r'
+#endif
+
+#ifndef PERL_MAGIC_sig
+#  define PERL_MAGIC_sig                 'S'
+#endif
+
+#ifndef PERL_MAGIC_sigelem
+#  define PERL_MAGIC_sigelem             's'
+#endif
+
+#ifndef PERL_MAGIC_taint
+#  define PERL_MAGIC_taint               't'
+#endif
+
+#ifndef PERL_MAGIC_uvar
+#  define PERL_MAGIC_uvar                'U'
+#endif
+
+#ifndef PERL_MAGIC_uvar_elem
+#  define PERL_MAGIC_uvar_elem           'u'
+#endif
+
+#ifndef PERL_MAGIC_vstring
+#  define PERL_MAGIC_vstring             'V'
+#endif
+
+#ifndef PERL_MAGIC_vec
+#  define PERL_MAGIC_vec                 'v'
+#endif
+
+#ifndef PERL_MAGIC_utf8
+#  define PERL_MAGIC_utf8                'w'
+#endif
+
+#ifndef PERL_MAGIC_substr
+#  define PERL_MAGIC_substr              'x'
+#endif
+
+#ifndef PERL_MAGIC_defelem
+#  define PERL_MAGIC_defelem             'y'
+#endif
+
+#ifndef PERL_MAGIC_glob
+#  define PERL_MAGIC_glob                '*'
+#endif
+
+#ifndef PERL_MAGIC_arylen
+#  define PERL_MAGIC_arylen              '#'
+#endif
+
+#ifndef PERL_MAGIC_pos
+#  define PERL_MAGIC_pos                 '.'
+#endif
+
+#ifndef PERL_MAGIC_backref
+#  define PERL_MAGIC_backref             '<'
+#endif
+
+#ifndef PERL_MAGIC_ext
+#  define PERL_MAGIC_ext                 '~'
+#endif
+
+/* That's the best we can do... */
+#ifndef sv_catpvn_nomg
+#  define sv_catpvn_nomg                 sv_catpvn
+#endif
+
+#ifndef sv_catsv_nomg
+#  define sv_catsv_nomg                  sv_catsv
+#endif
+
+#ifndef sv_setsv_nomg
+#  define sv_setsv_nomg                  sv_setsv
+#endif
+
+#ifndef sv_pvn_nomg
+#  define sv_pvn_nomg                    sv_pvn
+#endif
+
+#ifndef SvIV_nomg
+#  define SvIV_nomg                      SvIV
+#endif
+
+#ifndef SvUV_nomg
+#  define SvUV_nomg                      SvUV
+#endif
+
+#ifndef sv_catpv_mg
+#  define sv_catpv_mg(sv, ptr)          \
+   STMT_START {                         \
+     SV *TeMpSv = sv;                   \
+     sv_catpv(TeMpSv,ptr);              \
+     SvSETMAGIC(TeMpSv);                \
+   } STMT_END
+#endif
+
+#ifndef sv_catpvn_mg
+#  define sv_catpvn_mg(sv, ptr, len)    \
+   STMT_START {                         \
+     SV *TeMpSv = sv;                   \
+     sv_catpvn(TeMpSv,ptr,len);         \
+     SvSETMAGIC(TeMpSv);                \
+   } STMT_END
+#endif
+
+#ifndef sv_catsv_mg
+#  define sv_catsv_mg(dsv, ssv)         \
+   STMT_START {                         \
+     SV *TeMpSv = dsv;                  \
+     sv_catsv(TeMpSv,ssv);              \
+     SvSETMAGIC(TeMpSv);                \
+   } STMT_END
+#endif
+
+#ifndef sv_setiv_mg
+#  define sv_setiv_mg(sv, i)            \
+   STMT_START {                         \
+     SV *TeMpSv = sv;                   \
+     sv_setiv(TeMpSv,i);                \
+     SvSETMAGIC(TeMpSv);                \
+   } STMT_END
+#endif
+
+#ifndef sv_setnv_mg
+#  define sv_setnv_mg(sv, num)          \
+   STMT_START {                         \
+     SV *TeMpSv = sv;                   \
+     sv_setnv(TeMpSv,num);              \
+     SvSETMAGIC(TeMpSv);                \
+   } STMT_END
+#endif
+
+#ifndef sv_setpv_mg
+#  define sv_setpv_mg(sv, ptr)          \
+   STMT_START {                         \
+     SV *TeMpSv = sv;                   \
+     sv_setpv(TeMpSv,ptr);              \
+     SvSETMAGIC(TeMpSv);                \
+   } STMT_END
+#endif
+
+#ifndef sv_setpvn_mg
+#  define sv_setpvn_mg(sv, ptr, len)    \
+   STMT_START {                         \
+     SV *TeMpSv = sv;                   \
+     sv_setpvn(TeMpSv,ptr,len);         \
+     SvSETMAGIC(TeMpSv);                \
+   } STMT_END
+#endif
+
+#ifndef sv_setsv_mg
+#  define sv_setsv_mg(dsv, ssv)         \
+   STMT_START {                         \
+     SV *TeMpSv = dsv;                  \
+     sv_setsv(TeMpSv,ssv);              \
+     SvSETMAGIC(TeMpSv);                \
+   } STMT_END
+#endif
+
+#ifndef sv_setuv_mg
+#  define sv_setuv_mg(sv, i)            \
+   STMT_START {                         \
+     SV *TeMpSv = sv;                   \
+     sv_setuv(TeMpSv,i);                \
+     SvSETMAGIC(TeMpSv);                \
+   } STMT_END
+#endif
+
+#ifndef sv_usepvn_mg
+#  define sv_usepvn_mg(sv, ptr, len)    \
+   STMT_START {                         \
+     SV *TeMpSv = sv;                   \
+     sv_usepvn(TeMpSv,ptr,len);         \
+     SvSETMAGIC(TeMpSv);                \
+   } STMT_END
+#endif
+#ifndef SvVSTRING_mg
+#  define SvVSTRING_mg(sv)               (SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_vstring) : NULL)
+#endif
+
+/* Hint: sv_magic_portable
+ * This is a compatibility function that is only available with
+ * Devel::PPPort. It is NOT in the perl core.
+ * Its purpose is to mimic the 5.8.0 behaviour of sv_magic() when
+ * it is being passed a name pointer with namlen == 0. In that
+ * case, perl 5.8.0 and later store the pointer, not a copy of it.
+ * The compatibility can be provided back to perl 5.004. With
+ * earlier versions, the code will not compile.
+ */
+
+#if (PERL_BCDVERSION < 0x5004000)
+
+  /* code that uses sv_magic_portable will not compile */
+
+#elif (PERL_BCDVERSION < 0x5008000)
+
+#  define sv_magic_portable(sv, obj, how, name, namlen)     \
+   STMT_START {                                             \
+     SV *SvMp_sv = (sv);                                    \
+     char *SvMp_name = (char *) (name);                     \
+     I32 SvMp_namlen = (namlen);                            \
+     if (SvMp_name && SvMp_namlen == 0)                     \
+     {                                                      \
+       MAGIC *mg;                                           \
+       sv_magic(SvMp_sv, obj, how, 0, 0);                   \
+       mg = SvMAGIC(SvMp_sv);                               \
+       mg->mg_len = -42; /* XXX: this is the tricky part */ \
+       mg->mg_ptr = SvMp_name;                              \
+     }                                                      \
+     else                                                   \
+     {                                                      \
+       sv_magic(SvMp_sv, obj, how, SvMp_name, SvMp_namlen); \
+     }                                                      \
+   } STMT_END
+
+#else
+
+#  define sv_magic_portable(a, b, c, d, e)  sv_magic(a, b, c, d, e)
+
+#endif
+
+#ifdef USE_ITHREADS
+#ifndef CopFILE
+#  define CopFILE(c)                     ((c)->cop_file)
+#endif
+
+#ifndef CopFILEGV
+#  define CopFILEGV(c)                   (CopFILE(c) ? gv_fetchfile(CopFILE(c)) : Nullgv)
+#endif
+
+#ifndef CopFILE_set
+#  define CopFILE_set(c,pv)              ((c)->cop_file = savepv(pv))
+#endif
+
+#ifndef CopFILESV
+#  define CopFILESV(c)                   (CopFILE(c) ? GvSV(gv_fetchfile(CopFILE(c))) : Nullsv)
+#endif
+
+#ifndef CopFILEAV
+#  define CopFILEAV(c)                   (CopFILE(c) ? GvAV(gv_fetchfile(CopFILE(c))) : Nullav)
+#endif
+
+#ifndef CopSTASHPV
+#  define CopSTASHPV(c)                  ((c)->cop_stashpv)
+#endif
+
+#ifndef CopSTASHPV_set
+#  define CopSTASHPV_set(c,pv)           ((c)->cop_stashpv = ((pv) ? savepv(pv) : Nullch))
+#endif
+
+#ifndef CopSTASH
+#  define CopSTASH(c)                    (CopSTASHPV(c) ? gv_stashpv(CopSTASHPV(c),GV_ADD) : Nullhv)
+#endif
+
+#ifndef CopSTASH_set
+#  define CopSTASH_set(c,hv)             CopSTASHPV_set(c, (hv) ? HvNAME(hv) : Nullch)
+#endif
+
+#ifndef CopSTASH_eq
+#  define CopSTASH_eq(c,hv)              ((hv) && (CopSTASHPV(c) == HvNAME(hv) \
+					|| (CopSTASHPV(c) && HvNAME(hv) \
+					&& strEQ(CopSTASHPV(c), HvNAME(hv)))))
+#endif
+
+#else
+#ifndef CopFILEGV
+#  define CopFILEGV(c)                   ((c)->cop_filegv)
+#endif
+
+#ifndef CopFILEGV_set
+#  define CopFILEGV_set(c,gv)            ((c)->cop_filegv = (GV*)SvREFCNT_inc(gv))
+#endif
+
+#ifndef CopFILE_set
+#  define CopFILE_set(c,pv)              CopFILEGV_set((c), gv_fetchfile(pv))
+#endif
+
+#ifndef CopFILESV
+#  define CopFILESV(c)                   (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : Nullsv)
+#endif
+
+#ifndef CopFILEAV
+#  define CopFILEAV(c)                   (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : Nullav)
+#endif
+
+#ifndef CopFILE
+#  define CopFILE(c)                     (CopFILESV(c) ? SvPVX(CopFILESV(c)) : Nullch)
+#endif
+
+#ifndef CopSTASH
+#  define CopSTASH(c)                    ((c)->cop_stash)
+#endif
+
+#ifndef CopSTASH_set
+#  define CopSTASH_set(c,hv)             ((c)->cop_stash = (hv))
+#endif
+
+#ifndef CopSTASHPV
+#  define CopSTASHPV(c)                  (CopSTASH(c) ? HvNAME(CopSTASH(c)) : Nullch)
+#endif
+
+#ifndef CopSTASHPV_set
+#  define CopSTASHPV_set(c,pv)           CopSTASH_set((c), gv_stashpv(pv,GV_ADD))
+#endif
+
+#ifndef CopSTASH_eq
+#  define CopSTASH_eq(c,hv)              (CopSTASH(c) == (hv))
+#endif
+
+#endif /* USE_ITHREADS */
+#ifndef IN_PERL_COMPILETIME
+#  define IN_PERL_COMPILETIME            (PL_curcop == &PL_compiling)
+#endif
+
+#ifndef IN_LOCALE_RUNTIME
+#  define IN_LOCALE_RUNTIME              (PL_curcop->op_private & HINT_LOCALE)
+#endif
+
+#ifndef IN_LOCALE_COMPILETIME
+#  define IN_LOCALE_COMPILETIME          (PL_hints & HINT_LOCALE)
+#endif
+
+#ifndef IN_LOCALE
+#  define IN_LOCALE                      (IN_PERL_COMPILETIME ? IN_LOCALE_COMPILETIME : IN_LOCALE_RUNTIME)
+#endif
+#ifndef IS_NUMBER_IN_UV
+#  define IS_NUMBER_IN_UV                0x01
+#endif
+
+#ifndef IS_NUMBER_GREATER_THAN_UV_MAX
+#  define IS_NUMBER_GREATER_THAN_UV_MAX  0x02
+#endif
+
+#ifndef IS_NUMBER_NOT_INT
+#  define IS_NUMBER_NOT_INT              0x04
+#endif
+
+#ifndef IS_NUMBER_NEG
+#  define IS_NUMBER_NEG                  0x08
+#endif
+
+#ifndef IS_NUMBER_INFINITY
+#  define IS_NUMBER_INFINITY             0x10
+#endif
+
+#ifndef IS_NUMBER_NAN
+#  define IS_NUMBER_NAN                  0x20
+#endif
+#ifndef GROK_NUMERIC_RADIX
+#  define GROK_NUMERIC_RADIX(sp, send)   grok_numeric_radix(sp, send)
+#endif
+#ifndef PERL_SCAN_GREATER_THAN_UV_MAX
+#  define PERL_SCAN_GREATER_THAN_UV_MAX  0x02
+#endif
+
+#ifndef PERL_SCAN_SILENT_ILLDIGIT
+#  define PERL_SCAN_SILENT_ILLDIGIT      0x04
+#endif
+
+#ifndef PERL_SCAN_ALLOW_UNDERSCORES
+#  define PERL_SCAN_ALLOW_UNDERSCORES    0x01
+#endif
+
+#ifndef PERL_SCAN_DISALLOW_PREFIX
+#  define PERL_SCAN_DISALLOW_PREFIX      0x02
+#endif
+
+#ifndef grok_numeric_radix
+#if defined(NEED_grok_numeric_radix)
+static bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send);
+static
+#else
+extern bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send);
+#endif
+
+#ifdef grok_numeric_radix
+#  undef grok_numeric_radix
+#endif
+#define grok_numeric_radix(a,b) DPPP_(my_grok_numeric_radix)(aTHX_ a,b)
+#define Perl_grok_numeric_radix DPPP_(my_grok_numeric_radix)
+
+#if defined(NEED_grok_numeric_radix) || defined(NEED_grok_numeric_radix_GLOBAL)
+bool
+DPPP_(my_grok_numeric_radix)(pTHX_ const char **sp, const char *send)
+{
+#ifdef USE_LOCALE_NUMERIC
+#ifdef PL_numeric_radix_sv
+    if (PL_numeric_radix_sv && IN_LOCALE) {
+        STRLEN len;
+        char* radix = SvPV(PL_numeric_radix_sv, len);
+        if (*sp + len <= send && memEQ(*sp, radix, len)) {
+            *sp += len;
+            return TRUE;
+        }
+    }
+#else
+    /* older perls don't have PL_numeric_radix_sv so the radix
+     * must manually be requested from locale.h
+     */
+#include <locale.h>
+    dTHR;  /* needed for older threaded perls */
+    struct lconv *lc = localeconv();
+    char *radix = lc->decimal_point;
+    if (radix && IN_LOCALE) {
+        STRLEN len = strlen(radix);
+        if (*sp + len <= send && memEQ(*sp, radix, len)) {
+            *sp += len;
+            return TRUE;
+        }
+    }
+#endif
+#endif /* USE_LOCALE_NUMERIC */
+    /* always try "." if numeric radix didn't match because
+     * we may have data from different locales mixed */
+    if (*sp < send && **sp == '.') {
+        ++*sp;
+        return TRUE;
+    }
+    return FALSE;
+}
+#endif
+#endif
+
+#ifndef grok_number
+#if defined(NEED_grok_number)
+static int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep);
+static
+#else
+extern int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep);
+#endif
+
+#ifdef grok_number
+#  undef grok_number
+#endif
+#define grok_number(a,b,c) DPPP_(my_grok_number)(aTHX_ a,b,c)
+#define Perl_grok_number DPPP_(my_grok_number)
+
+#if defined(NEED_grok_number) || defined(NEED_grok_number_GLOBAL)
+int
+DPPP_(my_grok_number)(pTHX_ const char *pv, STRLEN len, UV *valuep)
+{
+  const char *s = pv;
+  const char *send = pv + len;
+  const UV max_div_10 = UV_MAX / 10;
+  const char max_mod_10 = UV_MAX % 10;
+  int numtype = 0;
+  int sawinf = 0;
+  int sawnan = 0;
+
+  while (s < send && isSPACE(*s))
+    s++;
+  if (s == send) {
+    return 0;
+  } else if (*s == '-') {
+    s++;
+    numtype = IS_NUMBER_NEG;
+  }
+  else if (*s == '+')
+  s++;
+
+  if (s == send)
+    return 0;
+
+  /* next must be digit or the radix separator or beginning of infinity */
+  if (isDIGIT(*s)) {
+    /* UVs are at least 32 bits, so the first 9 decimal digits cannot
+       overflow.  */
+    UV value = *s - '0';
+    /* This construction seems to be more optimiser friendly.
+       (without it gcc does the isDIGIT test and the *s - '0' separately)
+       With it gcc on arm is managing 6 instructions (6 cycles) per digit.
+       In theory the optimiser could deduce how far to unroll the loop
+       before checking for overflow.  */
+    if (++s < send) {
+      int digit = *s - '0';
+      if (digit >= 0 && digit <= 9) {
+        value = value * 10 + digit;
+        if (++s < send) {
+          digit = *s - '0';
+          if (digit >= 0 && digit <= 9) {
+            value = value * 10 + digit;
+            if (++s < send) {
+              digit = *s - '0';
+              if (digit >= 0 && digit <= 9) {
+                value = value * 10 + digit;
+		if (++s < send) {
+                  digit = *s - '0';
+                  if (digit >= 0 && digit <= 9) {
+                    value = value * 10 + digit;
+                    if (++s < send) {
+                      digit = *s - '0';
+                      if (digit >= 0 && digit <= 9) {
+                        value = value * 10 + digit;
+                        if (++s < send) {
+                          digit = *s - '0';
+                          if (digit >= 0 && digit <= 9) {
+                            value = value * 10 + digit;
+                            if (++s < send) {
+                              digit = *s - '0';
+                              if (digit >= 0 && digit <= 9) {
+                                value = value * 10 + digit;
+                                if (++s < send) {
+                                  digit = *s - '0';
+                                  if (digit >= 0 && digit <= 9) {
+                                    value = value * 10 + digit;
+                                    if (++s < send) {
+                                      /* Now got 9 digits, so need to check
+                                         each time for overflow.  */
+                                      digit = *s - '0';
+                                      while (digit >= 0 && digit <= 9
+                                             && (value < max_div_10
+                                                 || (value == max_div_10
+                                                     && digit <= max_mod_10))) {
+                                        value = value * 10 + digit;
+                                        if (++s < send)
+                                          digit = *s - '0';
+                                        else
+                                          break;
+                                      }
+                                      if (digit >= 0 && digit <= 9
+                                          && (s < send)) {
+                                        /* value overflowed.
+                                           skip the remaining digits, don't
+                                           worry about setting *valuep.  */
+                                        do {
+                                          s++;
+                                        } while (s < send && isDIGIT(*s));
+                                        numtype |=
+                                          IS_NUMBER_GREATER_THAN_UV_MAX;
+                                        goto skip_value;
+                                      }
+                                    }
+                                  }
+				}
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+	}
+      }
+    }
+    numtype |= IS_NUMBER_IN_UV;
+    if (valuep)
+      *valuep = value;
+
+  skip_value:
+    if (GROK_NUMERIC_RADIX(&s, send)) {
+      numtype |= IS_NUMBER_NOT_INT;
+      while (s < send && isDIGIT(*s))  /* optional digits after the radix */
+        s++;
+    }
+  }
+  else if (GROK_NUMERIC_RADIX(&s, send)) {
+    numtype |= IS_NUMBER_NOT_INT | IS_NUMBER_IN_UV; /* valuep assigned below */
+    /* no digits before the radix means we need digits after it */
+    if (s < send && isDIGIT(*s)) {
+      do {
+        s++;
+      } while (s < send && isDIGIT(*s));
+      if (valuep) {
+        /* integer approximation is valid - it's 0.  */
+        *valuep = 0;
+      }
+    }
+    else
+      return 0;
+  } else if (*s == 'I' || *s == 'i') {
+    s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
+    s++; if (s == send || (*s != 'F' && *s != 'f')) return 0;
+    s++; if (s < send && (*s == 'I' || *s == 'i')) {
+      s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
+      s++; if (s == send || (*s != 'I' && *s != 'i')) return 0;
+      s++; if (s == send || (*s != 'T' && *s != 't')) return 0;
+      s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0;
+      s++;
+    }
+    sawinf = 1;
+  } else if (*s == 'N' || *s == 'n') {
+    /* XXX TODO: There are signaling NaNs and quiet NaNs. */
+    s++; if (s == send || (*s != 'A' && *s != 'a')) return 0;
+    s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
+    s++;
+    sawnan = 1;
+  } else
+    return 0;
+
+  if (sawinf) {
+    numtype &= IS_NUMBER_NEG; /* Keep track of sign  */
+    numtype |= IS_NUMBER_INFINITY | IS_NUMBER_NOT_INT;
+  } else if (sawnan) {
+    numtype &= IS_NUMBER_NEG; /* Keep track of sign  */
+    numtype |= IS_NUMBER_NAN | IS_NUMBER_NOT_INT;
+  } else if (s < send) {
+    /* we can have an optional exponent part */
+    if (*s == 'e' || *s == 'E') {
+      /* The only flag we keep is sign.  Blow away any "it's UV"  */
+      numtype &= IS_NUMBER_NEG;
+      numtype |= IS_NUMBER_NOT_INT;
+      s++;
+      if (s < send && (*s == '-' || *s == '+'))
+        s++;
+      if (s < send && isDIGIT(*s)) {
+        do {
+          s++;
+        } while (s < send && isDIGIT(*s));
+      }
+      else
+      return 0;
+    }
+  }
+  while (s < send && isSPACE(*s))
+    s++;
+  if (s >= send)
+    return numtype;
+  if (len == 10 && memEQ(pv, "0 but true", 10)) {
+    if (valuep)
+      *valuep = 0;
+    return IS_NUMBER_IN_UV;
+  }
+  return 0;
+}
+#endif
+#endif
+
+/*
+ * The grok_* routines have been modified to use warn() instead of
+ * Perl_warner(). Also, 'hexdigit' was the former name of PL_hexdigit,
+ * which is why the stack variable has been renamed to 'xdigit'.
+ */
+
+#ifndef grok_bin
+#if defined(NEED_grok_bin)
+static UV DPPP_(my_grok_bin)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result);
+static
+#else
+extern UV DPPP_(my_grok_bin)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result);
+#endif
+
+#ifdef grok_bin
+#  undef grok_bin
+#endif
+#define grok_bin(a,b,c,d) DPPP_(my_grok_bin)(aTHX_ a,b,c,d)
+#define Perl_grok_bin DPPP_(my_grok_bin)
+
+#if defined(NEED_grok_bin) || defined(NEED_grok_bin_GLOBAL)
+UV
+DPPP_(my_grok_bin)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result)
+{
+    const char *s = start;
+    STRLEN len = *len_p;
+    UV value = 0;
+    NV value_nv = 0;
+
+    const UV max_div_2 = UV_MAX / 2;
+    bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES;
+    bool overflowed = FALSE;
+
+    if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) {
+        /* strip off leading b or 0b.
+           for compatibility silently suffer "b" and "0b" as valid binary
+           numbers. */
+        if (len >= 1) {
+            if (s[0] == 'b') {
+                s++;
+                len--;
+            }
+            else if (len >= 2 && s[0] == '0' && s[1] == 'b') {
+                s+=2;
+                len-=2;
+            }
+        }
+    }
+
+    for (; len-- && *s; s++) {
+        char bit = *s;
+        if (bit == '0' || bit == '1') {
+            /* Write it in this wonky order with a goto to attempt to get the
+               compiler to make the common case integer-only loop pretty tight.
+               With gcc seems to be much straighter code than old scan_bin.  */
+          redo:
+            if (!overflowed) {
+                if (value <= max_div_2) {
+                    value = (value << 1) | (bit - '0');
+                    continue;
+                }
+                /* Bah. We're just overflowed.  */
+                warn("Integer overflow in binary number");
+                overflowed = TRUE;
+                value_nv = (NV) value;
+            }
+            value_nv *= 2.0;
+	    /* If an NV has not enough bits in its mantissa to
+	     * represent a UV this summing of small low-order numbers
+	     * is a waste of time (because the NV cannot preserve
+	     * the low-order bits anyway): we could just remember when
+	     * did we overflow and in the end just multiply value_nv by the
+	     * right amount. */
+            value_nv += (NV)(bit - '0');
+            continue;
+        }
+        if (bit == '_' && len && allow_underscores && (bit = s[1])
+            && (bit == '0' || bit == '1'))
+	    {
+		--len;
+		++s;
+                goto redo;
+	    }
+        if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT))
+            warn("Illegal binary digit '%c' ignored", *s);
+        break;
+    }
+
+    if (   ( overflowed && value_nv > 4294967295.0)
+#if UVSIZE > 4
+	|| (!overflowed && value > 0xffffffff  )
+#endif
+	) {
+	warn("Binary number > 0b11111111111111111111111111111111 non-portable");
+    }
+    *len_p = s - start;
+    if (!overflowed) {
+        *flags = 0;
+        return value;
+    }
+    *flags = PERL_SCAN_GREATER_THAN_UV_MAX;
+    if (result)
+        *result = value_nv;
+    return UV_MAX;
+}
+#endif
+#endif
+
+#ifndef grok_hex
+#if defined(NEED_grok_hex)
+static UV DPPP_(my_grok_hex)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result);
+static
+#else
+extern UV DPPP_(my_grok_hex)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result);
+#endif
+
+#ifdef grok_hex
+#  undef grok_hex
+#endif
+#define grok_hex(a,b,c,d) DPPP_(my_grok_hex)(aTHX_ a,b,c,d)
+#define Perl_grok_hex DPPP_(my_grok_hex)
+
+#if defined(NEED_grok_hex) || defined(NEED_grok_hex_GLOBAL)
+UV
+DPPP_(my_grok_hex)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result)
+{
+    const char *s = start;
+    STRLEN len = *len_p;
+    UV value = 0;
+    NV value_nv = 0;
+
+    const UV max_div_16 = UV_MAX / 16;
+    bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES;
+    bool overflowed = FALSE;
+    const char *xdigit;
+
+    if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) {
+        /* strip off leading x or 0x.
+           for compatibility silently suffer "x" and "0x" as valid hex numbers.
+        */
+        if (len >= 1) {
+            if (s[0] == 'x') {
+                s++;
+                len--;
+            }
+            else if (len >= 2 && s[0] == '0' && s[1] == 'x') {
+                s+=2;
+                len-=2;
+            }
+        }
+    }
+
+    for (; len-- && *s; s++) {
+	xdigit = strchr((char *) PL_hexdigit, *s);
+        if (xdigit) {
+            /* Write it in this wonky order with a goto to attempt to get the
+               compiler to make the common case integer-only loop pretty tight.
+               With gcc seems to be much straighter code than old scan_hex.  */
+          redo:
+            if (!overflowed) {
+                if (value <= max_div_16) {
+                    value = (value << 4) | ((xdigit - PL_hexdigit) & 15);
+                    continue;
+                }
+                warn("Integer overflow in hexadecimal number");
+                overflowed = TRUE;
+                value_nv = (NV) value;
+            }
+            value_nv *= 16.0;
+	    /* If an NV has not enough bits in its mantissa to
+	     * represent a UV this summing of small low-order numbers
+	     * is a waste of time (because the NV cannot preserve
+	     * the low-order bits anyway): we could just remember when
+	     * did we overflow and in the end just multiply value_nv by the
+	     * right amount of 16-tuples. */
+            value_nv += (NV)((xdigit - PL_hexdigit) & 15);
+            continue;
+        }
+        if (*s == '_' && len && allow_underscores && s[1]
+		&& (xdigit = strchr((char *) PL_hexdigit, s[1])))
+	    {
+		--len;
+		++s;
+                goto redo;
+	    }
+        if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT))
+            warn("Illegal hexadecimal digit '%c' ignored", *s);
+        break;
+    }
+
+    if (   ( overflowed && value_nv > 4294967295.0)
+#if UVSIZE > 4
+	|| (!overflowed && value > 0xffffffff  )
+#endif
+	) {
+	warn("Hexadecimal number > 0xffffffff non-portable");
+    }
+    *len_p = s - start;
+    if (!overflowed) {
+        *flags = 0;
+        return value;
+    }
+    *flags = PERL_SCAN_GREATER_THAN_UV_MAX;
+    if (result)
+        *result = value_nv;
+    return UV_MAX;
+}
+#endif
+#endif
+
+#ifndef grok_oct
+#if defined(NEED_grok_oct)
+static UV DPPP_(my_grok_oct)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result);
+static
+#else
+extern UV DPPP_(my_grok_oct)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result);
+#endif
+
+#ifdef grok_oct
+#  undef grok_oct
+#endif
+#define grok_oct(a,b,c,d) DPPP_(my_grok_oct)(aTHX_ a,b,c,d)
+#define Perl_grok_oct DPPP_(my_grok_oct)
+
+#if defined(NEED_grok_oct) || defined(NEED_grok_oct_GLOBAL)
+UV
+DPPP_(my_grok_oct)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result)
+{
+    const char *s = start;
+    STRLEN len = *len_p;
+    UV value = 0;
+    NV value_nv = 0;
+
+    const UV max_div_8 = UV_MAX / 8;
+    bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES;
+    bool overflowed = FALSE;
+
+    for (; len-- && *s; s++) {
+         /* gcc 2.95 optimiser not smart enough to figure that this subtraction
+            out front allows slicker code.  */
+        int digit = *s - '0';
+        if (digit >= 0 && digit <= 7) {
+            /* Write it in this wonky order with a goto to attempt to get the
+               compiler to make the common case integer-only loop pretty tight.
+            */
+          redo:
+            if (!overflowed) {
+                if (value <= max_div_8) {
+                    value = (value << 3) | digit;
+                    continue;
+                }
+                /* Bah. We're just overflowed.  */
+                warn("Integer overflow in octal number");
+                overflowed = TRUE;
+                value_nv = (NV) value;
+            }
+            value_nv *= 8.0;
+	    /* If an NV has not enough bits in its mantissa to
+	     * represent a UV this summing of small low-order numbers
+	     * is a waste of time (because the NV cannot preserve
+	     * the low-order bits anyway): we could just remember when
+	     * did we overflow and in the end just multiply value_nv by the
+	     * right amount of 8-tuples. */
+            value_nv += (NV)digit;
+            continue;
+        }
+        if (digit == ('_' - '0') && len && allow_underscores
+            && (digit = s[1] - '0') && (digit >= 0 && digit <= 7))
+	    {
+		--len;
+		++s;
+                goto redo;
+	    }
+        /* Allow \octal to work the DWIM way (that is, stop scanning
+         * as soon as non-octal characters are seen, complain only iff
+         * someone seems to want to use the digits eight and nine). */
+        if (digit == 8 || digit == 9) {
+            if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT))
+                warn("Illegal octal digit '%c' ignored", *s);
+        }
+        break;
+    }
+
+    if (   ( overflowed && value_nv > 4294967295.0)
+#if UVSIZE > 4
+	|| (!overflowed && value > 0xffffffff  )
+#endif
+	) {
+	warn("Octal number > 037777777777 non-portable");
+    }
+    *len_p = s - start;
+    if (!overflowed) {
+        *flags = 0;
+        return value;
+    }
+    *flags = PERL_SCAN_GREATER_THAN_UV_MAX;
+    if (result)
+        *result = value_nv;
+    return UV_MAX;
+}
+#endif
+#endif
+
+#if !defined(my_snprintf)
+#if defined(NEED_my_snprintf)
+static int DPPP_(my_my_snprintf)(char * buffer, const Size_t len, const char * format, ...);
+static
+#else
+extern int DPPP_(my_my_snprintf)(char * buffer, const Size_t len, const char * format, ...);
+#endif
+
+#define my_snprintf DPPP_(my_my_snprintf)
+#define Perl_my_snprintf DPPP_(my_my_snprintf)
+
+#if defined(NEED_my_snprintf) || defined(NEED_my_snprintf_GLOBAL)
+
+int
+DPPP_(my_my_snprintf)(char *buffer, const Size_t len, const char *format, ...)
+{
+    dTHX;
+    int retval;
+    va_list ap;
+    va_start(ap, format);
+#ifdef HAS_VSNPRINTF
+    retval = vsnprintf(buffer, len, format, ap);
+#else
+    retval = vsprintf(buffer, format, ap);
+#endif
+    va_end(ap);
+    if (retval >= (int)len)
+	Perl_croak(aTHX_ "panic: my_snprintf buffer overflow");
+    return retval;
+}
+
+#endif
+#endif
+
+#ifdef NO_XSLOCKS
+#  ifdef dJMPENV
+#    define dXCPT             dJMPENV; int rEtV = 0
+#    define XCPT_TRY_START    JMPENV_PUSH(rEtV); if (rEtV == 0)
+#    define XCPT_TRY_END      JMPENV_POP;
+#    define XCPT_CATCH        if (rEtV != 0)
+#    define XCPT_RETHROW      JMPENV_JUMP(rEtV)
+#  else
+#    define dXCPT             Sigjmp_buf oldTOP; int rEtV = 0
+#    define XCPT_TRY_START    Copy(top_env, oldTOP, 1, Sigjmp_buf); rEtV = Sigsetjmp(top_env, 1); if (rEtV == 0)
+#    define XCPT_TRY_END      Copy(oldTOP, top_env, 1, Sigjmp_buf);
+#    define XCPT_CATCH        if (rEtV != 0)
+#    define XCPT_RETHROW      Siglongjmp(top_env, rEtV)
+#  endif
+#endif
+
+#if !defined(my_strlcat)
+#if defined(NEED_my_strlcat)
+static Size_t DPPP_(my_my_strlcat)(char * dst, const char * src, Size_t size);
+static
+#else
+extern Size_t DPPP_(my_my_strlcat)(char * dst, const char * src, Size_t size);
+#endif
+
+#define my_strlcat DPPP_(my_my_strlcat)
+#define Perl_my_strlcat DPPP_(my_my_strlcat)
+
+#if defined(NEED_my_strlcat) || defined(NEED_my_strlcat_GLOBAL)
+
+Size_t
+DPPP_(my_my_strlcat)(char *dst, const char *src, Size_t size)
+{
+    Size_t used, length, copy;
+
+    used = strlen(dst);
+    length = strlen(src);
+    if (size > 0 && used < size - 1) {
+        copy = (length >= size - used) ? size - used - 1 : length;
+        memcpy(dst + used, src, copy);
+        dst[used + copy] = '\0';
+    }
+    return used + length;
+}
+#endif
+#endif
+
+#if !defined(my_strlcpy)
+#if defined(NEED_my_strlcpy)
+static Size_t DPPP_(my_my_strlcpy)(char * dst, const char * src, Size_t size);
+static
+#else
+extern Size_t DPPP_(my_my_strlcpy)(char * dst, const char * src, Size_t size);
+#endif
+
+#define my_strlcpy DPPP_(my_my_strlcpy)
+#define Perl_my_strlcpy DPPP_(my_my_strlcpy)
+
+#if defined(NEED_my_strlcpy) || defined(NEED_my_strlcpy_GLOBAL)
+
+Size_t
+DPPP_(my_my_strlcpy)(char *dst, const char *src, Size_t size)
+{
+    Size_t length, copy;
+
+    length = strlen(src);
+    if (size > 0) {
+        copy = (length >= size) ? size - 1 : length;
+        memcpy(dst, src, copy);
+        dst[copy] = '\0';
+    }
+    return length;
+}
+
+#endif
+#endif
+
+#endif /* _P_P_PORTABILITY_H_ */
+
+/* End of File ppport.h */
+
@@ -0,0 +1,9 @@
+#!perl
+
+use Test::More tests => 1;
+
+BEGIN {
+	use_ok( 'Curses' );
+}
+
+diag( "Testing Curses $Curses::VERSION, Perl $]" );
@@ -0,0 +1,310 @@
+#!../../perl
+##
+##  test.syms -- test for function/variable symbols 
+##
+##  Set the environment variable CURSES_VERBOSE to see the details of the
+##  testing.
+
+##  Copyright (c) 1994-2000  William Setzer
+##
+##  You may distribute under the terms of either the Artistic License
+##  or the GNU General Public License, as specified in the README file.
+##
+##  This program is modelled after parts of the dist-3.0 distribution.
+##  In many cases I just hand-converted the sh script to perl, so this
+##  program probably falls under the Artistic license.  At the very least,
+##  it has the "look and feel".  Will I be sued? :-)
+##
+##  Thanks to Raphael Manfredi and the other contributors of dist-3.0.
+##
+##  VMS patches thanks to Peter Prymmer <pvhp@forte.com>
+
+use strict;
+use warnings;
+use English;
+
+my $verbose;
+
+sub makeCompileCommand($) {
+    my ($compileR) = @_;
+    
+    #  Get a compile command so we can test for curses symbols.
+    # (There has got to be an easier way.  Blech.)
+    #
+
+    my $compile = '#CC# #DEFS# #INCS# #CFLAGS# #FILE# #LFLAGS# #LIBS#' .
+        ($verbose ? '' : '#NULL#');
+    my $makefile = ($OSNAME =~ /VMS/) ? "Descrip.MMS" : "Makefile";
+
+    my ($cc, $inc, $ccflags, $ldloadlibs, $lddlflags);
+
+    open MAKEFILE, "< $makefile" or 
+        die "Can't open make file '$makefile' errno=$ERRNO";
+    while (<MAKEFILE>) {
+
+        if (/^CC\s*=\s*(.*)/) { 
+            $cc = $1;
+        } elsif (/^INC\s*=\s*(.*)/) { 
+            $inc = $1;
+        } elsif (/^CCFLAGS\s*=\s*(.*)/) { 
+            $ccflags = $1;
+        } elsif (/^LDLOADLIBS\s*=\s*(.*)/) { 
+            $ldloadlibs = $1;
+        } elsif (/^LDDLFLAGS\s*=\s*(.*)/) {
+            $lddlflags = $1;
+        }
+    }
+
+    if (defined($cc)) {
+        $compile =~ s{#CC#}{$cc};
+    }
+    if (defined($inc)) {
+        $compile =~ s{#INCS#}{$inc};
+    }
+    if (defined($ccflags)) {
+        $compile =~ s{#CFLAGS#}{$ccflags};
+    }
+    if (defined($ldloadlibs)) {
+        $compile =~ s{#LIBS#}{$ldloadlibs};
+    } else {
+        $compile =~ s{#LIBS#}{};
+    }
+    if (defined($lddlflags)) {
+        ## Only get -L's.  Other options can cause strange link behavior.
+        ## (I shoulda stayed in bed.)
+        #
+        my $lflags;
+        $lflags = '';  # initial value
+        while ($lddlflags =~ m{(-L\S+)}g) {
+            $lflags .= " $1";
+        }
+        $compile =~ s{#LFLAGS#}{$lflags};
+    }
+    close MAKEFILE;
+
+    #  Left to handle: DEFS/FILE/NULL
+    #  DEFS  => "cc" define of "SYM" to "_C_SYM_"
+    #  FILE  => "cc" compile of file _C_FILE_.c into executable _C_FILE_
+    #  NULL  => output of system call to dev null
+    #
+    #  _C_SYM_ and _C_FILE_ will be filled in later
+
+    if ($OSNAME =~ m{VMS}i) {
+        $compile =~ s{#DEFS#}{DEFINE=SYM="_C_SYM_"};
+        $compile =~ s{#FILE#}{_C_FILE_.c};
+        $compile =~ s{#NULL#}{};  # no non-verbose way
+    }
+    elsif ($OSNAME eq 'MSWin32') {
+        $compile =~ s{#DEFS#}{-DSYM="_C_SYM_"};
+        $compile =~ s{#FILE#}{_C_FILE_.c};
+        $compile =~ s{#NULL#}{>nul 2>&1};
+    }
+    else {
+        $compile =~ s{#DEFS#}{-DSYM="_C_SYM_"};
+        $compile =~ s{#FILE#}{-o _C_FILE_ _C_FILE_.c};
+        $compile =~ s{#NULL#}{>/dev/null 2>&1};
+    }
+    
+    if ($compile =~ m{#.+#}) {
+        die "OOPS: internal error constructing a compile command.  " .
+            "We failed to substitute for a #xxx# substitution variable " .
+            "and thus ended up with this: '$compile'\n";
+    }
+    $$compileR = $compile;
+}
+
+
+
+###############################################################################
+#                                 MAINLINE                                    #
+###############################################################################
+
+print("Checking capabilities of the Ncurses libraries.\n");
+print("Set CURSES_VERBOSE environment variable to see the details of the " .
+      "tests.\n");
+print("\n");
+
+my $panels;
+my $menus;
+my $forms;
+
+if ($ENV{CURSES_VERBOSE}) {
+    $verbose = 1;
+} else {
+ $verbose = 0;
+}
+
+open IN,  "list.syms"       or die "Can't open list.syms: $!\n";
+open(OUTH, ">CursesDef.h")  or die "Can't open CursesDef.h: $!\n";
+open LOG, ">&STDERR"        or die "Can't redirect to STDERR: $!\n";
+
+while (@ARGV) {
+    my $arg = shift;
+
+    $arg eq 'PANELS' and ++$panels and next;
+    $arg eq 'MENUS'  and ++$menus  and next;
+    $arg eq 'FORMS'  and ++$forms  and next;
+    $arg =~ /^-h/    and Usage();
+    $arg =~ /^-v/    and ++$verbose and next;
+    $arg =~ /^-l/    and do {
+	my $logfile = shift      or Usage("<-l> needs a filename");
+	open LOG,   ">$logfile"  or die "Can't open file '$logfile': $!\n";
+	open STDERR, ">&LOG"     or die "Can't redirect STDERR: $!\n";
+
+	next;
+    };	
+    $arg =~ /^-/ and Usage("Unknown option: $arg");
+    Usage("Unknown argument: $arg");
+}
+if (@ARGV) { Usage() }
+
+select LOG;
+$| = 1;
+
+# Prep compile stage
+
+makeCompileCommand(\my $compile);
+
+print STDOUT "Doing test compiles with the compile command '$compile'\n";
+
+
+###
+##  Now generate the .h file
+#
+
+print OUTH <<'EOHDR';
+/*  This file is automatically generated; changes will be lost.
+**
+**  If you need to edit this file because "test.syms" didn't do a good
+**  job, be sure to save a copy of your changes.
+**
+**  The "define"s below are simply educated guesses.  If you are
+**  having problems compiling, check the appropriate symbol to see if
+**  it was set correctly: For each line, if the answer to the question
+**  is "no", that line should start with "#undef"; if the answer is
+**  yes, it should start with "#define".
+*/
+
+EOHDR
+
+print OUTH 
+    $panels ? "#define " : "#undef  ",
+    "C_PANELFUNCTION         /* Add in panel library function?             */",
+    "\n\n";
+
+print OUTH 
+    $menus ? "#define " : "#undef  ",
+    "C_MENUFUNCTION         /* Add in menu library function?              */",
+    "\n\n";
+
+print OUTH 
+    $forms ? "#define " : "#undef  ",
+    "C_FORMFUNCTION          /* Add in form library function?              */",
+    "\n\n";
+
+# Some functions return either int or void, depending on what compiler
+# and libcurses.a you are using.  For the int/void test, if the
+# compiler doesn't complain about assigning the sym to an int
+# variable, we assume the function returns int.  Otherwise, we assume
+# it returns void.
+
+my %tstfile = qw( E  testsym
+                  I  testint
+                  V  testsym
+		  T  testtyp);
+while (<IN>) {
+    next if /^\S*#/;
+    next unless /\S/;
+
+    my ($action, $sym, $args) = /^([A-Z])\s+(\w+)\s*(\(.*\))?/;
+    my $file  = $tstfile{$action};
+
+    unless (defined $sym and defined $file) {
+	warn "WARNING: internal error on symbol $_\n";
+    }
+    
+    my $cmd;
+    $cmd = $compile;  # initial value
+    my $symargs = $sym . (defined($args) ? $args : '');
+    $cmd =~ s{_C_SYM_}{$symargs}ge;
+    $cmd =~ s{_C_FILE_}{$file}g;
+
+    print LOG $cmd, "\n"      if $verbose;
+    my $ret = qx{$cmd};
+    my $rc  = $?;
+    print LOG $ret            if $verbose;
+    print LOG "(rc = $rc)\n"  if $verbose;
+
+    my $ssym  = $sym;
+    $ssym =~ s/^w//;
+
+    my $c_sym;
+    my $comment;
+
+    if ($action eq 'E') {
+	print LOG "function '$sym' ", ($rc ? "NOT " : ""), "found\n";
+
+	$c_sym   = uc "C_$ssym";
+	$comment = "Does function '$ssym' exist?";
+    }
+    elsif ($action eq 'I') {
+	print LOG "function '$sym' returns ", ($rc ? "void" : "int"), "\n";
+
+	$c_sym   = uc "C_INT$ssym";
+	$comment = "Does function '$ssym' return 'int'?";
+    }
+    elsif ($action eq 'V') {
+	print LOG "variable '$sym' ", ($rc ? "NOT " : ""), "found\n";
+
+	$c_sym   = uc "C_$ssym";
+	$comment = "Does variable '$ssym' exist?";
+    }
+    elsif ($action eq 'T') {
+	print LOG "typedef '$sym' ", ($rc ? "NOT " : ""), "found\n";
+
+	$c_sym   = uc "C_TYP$ssym";
+	$comment = "Does typedef '$ssym' exist?";
+    }
+    else {
+        warn "WARNING: internal error on symbol $_\n";
+    }
+
+    print OUTH
+	$rc ? "#undef  " : "#define ",
+        $c_sym,   " " x (24 - length $c_sym),
+        "/* ",
+	$comment, " " x (42 - length $comment),
+	"*/\n";
+}
+
+unlink "testsym";
+unlink "testint";
+unlink "testtyp";
+
+1 while unlink "testsym.obj";   # Possibly pointless VMSism
+1 while unlink "testint.obj";   # Possibly pointless VMSism
+1 while unlink "testtyp.obj";   # Possibly pointless VMSism
+
+close IN;
+close OUTH;
+close LOG;
+exit 0;
+
+###
+##  Helper functions
+#
+
+sub Usage {
+    print LOG @_, "\n";
+    print LOG <<EOM;
+Usage: find_syms [options]
+where options include:
+
+   -h         This message.   
+   -v         Verbose.  Tell you more than you want to know about
+              how the Curses symbols are being determined.
+   -l <file>  Create file <file> and dump output into it.
+EOM
+}
+
+__END__
@@ -0,0 +1,120 @@
+#!/usr/bin/perl
+###############################################################################
+#                              testcurses
+###############################################################################
+#
+#  This is a test driver for the Curses Perl module.
+#
+#  This program is a development tool and is meant to change frequently.
+#
+###############################################################################
+use strict;
+use warnings;
+
+use Devel::Peek;
+use Data::Dumper;
+
+use I18N::Langinfo;
+
+use Encode;
+
+use Curses;
+
+
+
+sub test($$) {
+    my ($win, $argsR) = @_;
+
+    my $charset = I18N::Langinfo::langinfo(I18N::Langinfo::CODESET());
+
+    my ($function, $arg) = @{$argsR};
+
+    if (!defined($function)) {
+        die("You must give a function name as the first argument");
+    }
+
+    $win->keypad(1);
+
+    if ($function eq "getchar") {
+        my ($char, $key);
+        do {
+            ($char, $key) = $win->getchar();
+            if (defined $char) {
+                print STDERR "Char: " . encode($charset, $char) . "\n";
+            } elsif (defined $key) {
+                printf STDERR "Key: %04X\n", $key;
+            } else {
+                last;
+            }
+        } until (defined $char and $char eq " ");
+    } elsif ($function eq "getstring") {
+        my $s = $win->getstring;
+        print STDERR encode($charset, $s) . "\n";
+        Dump($s);
+    } elsif ($function eq "addstring") {
+        if (!defined($arg)) {
+            die("Need 2nd argument: string to add");
+        }
+        my $s = decode($charset, $arg) // "Hallo";
+        my $ret = $win->addstring($s);
+        print STDERR $ret, "\n";
+        $win->getchar;
+        $win->refresh;
+    } elsif ($function eq "getmaxyx") {
+        my ($y, $x);
+        $win->getmaxyx($y, $x);
+        print STDERR "$y $x\n";
+    } elsif ($function eq "insstring") {
+        if (!defined($arg)) {
+            die("Need 2nd argument: string");
+        }
+        my $s = decode($charset, $arg) // "Huhu";
+        $win->addstring("Hallo");
+        $win->insstring(0, 0, $s);
+        $win->getchar;
+    } elsif ($function eq "instring") {
+        if (!defined($arg)) {
+            die("Need 2nd argument: string");
+        }
+        my $s = decode($charset, $arg) // "Huhu";
+        $win->addstring("Hallo\n");
+        $win->addstring("$s\n");
+        $s = $win->instring(0, 0); print STDERR encode($charset, $s) . "\n";
+        $s = $win->instring(1, 0); print STDERR encode($charset, $s) . "\n";
+    } elsif ($function eq "ungetch") {
+        if (!defined($arg)) {
+            die("Need 2nd argument: string");
+        }
+        my $s = decode($charset, $arg) // "X";
+        if (ungetchar($s)) {
+            my ($ch, $key) = $win->getchar();
+            if (defined($ch)) {
+                print STDERR ("Char: " . encode($charset, $ch) . "\n");
+            }
+            if (defined($key)) {
+                print STDERR ("Key: $key\n");
+            }
+        } else {
+            print STDERR ("FAIL\n");
+        }
+    } else {
+        print STDERR "unknown function $function\n";
+    }
+}
+
+
+
+###############################################################################
+#                                 MAINLINE
+###############################################################################
+my ($function, $rest) = @ARGV;
+
+my $win = new Curses;
+
+eval { test($win, \@ARGV); };
+
+if ($@) {
+    print STDERR ("EXCEPTION: '$@'\n");
+};
+
+endwin();
@@ -0,0 +1,15 @@
+/* This is a program that 'test.syms' test-compiles to determine if a function
+   has an integer return value.
+
+   'test.syms' defines macro SYM on the compile command.
+*/
+
+#define _XOPEN_SOURCE_EXTENDED  /* We expect wide character functions */
+
+#include "c-config.h"
+
+main() {
+  int ret;
+
+  ret = SYM;
+}
@@ -0,0 +1,13 @@
+/* This is a program that 'test.syms' test-compiles to determine if a symbol
+   exists in the Curses library.
+
+   'test.syms' defines macro SYM on the compile command.
+*/
+
+#define _XOPEN_SOURCE_EXTENDED  /* We expect wide character functions */
+
+#include "c-config.h"
+
+main() {
+  SYM;
+}
@@ -0,0 +1,13 @@
+/* This is a program that 'test.syms' test-compiles to determine if a type
+   is defined in curses.h.
+
+   'test.syms' defines macro SYM on the compile command.
+*/
+
+#define _XOPEN_SOURCE_EXTENDED  /* We expect wide character functions */
+
+#include "c-config.h"
+
+main() {
+  typedef SYM c_sym_t;
+}
@@ -6,6 +6,8 @@
 **  or the GNU General Public License, as specified in the README file.
 */
 
+#define _XOPEN_SOURCE_EXTENDED  /* We expect wide character functions */
+
 #include "CursesDef.h"
 #include "CursesTyp.h"
 #include "c-config.h"
@@ -49,17 +51,18 @@
    work right without it.  Maybe a bug in Devel::PPPort?  */
 #define NEED_sv_2pv_flags
 #include "ppport.h"
+    /* Defines PERL_REVISION, etc. (if perl.h doesn't) */
 
-#ifndef C_PANELSUPPORT
+#ifndef C_PANELFUNCTION
 #  define PANEL int
 #endif
 
-#ifndef C_MENUSUPPORT
+#ifndef C_MENUFUNCTION
 #  define MENU int
 #  define ITEM int
 #endif
 
-#ifndef C_FORMSUPPORT
+#ifndef C_FORMFUNCTION
 #  define FORM int
 #  define FIELD int
 #endif
@@ -70,10 +73,10 @@
    defined in Perl's CORE/pp.h via our inclusion of perl.h above.
 */
 
-/* What a mess. :( */
-#ifndef PERL_VERSION
-#  define PL_sv_undef  sv_undef
-#  define PL_sv_yes    sv_yes
+#if PERL_REVISION > 5 || (PERL_REVISION == 5 && PERL_VERSION >= 16)
+  #define HAVE_PERL_UTF8 1
+#else
+  #define HAVE_PERL_UTF8 0
 #endif
 
 /*
@@ -96,8 +99,8 @@ int base;
     case 2:  c_win = 0; c_x = 1; c_arg = 2; break;
     case 3:  c_win = 1; c_x = 2; c_arg = 3; break;
     default:
-	croak("Curses function '%s' called with too %s arguments", fn,
-	      nargs < base ? "few" : "many");
+    croak("Curses function '%s' called with too %s arguments", fn,
+          nargs < base ? "few" : "many");
     }
     c_function = fn;
 }
@@ -109,8 +112,8 @@ int nargs;
 int base;
 {
     if (nargs != base)
-	croak("Curses function '%s' called with too %s arguments", fn,
-	      nargs < base ? "few" : "many" );
+    croak("Curses function '%s' called with too %s arguments", fn,
+          nargs < base ? "few" : "many" );
 
     c_function = fn;
 }
@@ -170,10 +173,10 @@ chtype ch;
 {
     if (ch == ERR || ch > 255) { sv_setiv(sv, (I32)ch); }
     else {
-	char tmp[2];
-	tmp[0] = (char)ch;
-	tmp[1] = (char)0;
-	sv_setpv(sv, tmp);
+    char tmp[2];
+    tmp[0] = (char)ch;
+    tmp[1] = (char)0;
+    sv_setpv(sv, tmp);
     }
 }
 
@@ -183,12 +186,12 @@ SV *sv;
 int argnum;
 {
     if (sv_derived_from(sv, "Curses::Field"))
-	return (FIELD *)SvIV((SV*)SvRV(sv));
+    return (FIELD *)SvIV((SV*)SvRV(sv));
     if (argnum >= 0)
-	croak("argument %d to Curses function '%s' is not a Curses field",
-	      argnum, c_function);
+    croak("argument %d to Curses function '%s' is not a Curses field",
+          argnum, c_function);
     else
-	croak("argument is not a Curses field");
+    croak("argument is not a Curses field");
 }
 
 static void
@@ -208,12 +211,12 @@ SV *sv;
 int argnum;
 {
     if (sv_derived_from(sv, "Curses::Form"))
-	return (FORM *)SvIV((SV*)SvRV(sv));
+    return (FORM *)SvIV((SV*)SvRV(sv));
     if (argnum >= 0)
-	croak("argument %d to Curses function '%s' is not a Curses form",
-	      argnum, c_function);
+    croak("argument %d to Curses function '%s' is not a Curses form",
+          argnum, c_function);
     else
-	croak("argument is not a Curses form");
+    croak("argument is not a Curses form");
 }
 
 static void
@@ -230,12 +233,12 @@ SV *sv;
 int argnum;
 {
     if (sv_derived_from(sv, "Curses::Item"))
-	return (ITEM *)SvIV((SV*)SvRV(sv));
+    return (ITEM *)SvIV((SV*)SvRV(sv));
     if (argnum >= 0)
-	croak("argument %d to Curses function '%s' is not a Curses item",
-	      argnum, c_function);
+    croak("argument %d to Curses function '%s' is not a Curses item",
+          argnum, c_function);
     else
-	croak("argument is not a Curses item");
+    croak("argument is not a Curses item");
 }
 
 
@@ -253,12 +256,12 @@ SV *sv;
 int argnum;
 {
     if (sv_derived_from(sv, "Curses::Menu"))
-	return (MENU *)SvIV((SV*)SvRV(sv));
+    return (MENU *)SvIV((SV*)SvRV(sv));
     if (argnum >= 0)
-	croak("argument %d to Curses function '%s' is not a Curses menu",
-	      argnum, c_function);
+    croak("argument %d to Curses function '%s' is not a Curses menu",
+          argnum, c_function);
     else
-	croak("argument is not a Curses menu");
+    croak("argument is not a Curses menu");
 }
 
 static void
@@ -275,12 +278,12 @@ SV *sv;
 int argnum;
 {
     if (sv_derived_from(sv, "Curses::Panel"))
-	return (PANEL *)SvIV((SV*)SvRV(sv));
+    return (PANEL *)SvIV((SV*)SvRV(sv));
     if (argnum >= 0)
-	croak("argument %d to Curses function '%s' is not a Curses panel",
-	      argnum, c_function);
+    croak("argument %d to Curses function '%s' is not a Curses panel",
+          argnum, c_function);
     else
-	croak("argument is not a Curses panel");
+    croak("argument is not a Curses panel");
 }
 
 static void
@@ -297,12 +300,12 @@ SV *sv;
 int argnum;
 {
     if (sv_derived_from(sv, "Curses::Screen"))
-	return (SCREEN *)SvIV((SV*)SvRV(sv));
+    return (SCREEN *)SvIV((SV*)SvRV(sv));
     if (argnum >= 0)
-	croak("argument %d to Curses function '%s' is not a Curses screen",
-	      argnum, c_function);
+    croak("argument %d to Curses function '%s' is not a Curses screen",
+          argnum, c_function);
     else
-	croak("argument is not a Curses screen");
+    croak("argument is not a Curses screen");
 }
 
 static void
@@ -323,10 +326,10 @@ int argnum;
       return ret;
     }
     if (argnum >= 0)
-	croak("argument %d to Curses function '%s' is not a Curses window",
-	      argnum, c_function);
+    croak("argument %d to Curses function '%s' is not a Curses window",
+          argnum, c_function);
     else
-	croak("argument is not a Curses window");
+    croak("argument is not a Curses window");
 }
 
 static void
@@ -348,9 +351,9 @@ char *name;
     if (len > 0) {
         name[len - 1] = 0;
 
-	SvCUR(sv) = strlen(name);
-	SvPOK_only(sv);
-	*SvEND(sv) = 0;
+    SvCUR(sv) = strlen(name);
+    SvPOK_only(sv);
+    *SvEND(sv) = 0;
     }
 }
 
@@ -366,11 +369,11 @@ chtype *name;
     if (len - len % rs > rs) {            /* find even multiple of rs */
         name[len - len % rs - rs] = 0;
 
-	while (*name++) { n++; }
+    while (*name++) { n++; }
 
-	SvCUR(sv) = n;
-	SvPOK_only(sv);
-	*(chtype *)SvEND(sv) = 0;
+    SvCUR(sv) = n;
+    SvPOK_only(sv);
+    *(chtype *)SvEND(sv) = 0;
     }
 }
 
@@ -382,12 +385,26 @@ SV *sv;
     SvPOK_only(sv);
 }
 
+
+#if HAVE_PERL_UTF8
+  #include "CursesWide.c"
+  #define HAVE_WIDE_SV_HELPER 1
+#else
+  #define HAVE_WIDE_SV_HELPER 0
+#endif
+
 /*
 **  Cheesy, I know.  But it works.
 */
 
 
 #include "CursesFun.c"
+#if HAVE_WIDE_SV_HELPER
+  #include "CursesFunWide.c"
+  #define HAVE_WIDE_XS_FUNCTIONS 1
+#else
+  #define HAVE_WIDE_XS_FUNCTIONS 0
+#endif
 #include "CursesVar.c"
 #include "CursesCon.c"
 #include "CursesBoot.c"
@@ -51,7 +51,7 @@ sub DESTROY { }
 
 package Curses;
 
-$VERSION = '1.28'; # Makefile.PL picks this up
+$VERSION = '1.30'; # Makefile.PL picks this up
 
 use Carp;
 require Exporter;
@@ -72,9 +72,12 @@ sub DESTROY  { }
 
 sub AUTOLOAD {
     my $N = $AUTOLOAD;
-       $N =~ s/^.*:://;
+    $N =~ s/^.*:://;
 
-    croak "Curses constant '$N' is not defined by your vendor";
+    croak
+        "No '$N' in Curses module.  This could be because the Curses " .
+        "library for which it was built does not provide the associated " .
+        "functions.  ";
 }
 
 sub printw   { addstr(sprintf shift, @_) }
@@ -92,6 +95,8 @@ tie $COLOR_PAIRS, Curses::Vars, 6;
     LINES $LINES COLS $COLS stdscr $stdscr curscr $curscr COLORS $COLORS
     COLOR_PAIRS $COLOR_PAIRS
 
+    getchar getstring ungetchar instring addstring insstring
+
     addch echochar addchstr addchnstr addstr addnstr attroff attron attrset
     standend standout attr_get attr_off attr_on attr_set chgat COLOR_PAIR
     PAIR_NUMBER beep flash bkgd bkgdset getbkgd border box hline vline
@@ -254,10 +259,6 @@ Curses - terminal screen handling and optimization
     ...
     endwin;
 
-
-   Curses::supports_function($function);
-   Curses::supports_constant($constant);
-
 =head1 DESCRIPTION
 
 C<Curses> is the interface between Perl and your system's curses(3)
@@ -311,6 +312,164 @@ variable C<$Curses::OldCurses> to a non-zero value before using the
 C<Curses> package.  See L<"Perl 4.X C<cursperl> Compatibility">
 for an example of this.
 
+=head2 Wide-Character-Aware Functions
+
+The following are the preferred functions for working with strings, though
+they don't follow the normal unified function naming convention (based on the
+names in the Curses library) described above.  Despite the naming, each
+corresponds to a Curses library function.  For example, a C<getchar>
+call performs a Curses library function in the C<getch> family.
+
+In addition to these functions, The C<Curses> module contains corresponding
+functions with the conventional naming (e.g. C<getch>); the duplication is for
+historical reasons.  The preferred functions were new in Curses 1.29 (April
+2014).  They use the wide character functions in the Curses library if
+available (falling back to using the traditional non-wide-character versions).
+They also have a more Perl-like interface, taking care of some gory details
+under the hood about which a Perl programmer shouldn't have to worry.
+
+The reason for two sets of string-handling functions is historical.  The
+original Curses Perl module predates Curses libraries that understand multiple
+byte character encodings.  Moreover, the module was designed to have a Perl
+interface that closely resembles the C interface syntactically and directly
+passes the internal byte representation of Perl strings to C code.  This was
+probably fine before Perl got Unicode function, but today, Perl stores strings
+internally in either Latin-1 or Unicode UTF-8 and the original module was not
+sensitive to which encoding was used.
+
+While most of the problems could be worked around in Perl code using the
+traditional interface, it's hard to get right and you need a
+wide-character-aware curses library (e.g. ncursesw) anyway to make it work
+properly.  Because existing consumers of the Curses module may be relying on
+the traditional behavior, Curses module designers couldn't simply modify the
+existing functions to understand wide characters and convert from and to Perl
+strings.
+
+None of these functions exist if Perl is older than 5.16.
+
+
+=head3 C<getchar>
+
+This calls C<wget_wch()>.  It returns a character -- more precisely, a
+one-character (not necessarily one-byte!) string holding the character -- for
+a normal key and a two-element list C<(undef, key-number)> for a function key.
+It returns C<undef> on error.
+
+If you don't expect function keys (i.e. with C<keypad(0))>, you can simply do
+
+=over 4
+
+	my $ch = getchar;
+	die "getchar failed" unless defined $ch;
+
+=back
+
+If you do expect function keys (i.e. with C<keypad(1)>), you can still assign
+the result to a scalar variable as above.  Because of of the way the comma
+operator works, that variable will receive either C<undef> or the string or
+the number, and you can decode it yourself.
+
+=over 4
+
+	my $ch = getchar;
+	die "getchar failed" unless defined $ch;
+	if (<$ch looks like a number >= 0x100>) {
+		<handle function key>
+	} else {
+		<handle normal key>
+	}
+
+=back
+
+or do
+
+=over 4
+
+	my ($ch, $key) = getchar;
+	if (defined $key) {
+		<handle function key $key>
+	} else if (defined $ch) {
+		<handle normal key $ch>
+	} else {
+		die "getchar failed";
+	}
+
+=back
+
+If C<wget_wch()> is not available (i.e. The Curses library does not understand
+wide characters), this calls C<wgetch()>, but returns the values described
+above nonetheless.  This can be a problem because with a multibyte character
+encoding like UTF-8, you will receive two one-character strings for a
+two-byte-character (e.g. "%81Ã" and "%81¤" for "%81ä").  If you append
+these characters to a Perl string, that string may internally contain a valid
+UTF-8 encoding of a character, but Perl will not interpret it that way. Perl
+may even try to convert what it believes to be two characters to UTF-8, giving
+you four bytes.
+
+
+=head3 C<getstring>
+
+This calls C<wgetn_wstr> and returns a string or C<undef>.  It cannot return a
+function key value; the Curses library will itself interpret KEY_LEFT and
+KEY_BACKSPACE.
+
+If C<wgett_wstr()> is unavailable, this calls C<wgetstr()>.
+
+In both cases, the function allocates a buffer of fixed size to hold the
+result of the Curses library call.
+
+=over 4
+
+	my $s = getstring();
+	die "getstring failed" unless defined $s;
+
+=back
+
+
+=head3 C<addstring>/C<insstring>
+
+This adds/inserts the Perl string passed as an argument to the Curses window
+using C<waddnwstr()>/C<wins_nwstr()> or, if unavailable,
+C<waddnstr()>/C<winsnstr()>.  It returns a true value on success, false on
+failure.
+
+=over 4
+
+	addstring("H%81äll%81ö, W%81örld") ||%81 die "addstring failed";
+
+=back
+
+=head3 C<instring>
+
+This returns a Perl string (or C<undef> on failure) holding the characters
+from the current cursor position up to the end of the line.  It uses
+C<winnwstr()> if available, and otherwise C<innstr()>.
+
+=over 4
+
+	my $s = instring();
+	die "instring failed" unless defined $s;
+
+=back
+
+=head3 C<ungetchar>
+
+This pushes one character (passed as a one-character Perl string) back to the
+input queue. It uses C<unget_wch()> or C<ungetch()>.  It returns a true value
+on success, false on failure.  It cannot push back a function key; the Curses
+library provides no way to push back function keys, only characters.
+
+=over 4
+
+	ungetchar("X") ||%81 die "ungetchar failed";
+
+=back
+
+The C<Curses> module provides no interface to the complex-character routines
+(C<wadd_wch()>, C<wadd_wchnstr()>, C<wecho_wchar()>, C<win_wch()>,
+C<win_wchnstr()>, C<wins_wch()>) because there is no sensible way of
+converting from Perl to a C C<cchar_t> or back.
+
 =head2 Objects
 
 Objects work.  Example:
@@ -346,45 +505,38 @@ In order to avoid this problem, use the alternate functions:
    inchnstr()
    innstr()
 
-which take an extra "size of buffer" argument.
+which take an extra "size of buffer" argument
+or the wide-character-aware getstring() and instring() versions.
 
 =head1 COMPATIBILITY
 
 =head2 Perl 4.X C<cursperl> Compatibility
 
-C<Curses> has been written to take advantage of the new features of
-Perl.  I felt it better to provide an improved curses programming
-environment rather than to be 100% compatible.  However, many old
-C<curseperl> applications will probably still work by starting the
-script with:
+C<Curses> was written to take advantage of features of Perl 5 and later.  The
+author thought it was better to provide an improved curses programming
+environment than to be 100% compatible.  However, many old C<curseperl>
+applications will probably still work by starting the script with:
 
     BEGIN { $Curses::OldCurses = 1; }
     use Curses;
 
-Any old application that still does not work should print an
-understandable error message explaining the problem.
+Any old application that still does not work should print an understandable
+error message explaining the problem.
 
 Some functions and variables are not available through C<Curses>, even with
 the C<BEGIN> line.  They are listed under
-L<"curses(3) items not available through Curses">.
+L<"Curses items not available through Perl Curses">.
 
 The variables C<$stdscr> and C<$curscr> are also available as
 functions C<stdscr> and C<curscr>.  This is because of a Perl bug.
-See the L<BUGS> section for details.
+See the L<LIMITATIONS> section for details.
 
 =head2 Incompatibilities with previous versions of C<Curses>
 
-In previous versions of this software, some Perl functions took a
-different set of parameters than their C counterparts.  This is no
-longer true.  You should now use C<getstr($str)> and C<getyx($y, $x)>
-instead of C<$str = getstr()> and C<($y, $x) = getyx()>.
-
-=head2 Incompatibilities with other Perl programs
-
-    menu.pl, v3.0 and v3.1
-	There were various interaction problems between these two
-	releases and Curses.  Please upgrade to the latest version
-	(v3.3 as of 3/16/96).
+In previous versions of this software, some Perl functions took a different
+set of parameters than their C counterparts.  This is not true in the current
+version.  You should now use C<getstr($str)> and C<getyx($y, $x)> instead of
+C<$str = getstr()> and C<($y, $x) = getyx()>.
 
 =head1 DIAGNOSTICS
 
@@ -396,34 +548,37 @@ You have called a C<Curses> function with a wrong number of
 arguments.
 
 =item * argument %d to Curses function '%s' is not a Curses %s at ...
+
 =item * argument is not a Curses %s at ...
 
-The argument you gave to the function wasn't what it wanted.
+The argument you gave to the function wasn't of a valid type for the
+place you used it.
 
-This probably means that you didn't give the right arguments to a
-I<unified> function.  See the DESCRIPTION section on L<Unified
-Functions> for more information.
+This probably means that you didn't give the right arguments to a I<unified>
+function.  See the DESCRIPTION section on L<Unified Functions> for more
+information.
 
-=item * Curses function '%s' is not defined by your vendor at ...
+=item * Curses function '%s' is not defined in your Curses library at ...
 
-You have a C<Curses> function in your code that your system's curses(3)
-library doesn't define.
+Your code has a call to a Perl C<Curses> function that your system's Curses
+library doesn't provide.
 
-=item * Curses variable '%s' is not defined by your vendor at ...
+=item * Curses variable '%s' is not defined in your Curses library at ...
 
-You have a C<Curses> variable in your code that your system's curses(3)
-library doesn't define.
+Your code has a Perl C<Curses> variable that your system's Curses library
+doesn't provide.
 
-=item * Curses constant '%s' is not defined by your vendor at ...
+=item * Curses constant '%s' is not defined in your Curses library at ...
 
-You have a C<Curses> constant in your code that your system's curses(3)
-library doesn't define.
+Your code references the specified C<Curses> constant, and your system's
+Curses library doesn't provide it.
 
 =item * Curses::Vars::FETCH called with bad index at ...
+
 =item * Curses::Vars::STORE called with bad index at ...
 
-You've been playing with the C<tie> interface to the C<Curses>
-variables.  Don't do that.  :-)
+You've been playing with the C<tie> interface to the C<Curses> variables.
+Don't do that.  :-)
 
 =item * Anything else
 
@@ -431,7 +586,7 @@ Check out the F<perldiag> man page to see if the error is in there.
 
 =back
 
-=head1 BUGS
+=head1 LIMITATIONS
 
 If you use the variables C<$stdscr> and C<$curscr> instead of their
 functional counterparts (C<stdscr> and C<curscr>), you might run into
@@ -440,8 +595,6 @@ manifested by the C<Curses> package telling you C<$stdscr> isn't a
 window.  One workaround is to put a line like C<$stdscr = $stdscr>
 near the front of your program.
 
-Probably many more.
-
 =head1 AUTHOR
 
 William Setzer <William_Setzer@ncsu.edu>
@@ -773,11 +926,22 @@ William Setzer <William_Setzer@ncsu.edu>
     form_request_name       No
     form_request_by_name    No
 
-[*] To use any functions in this column, the variable
-C<$Curses::OldCurses> must be set to a non-zero value before using the
+[*] To use any functions in this column, the program must set the variable
+C<$Curses::OldCurses> variable to a non-zero value before using the
 C<Curses> package.  See L<"Perl 4.X cursperl Compatibility"> for an
 example of this.
 
+=head2 Available Wide-Character-Aware Functions
+
+    Function    Uses wide-character call  Reverts to legacy call
+    --------    ------------------------  ----------------------
+    getchar     wget_wch                  wgetch
+    getstring   wgetn_wstr                wgetnstr
+    ungetchar   unget_wch                 ungetch
+    instring    winnwtr                   winnstr
+    addstring   waddnwstr                 waddnstr
+    insstring   wins_nwstr                winsnstr
+
 =head2 Available Variables
 
     LINES                   COLS                    stdscr
@@ -884,19 +1048,19 @@ example of this.
     O_PASSOK                O_STATIC                O_NL_OVERLOAD
     O_BS_OVERLOAD           
 
-=head2 curses(3) functions not available through C<Curses>
+=head2 Curses functions not available through Perl C<Curses>
 
     tstp _putchar fullname scanw wscanw mvscanw mvwscanw ripoffline
     setupterm setterm set_curterm del_curterm restartterm tparm tputs
     putp vidputs vidattr mvcur tigetflag tigetnum tigetstr tgetent
     tgetflag tgetnum tgetstr tgoto tputs
 
-=head2 menu(3) functions not available through C<Curses>
+=head2 Curses menu functions not available through Perl C<Curses>
 
     set_item_init item_init set_item_term item_term set_menu_init
     menu_init set_menu_term menu_term
 
-=head2 form(3) functions not available through C<Curses>
+=head2 Curses form functions not available through Perl C<Curses>
 
     new_fieldtype free_fieldtype set_fieldtype_arg
     set_fieldtype_choice link_fieldtype set_form_init form_init
@@ -1,8 +1,9 @@
-/*  This file can be automatically generated; changes may be lost.
-**
+/* 
 **
 **  CursesBoot.c -- the bootstrap function
 **
+**  This is an inclusion for Curses.c.
+**
 **  Copyright (c) 1994-2000  William Setzer
 **
 **  You may distribute under the terms of either the Artistic License
@@ -403,6 +404,17 @@ XS(boot_Curses)
     C_NEWXS("Curses::form_request_name",      XS_Curses_form_request_name);
     C_NEWXS("Curses::form_request_by_name",   XS_Curses_form_request_by_name);
 
+#if HAVE_WIDE_XS_FUNCTIONS
+    /* Combined Normal/Wide-Character Functions */
+
+    C_NEWXS("Curses::addstring",		XS_CURSES_addstring);
+    C_NEWXS("Curses::insstring",		XS_CURSES_insstring);
+    C_NEWXS("Curses::instring",			XS_CURSES_instring);
+    C_NEWXS("Curses::getchar",			XS_CURSES_getchar);
+    C_NEWXS("Curses::ungetchar",		XS_CURSES_ungetchar);
+    C_NEWXS("Curses::getstring",		XS_CURSES_getstring);
+#endif
+
     /* Variables masquerading as functions */
 
     C_NEWXS("Curses::LINES",                  XS_Curses_LINES);
@@ -3,6 +3,8 @@
 **
 **  CursesCon.c -- non-trivial constants
 **
+**  This is an inclusion for Curses.c
+**
 **  Copyright (c) 1994-2000  William Setzer
 **
 **  You may distribute under the terms of either the Artistic License
@@ -1,8 +1,10 @@
-/*  This file can be automatically generated; changes may be lost.
+/*  This is an inclusion for Curses.c.
 **
 **
 **  CursesFun.c -- the functions
 **
+**  This is an inclusion for Curses.c
+**
 **  Copyright (c) 1994-2000  William Setzer
 **
 **  You may distribute under the terms of either the Artistic License
@@ -17,13 +19,13 @@ XS(XS_Curses_addch)
 #ifdef C_ADDCH
     c_countargs("addch", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	chtype	ch	= c_sv2chtype(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : waddch(win, ch);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ch  = c_sv2chtype(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : waddch(win, ch);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -38,13 +40,13 @@ XS(XS_Curses_echochar)
 #ifdef C_ECHOCHAR
     c_countargs("echochar", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	chtype	ch	= c_sv2chtype(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : wechochar(win, ch);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ch  = c_sv2chtype(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : wechochar(win, ch);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -62,13 +64,13 @@ XS(XS_Curses_addchstr)
 #ifdef C_ADDCHSTR
     c_countargs("addchstr", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	chtype *str	= (chtype *)SvPV_nolen(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : waddchstr(win, str);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype *str = (chtype *)SvPV_nolen(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : waddchstr(win, str);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -83,14 +85,14 @@ XS(XS_Curses_addchnstr)
 #ifdef C_ADDCHNSTR
     c_countargs("addchnstr", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	chtype *str	= (chtype *)SvPV_nolen(ST(c_arg));
-	int	n	= (int)SvIV(ST(c_arg+1));
-	int	ret	= c_mret == ERR ? ERR : waddchnstr(win, str, n);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype *str = (chtype *)SvPV_nolen(ST(c_arg));
+    int n   = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : waddchnstr(win, str, n);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -108,13 +110,13 @@ XS(XS_Curses_addstr)
 #ifdef C_ADDSTR
     c_countargs("addstr", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	char *	str	= (char *)SvPV_nolen(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : waddstr(win, str);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    char *  str = (char *)SvPV_nolen(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : waddstr(win, str);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -129,14 +131,14 @@ XS(XS_Curses_addnstr)
 #ifdef C_ADDNSTR
     c_countargs("addnstr", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	char *	str	= (char *)SvPV_nolen(ST(c_arg));
-	int	n	= (int)SvIV(ST(c_arg+1));
-	int	ret	= c_mret == ERR ? ERR : waddnstr(win, str, n);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    char *  str = (char *)SvPV_nolen(ST(c_arg));
+    int n   = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : waddnstr(win, str, n);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -154,13 +156,13 @@ XS(XS_Curses_attroff)
 #ifdef C_ATTROFF
     c_countargs("attroff", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	attrs	= (int)SvIV(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : wattroff(win, attrs);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int attrs   = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : wattroff(win, attrs);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -175,13 +177,13 @@ XS(XS_Curses_attron)
 #ifdef C_ATTRON
     c_countargs("attron", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	attrs	= (int)SvIV(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : wattron(win, attrs);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int attrs   = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : wattron(win, attrs);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -196,13 +198,13 @@ XS(XS_Curses_attrset)
 #ifdef C_ATTRSET
     c_countargs("attrset", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	attrs	= (int)SvIV(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : wattrset(win, attrs);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int attrs   = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : wattrset(win, attrs);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -217,12 +219,12 @@ XS(XS_Curses_standend)
 #ifdef C_STANDEND
     c_countargs("standend", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	ret	= c_mret == ERR ? ERR : (int)wstandend(win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : (int)wstandend(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -237,12 +239,12 @@ XS(XS_Curses_standout)
 #ifdef C_STANDOUT
     c_countargs("standout", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	ret	= c_mret == ERR ? ERR : (int)wstandout(win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : (int)wstandout(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -257,17 +259,17 @@ XS(XS_Curses_attr_get)
 #ifdef C_ATTR_GET
     c_countargs("attr_get", items, 3);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	attr_t	attrs	= 0;
-	short	color	= 0;
-	void *	opts	= 0;
-	int	ret	= c_mret == ERR ? ERR : wattr_get(win, &attrs, &color, opts);
-	
-	sv_setiv(ST(c_arg), (IV)attrs);;
-	sv_setiv(ST(c_arg+1), (IV)color);;
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    attr_t  attrs   = 0;
+    short   color   = 0;
+    void *  opts    = 0;
+    int ret = c_mret == ERR ? ERR : wattr_get(win, &attrs, &color, opts);
+    
+    sv_setiv(ST(c_arg), (IV)attrs);;
+    sv_setiv(ST(c_arg+1), (IV)color);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -282,14 +284,14 @@ XS(XS_Curses_attr_off)
 #ifdef C_ATTR_OFF
     c_countargs("attr_off", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	attr_t	attrs	= (attr_t)SvIV(ST(c_arg));
-	void *	opts	= 0;
-	int	ret	= c_mret == ERR ? ERR : wattr_off(win, attrs, opts);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    attr_t  attrs   = (attr_t)SvIV(ST(c_arg));
+    void *  opts    = 0;
+    int ret = c_mret == ERR ? ERR : wattr_off(win, attrs, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -304,14 +306,14 @@ XS(XS_Curses_attr_on)
 #ifdef C_ATTR_ON
     c_countargs("attr_on", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	attr_t	attrs	= (attr_t)SvIV(ST(c_arg));
-	void *	opts	= 0;
-	int	ret	= c_mret == ERR ? ERR : wattr_on(win, attrs, opts);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    attr_t  attrs   = (attr_t)SvIV(ST(c_arg));
+    void *  opts    = 0;
+    int ret = c_mret == ERR ? ERR : wattr_on(win, attrs, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -326,15 +328,15 @@ XS(XS_Curses_attr_set)
 #ifdef C_ATTR_SET
     c_countargs("attr_set", items, 3);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	attr_t	attrs	= (attr_t)SvIV(ST(c_arg));
-	short	color	= (short)SvIV(ST(c_arg+1));
-	void *	opts	= 0;
-	int	ret	= c_mret == ERR ? ERR : wattr_set(win, attrs, color, opts);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    attr_t  attrs   = (attr_t)SvIV(ST(c_arg));
+    short   color   = (short)SvIV(ST(c_arg+1));
+    void *  opts    = 0;
+    int ret = c_mret == ERR ? ERR : wattr_set(win, attrs, color, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -358,16 +360,16 @@ XS(XS_Curses_chgat)
     */
     c_countargs("chgat", items, 4);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	n	= (int)SvIV(ST(c_arg));
-	attr_t	attrs	= (attr_t)SvIV(ST(c_arg+1));
-	short	color	= (short)SvIV(ST(c_arg+2));
-	void *	opts	= 0;
-	int	ret	= c_mret == ERR ? ERR : wchgat(win, n, attrs, color, opts);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int n   = (int)SvIV(ST(c_arg));
+    attr_t  attrs   = (attr_t)SvIV(ST(c_arg+1));
+    short   color   = (short)SvIV(ST(c_arg+2));
+    void *  opts    = 0;
+    int ret = c_mret == ERR ? ERR : wchgat(win, n, attrs, color, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -382,11 +384,11 @@ XS(XS_Curses_COLOR_PAIR)
 #ifdef C_COLOR_PAIR
     c_exactargs("COLOR_PAIR", items, 1);
     {
-	int	n	= (int)SvIV(ST(0));
-	int	ret	= COLOR_PAIR(n);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int n   = (int)SvIV(ST(0));
+    int ret = COLOR_PAIR(n);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -401,11 +403,11 @@ XS(XS_Curses_PAIR_NUMBER)
 #ifdef C_PAIR_NUMBER
     c_exactargs("PAIR_NUMBER", items, 1);
     {
-	int	attrs	= (int)SvIV(ST(0));
-	int	ret	= PAIR_NUMBER(attrs);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int attrs   = (int)SvIV(ST(0));
+    int ret = PAIR_NUMBER(attrs);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -423,10 +425,10 @@ XS(XS_Curses_beep)
 #ifdef C_BEEP
     c_exactargs("beep", items, 0);
     {
-	int	ret	= beep();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = beep();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -441,10 +443,10 @@ XS(XS_Curses_flash)
 #ifdef C_FLASH
     c_exactargs("flash", items, 0);
     {
-	int	ret	= flash();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = flash();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -462,13 +464,13 @@ XS(XS_Curses_bkgd)
 #ifdef C_BKGD
     c_countargs("bkgd", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	chtype	ch	= c_sv2chtype(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : wbkgd(win, ch);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ch  = c_sv2chtype(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : wbkgd(win, ch);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -483,11 +485,11 @@ XS(XS_Curses_bkgdset)
 #ifdef C_BKGDSET
     c_countargs("bkgdset", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	chtype	ch	= c_sv2chtype(ST(c_arg));
-	
-	if (c_mret == OK) { wbkgdset(win, ch); }
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ch  = c_sv2chtype(ST(c_arg));
+    
+    if (c_mret == OK) { wbkgdset(win, ch); }
     }
     XSRETURN(0);
 #else
@@ -502,12 +504,12 @@ XS(XS_Curses_getbkgd)
 #ifdef C_GETBKGD
     c_countargs("getbkgd", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	chtype	ret	= c_mret == ERR ? ERR : getbkgd(win);
-	
-	ST(0) = sv_newmortal();
-	c_chtype2sv(ST(0), ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ret = c_mret == ERR ? ERR : getbkgd(win);
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -525,20 +527,20 @@ XS(XS_Curses_border)
 #ifdef C_BORDER
     c_countargs("border", items, 8);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	chtype	ls	= c_sv2chtype(ST(c_arg));
-	chtype	rs_	= c_sv2chtype(ST(c_arg+1));
-	chtype	ts	= c_sv2chtype(ST(c_arg+2));
-	chtype	bs	= c_sv2chtype(ST(c_arg+3));
-	chtype	tl	= c_sv2chtype(ST(c_arg+4));
-	chtype	tr	= c_sv2chtype(ST(c_arg+5));
-	chtype	bl	= c_sv2chtype(ST(c_arg+6));
-	chtype	br	= c_sv2chtype(ST(c_arg+7));
-	int	ret	= c_mret == ERR ? ERR : wborder(win, ls, rs_, ts, bs, tl, tr, bl, br);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ls  = c_sv2chtype(ST(c_arg));
+    chtype  rs_ = c_sv2chtype(ST(c_arg+1));
+    chtype  ts  = c_sv2chtype(ST(c_arg+2));
+    chtype  bs  = c_sv2chtype(ST(c_arg+3));
+    chtype  tl  = c_sv2chtype(ST(c_arg+4));
+    chtype  tr  = c_sv2chtype(ST(c_arg+5));
+    chtype  bl  = c_sv2chtype(ST(c_arg+6));
+    chtype  br  = c_sv2chtype(ST(c_arg+7));
+    int ret = c_mret == ERR ? ERR : wborder(win, ls, rs_, ts, bs, tl, tr, bl, br);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -553,14 +555,14 @@ XS(XS_Curses_box)
 #ifdef C_BOX
     c_countargs("box", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	chtype	verch	= c_sv2chtype(ST(c_arg));
-	chtype	horch	= c_sv2chtype(ST(c_arg+1));
-	int	ret	= c_mret == ERR ? ERR : box(win, verch, horch);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  verch   = c_sv2chtype(ST(c_arg));
+    chtype  horch   = c_sv2chtype(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : box(win, verch, horch);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -575,14 +577,14 @@ XS(XS_Curses_hline)
 #ifdef C_HLINE
     c_countargs("hline", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	chtype	ch	= c_sv2chtype(ST(c_arg));
-	int	n	= (int)SvIV(ST(c_arg+1));
-	int	ret	= c_mret == ERR ? ERR : whline(win, ch, n);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ch  = c_sv2chtype(ST(c_arg));
+    int n   = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : whline(win, ch, n);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -597,14 +599,14 @@ XS(XS_Curses_vline)
 #ifdef C_VLINE
     c_countargs("vline", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	chtype	ch	= c_sv2chtype(ST(c_arg));
-	int	n	= (int)SvIV(ST(c_arg+1));
-	int	ret	= c_mret == ERR ? ERR : wvline(win, ch, n);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ch  = c_sv2chtype(ST(c_arg));
+    int n   = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : wvline(win, ch, n);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -622,12 +624,12 @@ XS(XS_Curses_erase)
 #ifdef C_ERASE
     c_countargs("erase", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	ret	= c_mret == ERR ? ERR : werase(win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : werase(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -642,12 +644,12 @@ XS(XS_Curses_clear)
 #ifdef C_CLEAR
     c_countargs("clear", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	ret	= c_mret == ERR ? ERR : wclear(win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : wclear(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -662,12 +664,12 @@ XS(XS_Curses_clrtobot)
 #ifdef C_CLRTOBOT
     c_countargs("clrtobot", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	ret	= c_mret == ERR ? ERR : wclrtobot(win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : wclrtobot(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -682,12 +684,12 @@ XS(XS_Curses_clrtoeol)
 #ifdef C_CLRTOEOL
     c_countargs("clrtoeol", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	ret	= c_mret == ERR ? ERR : wclrtoeol(win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : wclrtoeol(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -705,10 +707,10 @@ XS(XS_Curses_start_color)
 #ifdef C_START_COLOR
     c_exactargs("start_color", items, 0);
     {
-	int	ret	= start_color();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = start_color();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -723,13 +725,13 @@ XS(XS_Curses_init_pair)
 #ifdef C_INIT_PAIR
     c_exactargs("init_pair", items, 3);
     {
-	short	pair	= (short)SvIV(ST(0));
-	short	f	= (short)SvIV(ST(1));
-	short	b	= (short)SvIV(ST(2));
-	int	ret	= init_pair(pair, f, b);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    short   pair    = (short)SvIV(ST(0));
+    short   f   = (short)SvIV(ST(1));
+    short   b   = (short)SvIV(ST(2));
+    int ret = init_pair(pair, f, b);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -744,14 +746,14 @@ XS(XS_Curses_init_color)
 #ifdef C_INIT_COLOR
     c_exactargs("init_color", items, 4);
     {
-	short	color	= (short)SvIV(ST(0));
-	short	r	= (short)SvIV(ST(1));
-	short	g	= (short)SvIV(ST(2));
-	short	b	= (short)SvIV(ST(3));
-	int	ret	= init_color(color, r, g, b);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    short   color   = (short)SvIV(ST(0));
+    short   r   = (short)SvIV(ST(1));
+    short   g   = (short)SvIV(ST(2));
+    short   b   = (short)SvIV(ST(3));
+    int ret = init_color(color, r, g, b);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -766,10 +768,10 @@ XS(XS_Curses_has_colors)
 #ifdef C_HAS_COLORS
     c_exactargs("has_colors", items, 0);
     {
-	bool	ret	= has_colors();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    bool    ret = has_colors();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -784,10 +786,10 @@ XS(XS_Curses_can_change_color)
 #ifdef C_CAN_CHANGE_COLOR
     c_exactargs("can_change_color", items, 0);
     {
-	bool	ret	= can_change_color();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    bool    ret = can_change_color();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -802,17 +804,17 @@ XS(XS_Curses_color_content)
 #ifdef C_COLOR_CONTENT
     c_exactargs("color_content", items, 4);
     {
-	short	color	= (short)SvIV(ST(0));
-	short	r	= 0;
-	short	g	= 0;
-	short	b	= 0;
-	int	ret	= color_content(color, &r, &g, &b);
-	
-	sv_setiv(ST(1), (IV)r);;
-	sv_setiv(ST(2), (IV)g);;
-	sv_setiv(ST(3), (IV)b);;
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    short   color   = (short)SvIV(ST(0));
+    short   r   = 0;
+    short   g   = 0;
+    short   b   = 0;
+    int ret = color_content(color, &r, &g, &b);
+    
+    sv_setiv(ST(1), (IV)r);;
+    sv_setiv(ST(2), (IV)g);;
+    sv_setiv(ST(3), (IV)b);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -827,15 +829,15 @@ XS(XS_Curses_pair_content)
 #ifdef C_PAIR_CONTENT
     c_exactargs("pair_content", items, 3);
     {
-	short	pair	= (short)SvIV(ST(0));
-	short	f	= 0;
-	short	b	= 0;
-	int	ret	= pair_content(pair, &f, &b);
-	
-	sv_setiv(ST(1), (IV)f);;
-	sv_setiv(ST(2), (IV)b);;
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    short   pair    = (short)SvIV(ST(0));
+    short   f   = 0;
+    short   b   = 0;
+    int ret = pair_content(pair, &f, &b);
+    
+    sv_setiv(ST(1), (IV)f);;
+    sv_setiv(ST(2), (IV)b);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -853,12 +855,12 @@ XS(XS_Curses_delch)
 #ifdef C_DELCH
     c_countargs("delch", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	ret	= c_mret == ERR ? ERR : wdelch(win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : wdelch(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -876,12 +878,12 @@ XS(XS_Curses_deleteln)
 #ifdef C_DELETELN
     c_countargs("deleteln", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	ret	= c_mret == ERR ? ERR : wdeleteln(win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : wdeleteln(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -896,13 +898,13 @@ XS(XS_Curses_insdelln)
 #ifdef C_INSDELLN
     c_countargs("insdelln", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	n	= (int)SvIV(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : winsdelln(win, n);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int n   = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : winsdelln(win, n);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -917,12 +919,12 @@ XS(XS_Curses_insertln)
 #ifdef C_INSERTLN
     c_countargs("insertln", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	ret	= c_mret == ERR ? ERR : winsertln(win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : winsertln(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -940,12 +942,12 @@ XS(XS_Curses_getch)
 #ifdef C_GETCH
     c_countargs("getch", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	chtype	ret	= c_mret == ERR ? ERR : wgetch(win);
-	
-	ST(0) = sv_newmortal();
-	c_chtype2sv(ST(0), ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ret = c_mret == ERR ? ERR : wgetch(win);
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -960,11 +962,11 @@ XS(XS_Curses_ungetch)
 #ifdef C_UNGETCH
     c_exactargs("ungetch", items, 1);
     {
-	chtype	ch	= c_sv2chtype(ST(0));
-	int	ret	= ungetch(ch);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    chtype  ch  = c_sv2chtype(ST(0));
+    int ret = ungetch(ch);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -979,11 +981,11 @@ XS(XS_Curses_has_key)
 #ifdef C_HAS_KEY
     c_exactargs("has_key", items, 1);
     {
-	int	ch	= (int)SvIV(ST(0));
-	int	ret	= has_key(ch);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ch  = (int)SvIV(ST(0));
+    int ret = has_key(ch);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -998,11 +1000,11 @@ XS(XS_Curses_KEY_F)
 #ifdef C_KEY_F
     c_exactargs("KEY_F", items, 1);
     {
-	int	n	= (int)SvIV(ST(0));
-	chtype	ret	= KEY_F(n);
-	
-	ST(0) = sv_newmortal();
-	c_chtype2sv(ST(0), ret);
+    int n   = (int)SvIV(ST(0));
+    chtype  ret = KEY_F(n);
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -1020,14 +1022,14 @@ XS(XS_Curses_getstr)
 #ifdef C_GETSTR
     c_countargs("getstr", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	char *	str	= (char *)sv_grow(ST(c_arg), 250);
-	int	ret	= c_mret == ERR ? ERR : wgetstr(win, str);
-	
-	c_setchar(ST(c_arg), str);
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    char *  str = (char *)sv_grow(ST(c_arg), 250);
+    int ret = c_mret == ERR ? ERR : wgetstr(win, str);
+    
+    c_setchar(ST(c_arg), str);
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1042,15 +1044,15 @@ XS(XS_Curses_getnstr)
 #ifdef C_GETNSTR
     c_countargs("getnstr", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	n	= (int)SvIV(ST(c_arg+1));
-	char *	str	= (char *)sv_grow(ST(c_arg), n+1);
-	int	ret	= c_mret == ERR ? ERR : wgetnstr(win, str, n);
-	
-	c_setchar(ST(c_arg), str);
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int n   = (int)SvIV(ST(c_arg+1));
+    char *  str = (char *)sv_grow(ST(c_arg), n+1);
+    int ret = c_mret == ERR ? ERR : wgetnstr(win, str, n);
+    
+    c_setchar(ST(c_arg), str);
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1068,14 +1070,14 @@ XS(XS_Curses_getyx)
 #ifdef C_GETYX
     c_countargs("getyx", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	y	= 0;
-	int	x	= 0;
-	
-	if (c_mret == OK) { getyx(win, y, x); }
-	sv_setiv(ST(c_arg), (IV)y);;
-	sv_setiv(ST(c_arg+1), (IV)x);;
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int y   = 0;
+    int x   = 0;
+    
+    if (c_mret == OK) { getyx(win, y, x); }
+    sv_setiv(ST(c_arg), (IV)y);;
+    sv_setiv(ST(c_arg+1), (IV)x);;
     }
     XSRETURN(0);
 #else
@@ -1090,14 +1092,14 @@ XS(XS_Curses_getparyx)
 #ifdef C_GETPARYX
     c_countargs("getparyx", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	y	= 0;
-	int	x	= 0;
-	
-	if (c_mret == OK) { getparyx(win, y, x); }
-	sv_setiv(ST(c_arg), (IV)y);;
-	sv_setiv(ST(c_arg+1), (IV)x);;
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int y   = 0;
+    int x   = 0;
+    
+    if (c_mret == OK) { getparyx(win, y, x); }
+    sv_setiv(ST(c_arg), (IV)y);;
+    sv_setiv(ST(c_arg+1), (IV)x);;
     }
     XSRETURN(0);
 #else
@@ -1112,14 +1114,14 @@ XS(XS_Curses_getbegyx)
 #ifdef C_GETBEGYX
     c_countargs("getbegyx", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	y	= 0;
-	int	x	= 0;
-	
-	if (c_mret == OK) { getbegyx(win, y, x); }
-	sv_setiv(ST(c_arg), (IV)y);;
-	sv_setiv(ST(c_arg+1), (IV)x);;
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int y   = 0;
+    int x   = 0;
+    
+    if (c_mret == OK) { getbegyx(win, y, x); }
+    sv_setiv(ST(c_arg), (IV)y);;
+    sv_setiv(ST(c_arg+1), (IV)x);;
     }
     XSRETURN(0);
 #else
@@ -1134,14 +1136,14 @@ XS(XS_Curses_getmaxyx)
 #ifdef C_GETMAXYX
     c_countargs("getmaxyx", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	y	= 0;
-	int	x	= 0;
-	
-	if (c_mret == OK) { getmaxyx(win, y, x); }
-	sv_setiv(ST(c_arg), (IV)y);;
-	sv_setiv(ST(c_arg+1), (IV)x);;
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int y   = 0;
+    int x   = 0;
+    
+    if (c_mret == OK) { getmaxyx(win, y, x); }
+    sv_setiv(ST(c_arg), (IV)y);;
+    sv_setiv(ST(c_arg+1), (IV)x);;
     }
     XSRETURN(0);
 #else
@@ -1159,12 +1161,12 @@ XS(XS_Curses_inch)
 #ifdef C_INCH
     c_countargs("inch", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	chtype	ret	= c_mret == ERR ? ERR : winch(win);
-	
-	ST(0) = sv_newmortal();
-	c_chtype2sv(ST(0), ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ret = c_mret == ERR ? ERR : winch(win);
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -1182,14 +1184,14 @@ XS(XS_Curses_inchstr)
 #ifdef C_INCHSTR
     c_countargs("inchstr", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	chtype *str	= (chtype *)sv_grow(ST(c_arg), (250)*sizeof(chtype));
-	int	ret	= c_mret == ERR ? ERR : winchstr(win, str);
-	
-	c_setchtype(ST(c_arg), str);
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype *str = (chtype *)sv_grow(ST(c_arg), (250)*sizeof(chtype));
+    int ret = c_mret == ERR ? ERR : winchstr(win, str);
+    
+    c_setchtype(ST(c_arg), str);
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1204,15 +1206,15 @@ XS(XS_Curses_inchnstr)
 #ifdef C_INCHNSTR
     c_countargs("inchnstr", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	n	= (int)SvIV(ST(c_arg+1));
-	chtype *str	= (chtype *)sv_grow(ST(c_arg), (n+1)*sizeof(chtype));
-	int	ret	= c_mret == ERR ? ERR : winchnstr(win, str, n);
-	
-	c_setchtype(ST(c_arg), str);
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int n   = (int)SvIV(ST(c_arg+1));
+    chtype *str = (chtype *)sv_grow(ST(c_arg), (n+1)*sizeof(chtype));
+    int ret = c_mret == ERR ? ERR : winchnstr(win, str, n);
+    
+    c_setchtype(ST(c_arg), str);
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1230,10 +1232,10 @@ XS(XS_Curses_initscr)
 #ifdef C_INITSCR
     c_exactargs("initscr", items, 0);
     {
-	WINDOW *	ret	= initscr();
-	
-	ST(0) = sv_newmortal();
-	c_window2sv(ST(0), ret);
+    WINDOW *    ret = initscr();
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -1248,10 +1250,10 @@ XS(XS_Curses_endwin)
 #ifdef C_ENDWIN
     c_exactargs("endwin", items, 0);
     {
-	int	ret	= endwin();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = endwin();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1266,10 +1268,10 @@ XS(XS_Curses_isendwin)
 #ifdef C_ISENDWIN
     c_exactargs("isendwin", items, 0);
     {
-	int	ret	= isendwin();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = isendwin();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1284,18 +1286,18 @@ XS(XS_Curses_newterm)
 #ifdef C_NEWTERM
     c_exactargs("newterm", items, 3);
     {
-	char *	type	= ST(0) != &PL_sv_undef ? (char *)SvPV_nolen(ST(0)) : NULL;
+    char *  type    = ST(0) != &PL_sv_undef ? (char *)SvPV_nolen(ST(0)) : NULL;
 
     /* IoIFP() returns a FILE * with some Perl cores, and PerlIo with
        others.  We need FILE *.  PerlIO_findFILE() takes either a FILE * or
        PerlIo as input and returns a FILE *.
     */
-	FILE *	outfd	= PerlIO_findFILE(IoIFP(sv_2io(ST(1))));
-	FILE *	infd	= PerlIO_findFILE(IoIFP(sv_2io(ST(2))));
-	SCREEN *	ret	= newterm(type, outfd, infd);
-	
-	ST(0) = sv_newmortal();
-	c_screen2sv(ST(0), ret);
+    FILE *  outfd   = PerlIO_findFILE(IoIFP(sv_2io(ST(1))));
+    FILE *  infd    = PerlIO_findFILE(IoIFP(sv_2io(ST(2))));
+    SCREEN *    ret = newterm(type, outfd, infd);
+    
+    ST(0) = sv_newmortal();
+    c_screen2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -1310,11 +1312,11 @@ XS(XS_Curses_set_term)
 #ifdef C_SET_TERM
     c_exactargs("set_term", items, 1);
     {
-	SCREEN *new	= c_sv2screen(ST(0), 0);
-	SCREEN *	ret	= set_term(new);
-	
-	ST(0) = sv_newmortal();
-	c_screen2sv(ST(0), ret);
+    SCREEN *new = c_sv2screen(ST(0), 0);
+    SCREEN *    ret = set_term(new);
+    
+    ST(0) = sv_newmortal();
+    c_screen2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -1329,9 +1331,9 @@ XS(XS_Curses_delscreen)
 #ifdef C_DELSCREEN
     c_exactargs("delscreen", items, 1);
     {
-	SCREEN *sp	= c_sv2screen(ST(0), 0);
-	
-	delscreen(sp);
+    SCREEN *sp  = c_sv2screen(ST(0), 0);
+    
+    delscreen(sp);
     }
     XSRETURN(0);
 #else
@@ -1350,10 +1352,10 @@ XS(XS_Curses_cbreak)
 #ifdef C_CBREAK
     c_exactargs("cbreak", items, 0);
     {
-	int	ret	= cbreak();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = cbreak();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1369,7 +1371,7 @@ XS(XS_Curses_cbreak)
 #ifdef C_CBREAK
     c_exactargs("cbreak", items, 0);
     {
-	cbreak();
+    cbreak();
     }
     XSRETURN(0);
 #else
@@ -1386,10 +1388,10 @@ XS(XS_Curses_nocbreak)
 #ifdef C_NOCBREAK
     c_exactargs("nocbreak", items, 0);
     {
-	int	ret	= nocbreak();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = nocbreak();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1405,7 +1407,7 @@ XS(XS_Curses_nocbreak)
 #ifdef C_NOCBREAK
     c_exactargs("nocbreak", items, 0);
     {
-	nocbreak();
+    nocbreak();
     }
     XSRETURN(0);
 #else
@@ -1422,10 +1424,10 @@ XS(XS_Curses_echo)
 #ifdef C_ECHO
     c_exactargs("echo", items, 0);
     {
-	int	ret	= echo();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = echo();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1441,7 +1443,7 @@ XS(XS_Curses_echo)
 #ifdef C_ECHO
     c_exactargs("echo", items, 0);
     {
-	echo();
+    echo();
     }
     XSRETURN(0);
 #else
@@ -1458,10 +1460,10 @@ XS(XS_Curses_noecho)
 #ifdef C_NOECHO
     c_exactargs("noecho", items, 0);
     {
-	int	ret	= noecho();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = noecho();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1477,7 +1479,7 @@ XS(XS_Curses_noecho)
 #ifdef C_NOECHO
     c_exactargs("noecho", items, 0);
     {
-	noecho();
+    noecho();
     }
     XSRETURN(0);
 #else
@@ -1493,11 +1495,11 @@ XS(XS_Curses_halfdelay)
 #ifdef C_HALFDELAY
     c_exactargs("halfdelay", items, 1);
     {
-	int	tenths	= (int)SvIV(ST(0));
-	int	ret	= halfdelay(tenths);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int tenths  = (int)SvIV(ST(0));
+    int ret = halfdelay(tenths);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1512,13 +1514,13 @@ XS(XS_Curses_intrflush)
 #ifdef C_INTRFLUSH
     c_countargs("intrflush", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	bool	bf	= (int)SvIV(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : intrflush(win, bf);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : intrflush(win, bf);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1533,13 +1535,13 @@ XS(XS_Curses_keypad)
 #ifdef C_KEYPAD
     c_countargs("keypad", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	bool	bf	= (int)SvIV(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : keypad(win, bf);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : keypad(win, bf);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1554,13 +1556,13 @@ XS(XS_Curses_meta)
 #ifdef C_META
     c_countargs("meta", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	bool	bf	= (int)SvIV(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : meta(win, bf);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : meta(win, bf);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1575,13 +1577,13 @@ XS(XS_Curses_nodelay)
 #ifdef C_NODELAY
     c_countargs("nodelay", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	bool	bf	= (int)SvIV(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : nodelay(win, bf);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : nodelay(win, bf);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1596,13 +1598,13 @@ XS(XS_Curses_notimeout)
 #ifdef C_NOTIMEOUT
     c_countargs("notimeout", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	bool	bf	= (int)SvIV(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : notimeout(win, bf);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : notimeout(win, bf);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1618,10 +1620,10 @@ XS(XS_Curses_raw)
 #ifdef C_RAW
     c_exactargs("raw", items, 0);
     {
-	int	ret	= raw();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = raw();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1637,7 +1639,7 @@ XS(XS_Curses_raw)
 #ifdef C_RAW
     c_exactargs("raw", items, 0);
     {
-	raw();
+    raw();
     }
     XSRETURN(0);
 #else
@@ -1654,10 +1656,10 @@ XS(XS_Curses_noraw)
 #ifdef C_NORAW
     c_exactargs("noraw", items, 0);
     {
-	int	ret	= noraw();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = noraw();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1673,7 +1675,7 @@ XS(XS_Curses_noraw)
 #ifdef C_NORAW
     c_exactargs("noraw", items, 0);
     {
-	noraw();
+    noraw();
     }
     XSRETURN(0);
 #else
@@ -1689,7 +1691,7 @@ XS(XS_Curses_qiflush)
 #ifdef C_QIFLUSH
     c_exactargs("qiflush", items, 0);
     {
-	qiflush();
+    qiflush();
     }
     XSRETURN(0);
 #else
@@ -1704,7 +1706,7 @@ XS(XS_Curses_noqiflush)
 #ifdef C_NOQIFLUSH
     c_exactargs("noqiflush", items, 0);
     {
-	noqiflush();
+    noqiflush();
     }
     XSRETURN(0);
 #else
@@ -1719,11 +1721,11 @@ XS(XS_Curses_timeout)
 #ifdef C_TIMEOUT
     c_countargs("timeout", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	delay	= (int)SvIV(ST(c_arg));
-	
-	if (c_mret == OK) { wtimeout(win, delay); }
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int delay   = (int)SvIV(ST(c_arg));
+    
+    if (c_mret == OK) { wtimeout(win, delay); }
     }
     XSRETURN(0);
 #else
@@ -1738,11 +1740,11 @@ XS(XS_Curses_typeahead)
 #ifdef C_TYPEAHEAD
     c_exactargs("typeahead", items, 1);
     {
-	int	fd	= (int)SvIV(ST(0));
-	int	ret	= typeahead(fd);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int fd  = (int)SvIV(ST(0));
+    int ret = typeahead(fd);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1760,13 +1762,13 @@ XS(XS_Curses_insch)
 #ifdef C_INSCH
     c_countargs("insch", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	chtype	ch	= c_sv2chtype(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : winsch(win, ch);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    chtype  ch  = c_sv2chtype(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : winsch(win, ch);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1784,13 +1786,13 @@ XS(XS_Curses_insstr)
 #ifdef C_INSSTR
     c_countargs("insstr", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	char *	str	= (char *)SvPV_nolen(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : winsstr(win, str);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    char *  str = (char *)SvPV_nolen(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : winsstr(win, str);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1805,14 +1807,14 @@ XS(XS_Curses_insnstr)
 #ifdef C_INSNSTR
     c_countargs("insnstr", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	char *	str	= (char *)SvPV_nolen(ST(c_arg));
-	int	n	= (int)SvIV(ST(c_arg+1));
-	int	ret	= c_mret == ERR ? ERR : winsnstr(win, str, n);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    char *  str = (char *)SvPV_nolen(ST(c_arg));
+    int n   = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : winsnstr(win, str, n);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1830,14 +1832,14 @@ XS(XS_Curses_instr)
 #ifdef C_INSTR
     c_countargs("instr", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	char *	str	= (char *)sv_grow(ST(c_arg), 250);
-	int	ret	= c_mret == ERR ? ERR : winstr(win, str);
-	
-	c_setchar(ST(c_arg), str);
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    char *  str = (char *)sv_grow(ST(c_arg), 250);
+    int ret = c_mret == ERR ? ERR : winstr(win, str);
+    
+    c_setchar(ST(c_arg), str);
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1852,15 +1854,15 @@ XS(XS_Curses_innstr)
 #ifdef C_INNSTR
     c_countargs("innstr", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	n	= (int)SvIV(ST(c_arg+1));
-	char *	str	= (char *)sv_grow(ST(c_arg), n+1);
-	int	ret	= c_mret == ERR ? ERR : winnstr(win, str, n);
-	
-	c_setchar(ST(c_arg), str);
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int n   = (int)SvIV(ST(c_arg+1));
+    char *  str = (char *)sv_grow(ST(c_arg), n+1);
+    int ret = c_mret == ERR ? ERR : winnstr(win, str, n);
+    
+    c_setchar(ST(c_arg), str);
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1878,10 +1880,10 @@ XS(XS_Curses_def_prog_mode)
 #ifdef C_DEF_PROG_MODE
     c_exactargs("def_prog_mode", items, 0);
     {
-	int	ret	= def_prog_mode();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = def_prog_mode();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1896,10 +1898,10 @@ XS(XS_Curses_def_shell_mode)
 #ifdef C_DEF_SHELL_MODE
     c_exactargs("def_shell_mode", items, 0);
     {
-	int	ret	= def_shell_mode();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = def_shell_mode();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1914,10 +1916,10 @@ XS(XS_Curses_reset_prog_mode)
 #ifdef C_RESET_PROG_MODE
     c_exactargs("reset_prog_mode", items, 0);
     {
-	int	ret	= reset_prog_mode();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = reset_prog_mode();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1932,10 +1934,10 @@ XS(XS_Curses_reset_shell_mode)
 #ifdef C_RESET_SHELL_MODE
     c_exactargs("reset_shell_mode", items, 0);
     {
-	int	ret	= reset_shell_mode();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = reset_shell_mode();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1950,10 +1952,10 @@ XS(XS_Curses_resetty)
 #ifdef C_RESETTY
     c_exactargs("resetty", items, 0);
     {
-	int	ret	= resetty();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = resetty();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1968,10 +1970,10 @@ XS(XS_Curses_savetty)
 #ifdef C_SAVETTY
     c_exactargs("savetty", items, 0);
     {
-	int	ret	= savetty();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = savetty();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -1987,14 +1989,14 @@ XS(XS_Curses_getsyx)
 #ifdef C_GETSYX
     c_exactargs("getsyx", items, 2);
     {
-	int	y	= 0;
-	int	x	= 0;
-	int	ret	= getsyx(y, x);
-	
-	sv_setiv(ST(0), (IV)y);;
-	sv_setiv(ST(1), (IV)x);;
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int y   = 0;
+    int x   = 0;
+    int ret = getsyx(y, x);
+    
+    sv_setiv(ST(0), (IV)y);;
+    sv_setiv(ST(1), (IV)x);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2010,12 +2012,12 @@ XS(XS_Curses_getsyx)
 #ifdef C_GETSYX
     c_exactargs("getsyx", items, 2);
     {
-	int	y	= 0;
-	int	x	= 0;
-	
-	getsyx(y, x);
-	sv_setiv(ST(0), (IV)y);;
-	sv_setiv(ST(1), (IV)x);;
+    int y   = 0;
+    int x   = 0;
+    
+    getsyx(y, x);
+    sv_setiv(ST(0), (IV)y);;
+    sv_setiv(ST(1), (IV)x);;
     }
     XSRETURN(0);
 #else
@@ -2032,12 +2034,12 @@ XS(XS_Curses_setsyx)
 #ifdef C_SETSYX
     c_exactargs("setsyx", items, 2);
     {
-	int	y	= (int)SvIV(ST(0));
-	int	x	= (int)SvIV(ST(1));
-	int	ret	= setsyx(y, x);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int y   = (int)SvIV(ST(0));
+    int x   = (int)SvIV(ST(1));
+    int ret = setsyx(y, x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2053,10 +2055,10 @@ XS(XS_Curses_setsyx)
 #ifdef C_SETSYX
     c_exactargs("setsyx", items, 2);
     {
-	int	y	= (int)SvIV(ST(0));
-	int	x	= (int)SvIV(ST(1));
-	
-	setsyx(y, x);
+    int y   = (int)SvIV(ST(0));
+    int x   = (int)SvIV(ST(1));
+    
+    setsyx(y, x);
     }
     XSRETURN(0);
 #else
@@ -2072,11 +2074,11 @@ XS(XS_Curses_curs_set)
 #ifdef C_CURS_SET
     c_exactargs("curs_set", items, 1);
     {
-	int	visibility	= (int)SvIV(ST(0));
-	int	ret	= curs_set(visibility);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int visibility  = (int)SvIV(ST(0));
+    int ret = curs_set(visibility);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2091,11 +2093,11 @@ XS(XS_Curses_napms)
 #ifdef C_NAPMS
     c_exactargs("napms", items, 1);
     {
-	int	ms	= (int)SvIV(ST(0));
-	int	ret	= napms(ms);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ms  = (int)SvIV(ST(0));
+    int ret = napms(ms);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2113,14 +2115,14 @@ XS(XS_Curses_move)
 #ifdef C_MOVE
     c_countargs("move", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	y	= (int)SvIV(ST(c_arg));
-	int	x	= (int)SvIV(ST(c_arg+1));
-	int	ret	= c_mret == ERR ? ERR : wmove(win, y, x);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int y   = (int)SvIV(ST(c_arg));
+    int x   = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : wmove(win, y, x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2138,13 +2140,13 @@ XS(XS_Curses_clearok)
 #ifdef C_CLEAROK
     c_countargs("clearok", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	bool	bf	= (int)SvIV(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : clearok(win, bf);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : clearok(win, bf);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2160,13 +2162,13 @@ XS(XS_Curses_idlok)
 #ifdef C_IDLOK
     c_countargs("idlok", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	bool	bf	= (int)SvIV(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : idlok(win, bf);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : idlok(win, bf);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2182,11 +2184,11 @@ XS(XS_Curses_idlok)
 #ifdef C_IDLOK
     c_countargs("idlok", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	bool	bf	= (int)SvIV(ST(c_arg));
-	
-	if (c_mret == OK) { idlok(win, bf); }
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    
+    if (c_mret == OK) { idlok(win, bf); }
     }
     XSRETURN(0);
 #else
@@ -2202,11 +2204,11 @@ XS(XS_Curses_idcok)
 #ifdef C_IDCOK
     c_countargs("idcok", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	bool	bf	= (int)SvIV(ST(c_arg));
-	
-	if (c_mret == OK) { idcok(win, bf); }
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    
+    if (c_mret == OK) { idcok(win, bf); }
     }
     XSRETURN(0);
 #else
@@ -2221,11 +2223,11 @@ XS(XS_Curses_immedok)
 #ifdef C_IMMEDOK
     c_countargs("immedok", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	bool	bf	= (int)SvIV(ST(c_arg));
-	
-	if (c_mret == OK) { immedok(win, bf); }
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    
+    if (c_mret == OK) { immedok(win, bf); }
     }
     XSRETURN(0);
 #else
@@ -2240,13 +2242,13 @@ XS(XS_Curses_leaveok)
 #ifdef C_LEAVEOK
     c_countargs("leaveok", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	bool	bf	= (int)SvIV(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : leaveok(win, bf);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : leaveok(win, bf);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2261,14 +2263,14 @@ XS(XS_Curses_setscrreg)
 #ifdef C_SETSCRREG
     c_countargs("setscrreg", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	top	= (int)SvIV(ST(c_arg));
-	int	bot	= (int)SvIV(ST(c_arg+1));
-	int	ret	= c_mret == ERR ? ERR : wsetscrreg(win, top, bot);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int top = (int)SvIV(ST(c_arg));
+    int bot = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : wsetscrreg(win, top, bot);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2283,13 +2285,13 @@ XS(XS_Curses_scrollok)
 #ifdef C_SCROLLOK
     c_countargs("scrollok", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	bool	bf	= (int)SvIV(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : scrollok(win, bf);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : scrollok(win, bf);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2305,10 +2307,10 @@ XS(XS_Curses_nl)
 #ifdef C_NL
     c_exactargs("nl", items, 0);
     {
-	int	ret	= nl();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = nl();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2324,7 +2326,7 @@ XS(XS_Curses_nl)
 #ifdef C_NL
     c_exactargs("nl", items, 0);
     {
-	nl();
+    nl();
     }
     XSRETURN(0);
 #else
@@ -2341,10 +2343,10 @@ XS(XS_Curses_nonl)
 #ifdef C_NONL
     c_exactargs("nonl", items, 0);
     {
-	int	ret	= nonl();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = nonl();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2360,7 +2362,7 @@ XS(XS_Curses_nonl)
 #ifdef C_NONL
     c_exactargs("nonl", items, 0);
     {
-	nonl();
+    nonl();
     }
     XSRETURN(0);
 #else
@@ -2379,12 +2381,12 @@ XS(XS_Curses_overlay)
 #ifdef C_OVERLAY
     c_exactargs("overlay", items, 2);
     {
-	WINDOW *srcwin	= c_sv2window(ST(0), 0);
-	WINDOW *dstwin	= c_sv2window(ST(1), 1);
-	int	ret	= overlay(srcwin, dstwin);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *srcwin  = c_sv2window(ST(0), 0);
+    WINDOW *dstwin  = c_sv2window(ST(1), 1);
+    int ret = overlay(srcwin, dstwin);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2399,12 +2401,12 @@ XS(XS_Curses_overwrite)
 #ifdef C_OVERWRITE
     c_exactargs("overwrite", items, 2);
     {
-	WINDOW *srcwin	= c_sv2window(ST(0), 0);
-	WINDOW *dstwin	= c_sv2window(ST(1), 1);
-	int	ret	= overwrite(srcwin, dstwin);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *srcwin  = c_sv2window(ST(0), 0);
+    WINDOW *dstwin  = c_sv2window(ST(1), 1);
+    int ret = overwrite(srcwin, dstwin);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2419,19 +2421,19 @@ XS(XS_Curses_copywin)
 #ifdef C_COPYWIN
     c_exactargs("copywin", items, 9);
     {
-	WINDOW *srcwin	= c_sv2window(ST(0), 0);
-	WINDOW *dstwin	= c_sv2window(ST(1), 1);
-	int	sminrow	= (int)SvIV(ST(2));
-	int	smincol	= (int)SvIV(ST(3));
-	int	dminrow	= (int)SvIV(ST(4));
-	int	dmincol	= (int)SvIV(ST(5));
-	int	dmaxrow	= (int)SvIV(ST(6));
-	int	dmaxcol	= (int)SvIV(ST(7));
-	int	overlay	= (int)SvIV(ST(8));
-	int	ret	= copywin(srcwin, dstwin, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, overlay);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *srcwin  = c_sv2window(ST(0), 0);
+    WINDOW *dstwin  = c_sv2window(ST(1), 1);
+    int sminrow = (int)SvIV(ST(2));
+    int smincol = (int)SvIV(ST(3));
+    int dminrow = (int)SvIV(ST(4));
+    int dmincol = (int)SvIV(ST(5));
+    int dmaxrow = (int)SvIV(ST(6));
+    int dmaxcol = (int)SvIV(ST(7));
+    int overlay = (int)SvIV(ST(8));
+    int ret = copywin(srcwin, dstwin, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, overlay);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2449,12 +2451,12 @@ XS(XS_Curses_newpad)
 #ifdef C_NEWPAD
     c_exactargs("newpad", items, 2);
     {
-	int	lines_	= (int)SvIV(ST(0));
-	int	cols	= (int)SvIV(ST(1));
-	WINDOW *	ret	= newpad(lines_, cols);
-	
-	ST(0) = sv_newmortal();
-	c_window2sv(ST(0), ret);
+    int lines_  = (int)SvIV(ST(0));
+    int cols    = (int)SvIV(ST(1));
+    WINDOW *    ret = newpad(lines_, cols);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -2469,15 +2471,15 @@ XS(XS_Curses_subpad)
 #ifdef C_SUBPAD
     c_exactargs("subpad", items, 5);
     {
-	WINDOW *orig	= c_sv2window(ST(0), 0);
-	int	lines_	= (int)SvIV(ST(1));
-	int	cols	= (int)SvIV(ST(2));
-	int	beginy	= (int)SvIV(ST(3));
-	int	beginx	= (int)SvIV(ST(4));
-	WINDOW *	ret	= subpad(orig, lines_, cols, beginy, beginx);
-	
-	ST(0) = sv_newmortal();
-	c_window2sv(ST(0), ret);
+    WINDOW *orig    = c_sv2window(ST(0), 0);
+    int lines_  = (int)SvIV(ST(1));
+    int cols    = (int)SvIV(ST(2));
+    int beginy  = (int)SvIV(ST(3));
+    int beginx  = (int)SvIV(ST(4));
+    WINDOW *    ret = subpad(orig, lines_, cols, beginy, beginx);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -2492,17 +2494,17 @@ XS(XS_Curses_prefresh)
 #ifdef C_PREFRESH
     c_exactargs("prefresh", items, 7);
     {
-	WINDOW *pad	= c_sv2window(ST(0), 0);
-	int	pminrow	= (int)SvIV(ST(1));
-	int	pmincol	= (int)SvIV(ST(2));
-	int	sminrow	= (int)SvIV(ST(3));
-	int	smincol	= (int)SvIV(ST(4));
-	int	smaxrow	= (int)SvIV(ST(5));
-	int	smaxcol	= (int)SvIV(ST(6));
-	int	ret	= prefresh(pad, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *pad = c_sv2window(ST(0), 0);
+    int pminrow = (int)SvIV(ST(1));
+    int pmincol = (int)SvIV(ST(2));
+    int sminrow = (int)SvIV(ST(3));
+    int smincol = (int)SvIV(ST(4));
+    int smaxrow = (int)SvIV(ST(5));
+    int smaxcol = (int)SvIV(ST(6));
+    int ret = prefresh(pad, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2517,17 +2519,17 @@ XS(XS_Curses_pnoutrefresh)
 #ifdef C_PNOUTREFRESH
     c_exactargs("pnoutrefresh", items, 7);
     {
-	WINDOW *pad	= c_sv2window(ST(0), 0);
-	int	pminrow	= (int)SvIV(ST(1));
-	int	pmincol	= (int)SvIV(ST(2));
-	int	sminrow	= (int)SvIV(ST(3));
-	int	smincol	= (int)SvIV(ST(4));
-	int	smaxrow	= (int)SvIV(ST(5));
-	int	smaxcol	= (int)SvIV(ST(6));
-	int	ret	= pnoutrefresh(pad, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *pad = c_sv2window(ST(0), 0);
+    int pminrow = (int)SvIV(ST(1));
+    int pmincol = (int)SvIV(ST(2));
+    int sminrow = (int)SvIV(ST(3));
+    int smincol = (int)SvIV(ST(4));
+    int smaxrow = (int)SvIV(ST(5));
+    int smaxcol = (int)SvIV(ST(6));
+    int ret = pnoutrefresh(pad, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2542,12 +2544,12 @@ XS(XS_Curses_pechochar)
 #ifdef C_PECHOCHAR
     c_exactargs("pechochar", items, 2);
     {
-	WINDOW *pad	= c_sv2window(ST(0), 0);
-	chtype	ch	= c_sv2chtype(ST(1));
-	int	ret	= pechochar(pad, ch);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *pad = c_sv2window(ST(0), 0);
+    chtype  ch  = c_sv2chtype(ST(1));
+    int ret = pechochar(pad, ch);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2569,12 +2571,12 @@ XS(XS_Curses_refresh)
 #ifdef C_REFRESH
     c_countargs("refresh", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	ret	= c_mret == ERR ? ERR : wrefresh(win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : wrefresh(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2589,12 +2591,12 @@ XS(XS_Curses_noutrefresh)
 #ifdef C_NOUTREFRESH
     c_countargs("noutrefresh", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	ret	= c_mret == ERR ? ERR : wnoutrefresh(win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : wnoutrefresh(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2609,10 +2611,10 @@ XS(XS_Curses_doupdate)
 #ifdef C_DOUPDATE
     c_exactargs("doupdate", items, 0);
     {
-	int	ret	= doupdate();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = doupdate();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2627,12 +2629,12 @@ XS(XS_Curses_redrawwin)
 #ifdef C_REDRAWWIN
     c_countargs("redrawwin", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	ret	= c_mret == ERR ? ERR : redrawwin(win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : redrawwin(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2647,14 +2649,14 @@ XS(XS_Curses_redrawln)
 #ifdef C_REDRAWLN
     c_countargs("redrawln", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	beg_line	= (int)SvIV(ST(c_arg));
-	int	num_lines	= (int)SvIV(ST(c_arg+1));
-	int	ret	= c_mret == ERR ? ERR : wredrawln(win, beg_line, num_lines);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int beg_line    = (int)SvIV(ST(c_arg));
+    int num_lines   = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : wredrawln(win, beg_line, num_lines);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2676,11 +2678,11 @@ XS(XS_Curses_scr_dump)
 #ifdef C_SCR_DUMP
     c_exactargs("scr_dump", items, 1);
     {
-	char *	filename	= (char *)SvPV_nolen(ST(0));
-	int	ret	= scr_dump(filename);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    char *  filename    = (char *)SvPV_nolen(ST(0));
+    int ret = scr_dump(filename);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2695,11 +2697,11 @@ XS(XS_Curses_scr_restore)
 #ifdef C_SCR_RESTORE
     c_exactargs("scr_restore", items, 1);
     {
-	char *	filename	= (char *)SvPV_nolen(ST(0));
-	int	ret	= scr_restore(filename);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    char *  filename    = (char *)SvPV_nolen(ST(0));
+    int ret = scr_restore(filename);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2714,11 +2716,11 @@ XS(XS_Curses_scr_init)
 #ifdef C_SCR_INIT
     c_exactargs("scr_init", items, 1);
     {
-	char *	filename	= (char *)SvPV_nolen(ST(0));
-	int	ret	= scr_init(filename);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    char *  filename    = (char *)SvPV_nolen(ST(0));
+    int ret = scr_init(filename);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2733,11 +2735,11 @@ XS(XS_Curses_scr_set)
 #ifdef C_SCR_SET
     c_exactargs("scr_set", items, 1);
     {
-	char *	filename	= (char *)SvPV_nolen(ST(0));
-	int	ret	= scr_set(filename);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    char *  filename    = (char *)SvPV_nolen(ST(0));
+    int ret = scr_set(filename);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2755,12 +2757,12 @@ XS(XS_Curses_scroll)
 #ifdef C_SCROLL
     c_countargs("scroll", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	ret	= c_mret == ERR ? ERR : scroll(win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : scroll(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2775,13 +2777,13 @@ XS(XS_Curses_scrl)
 #ifdef C_SCRL
     c_countargs("scrl", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	n	= (int)SvIV(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : wscrl(win, n);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int n   = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : wscrl(win, n);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2799,11 +2801,11 @@ XS(XS_Curses_slk_init)
 #ifdef C_SLK_INIT
     c_exactargs("slk_init", items, 1);
     {
-	int	fmt	= (int)SvIV(ST(0));
-	int	ret	= slk_init(fmt);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int fmt = (int)SvIV(ST(0));
+    int ret = slk_init(fmt);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2818,13 +2820,13 @@ XS(XS_Curses_slk_set)
 #ifdef C_SLK_SET
     c_exactargs("slk_set", items, 3);
     {
-	int	labnum	= (int)SvIV(ST(0));
-	char *	label	= (char *)SvPV_nolen(ST(1));
-	int	fmt	= (int)SvIV(ST(2));
-	int	ret	= slk_set(labnum, label, fmt);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int labnum  = (int)SvIV(ST(0));
+    char *  label   = (char *)SvPV_nolen(ST(1));
+    int fmt = (int)SvIV(ST(2));
+    int ret = slk_set(labnum, label, fmt);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2839,10 +2841,10 @@ XS(XS_Curses_slk_refresh)
 #ifdef C_SLK_REFRESH
     c_exactargs("slk_refresh", items, 0);
     {
-	int	ret	= slk_refresh();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = slk_refresh();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2857,10 +2859,10 @@ XS(XS_Curses_slk_noutrefresh)
 #ifdef C_SLK_NOUTREFRESH
     c_exactargs("slk_noutrefresh", items, 0);
     {
-	int	ret	= slk_noutrefresh();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = slk_noutrefresh();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2875,11 +2877,11 @@ XS(XS_Curses_slk_label)
 #ifdef C_SLK_LABEL
     c_exactargs("slk_label", items, 1);
     {
-	int	labnum	= (int)SvIV(ST(0));
-	char *	ret	= slk_label(labnum);
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), ret);
+    int labnum  = (int)SvIV(ST(0));
+    char *  ret = slk_label(labnum);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -2894,10 +2896,10 @@ XS(XS_Curses_slk_clear)
 #ifdef C_SLK_CLEAR
     c_exactargs("slk_clear", items, 0);
     {
-	int	ret	= slk_clear();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = slk_clear();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2912,10 +2914,10 @@ XS(XS_Curses_slk_restore)
 #ifdef C_SLK_RESTORE
     c_exactargs("slk_restore", items, 0);
     {
-	int	ret	= slk_restore();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = slk_restore();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2930,10 +2932,10 @@ XS(XS_Curses_slk_touch)
 #ifdef C_SLK_TOUCH
     c_exactargs("slk_touch", items, 0);
     {
-	int	ret	= slk_touch();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = slk_touch();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2948,11 +2950,11 @@ XS(XS_Curses_slk_attron)
 #ifdef C_SLK_ATTRON
     c_exactargs("slk_attron", items, 1);
     {
-	chtype	attrs	= c_sv2chtype(ST(0));
-	int	ret	= slk_attron(attrs);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    chtype  attrs   = c_sv2chtype(ST(0));
+    int ret = slk_attron(attrs);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2967,11 +2969,11 @@ XS(XS_Curses_slk_attrset)
 #ifdef C_SLK_ATTRSET
     c_exactargs("slk_attrset", items, 1);
     {
-	chtype	attrs	= c_sv2chtype(ST(0));
-	int	ret	= slk_attrset(attrs);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    chtype  attrs   = c_sv2chtype(ST(0));
+    int ret = slk_attrset(attrs);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -2986,10 +2988,10 @@ XS(XS_Curses_slk_attr)
 #ifdef C_SLK_ATTR
     c_exactargs("slk_attr", items, 0);
     {
-	attr_t	ret	= slk_attr();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    attr_t  ret = slk_attr();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3004,11 +3006,11 @@ XS(XS_Curses_slk_attroff)
 #ifdef C_SLK_ATTROFF
     c_exactargs("slk_attroff", items, 1);
     {
-	chtype	attrs	= c_sv2chtype(ST(0));
-	int	ret	= slk_attroff(attrs);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    chtype  attrs   = c_sv2chtype(ST(0));
+    int ret = slk_attroff(attrs);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3023,11 +3025,11 @@ XS(XS_Curses_slk_color)
 #ifdef C_SLK_COLOR
     c_exactargs("slk_color", items, 1);
     {
-	short	color_pair_number	= (short)SvIV(ST(0));
-	int	ret	= slk_color(color_pair_number);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    short   color_pair_number   = (short)SvIV(ST(0));
+    int ret = slk_color(color_pair_number);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3045,10 +3047,10 @@ XS(XS_Curses_baudrate)
 #ifdef C_BAUDRATE
     c_exactargs("baudrate", items, 0);
     {
-	int	ret	= baudrate();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = baudrate();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3063,10 +3065,10 @@ XS(XS_Curses_erasechar)
 #ifdef C_ERASECHAR
     c_exactargs("erasechar", items, 0);
     {
-	char	ret	= erasechar();
-	
-	ST(0) = sv_newmortal();
-	sv_setpvn(ST(0), (char *)&ret, 1);
+    char    ret = erasechar();
+    
+    ST(0) = sv_newmortal();
+    sv_setpvn(ST(0), (char *)&ret, 1);
     }
     XSRETURN(1);
 #else
@@ -3081,10 +3083,10 @@ XS(XS_Curses_has_ic)
 #ifdef C_HAS_IC
     c_exactargs("has_ic", items, 0);
     {
-	int	ret	= has_ic();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = has_ic();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3099,10 +3101,10 @@ XS(XS_Curses_has_il)
 #ifdef C_HAS_IL
     c_exactargs("has_il", items, 0);
     {
-	int	ret	= has_il();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = has_il();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3117,10 +3119,10 @@ XS(XS_Curses_killchar)
 #ifdef C_KILLCHAR
     c_exactargs("killchar", items, 0);
     {
-	char	ret	= killchar();
-	
-	ST(0) = sv_newmortal();
-	sv_setpvn(ST(0), (char *)&ret, 1);
+    char    ret = killchar();
+    
+    ST(0) = sv_newmortal();
+    sv_setpvn(ST(0), (char *)&ret, 1);
     }
     XSRETURN(1);
 #else
@@ -3136,10 +3138,10 @@ XS(XS_Curses_longname)
 #ifdef C_LONGNAME
     c_exactargs("longname", items, 0);
     {
-	char *	ret	= longname();
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), ret);
+    char *  ret = longname();
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -3155,12 +3157,12 @@ XS(XS_Curses_longname)
 #ifdef C_LONGNAME
     c_exactargs("longname", items, 2);
     {
-	char *	a	= (char *)SvPV_nolen(ST(0));
-	char *	b	= (char *)SvPV_nolen(ST(1));
-	char *	ret	= longname(a, b);
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), ret);
+    char *  a   = (char *)SvPV_nolen(ST(0));
+    char *  b   = (char *)SvPV_nolen(ST(1));
+    char *  ret = longname(a, b);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -3177,10 +3179,10 @@ XS(XS_Curses_termattrs)
 #ifdef C_TERMATTRS
     c_exactargs("termattrs", items, 0);
     {
-	chtype	ret	= termattrs();
-	
-	ST(0) = sv_newmortal();
-	c_chtype2sv(ST(0), ret);
+    chtype  ret = termattrs();
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -3195,10 +3197,10 @@ XS(XS_Curses_termname)
 #ifdef C_TERMNAME
     c_exactargs("termname", items, 0);
     {
-	char *	ret	= termname();
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), ret);
+    char *  ret = termname();
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -3216,12 +3218,12 @@ XS(XS_Curses_touchwin)
 #ifdef C_TOUCHWIN
     c_countargs("touchwin", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	ret	= c_mret == ERR ? ERR : touchwin(win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : touchwin(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3237,14 +3239,14 @@ XS(XS_Curses_touchline)
 #ifdef C_TOUCHLINE
     c_countargs("touchline", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	start	= (int)SvIV(ST(c_arg));
-	int	count	= (int)SvIV(ST(c_arg+1));
-	int	ret	= c_mret == ERR ? ERR : touchline(win, start, count);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int start   = (int)SvIV(ST(c_arg));
+    int count   = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : touchline(win, start, count);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3260,15 +3262,15 @@ XS(XS_Curses_touchline)
 #ifdef C_TOUCHLINE
     c_countargs("touchline", items, 3);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	y	= (int)SvIV(ST(c_arg));
-	int	sx	= (int)SvIV(ST(c_arg+1));
-	int	ex	= (int)SvIV(ST(c_arg+2));
-	int	ret	= c_mret == ERR ? ERR : touchline(win, y, sx, ex);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int y   = (int)SvIV(ST(c_arg));
+    int sx  = (int)SvIV(ST(c_arg+1));
+    int ex  = (int)SvIV(ST(c_arg+2));
+    int ret = c_mret == ERR ? ERR : touchline(win, y, sx, ex);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3285,12 +3287,12 @@ XS(XS_Curses_untouchwin)
 #ifdef C_UNTOUCHWIN
     c_countargs("untouchwin", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	ret	= c_mret == ERR ? ERR : untouchwin(win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : untouchwin(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3305,15 +3307,15 @@ XS(XS_Curses_touchln)
 #ifdef C_TOUCHLN
     c_countargs("touchln", items, 3);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	y	= (int)SvIV(ST(c_arg));
-	int	n	= (int)SvIV(ST(c_arg+1));
-	int	changed	= (int)SvIV(ST(c_arg+2));
-	int	ret	= c_mret == ERR ? ERR : wtouchln(win, y, n, changed);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int y   = (int)SvIV(ST(c_arg));
+    int n   = (int)SvIV(ST(c_arg+1));
+    int changed = (int)SvIV(ST(c_arg+2));
+    int ret = c_mret == ERR ? ERR : wtouchln(win, y, n, changed);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3328,13 +3330,13 @@ XS(XS_Curses_is_linetouched)
 #ifdef C_IS_LINETOUCHED
     c_countargs("is_linetouched", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	line	= (int)SvIV(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : is_linetouched(win, line);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int line    = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : is_linetouched(win, line);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3349,12 +3351,12 @@ XS(XS_Curses_is_wintouched)
 #ifdef C_IS_WINTOUCHED
     c_countargs("is_wintouched", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	ret	= c_mret == ERR ? ERR : is_wintouched(win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : is_wintouched(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3395,11 +3397,11 @@ XS(XS_Curses_keyname)
 #ifdef C_KEYNAME
     c_exactargs("keyname", items, 1);
     {
-	int	k	= (int)SvIV(ST(0));
-	char *	ret	= (char *)keyname(k);
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), ret);
+    int k   = (int)SvIV(ST(0));
+    char *  ret = (char *)keyname(k);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -3415,10 +3417,10 @@ XS(XS_Curses_filter)
 #ifdef C_FILTER
     c_exactargs("filter", items, 0);
     {
-	int	ret	= filter();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = filter();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3434,7 +3436,7 @@ XS(XS_Curses_filter)
 #ifdef C_FILTER
     c_exactargs("filter", items, 0);
     {
-	filter();
+    filter();
     }
     XSRETURN(0);
 #else
@@ -3450,9 +3452,9 @@ XS(XS_Curses_use_env)
 #ifdef C_USE_ENV
     c_exactargs("use_env", items, 1);
     {
-	bool	bf	= (int)SvIV(ST(0));
-	
-	use_env(bf);
+    bool    bf  = (int)SvIV(ST(0));
+    
+    use_env(bf);
     }
     XSRETURN(0);
 #else
@@ -3467,13 +3469,13 @@ XS(XS_Curses_putwin)
 #ifdef C_PUTWIN
     c_exactargs("putwin", items, 2);
     {
-	WINDOW *win	= c_sv2window(ST(0), 0);
+    WINDOW *win = c_sv2window(ST(0), 0);
     /* See explanation of PerlIO_findFILE in newterm() */
-	FILE *	filep	= PerlIO_findFILE(IoIFP(sv_2io(ST(1))));
-	int	ret	= putwin(win, filep);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FILE *  filep   = PerlIO_findFILE(IoIFP(sv_2io(ST(1))));
+    int ret = putwin(win, filep);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3489,11 +3491,11 @@ XS(XS_Curses_getwin)
     c_exactargs("getwin", items, 1);
     {
     /* See explanation of PerlIO_findFILE in newterm() */
-	FILE *	filep	= PerlIO_findFILE(IoIFP(sv_2io(ST(0))));
-	WINDOW *	ret	= getwin(filep);
-	
-	ST(0) = sv_newmortal();
-	c_window2sv(ST(0), ret);
+    FILE *  filep   = PerlIO_findFILE(IoIFP(sv_2io(ST(0))));
+    WINDOW *    ret = getwin(filep);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -3508,11 +3510,11 @@ XS(XS_Curses_delay_output)
 #ifdef C_DELAY_OUTPUT
     c_exactargs("delay_output", items, 1);
     {
-	int	ms	= (int)SvIV(ST(0));
-	int	ret	= delay_output(ms);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ms  = (int)SvIV(ST(0));
+    int ret = delay_output(ms);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3527,10 +3529,10 @@ XS(XS_Curses_flushinp)
 #ifdef C_FLUSHINP
     c_exactargs("flushinp", items, 0);
     {
-	int	ret	= flushinp();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = flushinp();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3548,14 +3550,14 @@ XS(XS_Curses_newwin)
 #ifdef C_NEWWIN
     c_exactargs("newwin", items, 4);
     {
-	int	nlines	= (int)SvIV(ST(0));
-	int	ncols	= (int)SvIV(ST(1));
-	int	beginy	= (int)SvIV(ST(2));
-	int	beginx	= (int)SvIV(ST(3));
-	WINDOW *	ret	= newwin(nlines, ncols, beginy, beginx);
-	
-	ST(0) = sv_newmortal();
-	c_window2sv(ST(0), ret);
+    int nlines  = (int)SvIV(ST(0));
+    int ncols   = (int)SvIV(ST(1));
+    int beginy  = (int)SvIV(ST(2));
+    int beginx  = (int)SvIV(ST(3));
+    WINDOW *    ret = newwin(nlines, ncols, beginy, beginx);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -3570,12 +3572,12 @@ XS(XS_Curses_delwin)
 #ifdef C_DELWIN
     c_countargs("delwin", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	ret	= c_mret == ERR ? ERR : delwin(win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : delwin(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3590,14 +3592,14 @@ XS(XS_Curses_mvwin)
 #ifdef C_MVWIN
     c_countargs("mvwin", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	y	= (int)SvIV(ST(c_arg));
-	int	x	= (int)SvIV(ST(c_arg+1));
-	int	ret	= c_mret == ERR ? ERR : mvwin(win, y, x);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int y   = (int)SvIV(ST(c_arg));
+    int x   = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : mvwin(win, y, x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3612,16 +3614,16 @@ XS(XS_Curses_subwin)
 #ifdef C_SUBWIN
     c_countargs("subwin", items, 4);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	nlines	= (int)SvIV(ST(c_arg));
-	int	ncols	= (int)SvIV(ST(c_arg+1));
-	int	beginy	= (int)SvIV(ST(c_arg+2));
-	int	beginx	= (int)SvIV(ST(c_arg+3));
-	WINDOW *	ret	= c_mret == ERR ? NULL : subwin(win, nlines, ncols, beginy, beginx);
-	
-	ST(0) = sv_newmortal();
-	c_window2sv(ST(0), ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int nlines  = (int)SvIV(ST(c_arg));
+    int ncols   = (int)SvIV(ST(c_arg+1));
+    int beginy  = (int)SvIV(ST(c_arg+2));
+    int beginx  = (int)SvIV(ST(c_arg+3));
+    WINDOW *    ret = c_mret == ERR ? NULL : subwin(win, nlines, ncols, beginy, beginx);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -3636,16 +3638,16 @@ XS(XS_Curses_derwin)
 #ifdef C_DERWIN
     c_countargs("derwin", items, 4);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	nlines	= (int)SvIV(ST(c_arg));
-	int	ncols	= (int)SvIV(ST(c_arg+1));
-	int	beginy	= (int)SvIV(ST(c_arg+2));
-	int	beginx	= (int)SvIV(ST(c_arg+3));
-	WINDOW *	ret	= c_mret == ERR ? NULL : derwin(win, nlines, ncols, beginy, beginx);
-	
-	ST(0) = sv_newmortal();
-	c_window2sv(ST(0), ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int nlines  = (int)SvIV(ST(c_arg));
+    int ncols   = (int)SvIV(ST(c_arg+1));
+    int beginy  = (int)SvIV(ST(c_arg+2));
+    int beginx  = (int)SvIV(ST(c_arg+3));
+    WINDOW *    ret = c_mret == ERR ? NULL : derwin(win, nlines, ncols, beginy, beginx);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -3660,14 +3662,14 @@ XS(XS_Curses_mvderwin)
 #ifdef C_MVDERWIN
     c_countargs("mvderwin", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	par_y	= (int)SvIV(ST(c_arg));
-	int	par_x	= (int)SvIV(ST(c_arg+1));
-	int	ret	= c_mret == ERR ? ERR : mvderwin(win, par_y, par_x);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int par_y   = (int)SvIV(ST(c_arg));
+    int par_x   = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : mvderwin(win, par_y, par_x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3682,12 +3684,12 @@ XS(XS_Curses_dupwin)
 #ifdef C_DUPWIN
     c_countargs("dupwin", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	WINDOW *	ret	= c_mret == ERR ? NULL : dupwin(win);
-	
-	ST(0) = sv_newmortal();
-	c_window2sv(ST(0), ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    WINDOW *    ret = c_mret == ERR ? NULL : dupwin(win);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -3702,10 +3704,10 @@ XS(XS_Curses_syncup)
 #ifdef C_SYNCUP
     c_countargs("syncup", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	
-	if (c_mret == OK) { wsyncup(win); }
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    
+    if (c_mret == OK) { wsyncup(win); }
     }
     XSRETURN(0);
 #else
@@ -3720,13 +3722,13 @@ XS(XS_Curses_syncok)
 #ifdef C_SYNCOK
     c_countargs("syncok", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	bool	bf	= (int)SvIV(ST(c_arg));
-	int	ret	= c_mret == ERR ? ERR : syncok(win, bf);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    int ret = c_mret == ERR ? ERR : syncok(win, bf);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3741,10 +3743,10 @@ XS(XS_Curses_cursyncup)
 #ifdef C_CURSYNCUP
     c_countargs("cursyncup", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	
-	if (c_mret == OK) { wcursyncup(win); }
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    
+    if (c_mret == OK) { wcursyncup(win); }
     }
     XSRETURN(0);
 #else
@@ -3759,10 +3761,10 @@ XS(XS_Curses_syncdown)
 #ifdef C_SYNCDOWN
     c_countargs("syncdown", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	
-	if (c_mret == OK) { wsyncdown(win); }
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    
+    if (c_mret == OK) { wsyncdown(win); }
     }
     XSRETURN(0);
 #else
@@ -3780,12 +3782,12 @@ XS(XS_Curses_getmouse)
 #ifdef C_GETMOUSE
     c_exactargs("getmouse", items, 1);
     {
-	MEVENT *event	= (MEVENT *)sv_grow(ST(0), 2 * sizeof(MEVENT));
-	int	ret	= getmouse(event);
-	
-	c_setmevent(ST(0), event);
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MEVENT *event   = (MEVENT *)sv_grow(ST(0), 2 * sizeof(MEVENT));
+    int ret = getmouse(event);
+    
+    c_setmevent(ST(0));
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3800,11 +3802,11 @@ XS(XS_Curses_ungetmouse)
 #ifdef C_UNGETMOUSE
     c_exactargs("ungetmouse", items, 1);
     {
-	MEVENT *event	= (MEVENT *)SvPV_nolen(ST(0));
-	int	ret	= ungetmouse(event);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MEVENT *event   = (MEVENT *)SvPV_nolen(ST(0));
+    int ret = ungetmouse(event);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3819,13 +3821,13 @@ XS(XS_Curses_mousemask)
 #ifdef C_MOUSEMASK
     c_exactargs("mousemask", items, 2);
     {
-	mmask_t	newmask	= (mmask_t)SvIV(ST(0));
-	mmask_t	oldmask	= 0;
-	mmask_t	ret	= mousemask(newmask, &oldmask);
-	
-	sv_setiv(ST(1), (IV)oldmask);;
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    mmask_t newmask = (mmask_t)SvIV(ST(0));
+    mmask_t oldmask = 0;
+    mmask_t ret = mousemask(newmask, &oldmask);
+    
+    sv_setiv(ST(1), (IV)oldmask);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3840,14 +3842,14 @@ XS(XS_Curses_enclose)
 #ifdef C_ENCLOSE
     c_countargs("enclose", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	y	= (int)SvIV(ST(c_arg));
-	int	x	= (int)SvIV(ST(c_arg+1));
-	bool	ret	= c_mret == ERR ? ERR : wenclose(win, y, x);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int y   = (int)SvIV(ST(c_arg));
+    int x   = (int)SvIV(ST(c_arg+1));
+    bool    ret = c_mret == ERR ? ERR : wenclose(win, y, x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3862,17 +3864,17 @@ XS(XS_Curses_mouse_trafo)
 #ifdef C_MOUSE_TRAFO
     c_countargs("mouse_trafo", items, 3);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	pY	= 0;
-	int	pX	= 0;
-	bool	to_screen	= (int)SvIV(ST(c_arg+2));
-	bool	ret	= c_mret == ERR ? ERR : wmouse_trafo(win, &pY, &pX, to_screen);
-	
-	sv_setiv(ST(c_arg), (IV)pY);;
-	sv_setiv(ST(c_arg+1), (IV)pX);;
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int pY  = 0;
+    int pX  = 0;
+    bool    to_screen   = (int)SvIV(ST(c_arg+2));
+    bool    ret = c_mret == ERR ? ERR : wmouse_trafo(win, &pY, &pX, to_screen);
+    
+    sv_setiv(ST(c_arg), (IV)pY);;
+    sv_setiv(ST(c_arg+1), (IV)pX);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3887,11 +3889,11 @@ XS(XS_Curses_mouseinterval)
 #ifdef C_MOUSEINTERVAL
     c_exactargs("mouseinterval", items, 1);
     {
-	int	erval	= (int)SvIV(ST(0));
-	int	ret	= mouseinterval(erval);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int erval   = (int)SvIV(ST(0));
+    int ret = mouseinterval(erval);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3906,12 +3908,12 @@ XS(XS_Curses_BUTTON_RELEASE)
 #ifdef C_BUTTON_RELEASE
     c_exactargs("BUTTON_RELEASE", items, 2);
     {
-	mmask_t	e	= (mmask_t)SvIV(ST(0));
-	int	x	= (int)SvIV(ST(1));
-	int	ret	= BUTTON_RELEASE(e, x);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    mmask_t e   = (mmask_t)SvIV(ST(0));
+    int x   = (int)SvIV(ST(1));
+    int ret = BUTTON_RELEASE(e, x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3926,12 +3928,12 @@ XS(XS_Curses_BUTTON_PRESS)
 #ifdef C_BUTTON_PRESS
     c_exactargs("BUTTON_PRESS", items, 2);
     {
-	mmask_t	e	= (mmask_t)SvIV(ST(0));
-	int	x	= (int)SvIV(ST(1));
-	int	ret	= BUTTON_PRESS(e, x);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    mmask_t e   = (mmask_t)SvIV(ST(0));
+    int x   = (int)SvIV(ST(1));
+    int ret = BUTTON_PRESS(e, x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3946,12 +3948,12 @@ XS(XS_Curses_BUTTON_CLICK)
 #ifdef C_BUTTON_CLICK
     c_exactargs("BUTTON_CLICK", items, 2);
     {
-	mmask_t	e	= (mmask_t)SvIV(ST(0));
-	int	x	= (int)SvIV(ST(1));
-	int	ret	= BUTTON_CLICK(e, x);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    mmask_t e   = (mmask_t)SvIV(ST(0));
+    int x   = (int)SvIV(ST(1));
+    int ret = BUTTON_CLICK(e, x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3966,12 +3968,12 @@ XS(XS_Curses_BUTTON_DOUBLE_CLICK)
 #ifdef C_BUTTON_DOUBLE_CLICK
     c_exactargs("BUTTON_DOUBLE_CLICK", items, 2);
     {
-	mmask_t	e	= (mmask_t)SvIV(ST(0));
-	int	x	= (int)SvIV(ST(1));
-	int	ret	= BUTTON_DOUBLE_CLICK(e, x);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    mmask_t e   = (mmask_t)SvIV(ST(0));
+    int x   = (int)SvIV(ST(1));
+    int ret = BUTTON_DOUBLE_CLICK(e, x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -3986,12 +3988,12 @@ XS(XS_Curses_BUTTON_TRIPLE_CLICK)
 #ifdef C_BUTTON_TRIPLE_CLICK
     c_exactargs("BUTTON_TRIPLE_CLICK", items, 2);
     {
-	mmask_t	e	= (mmask_t)SvIV(ST(0));
-	int	x	= (int)SvIV(ST(1));
-	int	ret	= BUTTON_TRIPLE_CLICK(e, x);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    mmask_t e   = (mmask_t)SvIV(ST(0));
+    int x   = (int)SvIV(ST(1));
+    int ret = BUTTON_TRIPLE_CLICK(e, x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4006,12 +4008,12 @@ XS(XS_Curses_BUTTON_RESERVED_EVENT)
 #ifdef C_BUTTON_RESERVED_EVENT
     c_exactargs("BUTTON_RESERVED_EVENT", items, 2);
     {
-	mmask_t	e	= (mmask_t)SvIV(ST(0));
-	int	x	= (int)SvIV(ST(1));
-	int	ret	= BUTTON_RESERVED_EVENT(e, x);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    mmask_t e   = (mmask_t)SvIV(ST(0));
+    int x   = (int)SvIV(ST(1));
+    int ret = BUTTON_RESERVED_EVENT(e, x);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4027,10 +4029,10 @@ XS(XS_Curses_use_default_colors)
 #ifdef C_USE_DEFAULT_COLORS
     c_exactargs("use_default_colors", items, 0);
     {
-	int	ret	= use_default_colors();
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int ret = use_default_colors();
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4045,12 +4047,12 @@ XS(XS_Curses_assume_default_colors)
 #ifdef C_ASSUME_DEFAULT_COLORS
     c_exactargs("assume_default_colors", items, 2);
     {
-	int	fg	= (int)SvIV(ST(0));
-	int	bg	= (int)SvIV(ST(1));
-	int	ret	= assume_default_colors(fg, bg);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int fg  = (int)SvIV(ST(0));
+    int bg  = (int)SvIV(ST(1));
+    int ret = assume_default_colors(fg, bg);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4065,12 +4067,12 @@ XS(XS_Curses_define_key)
 #ifdef C_DEFINE_KEY
     c_exactargs("define_key", items, 2);
     {
-	char *	definition	= (char *)SvPV_nolen(ST(0));
-	int	keycode	= (int)SvIV(ST(1));
-	int	ret	= define_key(definition, keycode);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    char *  definition  = (char *)SvPV_nolen(ST(0));
+    int keycode = (int)SvIV(ST(1));
+    int ret = define_key(definition, keycode);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4085,12 +4087,12 @@ XS(XS_Curses_keybound)
 #ifdef C_KEYBOUND
     c_exactargs("keybound", items, 2);
     {
-	int	keycode	= (int)SvIV(ST(0));
-	int	count	= (int)SvIV(ST(1));
-	char *	ret	= keybound(keycode, count);
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), ret);
+    int keycode = (int)SvIV(ST(0));
+    int count   = (int)SvIV(ST(1));
+    char *  ret = keybound(keycode, count);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -4105,12 +4107,12 @@ XS(XS_Curses_keyok)
 #ifdef C_KEYOK
     c_exactargs("keyok", items, 2);
     {
-	int	keycode	= (int)SvIV(ST(0));
-	bool	enable	= (int)SvIV(ST(1));
-	int	ret	= keyok(keycode, enable);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int keycode = (int)SvIV(ST(0));
+    bool    enable  = (int)SvIV(ST(1));
+    int ret = keyok(keycode, enable);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4125,12 +4127,12 @@ XS(XS_Curses_resizeterm)
 #ifdef C_RESIZETERM
     c_exactargs("resizeterm", items, 2);
     {
-	int	lines	= (int)SvIV(ST(0));
-	int	cols	= (int)SvIV(ST(1));
-	int	ret	= resizeterm(lines, cols);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    int lines   = (int)SvIV(ST(0));
+    int cols    = (int)SvIV(ST(1));
+    int ret = resizeterm(lines, cols);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4145,14 +4147,14 @@ XS(XS_Curses_resize)
 #ifdef C_RESIZE
     c_countargs("resize", items, 2);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	lines_	= (int)SvIV(ST(c_arg));
-	int	columns	= (int)SvIV(ST(c_arg+1));
-	int	ret	= c_mret == ERR ? ERR : wresize(win, lines_, columns);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int lines_  = (int)SvIV(ST(c_arg));
+    int columns = (int)SvIV(ST(c_arg+1));
+    int ret = c_mret == ERR ? ERR : wresize(win, lines_, columns);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4170,12 +4172,12 @@ XS(XS_Curses_getmaxy)
 #ifdef C_GETMAXY
     c_countargs("getmaxy", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	ret	= c_mret == ERR ? ERR : getmaxy(win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : getmaxy(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4190,12 +4192,12 @@ XS(XS_Curses_getmaxx)
 #ifdef C_GETMAXX
     c_countargs("getmaxx", items, 0);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	int	ret	= c_mret == ERR ? ERR : getmaxx(win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    int ret = c_mret == ERR ? ERR : getmaxx(win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4213,11 +4215,11 @@ XS(XS_Curses_flusok)
 #ifdef C_FLUSOK
     c_countargs("flusok", items, 1);
     {
-	WINDOW *win	= c_win ? c_sv2window(ST(0), 0) : stdscr;
-	int	c_mret	= c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
-	bool	bf	= (int)SvIV(ST(c_arg));
-	
-	if (c_mret == OK) { flusok(win, bf); }
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    int c_mret  = c_x ? c_domove(win, ST(c_x-1), ST(c_x)) : OK;
+    bool    bf  = (int)SvIV(ST(c_arg));
+    
+    if (c_mret == OK) { flusok(win, bf); }
     }
     XSRETURN(0);
 #else
@@ -4232,11 +4234,11 @@ XS(XS_Curses_getcap)
 #ifdef C_GETCAP
     c_exactargs("getcap", items, 1);
     {
-	char *	term	= (char *)SvPV_nolen(ST(0));
-	char *	ret	= (char *)getcap(term);
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), ret);
+    char *  term    = (char *)SvPV_nolen(ST(0));
+    char *  ret = (char *)getcap(term);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -4251,12 +4253,12 @@ XS(XS_Curses_touchoverlap)
 #ifdef C_TOUCHOVERLAP
     c_exactargs("touchoverlap", items, 2);
     {
-	WINDOW *src	= c_sv2window(ST(0), 0);
-	WINDOW *dst	= c_sv2window(ST(1), 1);
-	int	ret	= touchoverlap(src, dst);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    WINDOW *src = c_sv2window(ST(0), 0);
+    WINDOW *dst = c_sv2window(ST(1), 1);
+    int ret = touchoverlap(src, dst);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4274,11 +4276,11 @@ XS(XS_Curses_new_panel)
 #ifdef C_NEW_PANEL
     c_exactargs("new_panel", items, 1);
     {
-	WINDOW *win	= c_sv2window(ST(0), 0);
-	PANEL *	ret	= new_panel(win);
-	
-	ST(0) = sv_newmortal();
-	c_panel2sv(ST(0), ret);
+    WINDOW *win = c_sv2window(ST(0), 0);
+    PANEL * ret = new_panel(win);
+    
+    ST(0) = sv_newmortal();
+    c_panel2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -4293,11 +4295,11 @@ XS(XS_Curses_bottom_panel)
 #ifdef C_BOTTOM_PANEL
     c_exactargs("bottom_panel", items, 1);
     {
-	PANEL *	pan	= c_sv2panel(ST(0), 0);
-	int	ret	= bottom_panel(pan);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    int ret = bottom_panel(pan);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4312,11 +4314,11 @@ XS(XS_Curses_top_panel)
 #ifdef C_TOP_PANEL
     c_exactargs("top_panel", items, 1);
     {
-	PANEL *	pan	= c_sv2panel(ST(0), 0);
-	int	ret	= top_panel(pan);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    int ret = top_panel(pan);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4331,11 +4333,11 @@ XS(XS_Curses_show_panel)
 #ifdef C_SHOW_PANEL
     c_exactargs("show_panel", items, 1);
     {
-	PANEL *	pan	= c_sv2panel(ST(0), 0);
-	int	ret	= show_panel(pan);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    int ret = show_panel(pan);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4350,7 +4352,7 @@ XS(XS_Curses_update_panels)
 #ifdef C_UPDATE_PANELS
     c_exactargs("update_panels", items, 0);
     {
-	update_panels();
+    update_panels();
     }
     XSRETURN(0);
 #else
@@ -4365,11 +4367,11 @@ XS(XS_Curses_hide_panel)
 #ifdef C_HIDE_PANEL
     c_exactargs("hide_panel", items, 1);
     {
-	PANEL *	pan	= c_sv2panel(ST(0), 0);
-	int	ret	= hide_panel(pan);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    int ret = hide_panel(pan);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4384,11 +4386,11 @@ XS(XS_Curses_panel_window)
 #ifdef C_PANEL_WINDOW
     c_exactargs("panel_window", items, 1);
     {
-	PANEL *	pan	= c_sv2panel(ST(0), 0);
-	WINDOW *	ret	= panel_window(pan);
-	
-	ST(0) = sv_newmortal();
-	c_window2sv(ST(0), ret);
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    WINDOW *    ret = panel_window(pan);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -4403,12 +4405,12 @@ XS(XS_Curses_replace_panel)
 #ifdef C_REPLACE_PANEL
     c_exactargs("replace_panel", items, 2);
     {
-	PANEL *	pan	= c_sv2panel(ST(0), 0);
-	WINDOW *window	= c_sv2window(ST(1), 1);
-	int	ret	= replace_panel(pan, window);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    WINDOW *window  = c_sv2window(ST(1), 1);
+    int ret = replace_panel(pan, window);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4423,13 +4425,13 @@ XS(XS_Curses_move_panel)
 #ifdef C_MOVE_PANEL
     c_exactargs("move_panel", items, 3);
     {
-	PANEL *	pan	= c_sv2panel(ST(0), 0);
-	int	starty	= (int)SvIV(ST(1));
-	int	startx	= (int)SvIV(ST(2));
-	int	ret	= move_panel(pan, starty, startx);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    int starty  = (int)SvIV(ST(1));
+    int startx  = (int)SvIV(ST(2));
+    int ret = move_panel(pan, starty, startx);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4444,11 +4446,11 @@ XS(XS_Curses_panel_hidden)
 #ifdef C_PANEL_HIDDEN
     c_exactargs("panel_hidden", items, 1);
     {
-	PANEL *	pan	= c_sv2panel(ST(0), 0);
-	int	ret	= panel_hidden(pan);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    int ret = panel_hidden(pan);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4463,11 +4465,11 @@ XS(XS_Curses_panel_above)
 #ifdef C_PANEL_ABOVE
     c_exactargs("panel_above", items, 1);
     {
-	PANEL *	pan	= ST(0) != &PL_sv_undef ? c_sv2panel(ST(0), 0) : NULL;
-	PANEL *	ret	= panel_above(pan);
-	
-	ST(0) = sv_newmortal();
-	c_panel2sv(ST(0), ret);
+    PANEL * pan = ST(0) != &PL_sv_undef ? c_sv2panel(ST(0), 0) : NULL;
+    PANEL * ret = panel_above(pan);
+    
+    ST(0) = sv_newmortal();
+    c_panel2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -4482,11 +4484,11 @@ XS(XS_Curses_panel_below)
 #ifdef C_PANEL_BELOW
     c_exactargs("panel_below", items, 1);
     {
-	PANEL *	pan	= ST(0) != &PL_sv_undef ? c_sv2panel(ST(0), 0) : NULL;
-	PANEL *	ret	= panel_below(pan);
-	
-	ST(0) = sv_newmortal();
-	c_panel2sv(ST(0), ret);
+    PANEL * pan = ST(0) != &PL_sv_undef ? c_sv2panel(ST(0), 0) : NULL;
+    PANEL * ret = panel_below(pan);
+    
+    ST(0) = sv_newmortal();
+    c_panel2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -4501,12 +4503,12 @@ XS(XS_Curses_set_panel_userptr)
 #ifdef C_SET_PANEL_USERPTR
     c_exactargs("set_panel_userptr", items, 2);
     {
-	PANEL *	pan	= c_sv2panel(ST(0), 0);
-	char *	ptr	= (char *)SvPV_nolen(ST(1));
-	int	ret	= set_panel_userptr(pan, ptr);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    char *  ptr = (char *)SvPV_nolen(ST(1));
+    int ret = set_panel_userptr(pan, ptr);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4521,11 +4523,11 @@ XS(XS_Curses_panel_userptr)
 #ifdef C_PANEL_USERPTR
     c_exactargs("panel_userptr", items, 1);
     {
-	PANEL *	pan	= c_sv2panel(ST(0), 0);
-	char *	ret	= (char *)panel_userptr(pan);
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), ret);
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    char *  ret = (char *)panel_userptr(pan);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -4540,11 +4542,11 @@ XS(XS_Curses_del_panel)
 #ifdef C_DEL_PANEL
     c_exactargs("del_panel", items, 1);
     {
-	PANEL *	pan	= c_sv2panel(ST(0), 0);
-	int	ret	= del_panel(pan);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    PANEL * pan = c_sv2panel(ST(0), 0);
+    int ret = del_panel(pan);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4564,12 +4566,12 @@ XS(XS_Curses_set_menu_fore)
 #ifdef C_SET_MENU_FORE
     c_exactargs("set_menu_fore", items, 2);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	chtype	attr	= c_sv2chtype(ST(1));
-	int	ret	= set_menu_fore(menu, attr);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    chtype  attr    = c_sv2chtype(ST(1));
+    int ret = set_menu_fore(menu, attr);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4584,11 +4586,11 @@ XS(XS_Curses_menu_fore)
 #ifdef C_MENU_FORE
     c_exactargs("menu_fore", items, 1);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	chtype	ret	= menu_fore(menu);
-	
-	ST(0) = sv_newmortal();
-	c_chtype2sv(ST(0), ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    chtype  ret = menu_fore(menu);
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -4603,12 +4605,12 @@ XS(XS_Curses_set_menu_back)
 #ifdef C_SET_MENU_BACK
     c_exactargs("set_menu_back", items, 2);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	chtype	attr	= c_sv2chtype(ST(1));
-	int	ret	= set_menu_back(menu, attr);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    chtype  attr    = c_sv2chtype(ST(1));
+    int ret = set_menu_back(menu, attr);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4623,11 +4625,11 @@ XS(XS_Curses_menu_back)
 #ifdef C_MENU_BACK
     c_exactargs("menu_back", items, 1);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	chtype	ret	= menu_back(menu);
-	
-	ST(0) = sv_newmortal();
-	c_chtype2sv(ST(0), ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    chtype  ret = menu_back(menu);
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -4642,12 +4644,12 @@ XS(XS_Curses_set_menu_grey)
 #ifdef C_SET_MENU_GREY
     c_exactargs("set_menu_grey", items, 2);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	chtype	attr	= c_sv2chtype(ST(1));
-	int	ret	= set_menu_grey(menu, attr);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    chtype  attr    = c_sv2chtype(ST(1));
+    int ret = set_menu_grey(menu, attr);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4662,11 +4664,11 @@ XS(XS_Curses_menu_grey)
 #ifdef C_MENU_GREY
     c_exactargs("menu_grey", items, 1);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	chtype	ret	= menu_grey(menu);
-	
-	ST(0) = sv_newmortal();
-	c_chtype2sv(ST(0), ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    chtype  ret = menu_grey(menu);
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -4681,12 +4683,12 @@ XS(XS_Curses_set_menu_pad)
 #ifdef C_SET_MENU_PAD
     c_exactargs("set_menu_pad", items, 2);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	int	pad	= (int)SvIV(ST(1));
-	int	ret	= set_menu_pad(menu, pad);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int pad = (int)SvIV(ST(1));
+    int ret = set_menu_pad(menu, pad);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4701,11 +4703,11 @@ XS(XS_Curses_menu_pad)
 #ifdef C_MENU_PAD
     c_exactargs("menu_pad", items, 1);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	int	ret	= menu_pad(menu);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int ret = menu_pad(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4723,11 +4725,11 @@ XS(XS_Curses_pos_menu_cursor)
 #ifdef C_POS_MENU_CURSOR
     c_exactargs("pos_menu_cursor", items, 1);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	int	ret	= pos_menu_cursor(menu);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int ret = pos_menu_cursor(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4745,12 +4747,12 @@ XS(XS_Curses_menu_driver)
 #ifdef C_MENU_DRIVER
     c_exactargs("menu_driver", items, 2);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	int	c	= (int)SvIV(ST(1));
-	int	ret	= menu_driver(menu, c);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int c   = (int)SvIV(ST(1));
+    int ret = menu_driver(menu, c);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4768,13 +4770,13 @@ XS(XS_Curses_set_menu_format)
 #ifdef C_SET_MENU_FORMAT
     c_exactargs("set_menu_format", items, 3);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	int	rows	= (int)SvIV(ST(1));
-	int	cols	= (int)SvIV(ST(2));
-	int	ret	= set_menu_format(menu, rows, cols);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int rows    = (int)SvIV(ST(1));
+    int cols    = (int)SvIV(ST(2));
+    int ret = set_menu_format(menu, rows, cols);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4789,13 +4791,13 @@ XS(XS_Curses_menu_format)
 #ifdef C_MENU_FORMAT
     c_exactargs("menu_format", items, 3);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	int	rows	= 0;
-	int	cols	= 0;
-	
-	menu_format(menu, &rows, &cols);
-	sv_setiv(ST(1), (IV)rows);;
-	sv_setiv(ST(2), (IV)cols);;
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int rows    = 0;
+    int cols    = 0;
+    
+    menu_format(menu, &rows, &cols);
+    sv_setiv(ST(1), (IV)rows);;
+    sv_setiv(ST(2), (IV)cols);;
     }
     XSRETURN(0);
 #else
@@ -4813,12 +4815,12 @@ XS(XS_Curses_set_menu_items)
 #ifdef C_SET_MENU_ITEMS
     c_exactargs("set_menu_items", items, 2);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	ITEM **	items	= (ITEM **)SvPV_nolen(ST(1));
-	int	ret	= set_menu_items(menu, items);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    ITEM ** items   = (ITEM **)SvPV_nolen(ST(1));
+    int ret = set_menu_items(menu, items);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4833,11 +4835,11 @@ XS(XS_Curses_menu_items)
 #ifdef C_MENU_ITEMS
     c_exactargs("menu_items", items, 1);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	ITEM **	ret	= menu_items(menu);
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), (char *)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    ITEM ** ret = menu_items(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), (char *)ret);
     }
     XSRETURN(1);
 #else
@@ -4852,11 +4854,11 @@ XS(XS_Curses_item_count)
 #ifdef C_ITEM_COUNT
     c_exactargs("item_count", items, 1);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	int	ret	= item_count(menu);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int ret = item_count(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4874,12 +4876,12 @@ XS(XS_Curses_set_menu_mark)
 #ifdef C_SET_MENU_MARK
     c_exactargs("set_menu_mark", items, 2);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	char *	mark	= (char *)SvPV_nolen(ST(1));
-	int	ret	= set_menu_mark(menu, mark);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    char *  mark    = (char *)SvPV_nolen(ST(1));
+    int ret = set_menu_mark(menu, mark);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4894,11 +4896,11 @@ XS(XS_Curses_menu_mark)
 #ifdef C_MENU_MARK
     c_exactargs("menu_mark", items, 1);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	char *	ret	= (char *)menu_mark(menu);
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    char *  ret = (char *)menu_mark(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -4916,11 +4918,11 @@ XS(XS_Curses_new_menu)
 #ifdef C_NEW_MENU
     c_exactargs("new_menu", items, 1);
     {
-	ITEM **	items	= (ITEM **)SvPV_nolen(ST(0));
-	MENU *	ret	= new_menu(items);
-	
-	ST(0) = sv_newmortal();
-	c_menu2sv(ST(0), ret);
+    ITEM ** items   = (ITEM **)SvPV_nolen(ST(0));
+    MENU *  ret = new_menu(items);
+    
+    ST(0) = sv_newmortal();
+    c_menu2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -4935,11 +4937,11 @@ XS(XS_Curses_free_menu)
 #ifdef C_FREE_MENU
     c_exactargs("free_menu", items, 1);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	int	ret	= free_menu(menu);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int ret = free_menu(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4957,11 +4959,11 @@ XS(XS_Curses_menu_opts)
 #ifdef C_MENU_OPTS
     c_exactargs("menu_opts", items, 1);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	int	ret	= menu_opts(menu);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int ret = menu_opts(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4976,12 +4978,12 @@ XS(XS_Curses_set_menu_opts)
 #ifdef C_SET_MENU_OPTS
     c_exactargs("set_menu_opts", items, 2);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	int	opts	= (int)SvIV(ST(1));
-	int	ret	= set_menu_opts(menu, opts);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = set_menu_opts(menu, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -4996,12 +4998,12 @@ XS(XS_Curses_menu_opts_on)
 #ifdef C_MENU_OPTS_ON
     c_exactargs("menu_opts_on", items, 2);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	int	opts	= (int)SvIV(ST(1));
-	int	ret	= menu_opts_on(menu, opts);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = menu_opts_on(menu, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5016,12 +5018,12 @@ XS(XS_Curses_menu_opts_off)
 #ifdef C_MENU_OPTS_OFF
     c_exactargs("menu_opts_off", items, 2);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	int	opts	= (int)SvIV(ST(1));
-	int	ret	= menu_opts_off(menu, opts);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = menu_opts_off(menu, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5039,12 +5041,12 @@ XS(XS_Curses_set_menu_pattern)
 #ifdef C_SET_MENU_PATTERN
     c_exactargs("set_menu_pattern", items, 2);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	char *	pattern	= (char *)SvPV_nolen(ST(1));
-	int	ret	= set_menu_pattern(menu, pattern);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    char *  pattern = (char *)SvPV_nolen(ST(1));
+    int ret = set_menu_pattern(menu, pattern);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5059,11 +5061,11 @@ XS(XS_Curses_menu_pattern)
 #ifdef C_MENU_PATTERN
     c_exactargs("menu_pattern", items, 1);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	char *	ret	= menu_pattern(menu);
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    char *  ret = menu_pattern(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -5081,11 +5083,11 @@ XS(XS_Curses_post_menu)
 #ifdef C_POST_MENU
     c_exactargs("post_menu", items, 1);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	int	ret	= post_menu(menu);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int ret = post_menu(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5100,11 +5102,11 @@ XS(XS_Curses_unpost_menu)
 #ifdef C_UNPOST_MENU
     c_exactargs("unpost_menu", items, 1);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	int	ret	= unpost_menu(menu);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int ret = unpost_menu(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5122,12 +5124,12 @@ XS(XS_Curses_set_menu_userptr)
 #ifdef C_SET_MENU_USERPTR
     c_exactargs("set_menu_userptr", items, 2);
     {
-	MENU *	item	= c_sv2menu(ST(0), 0);
-	char *	userptr	= (char *)SvPV_nolen(ST(1));
-	int	ret	= set_menu_userptr(item, userptr);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  item    = c_sv2menu(ST(0), 0);
+    char *  userptr = (char *)SvPV_nolen(ST(1));
+    int ret = set_menu_userptr(item, userptr);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5142,11 +5144,11 @@ XS(XS_Curses_menu_userptr)
 #ifdef C_MENU_USERPTR
     c_exactargs("menu_userptr", items, 1);
     {
-	MENU *	item	= c_sv2menu(ST(0), 0);
-	char *	ret	= menu_userptr(item);
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), ret);
+    MENU *  item    = c_sv2menu(ST(0), 0);
+    char *  ret = menu_userptr(item);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -5164,12 +5166,12 @@ XS(XS_Curses_set_menu_win)
 #ifdef C_SET_MENU_WIN
     c_exactargs("set_menu_win", items, 2);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	WINDOW *win	= c_sv2window(ST(1), 1);
-	int	ret	= set_menu_win(menu, win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    WINDOW *win = c_sv2window(ST(1), 1);
+    int ret = set_menu_win(menu, win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5184,11 +5186,11 @@ XS(XS_Curses_menu_win)
 #ifdef C_MENU_WIN
     c_exactargs("menu_win", items, 1);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	WINDOW *	ret	= menu_win(menu);
-	
-	ST(0) = sv_newmortal();
-	c_window2sv(ST(0), ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    WINDOW *    ret = menu_win(menu);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -5203,12 +5205,12 @@ XS(XS_Curses_set_menu_sub)
 #ifdef C_SET_MENU_SUB
     c_exactargs("set_menu_sub", items, 2);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	WINDOW *win	= c_sv2window(ST(1), 1);
-	int	ret	= set_menu_sub(menu, win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    WINDOW *win = c_sv2window(ST(1), 1);
+    int ret = set_menu_sub(menu, win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5223,11 +5225,11 @@ XS(XS_Curses_menu_sub)
 #ifdef C_MENU_SUB
     c_exactargs("menu_sub", items, 1);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	WINDOW *	ret	= menu_sub(menu);
-	
-	ST(0) = sv_newmortal();
-	c_window2sv(ST(0), ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    WINDOW *    ret = menu_sub(menu);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -5242,15 +5244,15 @@ XS(XS_Curses_scale_menu)
 #ifdef C_SCALE_MENU
     c_exactargs("scale_menu", items, 3);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	int	rows	= 0;
-	int	cols	= 0;
-	int	ret	= scale_menu(menu, &rows, &cols);
-	
-	sv_setiv(ST(1), (IV)rows);;
-	sv_setiv(ST(2), (IV)cols);;
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int rows    = 0;
+    int cols    = 0;
+    int ret = scale_menu(menu, &rows, &cols);
+    
+    sv_setiv(ST(1), (IV)rows);;
+    sv_setiv(ST(2), (IV)cols);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5268,12 +5270,12 @@ XS(XS_Curses_set_current_item)
 #ifdef C_SET_CURRENT_ITEM
     c_exactargs("set_current_item", items, 2);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	ITEM *	item	= c_sv2item(ST(1), 1);
-	int	ret	= set_current_item(menu, item);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    ITEM *  item    = c_sv2item(ST(1), 1);
+    int ret = set_current_item(menu, item);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5288,11 +5290,11 @@ XS(XS_Curses_current_item)
 #ifdef C_CURRENT_ITEM
     c_exactargs("current_item", items, 1);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	ITEM *	ret	= current_item(menu);
-	
-	ST(0) = sv_newmortal();
-	c_item2sv(ST(0), ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    ITEM *  ret = current_item(menu);
+    
+    ST(0) = sv_newmortal();
+    c_item2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -5307,12 +5309,12 @@ XS(XS_Curses_set_top_row)
 #ifdef C_SET_TOP_ROW
     c_exactargs("set_top_row", items, 2);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	int	row	= (int)SvIV(ST(1));
-	int	ret	= set_top_row(menu, row);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int row = (int)SvIV(ST(1));
+    int ret = set_top_row(menu, row);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5327,11 +5329,11 @@ XS(XS_Curses_top_row)
 #ifdef C_TOP_ROW
     c_exactargs("top_row", items, 1);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	int	ret	= top_row(menu);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int ret = top_row(menu);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5346,11 +5348,11 @@ XS(XS_Curses_item_index)
 #ifdef C_ITEM_INDEX
     c_exactargs("item_index", items, 1);
     {
-	ITEM *	item	= c_sv2item(ST(0), 0);
-	int	ret	= item_index(item);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    int ret = item_index(item);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5368,11 +5370,11 @@ XS(XS_Curses_item_name)
 #ifdef C_ITEM_NAME
     c_exactargs("item_name", items, 1);
     {
-	ITEM *	item	= c_sv2item(ST(0), 0);
-	char *	ret	= (char *)item_name(item);
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), ret);
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    char *  ret = (char *)item_name(item);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -5387,11 +5389,11 @@ XS(XS_Curses_item_description)
 #ifdef C_ITEM_DESCRIPTION
     c_exactargs("item_description", items, 1);
     {
-	ITEM *	item	= c_sv2item(ST(0), 0);
-	char *	ret	= (char *)item_description(item);
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), ret);
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    char *  ret = (char *)item_description(item);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -5409,12 +5411,12 @@ XS(XS_Curses_new_item)
 #ifdef C_NEW_ITEM
     c_exactargs("new_item", items, 2);
     {
-	char *	name	= (char *)SvPV_nolen(ST(0));
-	char *	descr	= (char *)SvPV_nolen(ST(1));
-	ITEM *	ret	= new_item(name, descr);
-	
-	ST(0) = sv_newmortal();
-	c_item2sv(ST(0), ret);
+    char *  name    = (char *)SvPV_nolen(ST(0));
+    char *  descr   = (char *)SvPV_nolen(ST(1));
+    ITEM *  ret = new_item(name, descr);
+    
+    ST(0) = sv_newmortal();
+    c_item2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -5429,11 +5431,11 @@ XS(XS_Curses_free_item)
 #ifdef C_FREE_ITEM
     c_exactargs("free_item", items, 1);
     {
-	ITEM *	item	= c_sv2item(ST(0), 0);
-	int	ret	= free_item(item);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    int ret = free_item(item);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5451,12 +5453,12 @@ XS(XS_Curses_set_item_opts)
 #ifdef C_SET_ITEM_OPTS
     c_exactargs("set_item_opts", items, 2);
     {
-	ITEM *	item	= c_sv2item(ST(0), 0);
-	int	opts	= (int)SvIV(ST(1));
-	int	ret	= set_item_opts(item, opts);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = set_item_opts(item, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5471,12 +5473,12 @@ XS(XS_Curses_item_opts_on)
 #ifdef C_ITEM_OPTS_ON
     c_exactargs("item_opts_on", items, 2);
     {
-	ITEM *	item	= c_sv2item(ST(0), 0);
-	int	opts	= (int)SvIV(ST(1));
-	int	ret	= item_opts_on(item, opts);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = item_opts_on(item, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5491,12 +5493,12 @@ XS(XS_Curses_item_opts_off)
 #ifdef C_ITEM_OPTS_OFF
     c_exactargs("item_opts_off", items, 2);
     {
-	ITEM *	item	= c_sv2item(ST(0), 0);
-	int	opts	= (int)SvIV(ST(1));
-	int	ret	= item_opts_off(item, opts);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = item_opts_off(item, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5511,11 +5513,11 @@ XS(XS_Curses_item_opts)
 #ifdef C_ITEM_OPTS
     c_exactargs("item_opts", items, 1);
     {
-	ITEM *	item	= c_sv2item(ST(0), 0);
-	int	ret	= item_opts(item);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    int ret = item_opts(item);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5533,11 +5535,11 @@ XS(XS_Curses_item_userptr)
 #ifdef C_ITEM_USERPTR
     c_exactargs("item_userptr", items, 1);
     {
-	ITEM *	item	= c_sv2item(ST(0), 0);
-	char *	ret	= (char *)item_userptr(item);
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), ret);
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    char *  ret = (char *)item_userptr(item);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -5552,12 +5554,12 @@ XS(XS_Curses_set_item_userptr)
 #ifdef C_SET_ITEM_USERPTR
     c_exactargs("set_item_userptr", items, 2);
     {
-	ITEM *	item	= c_sv2item(ST(0), 0);
-	char *	ptr	= (char *)SvPV_nolen(ST(1));
-	int	ret	= set_item_userptr(item, ptr);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    char *  ptr = (char *)SvPV_nolen(ST(1));
+    int ret = set_item_userptr(item, ptr);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5575,12 +5577,12 @@ XS(XS_Curses_set_item_value)
 #ifdef C_SET_ITEM_VALUE
     c_exactargs("set_item_value", items, 2);
     {
-	ITEM *	item	= c_sv2item(ST(0), 0);
-	bool	val	= (int)SvIV(ST(1));
-	int	ret	= set_item_value(item, val);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    bool    val = (int)SvIV(ST(1));
+    int ret = set_item_value(item, val);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5595,11 +5597,11 @@ XS(XS_Curses_item_value)
 #ifdef C_ITEM_VALUE
     c_exactargs("item_value", items, 1);
     {
-	ITEM *	item	= c_sv2item(ST(0), 0);
-	bool	ret	= item_value(item);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    bool    ret = item_value(item);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5617,11 +5619,11 @@ XS(XS_Curses_item_visible)
 #ifdef C_ITEM_VISIBLE
     c_exactargs("item_visible", items, 1);
     {
-	ITEM *	item	= c_sv2item(ST(0), 0);
-	bool	ret	= item_visible(item);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    ITEM *  item    = c_sv2item(ST(0), 0);
+    bool    ret = item_visible(item);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5639,11 +5641,11 @@ XS(XS_Curses_menu_request_name)
 #ifdef C_MENU_REQUEST_NAME
     c_exactargs("menu_request_name", items, 1);
     {
-	int	request	= (int)SvIV(ST(0));
-	char *	ret	= (char *)menu_request_name(request);
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), ret);
+    int request = (int)SvIV(ST(0));
+    char *  ret = (char *)menu_request_name(request);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -5658,11 +5660,11 @@ XS(XS_Curses_menu_request_by_name)
 #ifdef C_MENU_REQUEST_BY_NAME
     c_exactargs("menu_request_by_name", items, 1);
     {
-	char *	name	= (char *)SvPV_nolen(ST(0));
-	int	ret	= menu_request_by_name(name);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    char *  name    = (char *)SvPV_nolen(ST(0));
+    int ret = menu_request_by_name(name);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5677,14 +5679,14 @@ XS(XS_Curses_set_menu_spacing)
 #ifdef C_SET_MENU_SPACING
     c_exactargs("set_menu_spacing", items, 4);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	int	descr	= (int)SvIV(ST(1));
-	int	rows	= (int)SvIV(ST(2));
-	int	cols	= (int)SvIV(ST(3));
-	int	ret	= set_menu_spacing(menu, descr, rows, cols);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int descr   = (int)SvIV(ST(1));
+    int rows    = (int)SvIV(ST(2));
+    int cols    = (int)SvIV(ST(3));
+    int ret = set_menu_spacing(menu, descr, rows, cols);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5699,17 +5701,17 @@ XS(XS_Curses_menu_spacing)
 #ifdef C_MENU_SPACING
     c_exactargs("menu_spacing", items, 4);
     {
-	MENU *	menu	= c_sv2menu(ST(0), 0);
-	int	descr	= 0;
-	int	rows	= 0;
-	int	cols	= 0;
-	int	ret	= menu_spacing(menu, &descr, &rows, &cols);
-	
-	sv_setiv(ST(1), (IV)descr);;
-	sv_setiv(ST(2), (IV)rows);;
-	sv_setiv(ST(3), (IV)cols);;
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    MENU *  menu    = c_sv2menu(ST(0), 0);
+    int descr   = 0;
+    int rows    = 0;
+    int cols    = 0;
+    int ret = menu_spacing(menu, &descr, &rows, &cols);
+    
+    sv_setiv(ST(1), (IV)descr);;
+    sv_setiv(ST(2), (IV)rows);;
+    sv_setiv(ST(3), (IV)cols);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5729,11 +5731,11 @@ XS(XS_Curses_pos_form_cursor)
 #ifdef C_POS_FORM_CURSOR
     c_exactargs("pos_form_cursor", items, 1);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	int	ret	= pos_form_cursor(form);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int ret = pos_form_cursor(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5751,11 +5753,11 @@ XS(XS_Curses_data_ahead)
 #ifdef C_DATA_AHEAD
     c_exactargs("data_ahead", items, 1);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	bool	ret	= data_ahead(form);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    bool    ret = data_ahead(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5770,11 +5772,11 @@ XS(XS_Curses_data_behind)
 #ifdef C_DATA_BEHIND
     c_exactargs("data_behind", items, 1);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	bool	ret	= data_behind(form);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    bool    ret = data_behind(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5792,12 +5794,12 @@ XS(XS_Curses_form_driver)
 #ifdef C_FORM_DRIVER
     c_exactargs("form_driver", items, 2);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	int	c	= (int)SvIV(ST(1));
-	int	ret	= form_driver(form, c);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int c   = (int)SvIV(ST(1));
+    int ret = form_driver(form, c);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5815,12 +5817,12 @@ XS(XS_Curses_set_form_fields)
 #ifdef C_SET_FORM_FIELDS
     c_exactargs("set_form_fields", items, 2);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	FIELD **fields	= (FIELD **)SvPV_nolen(ST(1));
-	int	ret	= set_form_fields(form, fields);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    FIELD **fields  = (FIELD **)SvPV_nolen(ST(1));
+    int ret = set_form_fields(form, fields);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5835,11 +5837,11 @@ XS(XS_Curses_form_fields)
 #ifdef C_FORM_FIELDS
     c_exactargs("form_fields", items, 1);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	FIELD **	ret	= form_fields(form);
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), (char *)ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    FIELD **    ret = form_fields(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), (char *)ret);
     }
     XSRETURN(1);
 #else
@@ -5854,11 +5856,11 @@ XS(XS_Curses_field_count)
 #ifdef C_FIELD_COUNT
     c_exactargs("field_count", items, 1);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	int	ret	= field_count(form);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int ret = field_count(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5873,13 +5875,13 @@ XS(XS_Curses_move_field)
 #ifdef C_MOVE_FIELD
     c_exactargs("move_field", items, 3);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	int	frow	= (int)SvIV(ST(1));
-	int	fcol	= (int)SvIV(ST(2));
-	int	ret	= move_field(field, frow, fcol);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int frow    = (int)SvIV(ST(1));
+    int fcol    = (int)SvIV(ST(2));
+    int ret = move_field(field, frow, fcol);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5915,11 +5917,11 @@ XS(XS_Curses_free_form)
 #ifdef C_FREE_FORM
     c_exactargs("free_form", items, 1);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	int	ret	= free_form(form);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int ret = free_form(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5937,12 +5939,12 @@ XS(XS_Curses_set_new_page)
 #ifdef C_SET_NEW_PAGE
     c_exactargs("set_new_page", items, 2);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	bool	new_page_flag	= (int)SvIV(ST(1));
-	int	ret	= set_new_page(field, new_page_flag);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    bool    new_page_flag   = (int)SvIV(ST(1));
+    int ret = set_new_page(field, new_page_flag);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5957,11 +5959,11 @@ XS(XS_Curses_new_page)
 #ifdef C_NEW_PAGE
     c_exactargs("new_page", items, 1);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	bool	ret	= new_page(field);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    bool    ret = new_page(field);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5979,12 +5981,12 @@ XS(XS_Curses_set_form_opts)
 #ifdef C_SET_FORM_OPTS
     c_exactargs("set_form_opts", items, 2);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	int	opts	= (int)SvIV(ST(1));
-	int	ret	= set_form_opts(form, opts);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = set_form_opts(form, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -5999,12 +6001,12 @@ XS(XS_Curses_form_opts_on)
 #ifdef C_FORM_OPTS_ON
     c_exactargs("form_opts_on", items, 2);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	int	opts	= (int)SvIV(ST(1));
-	int	ret	= form_opts_on(form, opts);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = form_opts_on(form, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6019,12 +6021,12 @@ XS(XS_Curses_form_opts_off)
 #ifdef C_FORM_OPTS_OFF
     c_exactargs("form_opts_off", items, 2);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	int	opts	= (int)SvIV(ST(1));
-	int	ret	= form_opts_off(form, opts);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = form_opts_off(form, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6039,11 +6041,11 @@ XS(XS_Curses_form_opts)
 #ifdef C_FORM_OPTS
     c_exactargs("form_opts", items, 1);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	int	ret	= form_opts(form);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int ret = form_opts(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6061,12 +6063,12 @@ XS(XS_Curses_set_current_field)
 #ifdef C_SET_CURRENT_FIELD
     c_exactargs("set_current_field", items, 2);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	FIELD *	field	= c_sv2field(ST(1), 1);
-	int	ret	= set_current_field(form, field);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    FIELD * field   = c_sv2field(ST(1), 1);
+    int ret = set_current_field(form, field);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6081,11 +6083,11 @@ XS(XS_Curses_current_field)
 #ifdef C_CURRENT_FIELD
     c_exactargs("current_field", items, 1);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	FIELD *	ret	= current_field(form);
-	
-	ST(0) = sv_newmortal();
-	c_field2sv(ST(0), ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    FIELD * ret = current_field(form);
+    
+    ST(0) = sv_newmortal();
+    c_field2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -6100,12 +6102,12 @@ XS(XS_Curses_set_form_page)
 #ifdef C_SET_FORM_PAGE
     c_exactargs("set_form_page", items, 2);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	int	n	= (int)SvIV(ST(1));
-	int	ret	= set_form_page(form, n);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int n   = (int)SvIV(ST(1));
+    int ret = set_form_page(form, n);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6120,11 +6122,11 @@ XS(XS_Curses_form_page)
 #ifdef C_FORM_PAGE
     c_exactargs("form_page", items, 1);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	int	ret	= form_page(form);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int ret = form_page(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6139,11 +6141,11 @@ XS(XS_Curses_field_index)
 #ifdef C_FIELD_INDEX
     c_exactargs("field_index", items, 1);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	int	ret	= field_index(field);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int ret = field_index(field);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6161,11 +6163,11 @@ XS(XS_Curses_post_form)
 #ifdef C_POST_FORM
     c_exactargs("post_form", items, 1);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	int	ret	= post_form(form);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int ret = post_form(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6180,11 +6182,11 @@ XS(XS_Curses_unpost_form)
 #ifdef C_UNPOST_FORM
     c_exactargs("unpost_form", items, 1);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	int	ret	= unpost_form(form);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int ret = unpost_form(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6202,12 +6204,12 @@ XS(XS_Curses_set_form_userptr)
 #ifdef C_SET_FORM_USERPTR
     c_exactargs("set_form_userptr", items, 2);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	char *	userptr	= (char *)SvPV_nolen(ST(1));
-	int	ret	= set_form_userptr(form, userptr);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    char *  userptr = (char *)SvPV_nolen(ST(1));
+    int ret = set_form_userptr(form, userptr);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6222,11 +6224,11 @@ XS(XS_Curses_form_userptr)
 #ifdef C_FORM_USERPTR
     c_exactargs("form_userptr", items, 1);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	char *	ret	= form_userptr(form);
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    char *  ret = form_userptr(form);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -6244,12 +6246,12 @@ XS(XS_Curses_set_form_win)
 #ifdef C_SET_FORM_WIN
     c_exactargs("set_form_win", items, 2);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	WINDOW *win	= c_sv2window(ST(1), 1);
-	int	ret	= set_form_win(form, win);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    WINDOW *win = c_sv2window(ST(1), 1);
+    int ret = set_form_win(form, win);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6264,11 +6266,11 @@ XS(XS_Curses_form_win)
 #ifdef C_FORM_WIN
     c_exactargs("form_win", items, 1);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	WINDOW *	ret	= form_win(form);
-	
-	ST(0) = sv_newmortal();
-	c_window2sv(ST(0), ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    WINDOW *    ret = form_win(form);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -6283,12 +6285,12 @@ XS(XS_Curses_set_form_sub)
 #ifdef C_SET_FORM_SUB
     c_exactargs("set_form_sub", items, 2);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	WINDOW *sub	= c_sv2window(ST(1), 1);
-	int	ret	= set_form_sub(form, sub);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    WINDOW *sub = c_sv2window(ST(1), 1);
+    int ret = set_form_sub(form, sub);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6303,11 +6305,11 @@ XS(XS_Curses_form_sub)
 #ifdef C_FORM_SUB
     c_exactargs("form_sub", items, 1);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	WINDOW *	ret	= form_sub(form);
-	
-	ST(0) = sv_newmortal();
-	c_window2sv(ST(0), ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    WINDOW *    ret = form_sub(form);
+    
+    ST(0) = sv_newmortal();
+    c_window2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -6322,15 +6324,15 @@ XS(XS_Curses_scale_form)
 #ifdef C_SCALE_FORM
     c_exactargs("scale_form", items, 3);
     {
-	FORM *	form	= c_sv2form(ST(0), 0);
-	int	rows	= 0;
-	int	cols	= 0;
-	int	ret	= scale_form(form, &rows, &cols);
-	
-	sv_setiv(ST(1), (IV)rows);;
-	sv_setiv(ST(2), (IV)cols);;
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FORM *  form    = c_sv2form(ST(0), 0);
+    int rows    = 0;
+    int cols    = 0;
+    int ret = scale_form(form, &rows, &cols);
+    
+    sv_setiv(ST(1), (IV)rows);;
+    sv_setiv(ST(2), (IV)cols);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6348,12 +6350,12 @@ XS(XS_Curses_set_field_fore)
 #ifdef C_SET_FIELD_FORE
     c_exactargs("set_field_fore", items, 2);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	chtype	attr	= c_sv2chtype(ST(1));
-	int	ret	= set_field_fore(field, attr);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    chtype  attr    = c_sv2chtype(ST(1));
+    int ret = set_field_fore(field, attr);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6368,11 +6370,11 @@ XS(XS_Curses_field_fore)
 #ifdef C_FIELD_FORE
     c_exactargs("field_fore", items, 1);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	chtype	ret	= field_fore(field);
-	
-	ST(0) = sv_newmortal();
-	c_chtype2sv(ST(0), ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    chtype  ret = field_fore(field);
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -6387,12 +6389,12 @@ XS(XS_Curses_set_field_back)
 #ifdef C_SET_FIELD_BACK
     c_exactargs("set_field_back", items, 2);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	chtype	attr	= c_sv2chtype(ST(1));
-	int	ret	= set_field_back(field, attr);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    chtype  attr    = c_sv2chtype(ST(1));
+    int ret = set_field_back(field, attr);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6407,11 +6409,11 @@ XS(XS_Curses_field_back)
 #ifdef C_FIELD_BACK
     c_exactargs("field_back", items, 1);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	chtype	ret	= field_back(field);
-	
-	ST(0) = sv_newmortal();
-	c_chtype2sv(ST(0), ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    chtype  ret = field_back(field);
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -6426,12 +6428,12 @@ XS(XS_Curses_set_field_pad)
 #ifdef C_SET_FIELD_PAD
     c_exactargs("set_field_pad", items, 2);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	int	pad	= (int)SvIV(ST(1));
-	int	ret	= set_field_pad(field, pad);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int pad = (int)SvIV(ST(1));
+    int ret = set_field_pad(field, pad);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6446,11 +6448,11 @@ XS(XS_Curses_field_pad)
 #ifdef C_FIELD_PAD
     c_exactargs("field_pad", items, 1);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	chtype	ret	= field_pad(field);
-	
-	ST(0) = sv_newmortal();
-	c_chtype2sv(ST(0), ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    chtype  ret = field_pad(field);
+    
+    ST(0) = sv_newmortal();
+    c_chtype2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -6468,13 +6470,13 @@ XS(XS_Curses_set_field_buffer)
 #ifdef C_SET_FIELD_BUFFER
     c_exactargs("set_field_buffer", items, 3);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	int	buf	= (int)SvIV(ST(1));
-	char *	value	= (char *)SvPV_nolen(ST(2));
-	int	ret	= set_field_buffer(field, buf, value);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int buf = (int)SvIV(ST(1));
+    char *  value   = (char *)SvPV_nolen(ST(2));
+    int ret = set_field_buffer(field, buf, value);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6489,12 +6491,12 @@ XS(XS_Curses_field_buffer)
 #ifdef C_FIELD_BUFFER
     c_exactargs("field_buffer", items, 2);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	int	buffer	= (int)SvIV(ST(1));
-	char *	ret	= field_buffer(field, buffer);
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int buffer  = (int)SvIV(ST(1));
+    char *  ret = field_buffer(field, buffer);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -6509,12 +6511,12 @@ XS(XS_Curses_set_field_status)
 #ifdef C_SET_FIELD_STATUS
     c_exactargs("set_field_status", items, 2);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	bool	status	= (int)SvIV(ST(1));
-	int	ret	= set_field_status(field, status);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    bool    status  = (int)SvIV(ST(1));
+    int ret = set_field_status(field, status);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6529,11 +6531,11 @@ XS(XS_Curses_field_status)
 #ifdef C_FIELD_STATUS
     c_exactargs("field_status", items, 1);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	bool	ret	= field_status(field);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    bool    ret = field_status(field);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6548,12 +6550,12 @@ XS(XS_Curses_set_max_field)
 #ifdef C_SET_MAX_FIELD
     c_exactargs("set_max_field", items, 2);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	int	max	= (int)SvIV(ST(1));
-	int	ret	= set_max_field(field, max);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int max = (int)SvIV(ST(1));
+    int ret = set_max_field(field, max);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6571,23 +6573,23 @@ XS(XS_Curses_field_info)
 #ifdef C_FIELD_INFO
     c_exactargs("field_info", items, 7);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	int	rows	= 0;
-	int	cols	= 0;
-	int	frow	= 0;
-	int	fcol	= 0;
-	int	nrow	= 0;
-	int	nbuf	= 0;
-	int	ret	= field_info(field, &rows, &cols, &frow, &fcol, &nrow, &nbuf);
-	
-	sv_setiv(ST(1), (IV)rows);;
-	sv_setiv(ST(2), (IV)cols);;
-	sv_setiv(ST(3), (IV)frow);;
-	sv_setiv(ST(4), (IV)fcol);;
-	sv_setiv(ST(5), (IV)nrow);;
-	sv_setiv(ST(6), (IV)nbuf);;
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int rows    = 0;
+    int cols    = 0;
+    int frow    = 0;
+    int fcol    = 0;
+    int nrow    = 0;
+    int nbuf    = 0;
+    int ret = field_info(field, &rows, &cols, &frow, &fcol, &nrow, &nbuf);
+    
+    sv_setiv(ST(1), (IV)rows);;
+    sv_setiv(ST(2), (IV)cols);;
+    sv_setiv(ST(3), (IV)frow);;
+    sv_setiv(ST(4), (IV)fcol);;
+    sv_setiv(ST(5), (IV)nrow);;
+    sv_setiv(ST(6), (IV)nbuf);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6602,17 +6604,17 @@ XS(XS_Curses_dynamic_field_info)
 #ifdef C_DYNAMIC_FIELD_INFO
     c_exactargs("dynamic_field_info", items, 4);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	int	rows	= 0;
-	int	cols	= 0;
-	int	max	= 0;
-	int	ret	= dynamic_field_info(field, &rows, &cols, &max);
-	
-	sv_setiv(ST(1), (IV)rows);;
-	sv_setiv(ST(2), (IV)cols);;
-	sv_setiv(ST(3), (IV)max);;
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int rows    = 0;
+    int cols    = 0;
+    int max = 0;
+    int ret = dynamic_field_info(field, &rows, &cols, &max);
+    
+    sv_setiv(ST(1), (IV)rows);;
+    sv_setiv(ST(2), (IV)cols);;
+    sv_setiv(ST(3), (IV)max);;
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6630,12 +6632,12 @@ XS(XS_Curses_set_field_just)
 #ifdef C_SET_FIELD_JUST
     c_exactargs("set_field_just", items, 2);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	int	justif	= (int)SvIV(ST(1));
-	int	ret	= set_field_just(field, justif);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int justif  = (int)SvIV(ST(1));
+    int ret = set_field_just(field, justif);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6650,11 +6652,11 @@ XS(XS_Curses_field_just)
 #ifdef C_FIELD_JUST
     c_exactargs("field_just", items, 1);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	int	ret	= field_just(field);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int ret = field_just(field);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6695,13 +6697,13 @@ XS(XS_Curses_dup_field)
 #ifdef C_DUP_FIELD
     c_exactargs("dup_field", items, 3);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	int	toprow	= (int)SvIV(ST(1));
-	int	leftcol	= (int)SvIV(ST(2));
-	FIELD *	ret	= dup_field(field, toprow, leftcol);
-	
-	ST(0) = sv_newmortal();
-	c_field2sv(ST(0), ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int toprow  = (int)SvIV(ST(1));
+    int leftcol = (int)SvIV(ST(2));
+    FIELD * ret = dup_field(field, toprow, leftcol);
+    
+    ST(0) = sv_newmortal();
+    c_field2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -6716,13 +6718,13 @@ XS(XS_Curses_link_field)
 #ifdef C_LINK_FIELD
     c_exactargs("link_field", items, 3);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	int	toprow	= (int)SvIV(ST(1));
-	int	leftcol	= (int)SvIV(ST(2));
-	FIELD *	ret	= link_field(field, toprow, leftcol);
-	
-	ST(0) = sv_newmortal();
-	c_field2sv(ST(0), ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int toprow  = (int)SvIV(ST(1));
+    int leftcol = (int)SvIV(ST(2));
+    FIELD * ret = link_field(field, toprow, leftcol);
+    
+    ST(0) = sv_newmortal();
+    c_field2sv(ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -6737,11 +6739,11 @@ XS(XS_Curses_free_field)
 #ifdef C_FREE_FIELD
     c_exactargs("free_field", items, 1);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	int	ret	= free_field(field);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int ret = free_field(field);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6759,12 +6761,12 @@ XS(XS_Curses_set_field_opts)
 #ifdef C_SET_FIELD_OPTS
     c_exactargs("set_field_opts", items, 2);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	int	opts	= (int)SvIV(ST(1));
-	int	ret	= set_field_opts(field, opts);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = set_field_opts(field, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6779,12 +6781,12 @@ XS(XS_Curses_field_opts_on)
 #ifdef C_FIELD_OPTS_ON
     c_exactargs("field_opts_on", items, 2);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	int	opts	= (int)SvIV(ST(1));
-	int	ret	= field_opts_on(field, opts);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = field_opts_on(field, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6799,12 +6801,12 @@ XS(XS_Curses_field_opts_off)
 #ifdef C_FIELD_OPTS_OFF
     c_exactargs("field_opts_off", items, 2);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	int	opts	= (int)SvIV(ST(1));
-	int	ret	= field_opts_off(field, opts);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int opts    = (int)SvIV(ST(1));
+    int ret = field_opts_off(field, opts);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6819,11 +6821,11 @@ XS(XS_Curses_field_opts)
 #ifdef C_FIELD_OPTS
     c_exactargs("field_opts", items, 1);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	int	ret	= field_opts(field);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    int ret = field_opts(field);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6841,12 +6843,12 @@ XS(XS_Curses_set_field_userptr)
 #ifdef C_SET_FIELD_USERPTR
     c_exactargs("set_field_userptr", items, 2);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	char *	userptr	= (char *)SvPV_nolen(ST(1));
-	int	ret	= set_field_userptr(field, userptr);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    char *  userptr = (char *)SvPV_nolen(ST(1));
+    int ret = set_field_userptr(field, userptr);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -6861,11 +6863,11 @@ XS(XS_Curses_field_userptr)
 #ifdef C_FIELD_USERPTR
     c_exactargs("field_userptr", items, 1);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	char *	ret	= field_userptr(field);
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    char *  ret = field_userptr(field);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -6883,11 +6885,11 @@ XS(XS_Curses_field_arg)
 #ifdef C_FIELD_ARG
     c_exactargs("field_arg", items, 1);
     {
-	FIELD *	field	= c_sv2field(ST(0), 0);
-	char *	ret	= field_arg(field);
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), ret);
+    FIELD * field   = c_sv2field(ST(0), 0);
+    char *  ret = field_arg(field);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -6905,11 +6907,11 @@ XS(XS_Curses_form_request_name)
 #ifdef C_FORM_REQUEST_NAME
     c_exactargs("form_request_name", items, 1);
     {
-	int	request	= (int)SvIV(ST(0));
-	char *	ret	= (char *)form_request_name(request);
-	
-	ST(0) = sv_newmortal();
-	sv_setpv((SV*)ST(0), ret);
+    int request = (int)SvIV(ST(0));
+    char *  ret = (char *)form_request_name(request);
+    
+    ST(0) = sv_newmortal();
+    sv_setpv((SV*)ST(0), ret);
     }
     XSRETURN(1);
 #else
@@ -6924,11 +6926,11 @@ XS(XS_Curses_form_request_by_name)
 #ifdef C_FORM_REQUEST_BY_NAME
     c_exactargs("form_request_by_name", items, 1);
     {
-	char *	name	= (char *)SvPV_nolen(ST(0));
-	int	ret	= form_request_by_name(name);
-	
-	ST(0) = sv_newmortal();
-	sv_setiv(ST(0), (IV)ret);
+    char *  name    = (char *)SvPV_nolen(ST(0));
+    int ret = form_request_by_name(name);
+    
+    ST(0) = sv_newmortal();
+    sv_setiv(ST(0), (IV)ret);
     }
     XSRETURN(1);
 #else
@@ -0,0 +1,206 @@
+/* This is an inclusion for Curses.c */
+
+/* Combined Normal/Wide-Character Functions */
+
+XS(XS_CURSES_getchar) {
+    dXSARGS;
+    c_countargs("getchar", items, 0);
+
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    if (c_x)
+        if (c_domove(win, ST(c_x-1), ST(c_x)) == ERR)
+            XSRETURN_UNDEF;
+#ifdef C_GET_WCH
+    wint_t wch;
+    int ret = wget_wch(win, &wch);
+    if (ret == OK) {
+        ST(0) = sv_newmortal();
+        c_wchar2sv(ST(0), wch);
+        XSRETURN(1);
+    } else if (ret == KEY_CODE_YES) {
+        XST_mUNDEF(0);
+        ST(1) = sv_newmortal();
+        sv_setiv(ST(1), (IV)wch);
+        XSRETURN(2);
+    } else {
+        XSRETURN_UNDEF;
+    }
+#else
+    int key = wgetch(win);
+    if (key == ERR) {
+        XSRETURN_UNDEF;
+    } else if (key < KEY_CODE_YES) {
+        ST(0) = sv_newmortal();
+        c_wchar2sv(ST(0), key);
+        XSRETURN(1);
+    } else {
+        XST_mUNDEF(0);
+        ST(1) = sv_newmortal();
+        sv_setiv(ST(1), (IV)key);
+        XSRETURN(2);
+    }
+#endif
+}
+
+XS(XS_CURSES_ungetchar) {
+    dXSARGS;
+    c_exactargs("ungetchar", items, 1);
+    wint_t wc = c_sv2wchar(ST(0));
+    if (wc == WEOF)
+        XSRETURN_NO;
+#ifdef C_UNGET_WCH
+    int ret;
+    ret = unget_wch(wc);
+    if (ret == OK)
+        XSRETURN_YES;
+    else
+        XSRETURN_NO;
+#else
+    if (wc > 0xff)
+        XSRETURN_NO;
+    else {
+        int ret;
+        ret = ungetch(wc);
+        if (ret == OK)
+            XSRETURN_YES;
+        else
+            XSRETURN_NO;
+    }
+#endif
+}
+
+XS(XS_CURSES_getstring) {
+    dXSARGS;
+    c_countargs("getstring", items, 0);
+
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    if (c_x)
+        if (c_domove(win, ST(c_x-1), ST(c_x)) == ERR)
+            XSRETURN_UNDEF;
+#ifdef C_GETN_WSTR
+    wchar_t buf[1000];
+    if (wgetn_wstr(win, (wint_t *)buf, (sizeof buf/sizeof *buf) - 1) == ERR)
+        XSRETURN_UNDEF;
+    ST(0) = sv_newmortal();
+    c_wstr2sv(ST(0), buf);
+    XSRETURN(1);
+#else
+    unsigned char buf[1000];
+    if (wgetnstr(win, (char *)buf, (sizeof buf/sizeof *buf) - 1) == ERR)
+        XSRETURN_UNDEF;
+    ST(0) = sv_newmortal();
+    c_bstr2sv(ST(0), buf);
+    XSRETURN(1);
+#endif
+}
+
+XS(XS_CURSES_addstring) {
+    dXSARGS;
+    c_countargs("addstring", items, 1);
+
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    if (c_x)
+        if (c_domove(win, ST(c_x-1), ST(c_x)) == ERR)
+            XSRETURN_NO;
+#ifdef C_ADDNWSTR
+    int ret;
+    size_t len;
+    wint_t *wstr = c_sv2wstr(ST(c_arg), &len);
+    if (wstr == NULL)
+        XSRETURN_NO;
+    ret = waddnwstr(win, wstr, len);
+    free(wstr);
+    if (ret == OK)
+        XSRETURN_YES;
+    else
+        XSRETURN_NO;
+#else
+    int ret;
+    size_t len;
+    int need_free;
+    unsigned char *bstr = c_sv2bstr(ST(c_arg), &len, &need_free);
+    if (bstr == NULL)
+        XSRETURN_NO;
+    ret = waddnstr(win, (char *)bstr, len);
+    if (need_free) free(bstr);
+    if (ret == OK)
+        XSRETURN_YES;
+    else
+        XSRETURN_NO;
+#endif
+}
+
+XS(XS_CURSES_insstring) {
+    dXSARGS;
+    c_countargs("insstring", items, 1);
+
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    if (c_x)
+        if (c_domove(win, ST(c_x-1), ST(c_x)) == ERR)
+            XSRETURN_NO;
+#ifdef C_INS_NWSTR
+    int ret;
+    size_t len;
+    wint_t *wstr = c_sv2wstr(ST(c_arg), &len);
+    if (wstr == NULL)
+        XSRETURN_NO;
+    ret = wins_nwstr(win, wstr, len);
+    free(wstr);
+    if (ret == OK)
+        XSRETURN_YES;
+    else
+        XSRETURN_NO;
+#else
+    int ret;
+    size_t len;
+    int need_free;
+    unsigned char *bstr = c_sv2bstr(ST(c_arg), &len, &need_free);
+    if (bstr == NULL)
+        XSRETURN_NO;
+    ret = winsnstr(win, (char *)bstr, len);
+    if (need_free) free(bstr);
+    if (ret == OK)
+        XSRETURN_YES;
+    else
+        XSRETURN_NO;
+#endif
+}
+
+XS(XS_CURSES_instring) {
+    int x, y;
+    dXSARGS;
+    c_countargs("instring", items, 0);
+
+    WINDOW *win = c_win ? c_sv2window(ST(0), 0) : stdscr;
+    if (c_x)
+        if (c_domove(win, ST(c_x-1), ST(c_x)) == ERR)
+            XSRETURN_UNDEF;
+    getmaxyx(win, y, x); /* Macro: not &y, &x! */
+#ifdef C_INNWSTR
+    int ret;
+    wchar_t *buf = malloc((x + 1) * sizeof *buf);
+    if (buf == NULL) croak("insstring: malloc");
+    ret = winnwstr(win, buf, x);
+    if (ret == ERR) {
+        free(buf);
+        XSRETURN_UNDEF;
+    }
+    ST(0) = sv_newmortal();
+    c_wstr2sv(ST(0), buf);
+    free(buf);
+    XSRETURN(1);
+#else
+    int ret;
+    unsigned char *buf = malloc(x + 1);
+    if (buf == NULL) croak("insstring: malloc");
+    ret = winnstr(win, (char *)buf, x);
+    if (ret == ERR) {
+        free(buf);
+        XSRETURN_UNDEF;
+    }
+    ST(0) = sv_newmortal();
+    c_bstr2sv(ST(0), buf);
+    free(buf);
+    XSRETURN(1);
+#endif
+}
@@ -3,6 +3,8 @@
 **
 **  CursesVar.c -- the variables
 **
+**  This is an inclusion for Curses.c
+**
 **  Copyright (c) 1994-2000  William Setzer
 **
 **  You may distribute under the terms of either the Artistic License
@@ -0,0 +1,216 @@
+/* This is an inclusion for Curses.c */
+
+
+/* Combined Normal/Wide-Character helper functions */
+#include <wchar.h>
+
+static void
+c_wchar2sv(SV *    const sv,
+           wchar_t const wc) {
+/*----------------------------------------------------------------------------
+  Set SV to a one-character (not -byte!) Perl string holding a given wide
+  character
+-----------------------------------------------------------------------------*/
+    if (wc <= 0xff) {
+        char s[] = { wc, 0 };
+        sv_setpv(sv, s);
+        SvPOK_on(sv);
+        SvUTF8_off(sv);
+    } else {
+        char s[UTF8_MAXBYTES + 1] = { 0 };
+        char *s_end = (char *)uvchr_to_utf8((U8 *)s, wc);
+        *s_end = 0;
+        sv_setpv(sv, s);
+        SvPOK_on(sv);
+        SvUTF8_on(sv);
+    }
+}
+
+static void
+c_bstr2sv(SV *            const sv,
+          unsigned char * const bs) {
+/*----------------------------------------------------------------------------
+  Set SV to a Perl string holding a given byte string
+-----------------------------------------------------------------------------*/
+    SvPOK_on(sv);
+    sv_setpv(sv, (char *)bs);
+    SvUTF8_off(sv);
+}
+
+static void
+c_wstr2sv(SV *      const sv,
+          wchar_t * const ws) {
+/*----------------------------------------------------------------------------
+  Set SV to a Perl string holding a given wide string
+-----------------------------------------------------------------------------*/
+    wint_t *ws_p;
+    int need_utf8 = 0;
+    size_t ws_len = wcslen(ws);
+    
+    for (ws_p = ws; *ws_p; ws_p++) {
+        if (*ws_p > 0xff) {
+            need_utf8 = 1;
+            break;
+        }
+    }
+    SvPOK_on(sv);
+    if (need_utf8) {
+        U8 *u8, *u8_p;
+        u8 = (U8 *)sv_grow(sv, (ws_len + 1) * UTF8_MAXBYTES);
+        for (ws_p = ws, u8_p = u8; *ws_p; ws_p++)
+            u8_p = uvchr_to_utf8(u8_p, *ws_p);
+        *u8_p = 0;
+        SvCUR_set(sv, u8_p - u8);
+        SvUTF8_on(sv);
+    } else {
+        U8 *u8, *u8_p;
+        u8 = (U8 *)sv_grow(sv, ws_len + 1);
+        for (ws_p = ws, u8_p = u8; *ws_p; ws_p++, u8_p++)
+            *u8_p = *ws_p;
+        *u8_p = 0;
+        SvCUR_set(sv, ws_len);
+        SvUTF8_off(sv);
+    }
+}
+
+static wint_t
+c_sv2wchar(SV * const sv) {
+/*----------------------------------------------------------------------------
+   Extract a wide character from a SV holding a one-character Perl string
+
+   Fails (returning WEOF) if SV doesn't hold a string or the string is not one
+   character long.
+-----------------------------------------------------------------------------*/
+    U8 *s;
+    STRLEN s_len;
+    if (!SvPOK(sv))
+        return WEOF;
+    s = (U8 *)SvPV(sv, s_len);
+    if (s_len == 0)
+        return WEOF;
+    if (SvUTF8(sv)) {
+        STRLEN len;
+        UV uv = utf8_to_uvchr_buf(s, s + s_len, &len);
+        if (len != s_len)
+            return WEOF;
+        return (wint_t) uv;
+    } else {
+        if (s_len != 1)
+            return WEOF;
+        return *s;
+    }
+}
+
+static unsigned char *
+c_sv2bstr(SV *     const sv,
+          size_t * const b_len,
+          int *    const need_free) {
+/*----------------------------------------------------------------------------
+  Extract a char (byte) string from a SV holding a Perl string
+
+  Fails (returning NULL) if SV doesn't hold a string or the string has
+  characters not fitting into a byte or doesn't UTF-8 decode
+
+  Set b_len to length of result.
+
+   Caller must free() result if we set need_free.
+-----------------------------------------------------------------------------*/
+    U8 *s, *s_p, *s_end;
+    STRLEN s_len;
+    unsigned char *bs, *bs_p;
+
+    if (!SvPOK(sv)) {
+        *need_free = 0;
+        return NULL;
+    }
+    s = (U8 *)SvPV(sv, s_len);
+    s_p = s;
+    s_end = s + s_len;
+    if (SvUTF8(sv)) {
+        bs = malloc(s_len + 1);
+            /* number of bytes is an upper bound on the number of characters */
+        if (bs == NULL) croak("c_sv2bstr: malloc");
+        bs_p = bs;
+        while (s_p < s_end) {
+            if (UTF8_IS_INVARIANT(*s_p)) {
+                *bs_p++ = *s_p++;
+            } else {
+                STRLEN len;
+                UV uv = utf8_to_uvchr_buf(s_p, s_end, &len);
+                if (uv > 0xff) {
+                    *need_free = 0;
+                    *b_len = 0;
+                    return NULL;
+                }
+                *bs_p++ = uv;
+                s_p += len;
+            }
+        }
+        if (s_p != s_end) {
+            *need_free = 0;
+            *b_len = 0;
+            return NULL;
+        }
+        *bs_p = 0;
+        *b_len = s_len;
+        *need_free = 1;
+        return bs;
+    } else {
+        *need_free = 0;
+        *b_len = s_len;
+        return (unsigned char *)s;
+    }
+
+}
+
+static wint_t *
+c_sv2wstr(SV *     const sv,
+          size_t * const w_len) {
+/*----------------------------------------------------------------------------
+   Extract a wide char string from a SV holding a Perl string.
+
+   Fails (returning NULL) if SV doesn't hold a string or doesn't UTF-8
+   decode.
+
+   set w_len s to length of result.
+
+   Caller must free() result
+-----------------------------------------------------------------------------*/
+    U8 *s, *s_p, *s_end;
+    STRLEN s_len;
+    wint_t *ws, *ws_p;
+
+    if (!SvPOK(sv)) return NULL;
+    s = (U8 *)SvPV(sv, s_len);
+    s_p = s;
+    s_end = s + s_len;
+    ws = malloc((s_len + 1) * sizeof(*ws));
+        /* number of bytes is an upper bound on the number of characters */
+    if (ws == NULL) croak("c_sv2wstr: malloc");
+    ws_p = ws;
+    if (SvUTF8(sv)) {
+        while (s_p < s_end) {
+            if (UTF8_IS_INVARIANT(*s_p)) {
+                *ws_p++ = *s_p++;
+            } else {
+                STRLEN len;
+                *ws_p++ = utf8_to_uvchr_buf(s_p, s_end, &len);
+                s_p += len;
+            }
+        }
+        if (s_p != s_end) {
+            free(ws);
+            *w_len = 0;
+            return NULL;
+        }
+    } else {
+        s_p = s;
+        while (s_p < s_end) {
+            *ws_p++ = *s_p++;
+        }
+    }
+    *ws_p = 0;
+    *w_len = s_len;
+    return ws;
+}
+
@@ -11,6 +11,35 @@ The module has always been distributed via CPAN.
 Curses itself is much older than the Perl implementation.  Curses was
 originally only a C programming library.
 
+New in 1.30 (Released April 15, 2014)
+
+  Fix build failure: Don't provide the wide character functions if Perl is too
+  old to have the 'utf8_to_uvchr_buf' function they use.  Broken in 1.29.
+
+  Fix "constant not provided by your vendor" message when you refer to a
+  function that does not exist in the Curses module.
+
+  Minor fixes to documentation of new wide character functions.
+
+  Fix warning about extra argument to c_setmevent .
+
+  Fix documentation for "not defined in your Curses library" errors.
+  (broken in 1.28).
+
+  Fix demo programs' recognition of "not defined in your Curses library"
+  errors (broken in 1.28).
+
+New in 1.29 (Released April 6, 2014)
+
+  Add an alternate set of functions (getchar, ungetchar, getstring,
+  instring, addstring, insstring) providing a more Perl-like interface,
+  converting from and to Perl strings (instead of passing data to the C
+  library verbatim) and using wide character functions if available in the
+  underlying curses library.
+
+  Written by Edgar Fu%81ß, Mathematisches Institut der Uni Bonn,
+  <ef@math.uni-bonn.de>
+
 New in 1.28 (Released January 27, 2010)
 
   Disable Curses::Var::STORE.  It doesn't work (doesn't even compile) with
@@ -35,11 +35,16 @@ Steps to release:
     in there by name (Curses::Window, Curses::Screen, etc.).
 
 
-For Bryan's test system:
+For Bryan's Giraffe test system:
 
   export CURSES_LDFLAGS="-L/usr/link/ncurses -lncurses -ldl"
   export CURSES_CFLAGS="-I/usr/include/ncurses"
 
+For Bryan's Rhino test system:
+
+  Copy hints/c-linux.ncurses.h as c-config.h and edit it
+  to say #include "/usr/include/form.h"
+
 
 GEN
 ---
@@ -12,6 +12,7 @@ use strict;
 #use warnings;   Can't use; new since Perl 5.005; use perl -w instead
 use ExtUtils::MakeMaker;
 use English;
+use Config;
 
 #  Here are the arguments defined for this file:
 #
@@ -565,8 +566,8 @@ my $components =
     ($menus  ? " MENUS "  : "") .
     ($forms  ? " FORMS "  : "");
 
-WriteMakefile(NAME         =>   'Curses',
-              INC          =>   "$panel_inc $menu_inc $form_inc $inc",
+WriteMakefile(NAME         => 'Curses',
+              INC          => "$panel_inc $menu_inc $form_inc $inc",
               LIBS         => [ "$panel_libs $menu_libs $form_libs $libs" ],
               H            => [ 'CursesDef.h'                   ],
               clean        => { FILES      => $clean              },
@@ -607,11 +608,25 @@ EOM
     if ($gen) {
         $mf .= <<EOM;
 
-Curses.c    :: CursesFun.c CursesVar.c CursesCon.c CursesTyp.h CursesBoot.c
+Curses.c    :: \\
+  CursesWide.c \\
+  CursesFun.c \\
+  CursesFunWide.c \\
+  CursesVar.c \\
+  CursesCon.c \\
+  CursesTyp.h \\
+  CursesBoot.c
 	@\$(NOOP)
 
-config      :: list.syms Curses.pm \\
-               CursesFun.c CursesVar.c CursesCon.c CursesTyp.h CursesBoot.c
+config      :: \\
+  list.syms \\
+  Curses.pm \\
+  CursesFun.c \\
+  CursesFunWide.c \\
+  CursesVar.c \\
+  CursesCon.c \\
+  CursesTyp.h \\
+  CursesBoot.c
 
 list.syms    : gen/make.list.syms gen/list.fun gen/list.var gen/list.typ
 	\$(PERL) gen/make.list.syms
@@ -75,32 +75,19 @@ In order to avoid this problem, use the alternate functions:
    inchnstr()
    innstr()
 
-which take an extra "size of buffer" argument.
+which take an extra "size of buffer" argument or the wide-character-aware
+getstring() and instring() versions.
 
 
 Known Problems
 --------------
-Wide characters
-
-   Screen positions get calculated wrong, i.e. based on the number of
-   bytes in a string instead of the number of characters.
-
-   You should debug this, fix it, and submit the fix for inclusion in
-   the next release of Perl Curses.
-
-   Note that unless you have and build for the wide-character-capable
-   Ncurses (named 'ncursesw'), wide characters won't work even this much.
-   
-
 NCurses
    getch() and getstr() don't work right under very old versions of
-   ncurses (around v1.8.5).  Please upgrade to a newer version.
+   ncurses (around v1.8.5).
 
-   panel_hidden() test is reversed in v1.9.9g.  Please upgrade to
-   a newer version.
+   panel_hidden() test is reversed in v1.9.9g.
 
-   Actually, there are several problems in v1.9.9g.  Please upgrade
-   to a newer version.
+   Actually, there are several problems in v1.9.9g.
 
 NETBSD
 
@@ -138,7 +138,7 @@ sub demo() {
     noecho();
 
     eval { new_form() };
-    if ($@ =~ m{not defined by your vendor}) {
+    if ($@ =~ m{not defined in your Curses library}) {
         print STDERR "Curses was not compiled with form function.\n";
         exit 1;
     }
@@ -8,7 +8,7 @@ use ExtUtils::testlib;
 use Curses;
 
 eval { new_menu() };
-if ($@ =~ /not defined by your vendor/) {
+if ($@ =~ m{not defined in your Curses library}) {
     print STDERR "Curses was not compiled with menu function.\n";
     exit 1;
 }
@@ -6,7 +6,7 @@ use ExtUtils::testlib;
 use Curses;
 
 eval { new_panel() };
-if ($@ =~ /not defined by your vendor/) {
+if ($@ =~ m{not defined in your Curses library}) {
     print STDERR "Curses was not compiled with panel function.\n";
     exit 1;
 }
@@ -17,15 +17,15 @@
 
 #include <curses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -17,15 +17,15 @@
 
 #include <curses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -6,15 +6,15 @@
 
 #include <curses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -9,15 +9,15 @@
 
 #include <curses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -8,15 +8,15 @@
 
 #include <curses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -10,15 +10,15 @@
 
 #include <ncurses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -6,17 +6,17 @@
 
 #include <ncurses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -8,15 +8,15 @@
 
 #include <curses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -9,15 +9,15 @@
 #include <curses.h>
 /* #include <term.h> */
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -8,15 +8,15 @@
 
 #include <curses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -8,15 +8,15 @@
 
 #include <curses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -8,15 +8,15 @@
 
 #include <ncurses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -6,15 +6,15 @@
 
 #include <ncurses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -6,15 +6,15 @@
 
 #include <curses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -9,15 +9,15 @@
 
 #include <ncurses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -6,15 +6,15 @@
 
 #include <curses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -6,15 +6,15 @@
 
 #include <ncurses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -14,15 +14,15 @@
 
 #include <curses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -8,15 +8,15 @@
 
 #include <curses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -2,17 +2,17 @@
 #include <curses.h>
 
 /* Change <panel.h> below to the proper "include" file for panels. */
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
 /* Change <menu.h> below to the proper "include" file for menus. */
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
 /* Change <form.h> below to the proper "include" file for forms. */
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -8,15 +8,15 @@
 
 #include <curses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -8,15 +8,15 @@
 
 #include <curses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -8,15 +8,15 @@
 
 #include <curses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -8,15 +8,15 @@
 
 #include <curses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -8,15 +8,15 @@
 
 #include <ncurses.h>   /* or curses.h */
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -26,15 +26,15 @@
 
 #include <curses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -9,15 +9,15 @@
 
 #include <curses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -8,15 +8,15 @@
 
 #include <curses.h>
 
-#ifdef C_PANELSUPPORT
+#ifdef C_PANELFUNCTION
 #include <panel.h>
 #endif
 
-#ifdef C_MENUSUPPORT
+#ifdef C_MENUFUNCTION
 #include <menu.h>
 #endif
 
-#ifdef C_FORMSUPPORT
+#ifdef C_FORMFUNCTION
 #include <form.h>
 #endif
 
@@ -347,3 +347,9 @@ T  chtype
 T  MEVENT
 T  mmask_t
 T  SCREEN
+E  waddnwstr(stdscr,0,0)
+E  wget_wch(stdscr,0)
+E  wgetn_wstr(stdscr,0,0)
+E  winnwstr(stdscr,0,0)
+E  wins_nwstr(stdscr,0,0)
+E  unget_wch(0)
@@ -189,17 +189,17 @@ EOHDR
 
 print OUTH 
     $panels ? "#define " : "#undef  ",
-    "C_PANELSUPPORT          /* Add in panel library function?             */",
+    "C_PANELFUNCTION         /* Add in panel library function?             */",
     "\n\n";
 
 print OUTH 
     $menus ? "#define " : "#undef  ",
-    "C_MENUSUPPORT           /* Add in menu library function?              */",
+    "C_MENUFUNCTION         /* Add in menu library function?              */",
     "\n\n";
 
 print OUTH 
     $forms ? "#define " : "#undef  ",
-    "C_FORMSUPPORT           /* Add in form library function?              */",
+    "C_FORMFUNCTION          /* Add in form library function?              */",
     "\n\n";
 
 # Some functions return either int or void, depending on what compiler
@@ -230,7 +230,7 @@ while (<IN>) {
     $cmd =~ s{_C_FILE_}{$file}g;
 
     print LOG $cmd, "\n"      if $verbose;
-    my $ret = `$cmd`;
+    my $ret = qx{$cmd};
     my $rc  = $?;
     print LOG $ret            if $verbose;
     print LOG "(rc = $rc)\n"  if $verbose;
@@ -1,3 +1,11 @@
+/* This is a program that 'test.syms' test-compiles to determine if a function
+   has an integer return value.
+
+   'test.syms' defines macro SYM on the compile command.
+*/
+
+#define _XOPEN_SOURCE_EXTENDED  /* We expect wide character functions */
+
 #include "c-config.h"
 
 main() {
@@ -1,3 +1,11 @@
+/* This is a program that 'test.syms' test-compiles to determine if a symbol
+   exists in the Curses library.
+
+   'test.syms' defines macro SYM on the compile command.
+*/
+
+#define _XOPEN_SOURCE_EXTENDED  /* We expect wide character functions */
+
 #include "c-config.h"
 
 main() {
@@ -1,3 +1,11 @@
+/* This is a program that 'test.syms' test-compiles to determine if a type
+   is defined in curses.h.
+
+   'test.syms' defines macro SYM on the compile command.
+*/
+
+#define _XOPEN_SOURCE_EXTENDED  /* We expect wide character functions */
+
 #include "c-config.h"
 
 main() {