Update to ncurses-6.0

Change-Id: I98ab2ea8a5e13cca9f8b7cf6277b9b14a4da4299
diff --git a/form/Makefile b/form/Makefile
deleted file mode 100644
index a641849..0000000
--- a/form/Makefile
+++ /dev/null
@@ -1,768 +0,0 @@
-# $Id: Makefile.in,v 1.47 2007/04/28 14:56:11 tom Exp $
-##############################################################################
-# Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.                #
-#                                                                            #
-# Permission is hereby granted, free of charge, to any person obtaining a    #
-# copy of this software and associated documentation files (the "Software"), #
-# to deal in the Software without restriction, including without limitation  #
-# the rights to use, copy, modify, merge, publish, distribute, distribute    #
-# with modifications, sublicense, and/or sell copies of the Software, and to #
-# permit persons to whom the Software is furnished to do so, subject to the  #
-# following conditions:                                                      #
-#                                                                            #
-# The above copyright notice and this permission notice shall be included in #
-# all copies or substantial portions of the Software.                        #
-#                                                                            #
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
-# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
-# DEALINGS IN THE SOFTWARE.                                                  #
-#                                                                            #
-# Except as contained in this notice, the name(s) of the above copyright     #
-# holders shall not be used in advertising or otherwise to promote the sale, #
-# use or other dealings in this Software without prior written               #
-# authorization.                                                             #
-##############################################################################
-#
-# Author: Thomas E. Dickey 1996-on
-#
-# Makefile for form source code.
-#
-# This makes the following:
-#	libraries (normal/debug/profile/shared)
-#
-# The variable 'srcdir' refers to the source-distribution, and can be set with
-# the configure script by "--srcdir=DIR".
-#
-# The rules are organized to produce the libraries for the configured models,
-
-# turn off _all_ suffix rules; we'll generate our own
-.SUFFIXES:
-
-SHELL		= /bin/sh
-THIS		= Makefile
-
-x		= 
-o		= .o
-
-MODEL		= normal
-DESTDIR		= 
-srcdir		= .
-prefix		= /usr/local
-exec_prefix	= ${prefix}
-bindir		= ${exec_prefix}/bin
-libdir		= ${exec_prefix}/lib
-includedir	= ${prefix}/include/ncurses
-
-LIBTOOL		= 
-LIBTOOL_CLEAN	= 
-LIBTOOL_COMPILE	= 
-LIBTOOL_LINK	= ${CC}
-LIBTOOL_INSTALL	= 
-LIBTOOL_UNINSTALL = 
-
-INSTALL		= /usr/bin/install -c
-INSTALL_LIB	= /usr/bin/install -c -m 644
-INSTALL_PROG	= ${INSTALL}
-INSTALL_DATA	= ${INSTALL} -m 644
-
-AR		= arm-eabi-ar
-AR_OPTS		= rv
-AWK		= mawk
-LD		= arm-eabi-ld
-LN_S		= ln -s
-
-CC		= agcc.pl
-CPP		= agcc.pl -E
-CFLAGS		= -O2 --param max-inline-insns-single=1200
-
-CPPFLAGS	= -I../ncurses -DHAVE_CONFIG_H -I. -I../include  -U_XOPEN_SOURCE -D_XOPEN_SOURCE=500 -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=199506L -DNDEBUG -I${includedir}
-
-CCFLAGS		= $(CPPFLAGS) $(CFLAGS)
-
-CFLAGS_LIBTOOL	= $(CCFLAGS)
-CFLAGS_NORMAL	= $(CCFLAGS)
-CFLAGS_DEBUG	= $(CCFLAGS) -g -DTRACE
-CFLAGS_PROFILE	= $(CCFLAGS) -pg
-CFLAGS_SHARED	= $(CCFLAGS) unknown
-
-CFLAGS_DEFAULT	= $(CFLAGS_NORMAL)
-
-LINK		= $(LIBTOOL_LINK)
-LDFLAGS		=   
-
-SHLIB_DIRS	= -L../lib
-SHLIB_LIST	= $(SHLIB_DIRS) -lncurses 
-
-MK_SHARED_LIB	= echo unknown
-
-NCURSES_MAJOR	= 5
-NCURSES_MINOR	= 7
-REL_VERSION	= 5.7
-ABI_VERSION	= 5
-
-RANLIB		= arm-eabi-ranlib
-
-LIBRARIES	=  ../lib/libform.a ../lib/libform_g.a
-
-LINT		= 
-LINT_OPTS	= 
-LINT_LIBS	= -lform -lncurses 
-
-AUTO_SRC	= \
-		../include/form.h
-
-################################################################################
-all \
-libs \
-install ::	$(AUTO_SRC) $(LIBRARIES)
-
-sources :	$(AUTO_SRC)
-
-$(DESTDIR)$(bindir) \
-$(DESTDIR)$(libdir) :
-	sh $(srcdir)/../mkdirs.sh $@
-
-# make copies to simplify include-paths while still keeping form's include
-# file in this directory.
-../include/form.h : $(srcdir)/form.h
-	-rm -f $@
-	cp $(srcdir)/form.h $@
-
-FORM_PRIV_H = \
-	$(srcdir)/form.priv.h \
-	$(srcdir)/form.h \
-	../include/mf_common.h \
-	../include/curses.h \
-	../include/eti.h
-
-tags:
-	ctags *.[ch]
-
-TAGS:
-	etags *.[ch]
-
-mostlyclean ::
-	-rm -f core tags TAGS *~ *.bak *.i *.ln *.atac trace
-
-clean :: mostlyclean
-	-rm -f $(AUTO_SRC)
-
-distclean :: clean
-	-rm -f Makefile
-
-realclean :: distclean
-
-../include/mf_common.h \
-../include/eti.h :
-	cd ../menu && $(MAKE) $@
-
-###############################################################################
-# The remainder of this file is automatically generated during configuration
-###############################################################################
-
-# generated by mk-0th.awk
-#   libname:    form
-#   subsets:    ticlib+termlib+ext_tinfo+base+ext_funcs
-
-.SUFFIXES: .c .cc .h .i .ii
-.c.i :
-	$(CPP) $(CPPFLAGS) $< >$@
-.cc.ii :
-	$(CPP) $(CPPFLAGS) $< >$@
-.h.i :
-	$(CPP) $(CPPFLAGS) $< >$@
-
-C_SRC = \
-	$(srcdir)/f_trace.c \
-	$(srcdir)/fld_arg.c \
-	$(srcdir)/fld_attr.c \
-	$(srcdir)/fld_current.c \
-	$(srcdir)/fld_def.c \
-	$(srcdir)/fld_dup.c \
-	$(srcdir)/fld_ftchoice.c \
-	$(srcdir)/fld_ftlink.c \
-	$(srcdir)/fld_info.c \
-	$(srcdir)/fld_just.c \
-	$(srcdir)/fld_link.c \
-	$(srcdir)/fld_max.c \
-	$(srcdir)/fld_move.c \
-	$(srcdir)/fld_newftyp.c \
-	$(srcdir)/fld_opts.c \
-	$(srcdir)/fld_pad.c \
-	$(srcdir)/fld_page.c \
-	$(srcdir)/fld_stat.c \
-	$(srcdir)/fld_type.c \
-	$(srcdir)/fld_user.c \
-	$(srcdir)/frm_cursor.c \
-	$(srcdir)/frm_data.c \
-	$(srcdir)/frm_def.c \
-	$(srcdir)/frm_driver.c \
-	$(srcdir)/frm_hook.c \
-	$(srcdir)/frm_opts.c \
-	$(srcdir)/frm_page.c \
-	$(srcdir)/frm_post.c \
-	$(srcdir)/frm_req_name.c \
-	$(srcdir)/frm_scale.c \
-	$(srcdir)/frm_sub.c \
-	$(srcdir)/frm_user.c \
-	$(srcdir)/frm_win.c \
-	$(srcdir)/fty_alnum.c \
-	$(srcdir)/fty_alpha.c \
-	$(srcdir)/fty_enum.c \
-	$(srcdir)/fty_int.c \
-	$(srcdir)/fty_ipv4.c \
-	$(srcdir)/fty_num.c \
-	$(srcdir)/fty_regex.c
-
-# Producing llib-lform is time-consuming, so there's no direct-dependency for
-# it in the lintlib rule.  We'll only remove in the cleanest setup.
-clean ::
-	rm -f llib-lform.*
-
-realclean ::
-	rm -f llib-lform
-
-llib-lform : $(C_SRC)
-	cproto -a -l -DNCURSES_ENABLE_STDBOOL_H=0 -DLINT $(CPPFLAGS) $(C_SRC) >$@
-
-lintlib :
-	sh $(srcdir)/../misc/makellib form $(CPPFLAGS)
-lint :
-	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(C_SRC) $(LINT_LIBS)
-
-# generated by mk-1st.awk (subset=ticlib+termlib+ext_tinfo+base+ext_funcs)
-#  name:          form
-#  traces:        DEBUG
-#  MODEL:         NORMAL
-#  model:         objects
-#  prefix:        lib
-#  suffix:        .a
-#  subset:        ticlib+termlib+ext_tinfo+base+ext_funcs
-#  ShlibVer:      auto
-#  ShlibVerInfix: no
-#  TermlibRoot:   ncurses
-#  TermlibSuffix: .a
-#  ReLink:        
-#  DoLinks:       no
-#  rmSoLocs:      no
-#  ldconfig:      :
-#  overwrite:     no
-#  depend:        ../include/ncurses_cfg.h ./form.priv.h
-#  host:          arm-unknown-eabi
-
-NORMAL_OBJS = \
-	../objects/fld_arg$o \
-	../objects/fld_attr$o \
-	../objects/fld_current$o \
-	../objects/fld_def$o \
-	../objects/fld_dup$o \
-	../objects/fld_ftchoice$o \
-	../objects/fld_ftlink$o \
-	../objects/fld_info$o \
-	../objects/fld_just$o \
-	../objects/fld_link$o \
-	../objects/fld_max$o \
-	../objects/fld_move$o \
-	../objects/fld_newftyp$o \
-	../objects/fld_opts$o \
-	../objects/fld_pad$o \
-	../objects/fld_page$o \
-	../objects/fld_stat$o \
-	../objects/fld_type$o \
-	../objects/fld_user$o \
-	../objects/frm_cursor$o \
-	../objects/frm_data$o \
-	../objects/frm_def$o \
-	../objects/frm_driver$o \
-	../objects/frm_hook$o \
-	../objects/frm_opts$o \
-	../objects/frm_page$o \
-	../objects/frm_post$o \
-	../objects/frm_req_name$o \
-	../objects/frm_scale$o \
-	../objects/frm_sub$o \
-	../objects/frm_user$o \
-	../objects/frm_win$o \
-	../objects/fty_alnum$o \
-	../objects/fty_alpha$o \
-	../objects/fty_enum$o \
-	../objects/fty_int$o \
-	../objects/fty_ipv4$o \
-	../objects/fty_num$o \
-	../objects/fty_regex$o
-
-$(NORMAL_OBJS) : ../include/ncurses_cfg.h ./form.priv.h
-
-../lib/libform.a : $(NORMAL_OBJS)
-	$(AR) $(AR_OPTS) $@ $?
-	$(RANLIB) $@
-
-install \
-install.libs \
-install.form :: $(DESTDIR)$(libdir) ../lib/libform.a
-	@echo installing ../lib/libform.a as $(DESTDIR)$(libdir)/libform.a
-	$(INSTALL_DATA) ../lib/libform.a $(DESTDIR)$(libdir)/libform.a
-	$(RANLIB) $(DESTDIR)$(libdir)/libform.a
-
-uninstall \
-uninstall.libs \
-uninstall.form ::
-	@echo uninstalling $(DESTDIR)$(libdir)/libform.a
-	-@rm -f $(DESTDIR)$(libdir)/libform.a
-
-clean ::
-	-rm -f ../lib/libform.a
-
-mostlyclean::
-	-rm -f $(NORMAL_OBJS)
-
-# generated by mk-2nd.awk
-#   model:      objects
-#   MODEL:      NORMAL
-#   echo:       yes
-#   subset:     ticlib+termlib+ext_tinfo+base+ext_funcs
-#   crenames:   yes
-#   cxxrenames: no
-#   traces:     DEBUG
-#   srcdir:     .
-
-../objects/fld_arg$o :	$(srcdir)/fld_arg.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_arg.c -o ../objects/fld_arg$o
-
-../objects/fld_attr$o :	$(srcdir)/fld_attr.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_attr.c -o ../objects/fld_attr$o
-
-../objects/fld_current$o :	$(srcdir)/fld_current.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_current.c -o ../objects/fld_current$o
-
-../objects/fld_def$o :	$(srcdir)/fld_def.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_def.c -o ../objects/fld_def$o
-
-../objects/fld_dup$o :	$(srcdir)/fld_dup.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_dup.c -o ../objects/fld_dup$o
-
-../objects/fld_ftchoice$o :	$(srcdir)/fld_ftchoice.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_ftchoice.c -o ../objects/fld_ftchoice$o
-
-../objects/fld_ftlink$o :	$(srcdir)/fld_ftlink.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_ftlink.c -o ../objects/fld_ftlink$o
-
-../objects/fld_info$o :	$(srcdir)/fld_info.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_info.c -o ../objects/fld_info$o
-
-../objects/fld_just$o :	$(srcdir)/fld_just.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_just.c -o ../objects/fld_just$o
-
-../objects/fld_link$o :	$(srcdir)/fld_link.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_link.c -o ../objects/fld_link$o
-
-../objects/fld_max$o :	$(srcdir)/fld_max.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_max.c -o ../objects/fld_max$o
-
-../objects/fld_move$o :	$(srcdir)/fld_move.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_move.c -o ../objects/fld_move$o
-
-../objects/fld_newftyp$o :	$(srcdir)/fld_newftyp.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_newftyp.c -o ../objects/fld_newftyp$o
-
-../objects/fld_opts$o :	$(srcdir)/fld_opts.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_opts.c -o ../objects/fld_opts$o
-
-../objects/fld_pad$o :	$(srcdir)/fld_pad.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_pad.c -o ../objects/fld_pad$o
-
-../objects/fld_page$o :	$(srcdir)/fld_page.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_page.c -o ../objects/fld_page$o
-
-../objects/fld_stat$o :	$(srcdir)/fld_stat.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_stat.c -o ../objects/fld_stat$o
-
-../objects/fld_type$o :	$(srcdir)/fld_type.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_type.c -o ../objects/fld_type$o
-
-../objects/fld_user$o :	$(srcdir)/fld_user.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_user.c -o ../objects/fld_user$o
-
-../objects/frm_cursor$o :	$(srcdir)/frm_cursor.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_cursor.c -o ../objects/frm_cursor$o
-
-../objects/frm_data$o :	$(srcdir)/frm_data.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_data.c -o ../objects/frm_data$o
-
-../objects/frm_def$o :	$(srcdir)/frm_def.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_def.c -o ../objects/frm_def$o
-
-../objects/frm_driver$o :	$(srcdir)/frm_driver.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_driver.c -o ../objects/frm_driver$o
-
-../objects/frm_hook$o :	$(srcdir)/frm_hook.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_hook.c -o ../objects/frm_hook$o
-
-../objects/frm_opts$o :	$(srcdir)/frm_opts.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_opts.c -o ../objects/frm_opts$o
-
-../objects/frm_page$o :	$(srcdir)/frm_page.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_page.c -o ../objects/frm_page$o
-
-../objects/frm_post$o :	$(srcdir)/frm_post.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_post.c -o ../objects/frm_post$o
-
-../objects/frm_req_name$o :	$(srcdir)/frm_req_name.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_req_name.c -o ../objects/frm_req_name$o
-
-../objects/frm_scale$o :	$(srcdir)/frm_scale.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_scale.c -o ../objects/frm_scale$o
-
-../objects/frm_sub$o :	$(srcdir)/frm_sub.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_sub.c -o ../objects/frm_sub$o
-
-../objects/frm_user$o :	$(srcdir)/frm_user.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_user.c -o ../objects/frm_user$o
-
-../objects/frm_win$o :	$(srcdir)/frm_win.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_win.c -o ../objects/frm_win$o
-
-../objects/fty_alnum$o :	$(srcdir)/fty_alnum.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fty_alnum.c -o ../objects/fty_alnum$o
-
-../objects/fty_alpha$o :	$(srcdir)/fty_alpha.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fty_alpha.c -o ../objects/fty_alpha$o
-
-../objects/fty_enum$o :	$(srcdir)/fty_enum.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fty_enum.c -o ../objects/fty_enum$o
-
-../objects/fty_int$o :	$(srcdir)/fty_int.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fty_int.c -o ../objects/fty_int$o
-
-../objects/fty_ipv4$o :	$(srcdir)/fty_ipv4.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fty_ipv4.c -o ../objects/fty_ipv4$o
-
-../objects/fty_num$o :	$(srcdir)/fty_num.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fty_num.c -o ../objects/fty_num$o
-
-../objects/fty_regex$o :	$(srcdir)/fty_regex.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fty_regex.c -o ../objects/fty_regex$o
-
-
-# generated by mk-1st.awk (subset=ticlib+termlib+ext_tinfo+base+ext_funcs)
-#  name:          form
-#  traces:        DEBUG
-#  MODEL:         DEBUG
-#  model:         obj_g
-#  prefix:        lib
-#  suffix:        _g.a
-#  subset:        ticlib+termlib+ext_tinfo+base+ext_funcs
-#  ShlibVer:      auto
-#  ShlibVerInfix: no
-#  TermlibRoot:   ncurses
-#  TermlibSuffix: .a
-#  ReLink:        
-#  DoLinks:       no
-#  rmSoLocs:      no
-#  ldconfig:      :
-#  overwrite:     no
-#  depend:        ../include/ncurses_cfg.h ./form.priv.h
-#  host:          arm-unknown-eabi
-
-DEBUG_OBJS = \
-	../obj_g/f_trace$o \
-	../obj_g/fld_arg$o \
-	../obj_g/fld_attr$o \
-	../obj_g/fld_current$o \
-	../obj_g/fld_def$o \
-	../obj_g/fld_dup$o \
-	../obj_g/fld_ftchoice$o \
-	../obj_g/fld_ftlink$o \
-	../obj_g/fld_info$o \
-	../obj_g/fld_just$o \
-	../obj_g/fld_link$o \
-	../obj_g/fld_max$o \
-	../obj_g/fld_move$o \
-	../obj_g/fld_newftyp$o \
-	../obj_g/fld_opts$o \
-	../obj_g/fld_pad$o \
-	../obj_g/fld_page$o \
-	../obj_g/fld_stat$o \
-	../obj_g/fld_type$o \
-	../obj_g/fld_user$o \
-	../obj_g/frm_cursor$o \
-	../obj_g/frm_data$o \
-	../obj_g/frm_def$o \
-	../obj_g/frm_driver$o \
-	../obj_g/frm_hook$o \
-	../obj_g/frm_opts$o \
-	../obj_g/frm_page$o \
-	../obj_g/frm_post$o \
-	../obj_g/frm_req_name$o \
-	../obj_g/frm_scale$o \
-	../obj_g/frm_sub$o \
-	../obj_g/frm_user$o \
-	../obj_g/frm_win$o \
-	../obj_g/fty_alnum$o \
-	../obj_g/fty_alpha$o \
-	../obj_g/fty_enum$o \
-	../obj_g/fty_int$o \
-	../obj_g/fty_ipv4$o \
-	../obj_g/fty_num$o \
-	../obj_g/fty_regex$o
-
-$(DEBUG_OBJS) : ../include/ncurses_cfg.h ./form.priv.h
-
-../lib/libform_g.a : $(DEBUG_OBJS)
-	$(AR) $(AR_OPTS) $@ $?
-	$(RANLIB) $@
-
-install \
-install.libs \
-install.form :: $(DESTDIR)$(libdir) ../lib/libform_g.a
-	@echo installing ../lib/libform_g.a as $(DESTDIR)$(libdir)/libform_g.a
-	$(INSTALL_DATA) ../lib/libform_g.a $(DESTDIR)$(libdir)/libform_g.a
-	$(RANLIB) $(DESTDIR)$(libdir)/libform_g.a
-
-uninstall \
-uninstall.libs \
-uninstall.form ::
-	@echo uninstalling $(DESTDIR)$(libdir)/libform_g.a
-	-@rm -f $(DESTDIR)$(libdir)/libform_g.a
-
-clean ::
-	-rm -f ../lib/libform_g.a
-
-mostlyclean::
-	-rm -f $(DEBUG_OBJS)
-
-# generated by mk-2nd.awk
-#   model:      obj_g
-#   MODEL:      DEBUG
-#   echo:       yes
-#   subset:     ticlib+termlib+ext_tinfo+base+ext_funcs
-#   crenames:   yes
-#   cxxrenames: no
-#   traces:     DEBUG
-#   srcdir:     .
-
-../obj_g/f_trace$o :	$(srcdir)/f_trace.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/f_trace.c -o ../obj_g/f_trace$o
-
-../obj_g/fld_arg$o :	$(srcdir)/fld_arg.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_arg.c -o ../obj_g/fld_arg$o
-
-../obj_g/fld_attr$o :	$(srcdir)/fld_attr.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_attr.c -o ../obj_g/fld_attr$o
-
-../obj_g/fld_current$o :	$(srcdir)/fld_current.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_current.c -o ../obj_g/fld_current$o
-
-../obj_g/fld_def$o :	$(srcdir)/fld_def.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_def.c -o ../obj_g/fld_def$o
-
-../obj_g/fld_dup$o :	$(srcdir)/fld_dup.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_dup.c -o ../obj_g/fld_dup$o
-
-../obj_g/fld_ftchoice$o :	$(srcdir)/fld_ftchoice.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_ftchoice.c -o ../obj_g/fld_ftchoice$o
-
-../obj_g/fld_ftlink$o :	$(srcdir)/fld_ftlink.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_ftlink.c -o ../obj_g/fld_ftlink$o
-
-../obj_g/fld_info$o :	$(srcdir)/fld_info.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_info.c -o ../obj_g/fld_info$o
-
-../obj_g/fld_just$o :	$(srcdir)/fld_just.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_just.c -o ../obj_g/fld_just$o
-
-../obj_g/fld_link$o :	$(srcdir)/fld_link.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_link.c -o ../obj_g/fld_link$o
-
-../obj_g/fld_max$o :	$(srcdir)/fld_max.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_max.c -o ../obj_g/fld_max$o
-
-../obj_g/fld_move$o :	$(srcdir)/fld_move.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_move.c -o ../obj_g/fld_move$o
-
-../obj_g/fld_newftyp$o :	$(srcdir)/fld_newftyp.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_newftyp.c -o ../obj_g/fld_newftyp$o
-
-../obj_g/fld_opts$o :	$(srcdir)/fld_opts.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_opts.c -o ../obj_g/fld_opts$o
-
-../obj_g/fld_pad$o :	$(srcdir)/fld_pad.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_pad.c -o ../obj_g/fld_pad$o
-
-../obj_g/fld_page$o :	$(srcdir)/fld_page.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_page.c -o ../obj_g/fld_page$o
-
-../obj_g/fld_stat$o :	$(srcdir)/fld_stat.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_stat.c -o ../obj_g/fld_stat$o
-
-../obj_g/fld_type$o :	$(srcdir)/fld_type.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_type.c -o ../obj_g/fld_type$o
-
-../obj_g/fld_user$o :	$(srcdir)/fld_user.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_user.c -o ../obj_g/fld_user$o
-
-../obj_g/frm_cursor$o :	$(srcdir)/frm_cursor.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_cursor.c -o ../obj_g/frm_cursor$o
-
-../obj_g/frm_data$o :	$(srcdir)/frm_data.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_data.c -o ../obj_g/frm_data$o
-
-../obj_g/frm_def$o :	$(srcdir)/frm_def.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_def.c -o ../obj_g/frm_def$o
-
-../obj_g/frm_driver$o :	$(srcdir)/frm_driver.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_driver.c -o ../obj_g/frm_driver$o
-
-../obj_g/frm_hook$o :	$(srcdir)/frm_hook.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_hook.c -o ../obj_g/frm_hook$o
-
-../obj_g/frm_opts$o :	$(srcdir)/frm_opts.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_opts.c -o ../obj_g/frm_opts$o
-
-../obj_g/frm_page$o :	$(srcdir)/frm_page.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_page.c -o ../obj_g/frm_page$o
-
-../obj_g/frm_post$o :	$(srcdir)/frm_post.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_post.c -o ../obj_g/frm_post$o
-
-../obj_g/frm_req_name$o :	$(srcdir)/frm_req_name.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_req_name.c -o ../obj_g/frm_req_name$o
-
-../obj_g/frm_scale$o :	$(srcdir)/frm_scale.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_scale.c -o ../obj_g/frm_scale$o
-
-../obj_g/frm_sub$o :	$(srcdir)/frm_sub.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_sub.c -o ../obj_g/frm_sub$o
-
-../obj_g/frm_user$o :	$(srcdir)/frm_user.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_user.c -o ../obj_g/frm_user$o
-
-../obj_g/frm_win$o :	$(srcdir)/frm_win.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_win.c -o ../obj_g/frm_win$o
-
-../obj_g/fty_alnum$o :	$(srcdir)/fty_alnum.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fty_alnum.c -o ../obj_g/fty_alnum$o
-
-../obj_g/fty_alpha$o :	$(srcdir)/fty_alpha.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fty_alpha.c -o ../obj_g/fty_alpha$o
-
-../obj_g/fty_enum$o :	$(srcdir)/fty_enum.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fty_enum.c -o ../obj_g/fty_enum$o
-
-../obj_g/fty_int$o :	$(srcdir)/fty_int.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fty_int.c -o ../obj_g/fty_int$o
-
-../obj_g/fty_ipv4$o :	$(srcdir)/fty_ipv4.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fty_ipv4.c -o ../obj_g/fty_ipv4$o
-
-../obj_g/fty_num$o :	$(srcdir)/fty_num.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fty_num.c -o ../obj_g/fty_num$o
-
-../obj_g/fty_regex$o :	$(srcdir)/fty_regex.c \
-			$(FORM_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fty_regex.c -o ../obj_g/fty_regex$o
-
-
-# generated by mk-hdr.awk
-#  subset:     ticlib+termlib+ext_tinfo+base+ext_funcs
-#  compat:     yes
-
-${DESTDIR}${includedir} :
-	sh ${srcdir}/../mkdirs.sh $@
-
-install \
-install.libs \
-install.includes :: ${AUTO_SRC} ${DESTDIR}${includedir} \
-		$(srcdir)/form.h
-	@ (cd ${DESTDIR}${includedir} && rm -f form.h) ; ../headers.sh ${INSTALL_DATA} ${DESTDIR}${includedir} ${srcdir} $(srcdir)/form.h
-
-uninstall \
-uninstall.libs \
-uninstall.includes ::
-	-@ (cd ${DESTDIR}${includedir} && rm -f form.h)
-depend : ${AUTO_SRC}
-	makedepend -- ${CPPFLAGS} -- ${C_SRC}
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/form/Makefile.in b/form/Makefile.in
index 2bf31e1..29b4929 100644
--- a/form/Makefile.in
+++ b/form/Makefile.in
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.47 2007/04/28 14:56:11 tom Exp $
+# $Id: Makefile.in,v 1.63 2015/08/05 23:15:41 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2014,2015 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -42,7 +42,8 @@
 # turn off _all_ suffix rules; we'll generate our own
 .SUFFIXES:
 
-SHELL		= /bin/sh
+SHELL		= @SHELL@
+VPATH		= @srcdir@
 THIS		= Makefile
 
 x		= @EXEEXT@
@@ -50,19 +51,27 @@
 
 MODEL		= @DFT_LWR_MODEL@
 DESTDIR		= @DESTDIR@
+top_srcdir	= @top_srcdir@
 srcdir		= @srcdir@
 prefix		= @prefix@
 exec_prefix	= @exec_prefix@
 bindir		= @bindir@
 libdir		= @libdir@
 includedir	= @includedir@
+includesubdir	= @includesubdir@
+
+INCLUDEDIR	= $(DESTDIR)$(includedir)$(includesubdir)
+
+PACKAGE		= @PACKAGE@
 
 LIBTOOL		= @LIBTOOL@
+LIBTOOL_OPTS	= @LIBTOOL_OPTS@ @EXPORT_SYMS@
 LIBTOOL_CLEAN	= @LIB_CLEAN@
 LIBTOOL_COMPILE	= @LIB_COMPILE@
 LIBTOOL_LINK	= @LIB_LINK@
 LIBTOOL_INSTALL	= @LIB_INSTALL@
 LIBTOOL_UNINSTALL = @LIB_UNINSTALL@
+LT_UNDEF	= @LT_UNDEF@
 
 INSTALL		= @INSTALL@
 INSTALL_LIB	= @INSTALL@ @INSTALL_LIB@
@@ -70,16 +79,19 @@
 INSTALL_DATA	= @INSTALL_DATA@
 
 AR		= @AR@
-AR_OPTS		= @AR_OPTS@
+ARFLAGS		= @ARFLAGS@
 AWK		= @AWK@
 LD		= @LD@
 LN_S		= @LN_S@
 
+CTAGS		= @CTAGS@
+ETAGS		= @ETAGS@
+
 CC		= @CC@
 CPP		= @CPP@
 CFLAGS		= @CFLAGS@
 
-CPPFLAGS	= -I@top_srcdir@/ncurses -DHAVE_CONFIG_H @CPPFLAGS@
+CPPFLAGS	= -I${top_srcdir}/ncurses -DHAVE_CONFIG_H @CPPFLAGS@
 
 CCFLAGS		= $(CPPFLAGS) $(CFLAGS)
 
@@ -95,8 +107,11 @@
 LDFLAGS		= @LDFLAGS@ @LD_MODEL@ @LIBS@
 
 SHLIB_DIRS	= -L../lib
-SHLIB_LIST	= $(SHLIB_DIRS) -lncurses@LIB_SUFFIX@ @SHLIB_LIST@
+SHLIB_LIST	= $(SHLIB_DIRS) -lncurses@USE_LIB_SUFFIX@ @SHLIB_LIST@
 
+RPATH_LIST	= @RPATH_LIST@
+RESULTING_SYMS	= @RESULTING_SYMS@
+VERSIONED_SYMS	= @VERSIONED_SYMS@
 MK_SHARED_LIB	= @MK_SHARED_LIB@
 
 NCURSES_MAJOR	= @NCURSES_MAJOR@
@@ -106,7 +121,7 @@
 
 RANLIB		= @LIB_PREP@
 
-LIBRARIES	= @LIBS_TO_MAKE@
+LIBRARIES	= @Libs_To_Make@
 
 LINT		= @LINT@
 LINT_OPTS	= @LINT_OPTS@
@@ -124,7 +139,7 @@
 
 $(DESTDIR)$(bindir) \
 $(DESTDIR)$(libdir) :
-	sh $(srcdir)/../mkdirs.sh $@
+	mkdir -p $@
 
 # make copies to simplify include-paths while still keeping form's include
 # file in this directory.
@@ -132,7 +147,7 @@
 	-rm -f $@
 	cp $(srcdir)/form.h $@
 
-FORM_PRIV_H = \
+HEADER_DEPS = \
 	$(srcdir)/form.priv.h \
 	$(srcdir)/form.h \
 	../include/mf_common.h \
@@ -140,10 +155,10 @@
 	../include/eti.h
 
 tags:
-	ctags *.[ch]
+	$(CTAGS) *.[ch]
 
 @MAKE_UPPER_TAGS@TAGS:
-@MAKE_UPPER_TAGS@	etags *.[ch]
+@MAKE_UPPER_TAGS@	$(ETAGS) *.[ch]
 
 mostlyclean ::
 	-rm -f core tags TAGS *~ *.bak *.i *.ln *.atac trace
@@ -153,6 +168,7 @@
 
 distclean :: clean
 	-rm -f Makefile
+	-rm -rf .libs *.dSYM
 
 realclean :: distclean
 
diff --git a/form/f_trace.c b/form/f_trace.c
index 3bb4ccd..6044e03 100644
--- a/form/f_trace.c
+++ b/form/f_trace.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2004 Free Software Foundation, Inc.                        *
+ * Copyright (c) 2004,2010 Free Software Foundation, Inc.                   *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,33 +32,33 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: f_trace.c,v 1.1 2004/12/25 23:28:49 tom Exp $")
+MODULE_ID("$Id: f_trace.c,v 1.2 2010/01/23 21:14:36 tom Exp $")
 
 NCURSES_EXPORT(FIELD **)
 _nc_retrace_field_ptr(FIELD **code)
 {
-  T((T_RETURN("%p"), code));
+  T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
 NCURSES_EXPORT(FIELD *)
 _nc_retrace_field(FIELD *code)
 {
-  T((T_RETURN("%p"), code));
+  T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
 NCURSES_EXPORT(FIELDTYPE *)
 _nc_retrace_field_type(FIELDTYPE *code)
 {
-  T((T_RETURN("%p"), code));
+  T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
 NCURSES_EXPORT(FORM *)
 _nc_retrace_form(FORM *code)
 {
-  T((T_RETURN("%p"), code));
+  T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
diff --git a/form/fld_arg.c b/form/fld_arg.c
index f79a157..001c1d1 100644
--- a/form/fld_arg.c
+++ b/form/fld_arg.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_arg.c,v 1.11 2004/12/25 22:20:18 tom Exp $")
+MODULE_ID("$Id: fld_arg.c,v 1.13 2012/06/10 00:27:49 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
@@ -67,11 +67,11 @@
 		  void (*const free_arg) (void *))
 {
   T((T_CALLED("set_fieldtype_arg(%p,%p,%p,%p)"),
-     typ, make_arg, copy_arg, free_arg));
+     (void *)typ, make_arg, copy_arg, free_arg));
 
   if (typ != 0 && make_arg != (void *)0)
     {
-      typ->status |= _HAS_ARGS;
+      SetStatus(typ, _HAS_ARGS);
       typ->makearg = make_arg;
       typ->copyarg = copy_arg;
       typ->freearg = free_arg;
@@ -91,7 +91,7 @@
 NCURSES_EXPORT(void *)
 field_arg(const FIELD *field)
 {
-  T((T_CALLED("field_arg(%p)"), field));
+  T((T_CALLED("field_arg(%p)"), (const void *)field));
   returnVoidPtr(Normalize_Field(field)->arg);
 }
 
diff --git a/form/fld_attr.c b/form/fld_attr.c
index c9c0838..0112f00 100644
--- a/form/fld_attr.c
+++ b/form/fld_attr.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_attr.c,v 1.10 2004/12/11 21:33:15 tom Exp $")
+MODULE_ID("$Id: fld_attr.c,v 1.11 2010/01/23 21:12:08 tom Exp $")
 
 /*----------------------------------------------------------------------------
   Field-Attribute manipulation routines
@@ -66,7 +66,7 @@
 #define GEN_FIELD_ATTR_GET_FCT( name ) \
 NCURSES_IMPEXP chtype NCURSES_API field_ ## name (const FIELD * field)\
 {\
-   T((T_CALLED("field_" #name "(%p)"), field));\
+   T((T_CALLED("field_" #name "(%p)"), (const void *) field));\
    returnAttr( A_ATTRIBUTES & (Normalize_Field( field ) -> name) );\
 }
 
diff --git a/form/fld_current.c b/form/fld_current.c
index 7c3a90a..ef9ec00 100644
--- a/form/fld_current.c
+++ b/form/fld_current.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_current.c,v 1.11 2004/12/25 22:40:13 tom Exp $")
+MODULE_ID("$Id: fld_current.c,v 1.12 2010/01/23 21:14:35 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
@@ -52,7 +52,7 @@
 {
   int err = E_OK;
 
-  T((T_CALLED("set_current_field(%p,%p)"), form, field));
+  T((T_CALLED("set_current_field(%p,%p)"), (void *)form, (void *)field));
   if (form == 0 || field == 0)
     {
       RETURN(E_BAD_ARGUMENT);
@@ -113,7 +113,7 @@
 NCURSES_EXPORT(FIELD *)
 current_field(const FORM *form)
 {
-  T((T_CALLED("current_field(%p)"), form));
+  T((T_CALLED("current_field(%p)"), (const void *)form));
   returnField(Normalize_Form(form)->current);
 }
 
@@ -130,7 +130,7 @@
 NCURSES_EXPORT(int)
 field_index(const FIELD *field)
 {
-  T((T_CALLED("field_index(%p)"), field));
+  T((T_CALLED("field_index(%p)"), (const void *)field));
   returnCode((field != 0 && field->form != 0) ? (int)field->index : -1);
 }
 
diff --git a/form/fld_def.c b/form/fld_def.c
index 3559ba6..b18462f 100644
--- a/form/fld_def.c
+++ b/form/fld_def.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2005,2007 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_def.c,v 1.36 2007/10/13 19:29:58 tom Exp $")
+MODULE_ID("$Id: fld_def.c,v 1.41 2014/07/26 21:08:55 tom Exp $")
 
 /* this can't be readonly */
 static FIELD default_field =
@@ -53,7 +53,7 @@
   (int)' ',			/* pad     */
   A_NORMAL,			/* fore    */
   A_NORMAL,			/* back    */
-  ALL_FIELD_OPTS,		/* opts    */
+  STD_FIELD_OPTS,		/* opts    */
   (FIELD *)0,			/* snext   */
   (FIELD *)0,			/* sprev   */
   (FIELD *)0,			/* link    */
@@ -65,8 +65,7 @@
   NCURSES_FIELD_EXTENSION
 };
 
-NCURSES_EXPORT_VAR(FIELD *)
-_nc_Default_Field = &default_field;
+NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field = &default_field;
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
@@ -186,10 +185,12 @@
     {
       if ((typ->status & _LINKED_TYPE) != 0)
 	{
-	  assert(argp != 0);
-	  _nc_Free_Argument(typ->left, argp->left);
-	  _nc_Free_Argument(typ->right, argp->right);
-	  free(argp);
+	  if (argp != 0)
+	    {
+	      _nc_Free_Argument(typ->left, argp->left);
+	      _nc_Free_Argument(typ->right, argp->right);
+	      free(argp);
+	    }
 	}
       else
 	{
@@ -252,8 +253,8 @@
   if (field->type != 0)
     {
       field->type->ref--;
+      _nc_Free_Argument(field->type, (TypeArgument *)(field->arg));
     }
-  _nc_Free_Argument(field->type, (TypeArgument *)(field->arg));
 }
 
 /*---------------------------------------------------------------------------
@@ -291,16 +292,16 @@
       ((err = E_SYSTEM_ERROR) != 0) &&	/* trick: this resets the default error */
       (New_Field = typeMalloc(FIELD, 1)) != 0)
     {
-      T((T_CREATE("field %p"), New_Field));
+      T((T_CREATE("field %p"), (void *)New_Field));
       *New_Field = default_field;
-      New_Field->rows = rows;
-      New_Field->cols = cols;
+      New_Field->rows = (short)rows;
+      New_Field->cols = (short)cols;
       New_Field->drows = rows + nrow;
       New_Field->dcols = cols;
-      New_Field->frow = frow;
-      New_Field->fcol = fcol;
+      New_Field->frow = (short)frow;
+      New_Field->fcol = (short)fcol;
       New_Field->nrow = nrow;
-      New_Field->nbuf = nbuf;
+      New_Field->nbuf = (short)nbuf;
       New_Field->link = New_Field;
 
 #if USE_WIDEC_SUPPORT
@@ -355,7 +356,7 @@
 NCURSES_EXPORT(int)
 free_field(FIELD *field)
 {
-  T((T_CALLED("free_field(%p)"), field));
+  T((T_CALLED("free_field(%p)"), (void *)field));
   if (!field)
     {
       RETURN(E_BAD_ARGUMENT);
diff --git a/form/fld_dup.c b/form/fld_dup.c
index bbc38a3..2df40ee 100644
--- a/form/fld_dup.c
+++ b/form/fld_dup.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2007 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_dup.c,v 1.12 2007/10/13 19:30:21 tom Exp $")
+MODULE_ID("$Id: fld_dup.c,v 1.14 2012/03/11 00:37:16 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
@@ -53,15 +53,15 @@
   FIELD *New_Field = (FIELD *)0;
   int err = E_BAD_ARGUMENT;
 
-  T((T_CALLED("dup_field(%p,%d,%d)"), field, frow, fcol));
+  T((T_CALLED("dup_field(%p,%d,%d)"), (void *)field, frow, fcol));
   if (field && (frow >= 0) && (fcol >= 0) &&
       ((err = E_SYSTEM_ERROR) != 0) &&	/* trick : this resets the default error */
       (New_Field = typeMalloc(FIELD, 1)))
     {
-      T((T_CREATE("field %p"), New_Field));
+      T((T_CREATE("field %p"), (void *)New_Field));
       *New_Field = *_nc_Default_Field;
-      New_Field->frow = frow;
-      New_Field->fcol = fcol;
+      New_Field->frow = (short) frow;
+      New_Field->fcol = (short) fcol;
       New_Field->link = New_Field;
       New_Field->rows = field->rows;
       New_Field->cols = field->cols;
diff --git a/form/fld_ftchoice.c b/form/fld_ftchoice.c
index 9237f96..0901306 100644
--- a/form/fld_ftchoice.c
+++ b/form/fld_ftchoice.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_ftchoice.c,v 1.9 2004/12/11 21:44:57 tom Exp $")
+MODULE_ID("$Id: fld_ftchoice.c,v 1.13 2012/06/10 00:27:49 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -51,14 +51,19 @@
 		     bool (*const next_choice) (FIELD *, const void *),
 		     bool (*const prev_choice) (FIELD *, const void *))
 {
-  T((T_CALLED("set_fieldtype_choice(%p,%p,%p)"), typ, next_choice, prev_choice));
+  T((T_CALLED("set_fieldtype_choice(%p,%p,%p)"), (void *)typ, next_choice, prev_choice));
 
   if (!typ || !next_choice || !prev_choice)
     RETURN(E_BAD_ARGUMENT);
 
-  typ->status |= _HAS_CHOICE;
+  SetStatus(typ, _HAS_CHOICE);
+#if NCURSES_INTEROP_FUNCS
+  typ->enum_next.onext = next_choice;
+  typ->enum_prev.oprev = prev_choice;
+#else
   typ->next = next_choice;
   typ->prev = prev_choice;
+#endif
   RETURN(E_OK);
 }
 
diff --git a/form/fld_ftlink.c b/form/fld_ftlink.c
index 4ed2219..e7b1440 100644
--- a/form/fld_ftlink.c
+++ b/form/fld_ftlink.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2007 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_ftlink.c,v 1.13 2007/10/13 19:30:35 tom Exp $")
+MODULE_ID("$Id: fld_ftlink.c,v 1.15 2012/06/10 00:27:49 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -53,20 +53,20 @@
 {
   FIELDTYPE *nftyp = (FIELDTYPE *)0;
 
-  T((T_CALLED("link_fieldtype(%p,%p)"), type1, type2));
+  T((T_CALLED("link_fieldtype(%p,%p)"), (void *)type1, (void *)type2));
   if (type1 && type2)
     {
       nftyp = typeMalloc(FIELDTYPE, 1);
 
       if (nftyp)
 	{
-	  T((T_CREATE("fieldtype %p"), nftyp));
+	  T((T_CREATE("fieldtype %p"), (void *)nftyp));
 	  *nftyp = *_nc_Default_FieldType;
-	  nftyp->status |= _LINKED_TYPE;
+	  SetStatus(nftyp, _LINKED_TYPE);
 	  if ((type1->status & _HAS_ARGS) || (type2->status & _HAS_ARGS))
-	    nftyp->status |= _HAS_ARGS;
+	    SetStatus(nftyp, _HAS_ARGS);
 	  if ((type1->status & _HAS_CHOICE) || (type2->status & _HAS_CHOICE))
-	    nftyp->status |= _HAS_CHOICE;
+	    SetStatus(nftyp, _HAS_CHOICE);
 	  nftyp->left = type1;
 	  nftyp->right = type2;
 	  type1->ref++;
diff --git a/form/fld_info.c b/form/fld_info.c
index 324198c..13fe8e7 100644
--- a/form/fld_info.c
+++ b/form/fld_info.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_info.c,v 1.10 2004/12/11 22:24:57 tom Exp $")
+MODULE_ID("$Id: fld_info.c,v 1.11 2010/01/23 21:14:35 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -53,10 +53,10 @@
 	   int *nrow, int *nbuf)
 {
   T((T_CALLED("field_info(%p,%p,%p,%p,%p,%p,%p)"),
-     field,
-     rows, cols,
-     frow, fcol,
-     nrow, nbuf));
+     (const void *)field,
+     (void *)rows, (void *)cols,
+     (void *)frow, (void *)fcol,
+     (void *)nrow, (void *)nbuf));
 
   if (!field)
     RETURN(E_BAD_ARGUMENT);
@@ -91,7 +91,11 @@
 NCURSES_EXPORT(int)
 dynamic_field_info(const FIELD *field, int *drows, int *dcols, int *maxgrow)
 {
-  T((T_CALLED("dynamic_field_info(%p,%p,%p,%p)"), field, drows, dcols, maxgrow));
+  T((T_CALLED("dynamic_field_info(%p,%p,%p,%p)"),
+     (const void *)field,
+     (void *)drows,
+     (void *)dcols,
+     (void *)maxgrow));
 
   if (!field)
     RETURN(E_BAD_ARGUMENT);
diff --git a/form/fld_just.c b/form/fld_just.c
index e021fb1..dea20b7 100644
--- a/form/fld_just.c
+++ b/form/fld_just.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_just.c,v 1.11 2004/12/11 22:55:48 tom Exp $")
+MODULE_ID("$Id: fld_just.c,v 1.13 2012/03/11 00:37:16 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -49,7 +49,7 @@
 {
   int res = E_BAD_ARGUMENT;
 
-  T((T_CALLED("set_field_just(%p,%d)"), field, just));
+  T((T_CALLED("set_field_just(%p,%d)"), (void *)field, just));
 
   if ((just == NO_JUSTIFICATION) ||
       (just == JUSTIFY_LEFT) ||
@@ -59,7 +59,7 @@
       Normalize_Field(field);
       if (field->just != just)
 	{
-	  field->just = just;
+	  field->just = (short) just;
 	  res = _nc_Synchronize_Attributes(field);
 	}
       else
@@ -79,7 +79,7 @@
 NCURSES_EXPORT(int)
 field_just(const FIELD *field)
 {
-  T((T_CALLED("field_just(%p)"), field));
+  T((T_CALLED("field_just(%p)"), (const void *)field));
   returnCode(Normalize_Field(field)->just);
 }
 
diff --git a/form/fld_link.c b/form/fld_link.c
index 0aac7db..b6c4768 100644
--- a/form/fld_link.c
+++ b/form/fld_link.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2007 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_link.c,v 1.11 2007/10/13 19:30:43 tom Exp $")
+MODULE_ID("$Id: fld_link.c,v 1.13 2012/03/11 00:37:16 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -54,15 +54,15 @@
   FIELD *New_Field = (FIELD *)0;
   int err = E_BAD_ARGUMENT;
 
-  T((T_CALLED("link_field(%p,%d,%d)"), field, frow, fcol));
+  T((T_CALLED("link_field(%p,%d,%d)"), (void *)field, frow, fcol));
   if (field && (frow >= 0) && (fcol >= 0) &&
       ((err = E_SYSTEM_ERROR) != 0) &&	/* trick: this resets the default error */
       (New_Field = typeMalloc(FIELD, 1)))
     {
-      T((T_CREATE("field %p"), New_Field));
+      T((T_CREATE("field %p"), (void *)New_Field));
       *New_Field = *_nc_Default_Field;
-      New_Field->frow = frow;
-      New_Field->fcol = fcol;
+      New_Field->frow = (short) frow;
+      New_Field->fcol = (short) fcol;
 
       New_Field->link = field->link;
       field->link = New_Field;
diff --git a/form/fld_max.c b/form/fld_max.c
index 7f5352e..6c7fe72 100644
--- a/form/fld_max.c
+++ b/form/fld_max.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_max.c,v 1.9 2004/12/11 21:51:54 tom Exp $")
+MODULE_ID("$Id: fld_max.c,v 1.13 2013/08/24 22:59:28 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -47,7 +47,7 @@
 NCURSES_EXPORT(int)
 set_max_field(FIELD *field, int maxgrow)
 {
-  T((T_CALLED("set_max_field(%p,%d)"), field, maxgrow));
+  T((T_CALLED("set_max_field(%p,%d)"), (void *)field, maxgrow));
 
   if (!field || (maxgrow < 0))
     RETURN(E_BAD_ARGUMENT);
@@ -62,13 +62,13 @@
 	    RETURN(E_BAD_ARGUMENT);
 	}
       field->maxgrow = maxgrow;
-      field->status &= ~_MAY_GROW;
-      if (!(field->opts & O_STATIC))
+      ClrStatus(field, _MAY_GROW);
+      if (!((unsigned)field->opts & O_STATIC))
 	{
 	  if ((maxgrow == 0) ||
 	      (single_line_field && (field->dcols < maxgrow)) ||
 	      (!single_line_field && (field->drows < maxgrow)))
-	    field->status |= _MAY_GROW;
+	    SetStatus(field, _MAY_GROW);
 	}
     }
   RETURN(E_OK);
diff --git a/form/fld_move.c b/form/fld_move.c
index d9ceaae..99f5490 100644
--- a/form/fld_move.c
+++ b/form/fld_move.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_move.c,v 1.9 2004/12/11 21:52:44 tom Exp $")
+MODULE_ID("$Id: fld_move.c,v 1.11 2012/03/11 00:37:16 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -48,7 +48,7 @@
 NCURSES_EXPORT(int)
 move_field(FIELD *field, int frow, int fcol)
 {
-  T((T_CALLED("move_field(%p,%d,%d)"), field, frow, fcol));
+  T((T_CALLED("move_field(%p,%d,%d)"), (void *)field, frow, fcol));
 
   if (!field || (frow < 0) || (fcol < 0))
     RETURN(E_BAD_ARGUMENT);
@@ -56,8 +56,8 @@
   if (field->form)
     RETURN(E_CONNECTED);
 
-  field->frow = frow;
-  field->fcol = fcol;
+  field->frow = (short) frow;
+  field->fcol = (short) fcol;
   RETURN(E_OK);
 }
 
diff --git a/form/fld_newftyp.c b/form/fld_newftyp.c
index c2984b1..4351aed 100644
--- a/form/fld_newftyp.c
+++ b/form/fld_newftyp.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2007 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,9 +32,9 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_newftyp.c,v 1.15 2007/10/13 19:30:55 tom Exp $")
+MODULE_ID("$Id: fld_newftyp.c,v 1.19 2010/01/23 21:14:36 tom Exp $")
 
-static FIELDTYPE const default_fieldtype =
+static FIELDTYPE default_fieldtype =
 {
   0,				/* status                                      */
   0L,				/* reference count                             */
@@ -43,13 +43,16 @@
   NULL,				/* makearg function                            */
   NULL,				/* copyarg function                            */
   NULL,				/* freearg function                            */
-  NULL,				/* field validation function                   */
-  NULL,				/* Character check function                    */
-  NULL,				/* enumerate next function                     */
-  NULL				/* enumerate previous function                 */
+  INIT_FT_FUNC(NULL),		/* field validation function                   */
+  INIT_FT_FUNC(NULL),		/* Character check function                    */
+  INIT_FT_FUNC(NULL),		/* enumerate next function                     */
+  INIT_FT_FUNC(NULL),		/* enumerate previous function                 */
+#if NCURSES_INTEROP_FUNCS
+  NULL				/* generic callback alternative to makearg     */
+#endif
 };
 
-NCURSES_EXPORT_VAR(const FIELDTYPE *)
+NCURSES_EXPORT_VAR(FIELDTYPE *)
 _nc_Default_FieldType = &default_fieldtype;
 
 /*---------------------------------------------------------------------------
@@ -80,10 +83,15 @@
 
       if (nftyp)
 	{
-	  T((T_CREATE("fieldtype %p"), nftyp));
+	  T((T_CREATE("fieldtype %p"), (void *)nftyp));
 	  *nftyp = default_fieldtype;
+#if NCURSES_INTEROP_FUNCS
+	  nftyp->fieldcheck.ofcheck = field_check;
+	  nftyp->charcheck.occheck = char_check;
+#else
 	  nftyp->fcheck = field_check;
 	  nftyp->ccheck = char_check;
+#endif
 	}
       else
 	{
@@ -110,7 +118,7 @@
 NCURSES_EXPORT(int)
 free_fieldtype(FIELDTYPE *typ)
 {
-  T((T_CALLED("free_fieldtype(%p)"), typ));
+  T((T_CALLED("free_fieldtype(%p)"), (void *)typ));
 
   if (!typ)
     RETURN(E_BAD_ARGUMENT);
diff --git a/form/fld_opts.c b/form/fld_opts.c
index 3c881ac..a52f1e2 100644
--- a/form/fld_opts.c
+++ b/form/fld_opts.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_opts.c,v 1.11 2004/12/11 21:55:46 tom Exp $")
+MODULE_ID("$Id: fld_opts.c,v 1.12 2010/01/23 21:14:36 tom Exp $")
 
 /*----------------------------------------------------------------------------
   Field-Options manipulation routines
@@ -55,7 +55,7 @@
 {
   int res = E_BAD_ARGUMENT;
 
-  T((T_CALLED("set_field_opts(%p,%d)"), field, opts));
+  T((T_CALLED("set_field_opts(%p,%d)"), (void *)field, opts));
 
   opts &= ALL_FIELD_OPTS;
   if (!(opts & ~ALL_FIELD_OPTS))
@@ -74,7 +74,7 @@
 NCURSES_EXPORT(Field_Options)
 field_opts(const FIELD *field)
 {
-  T((T_CALLED("field_opts(%p)"), field));
+  T((T_CALLED("field_opts(%p)"), (const void *)field));
 
   returnCode(ALL_FIELD_OPTS & Normalize_Field(field)->opts);
 }
@@ -96,7 +96,7 @@
 {
   int res = E_BAD_ARGUMENT;
 
-  T((T_CALLED("field_opts_on(%p,%d)"), field, opts));
+  T((T_CALLED("field_opts_on(%p,%d)"), (void *)field, opts));
 
   opts &= ALL_FIELD_OPTS;
   if (!(opts & ~ALL_FIELD_OPTS))
@@ -124,7 +124,7 @@
 {
   int res = E_BAD_ARGUMENT;
 
-  T((T_CALLED("field_opts_off(%p,%d)"), field, opts));
+  T((T_CALLED("field_opts_off(%p,%d)"), (void *)field, opts));
 
   opts &= ALL_FIELD_OPTS;
   if (!(opts & ~ALL_FIELD_OPTS))
diff --git a/form/fld_pad.c b/form/fld_pad.c
index 63d8ad1..4f8ff1f 100644
--- a/form/fld_pad.c
+++ b/form/fld_pad.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_pad.c,v 1.9 2004/12/11 21:56:49 tom Exp $")
+MODULE_ID("$Id: fld_pad.c,v 1.10 2010/01/23 21:14:36 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -50,7 +50,7 @@
 {
   int res = E_BAD_ARGUMENT;
 
-  T((T_CALLED("set_field_pad(%p,%d)"), field, ch));
+  T((T_CALLED("set_field_pad(%p,%d)"), (void *)field, ch));
 
   Normalize_Field(field);
   if (isprint(UChar(ch)))
@@ -77,7 +77,7 @@
 NCURSES_EXPORT(int)
 field_pad(const FIELD *field)
 {
-  T((T_CALLED("field_pad(%p)"), field));
+  T((T_CALLED("field_pad(%p)"), (const void *)field));
 
   returnCode(Normalize_Field(field)->pad);
 }
diff --git a/form/fld_page.c b/form/fld_page.c
index e1af496..bcce4cf 100644
--- a/form/fld_page.c
+++ b/form/fld_page.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_page.c,v 1.9 2004/12/11 21:58:19 tom Exp $")
+MODULE_ID("$Id: fld_page.c,v 1.12 2012/06/10 00:12:47 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -47,16 +47,16 @@
 NCURSES_EXPORT(int)
 set_new_page(FIELD *field, bool new_page_flag)
 {
-  T((T_CALLED("set_new_page(%p,%d)"), field, new_page_flag));
+  T((T_CALLED("set_new_page(%p,%d)"), (void *)field, new_page_flag));
 
   Normalize_Field(field);
   if (field->form)
     RETURN(E_CONNECTED);
 
   if (new_page_flag)
-    field->status |= _NEWPAGE;
+    SetStatus(field, _NEWPAGE);
   else
-    field->status &= ~_NEWPAGE;
+    ClrStatus(field, _NEWPAGE);
 
   RETURN(E_OK);
 }
@@ -74,7 +74,7 @@
 NCURSES_EXPORT(bool)
 new_page(const FIELD *field)
 {
-  T((T_CALLED("new_page(%p)"), field));
+  T((T_CALLED("new_page(%p)"), (const void *)field));
 
   returnBool((Normalize_Field(field)->status & _NEWPAGE) ? TRUE : FALSE);
 }
diff --git a/form/fld_stat.c b/form/fld_stat.c
index b85b4d5..9bbe76e 100644
--- a/form/fld_stat.c
+++ b/form/fld_stat.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_stat.c,v 1.11 2004/12/11 22:28:00 tom Exp $")
+MODULE_ID("$Id: fld_stat.c,v 1.14 2012/06/10 00:13:09 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -46,14 +46,14 @@
 NCURSES_EXPORT(int)
 set_field_status(FIELD *field, bool status)
 {
-  T((T_CALLED("set_field_status(%p,%d)"), field, status));
+  T((T_CALLED("set_field_status(%p,%d)"), (void *)field, status));
 
   Normalize_Field(field);
 
   if (status)
-    field->status |= _CHANGED;
+    SetStatus(field, _CHANGED);
   else
-    field->status &= ~_CHANGED;
+    ClrStatus(field, _CHANGED);
 
   RETURN(E_OK);
 }
@@ -71,7 +71,7 @@
 NCURSES_EXPORT(bool)
 field_status(const FIELD *field)
 {
-  T((T_CALLED("field_status(%p)"), field));
+  T((T_CALLED("field_status(%p)"), (const void *)field));
 
   returnBool((Normalize_Field(field)->status & _CHANGED) ? TRUE : FALSE);
 }
diff --git a/form/fld_type.c b/form/fld_type.c
index c9a3fbe..0b35b7e 100644
--- a/form/fld_type.c
+++ b/form/fld_type.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_type.c,v 1.15 2004/12/25 22:24:10 tom Exp $")
+MODULE_ID("$Id: fld_type.c,v 1.16 2010/01/23 21:14:36 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -52,7 +52,7 @@
   int res = E_SYSTEM_ERROR;
   int err = 0;
 
-  T((T_CALLED("set_field_type(%p,%p)"), field, type));
+  T((T_CALLED("set_field_type(%p,%p)"), (void *)field, (void *)type));
 
   va_start(ap, type);
 
@@ -90,7 +90,7 @@
 NCURSES_EXPORT(FIELDTYPE *)
 field_type(const FIELD *field)
 {
-  T((T_CALLED("field_type(%p)"), field));
+  T((T_CALLED("field_type(%p)"), (const void *)field));
   returnFieldType(Normalize_Field(field)->type);
 }
 
diff --git a/form/fld_user.c b/form/fld_user.c
index 323622c..30bcf7a 100644
--- a/form/fld_user.c
+++ b/form/fld_user.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_user.c,v 1.15 2004/12/25 22:24:50 tom Exp $")
+MODULE_ID("$Id: fld_user.c,v 1.16 2010/01/23 21:14:36 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -46,7 +46,7 @@
 NCURSES_EXPORT(int)
 set_field_userptr(FIELD *field, void *usrptr)
 {
-  T((T_CALLED("set_field_userptr(%p,%p)"), field, usrptr));
+  T((T_CALLED("set_field_userptr(%p,%p)"), (void *)field, (void *)usrptr));
 
   Normalize_Field(field)->usrptr = usrptr;
   RETURN(E_OK);
@@ -65,7 +65,7 @@
 NCURSES_EXPORT(void *)
 field_userptr(const FIELD *field)
 {
-  T((T_CALLED("field_userptr(%p)"), field));
+  T((T_CALLED("field_userptr(%p)"), (const void *)field));
   returnVoidPtr(Normalize_Field(field)->usrptr);
 }
 
diff --git a/form/form.h b/form/form.h
index a4691a8..09856dc 100644
--- a/form/form.h
+++ b/form/form.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -30,10 +30,11 @@
  *   Author:  Juergen Pfeifer, 1995,1997                                    *
  ****************************************************************************/
 
-/* $Id: form.h,v 0.20 2004/12/04 22:22:10 tom Exp $ */
+/* $Id: form.h,v 0.24 2014/07/26 20:52:28 tom Exp $ */
 
 #ifndef FORM_H
 #define FORM_H
+/* *INDENT-OFF*/
 
 #include <curses.h>
 #include <eti.h>
@@ -105,34 +106,13 @@
   NCURSES_FIELD_INTERNALS
 } FIELD;
 
-	/**************
-	*  FIELDTYPE  *
-	**************/
-
-typedef struct typenode {
-  unsigned short	status;			/* flags		*/
-  long			ref;			/* reference count	*/
-  struct typenode *	left;			/* ptr to operand for | */
-  struct typenode *	right;			/* ptr to operand for | */
-
-  void* (*makearg)(va_list *);			/* make fieldtype arg	*/
-  void* (*copyarg)(const void *);		/* copy fieldtype arg	*/
-  void	(*freearg)(void *);			/* free fieldtype arg	*/
-
-  bool	(*fcheck)(FIELD *,const void *);	/* field validation	*/
-  bool	(*ccheck)(int,const void *);		/* character validation */
-
-  bool	(*next)(FIELD *,const void *);		/* enumerate next value */
-  bool	(*prev)(FIELD *,const void *);		/* enumerate prev value */
-
-} FIELDTYPE;
 
 	/*********
 	*  FORM  *
 	*********/
 
 typedef struct formnode {
-  unsigned short	status;		/* flags			*/
+  unsigned short	status;	  	/* flags			*/
   short			rows;		/* size in rows			*/
   short			cols;		/* size in cols			*/
   int			currow;		/* current row in field window	*/
@@ -158,6 +138,49 @@
 
 } FORM;
 
+
+	/**************
+	*  FIELDTYPE  *
+	**************/
+
+typedef struct typenode {
+  unsigned short	status;			/* flags		    */
+  long			ref;			/* reference count	    */
+  struct typenode *	left;			/* ptr to operand for |     */
+  struct typenode *	right;			/* ptr to operand for |     */
+
+  void* (*makearg)(va_list *);			/* make fieldtype arg	    */
+  void* (*copyarg)(const void *);		/* copy fieldtype arg 	    */
+  void	(*freearg)(void *);			/* free fieldtype arg	    */
+
+#if NCURSES_INTEROP_FUNCS
+  union {
+    bool (*ofcheck)(FIELD *,const void *);	/* field validation	    */
+    bool (*gfcheck)(FORM*,FIELD *,const void*);	/* generic field validation */
+  } fieldcheck;
+  union {
+    bool (*occheck)(int,const void *);		/* character validation     */
+    bool (*gccheck)(int,FORM*,
+		    FIELD*,const void*);        /* generic char validation  */
+  } charcheck;
+  union {
+    bool (*onext)(FIELD *,const void *);        /* enumerate next value     */
+    bool (*gnext)(FORM*,FIELD*,const void*);    /* generic enumerate next   */
+  } enum_next;
+  union {
+    bool (*oprev)(FIELD *,const void *);	/* enumerate prev value     */
+    bool (*gprev)(FORM*,FIELD*,const void*);    /* generic enumerate prev   */
+  } enum_prev;
+  void* (*genericarg)(void*);                   /* Alternate Arg method     */
+#else
+  bool	(*fcheck)(FIELD *,const void *);	/* field validation	*/
+  bool	(*ccheck)(int,const void *);		/* character validation */
+
+  bool	(*next)(FIELD *,const void *);		/* enumerate next value */
+  bool	(*prev)(FIELD *,const void *);		/* enumerate prev value */
+#endif
+} FIELDTYPE;
+
 typedef void (*Form_Hook)(FORM *);
 
 	/***************************
@@ -181,6 +204,7 @@
 #define O_NULLOK		(0x0080U)
 #define O_PASSOK		(0x0100U)
 #define O_STATIC		(0x0200U)
+#define O_DYNAMIC_JUSTIFY	(0x0400U)	/* ncurses extension	*/
 
 /* form options */
 #define O_NL_OVERLOAD		(0x0001U)
@@ -279,13 +303,6 @@
 extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4;      /* Internet IP Version 4 address */
 
 	/***********************
-	*   Default objects    *
-	***********************/
-extern NCURSES_EXPORT_VAR(FORM *)	_nc_Default_Form;
-extern NCURSES_EXPORT_VAR(FIELD *)	_nc_Default_Field;
-
-
-	/***********************
 	*  FIELDTYPE routines  *
 	***********************/
 extern NCURSES_EXPORT(FIELDTYPE *) new_fieldtype (
@@ -381,6 +398,9 @@
 extern NCURSES_EXPORT(int)	unpost_form (FORM *);
 extern NCURSES_EXPORT(int)	pos_form_cursor (FORM *);
 extern NCURSES_EXPORT(int)	form_driver (FORM *,int);
+# if NCURSES_WIDECHAR
+extern NCURSES_EXPORT(int)	form_driver_w (FORM *,int,wchar_t);
+# endif
 extern NCURSES_EXPORT(int)	set_form_userptr (FORM *,void *);
 extern NCURSES_EXPORT(int)	set_form_opts (FORM *,Form_Options);
 extern NCURSES_EXPORT(int)	form_opts_on (FORM *,Form_Options);
@@ -396,8 +416,13 @@
 extern NCURSES_EXPORT(bool)	data_ahead (const FORM *);
 extern NCURSES_EXPORT(bool)	data_behind (const FORM *);
 
+#if NCURSES_SP_FUNCS
+extern NCURSES_EXPORT(FORM *)	NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **);
+#endif
+
 #ifdef __cplusplus
   }
 #endif
+/* *INDENT-ON*/
 
-#endif	/* FORM_H */
+#endif /* FORM_H */
diff --git a/form/form.priv.h b/form/form.priv.h
index fea627d..4d1dfe7 100644
--- a/form/form.priv.h
+++ b/form/form.priv.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2006,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -30,11 +30,11 @@
  *   Author:  Juergen Pfeifer, 1995,1997                                    *
  ****************************************************************************/
 
-/* $Id: form.priv.h,v 0.27 2008/09/08 20:29:05 tom Exp $ */
+/* $Id: form.priv.h,v 0.38 2014/11/01 13:56:14 tom Exp $ */
 
 #ifndef FORM_PRIV_H
 #define FORM_PRIV_H 1
-
+/* *INDENT-OFF*/
 #include "curses.priv.h"
 #include "mf_common.h"
 
@@ -62,6 +62,13 @@
 
 #include "form.h"
 
+	/***********************
+	*   Default objects    *
+	***********************/
+extern NCURSES_EXPORT_VAR(FORM *)      _nc_Default_Form;
+extern NCURSES_EXPORT_VAR(FIELD *)     _nc_Default_Field;
+extern NCURSES_EXPORT_VAR(FIELDTYPE *) _nc_Default_FieldType;
+
 /* form  status values */
 #define _OVLMODE         (0x04U) /* Form is in overlay mode                */
 #define _WINDOW_MODIFIED (0x10U) /* Current field window has been modified */
@@ -78,6 +85,7 @@
 #define _HAS_ARGS        (0x02U) /* Type has arguments                     */
 #define _HAS_CHOICE      (0x04U) /* Type has choice methods                */
 #define _RESIDENT        (0x08U) /* Type is built-in                       */
+#define _GENERIC         (0x10U) /* A generic field type                   */
 
 /* This are the field options required to be a selectable field in field
    navigation requests */
@@ -91,21 +99,34 @@
 #define Normalize_Field(field) \
   ((field) = (field != 0) ? (field) : _nc_Default_Field)
 
+#if NCURSES_SP_FUNCS
+#define Get_Form_Screen(form) \
+  ((form)->win ? _nc_screen_of((form->win)):CURRENT_SCREEN)
+#else
+#define Get_Form_Screen(form) CURRENT_SCREEN
+#endif
+
 /* Retrieve forms window */
 #define Get_Form_Window(form) \
-  ((form)->sub?(form)->sub:((form)->win?(form)->win:stdscr))
+  ((form)->sub \
+   ? (form)->sub \
+   : ((form)->win \
+      ? (form)->win \
+      : StdScreen(Get_Form_Screen(form))))
 
 /* Calculate the size for a single buffer for this field */
 #define Buffer_Length(field) ((field)->drows * (field)->dcols)
 
 /* Calculate the total size of all buffers for this field */
 #define Total_Buffer_Size(field) \
-   ( (Buffer_Length(field) + 1) * (1+(field)->nbuf) * sizeof(FIELD_CELL) )
+   ( (size_t)(Buffer_Length(field) + 1) * (size_t)(1+(field)->nbuf) * sizeof(FIELD_CELL) )
 
 /* Logic to determine whether or not a field is single lined */
 #define Single_Line_Field(field) \
    (((field)->rows + (field)->nrow) == 1)
 
+#define Field_Has_Option(f,o)      ((((unsigned)(f)->opts) & o) != 0)
+
 /* Logic to determine whether or not a field is selectable */
 #define Field_Is_Selectable(f)     (((unsigned)((f)->opts) & O_SELECTABLE)==O_SELECTABLE)
 #define Field_Is_Not_Selectable(f) (((unsigned)((f)->opts) & O_SELECTABLE)!=O_SELECTABLE)
@@ -127,7 +148,7 @@
 			O_NL_OVERLOAD  |\
 			O_BS_OVERLOAD   )
 
-#define ALL_FIELD_OPTS (Field_Options)( \
+#define STD_FIELD_OPTS (Field_Options)( \
 			O_VISIBLE |\
 			O_ACTIVE  |\
 			O_PUBLIC  |\
@@ -137,15 +158,17 @@
 			O_AUTOSKIP|\
 			O_NULLOK  |\
 			O_PASSOK  |\
-			O_STATIC   )
+			O_STATIC)
+
+#define ALL_FIELD_OPTS (Field_Options)( \
+			STD_FIELD_OPTS |\
+			O_DYNAMIC_JUSTIFY)
 
 #define C_BLANK ' '
 #define is_blank(c) ((c)==C_BLANK)
 
 #define C_ZEROS '\0'
 
-extern NCURSES_EXPORT_VAR(const FIELDTYPE *) _nc_Default_FieldType;
-
 extern NCURSES_EXPORT(TypeArgument *) _nc_Make_Argument (const FIELDTYPE*, va_list*, int*);
 extern NCURSES_EXPORT(TypeArgument *) _nc_Copy_Argument (const FIELDTYPE*, const TypeArgument*, int*);
 extern NCURSES_EXPORT(void) _nc_Free_Argument (const FIELDTYPE*, TypeArgument*);
@@ -161,23 +184,53 @@
 extern NCURSES_EXPORT(int) _nc_Set_Current_Field (FORM*, FIELD*);
 extern NCURSES_EXPORT(int) _nc_Position_Form_Cursor (FORM*);
 
+#if NCURSES_INTEROP_FUNCS
+extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_INTEGER(void);
+extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_ALNUM(void);
+extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_ALPHA(void);
+extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_ENUM(void);
+extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_NUMERIC(void);
+extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_REGEXP(void);
+extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_IPV4(void);
+
+extern NCURSES_EXPORT(FIELDTYPE *)
+_nc_generic_fieldtype(bool (*const field_check) (FORM*, 
+						 FIELD *, 
+						 const void *),
+		      bool (*const char_check)  (int, 
+						 FORM*, 
+						 FIELD*, 
+						 const void *),
+		      bool (*const next)(FORM*,FIELD*,const void*),
+		      bool (*const prev)(FORM*,FIELD*,const void*),
+		      void (*freecallback)(void*));
+extern NCURSES_EXPORT(int) _nc_set_generic_fieldtype(FIELD*, FIELDTYPE*, int (*)(void**));
+extern NCURSES_EXPORT(WINDOW*) _nc_form_cursor(const FORM* , int* , int* );
+
+#define INIT_FT_FUNC(func) {func}
+#else
+#define INIT_FT_FUNC(func) func
+#endif
+
+extern NCURSES_EXPORT(void) _nc_get_fieldbuffer(FORM*, FIELD*, FIELD_CELL*);
+
 #if USE_WIDEC_SUPPORT
 extern NCURSES_EXPORT(wchar_t *) _nc_Widen_String(char *, int *);
 #endif
 
 #ifdef TRACE
 
-#define returnField(code)	TRACE_RETURN(code,field)
-#define returnFieldPtr(code)	TRACE_RETURN(code,field_ptr)
-#define returnForm(code)	TRACE_RETURN(code,form)
-#define returnFieldType(code)	TRACE_RETURN(code,field_type)
-#define returnFormHook(code)	TRACE_RETURN(code,form_hook)
+#define returnField(code)	TRACE_RETURN1(code,field)
+#define returnFieldPtr(code)	TRACE_RETURN1(code,field_ptr)
+#define returnForm(code)	TRACE_RETURN1(code,form)
+#define returnFieldType(code)	TRACE_RETURN1(code,field_type)
+#define returnFormHook(code)	TRACE_RETURN1(code,form_hook)
 
 extern NCURSES_EXPORT(FIELD **)	    _nc_retrace_field_ptr (FIELD **);
 extern NCURSES_EXPORT(FIELD *)	    _nc_retrace_field (FIELD *);
 extern NCURSES_EXPORT(FIELDTYPE *)  _nc_retrace_field_type (FIELDTYPE *);
-extern NCURSES_EXPORT(FORM *)  _nc_retrace_form (FORM *);
-extern NCURSES_EXPORT(Form_Hook)  _nc_retrace_form_hook (Form_Hook);
+extern NCURSES_EXPORT(FORM *)       _nc_retrace_form (FORM *);
+extern NCURSES_EXPORT(Form_Hook)    _nc_retrace_form_hook (Form_Hook);
 
 #else /* !TRACE */
 
@@ -246,5 +299,6 @@
       result = ((*buffer || (l < width)) ? FALSE : TRUE); \
     }
 #endif
+/* *INDENT-ON*/
 
 #endif /* FORM_PRIV_H */
diff --git a/form/frm_cursor.c b/form/frm_cursor.c
index 18dabab..7a4cd16 100644
--- a/form/frm_cursor.c
+++ b/form/frm_cursor.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_cursor.c,v 1.9 2004/12/11 22:01:03 tom Exp $")
+MODULE_ID("$Id: frm_cursor.c,v 1.10 2010/01/23 21:14:36 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -53,7 +53,7 @@
 {
   int res;
 
-  T((T_CALLED("pos_form_cursor(%p)"), form));
+  T((T_CALLED("pos_form_cursor(%p)"), (void *)form));
 
   if (!form)
     res = E_BAD_ARGUMENT;
diff --git a/form/frm_data.c b/form/frm_data.c
index 787a179..a936060 100644
--- a/form/frm_data.c
+++ b/form/frm_data.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_data.c,v 1.14 2005/11/26 15:34:01 tom Exp $")
+MODULE_ID("$Id: frm_data.c,v 1.16 2013/08/24 22:44:05 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -49,7 +49,7 @@
 {
   bool result = FALSE;
 
-  T((T_CALLED("data_behind(%p)"), form));
+  T((T_CALLED("data_behind(%p)"), (const void *)form));
 
   if (form && (form->status & _POSTED) && form->current)
     {
@@ -103,7 +103,7 @@
 		}
 	    }
 #else
-	  cell = winch(w);
+	  cell = (FIELD_CELL) winch(w);
 	  if (ChCharOf(cell) != ChCharOf(pad))
 	    {
 	      result = FALSE;
@@ -136,7 +136,7 @@
 {
   bool result = FALSE;
 
-  T((T_CALLED("data_ahead(%p)"), form));
+  T((T_CALLED("data_ahead(%p)"), (const void *)form));
 
   if (form && (form->status & _POSTED) && form->current)
     {
diff --git a/form/frm_def.c b/form/frm_def.c
index e689751..fd7b56a 100644
--- a/form/frm_def.c
+++ b/form/frm_def.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_def.c,v 1.23 2008/08/04 00:07:55 tom Exp $")
+MODULE_ID("$Id: frm_def.c,v 1.26 2012/03/11 00:37:16 tom Exp $")
 
 /* this can't be readonly */
 static FORM default_form =
@@ -160,7 +160,7 @@
   int maximum_row_in_field, maximum_col_in_field;
   _PAGE *pg;
 
-  T((T_CALLED("Connect_Fields(%p,%p)"), form, fields));
+  T((T_CALLED("Connect_Fields(%p,%p)"), (void *)form, (void *)fields));
 
   assert(form);
 
@@ -188,7 +188,7 @@
   /* allocate page structures */
   if ((pg = typeMalloc(_PAGE, page_nr)) != (_PAGE *) 0)
     {
-      T((T_CREATE("_PAGE %p"), pg));
+      T((T_CREATE("_PAGE %p"), (void *)pg));
       form->page = pg;
     }
   else
@@ -199,14 +199,14 @@
   for (j = 0; j < field_cnt; j++)
     {
       if (j == 0)
-	pg->pmin = j;
+	pg->pmin = (short) j;
       else
 	{
 	  if (fields[j]->status & _NEWPAGE)
 	    {
-	      pg->pmax = j - 1;
+	      pg->pmax = (short) (j - 1);
 	      pg++;
-	      pg->pmin = j;
+	      pg->pmin = (short) j;
 	    }
 	}
 
@@ -214,14 +214,14 @@
       maximum_col_in_field = fields[j]->fcol + fields[j]->cols;
 
       if (form->rows < maximum_row_in_field)
-	form->rows = maximum_row_in_field;
+	form->rows = (short) maximum_row_in_field;
       if (form->cols < maximum_col_in_field)
-	form->cols = maximum_col_in_field;
+	form->cols = (short) maximum_col_in_field;
     }
 
-  pg->pmax = field_cnt - 1;
-  form->maxfield = field_cnt;
-  form->maxpage = page_nr;
+  pg->pmax = (short) (field_cnt - 1);
+  form->maxfield = (short) field_cnt;
+  form->maxpage = (short) page_nr;
 
   /* Sort fields on form pages */
   for (page_nr = 0; page_nr < form->maxpage; page_nr++)
@@ -230,8 +230,8 @@
 
       for (j = form->page[page_nr].pmin; j <= form->page[page_nr].pmax; j++)
 	{
-	  fields[j]->index = j;
-	  fields[j]->page = page_nr;
+	  fields[j]->index = (short) j;
+	  fields[j]->page = (short) page_nr;
 	  fld = Insert_Field_By_Position(fields[j], fld);
 	}
       if (fld)
@@ -283,7 +283,7 @@
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
-|   Function      :  FORM *new_form( FIELD **fields )
+|   Function      :  FORM *new_form_sp(SCREEN* sp, FIELD** fields )
 |   
 |   Description   :  Create new form with given array of fields.
 |
@@ -295,21 +295,31 @@
 |                    E_SYSTEM_ERROR  - not enough memory
 +--------------------------------------------------------------------------*/
 NCURSES_EXPORT(FORM *)
-new_form(FIELD **fields)
+NCURSES_SP_NAME(new_form) (NCURSES_SP_DCLx FIELD **fields)
 {
   int err = E_SYSTEM_ERROR;
+  FORM *form = (FORM *)0;
 
-  FORM *form = typeMalloc(FORM, 1);
+  T((T_CALLED("new_form(%p,%p)"), (void *)SP_PARM, (void *)fields));
 
-  T((T_CALLED("new_form(%p)"), fields));
-  if (form)
+  if (IsValidScreen(SP_PARM))
     {
-      T((T_CREATE("form %p"), form));
-      *form = *_nc_Default_Form;
-      if ((err = Associate_Fields(form, fields)) != E_OK)
+      form = typeMalloc(FORM, 1);
+
+      if (form)
 	{
-	  free_form(form);
-	  form = (FORM *)0;
+	  T((T_CREATE("form %p"), (void *)form));
+	  *form = *_nc_Default_Form;
+	  /* This ensures win and sub are always non-null,
+	     so we can derive always the SCREEN that this form is
+	     running on. */
+	  form->win = StdScreen(SP_PARM);
+	  form->sub = StdScreen(SP_PARM);
+	  if ((err = Associate_Fields(form, fields)) != E_OK)
+	    {
+	      free_form(form);
+	      form = (FORM *)0;
+	    }
 	}
     }
 
@@ -321,6 +331,27 @@
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
+|   Function      :  FORM* new_form(FIELD** fields )
+|   
+|   Description   :  Create new form with given array of fields.
+|
+|   Return Values :  Pointer to form. NULL if error occurred.
+!                    Set errno:
+|                    E_OK            - success
+|                    E_BAD_ARGUMENT  - Invalid form pointer or field array
+|                    E_CONNECTED     - a field is already connected
+|                    E_SYSTEM_ERROR  - not enough memory
++--------------------------------------------------------------------------*/
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(FORM *)
+new_form(FIELD **fields)
+{
+  return NCURSES_SP_NAME(new_form) (CURRENT_SCREEN, fields);
+}
+#endif
+
+/*---------------------------------------------------------------------------
+|   Facility      :  libnform  
 |   Function      :  int free_form( FORM *form )
 |   
 |   Description   :  Release internal memory associated with form.
@@ -332,7 +363,7 @@
 NCURSES_EXPORT(int)
 free_form(FORM *form)
 {
-  T((T_CALLED("free_form(%p)"), form));
+  T((T_CALLED("free_form(%p)"), (void *)form));
 
   if (!form)
     RETURN(E_BAD_ARGUMENT);
@@ -366,7 +397,7 @@
   FIELD **old;
   int res;
 
-  T((T_CALLED("set_form_fields(%p,%p)"), form, fields));
+  T((T_CALLED("set_form_fields(%p,%p)"), (void *)form, (void *)fields));
 
   if (!form)
     RETURN(E_BAD_ARGUMENT);
@@ -394,7 +425,7 @@
 NCURSES_EXPORT(FIELD **)
 form_fields(const FORM *form)
 {
-  T((T_CALLED("form_field(%p)"), form));
+  T((T_CALLED("form_field(%p)"), (const void *)form));
   returnFieldPtr(Normalize_Form(form)->field);
 }
 
@@ -409,7 +440,7 @@
 NCURSES_EXPORT(int)
 field_count(const FORM *form)
 {
-  T((T_CALLED("field_count(%p)"), form));
+  T((T_CALLED("field_count(%p)"), (const void *)form));
 
   returnCode(Normalize_Form(form)->maxfield);
 }
diff --git a/form/frm_driver.c b/form/frm_driver.c
index 94323ed..eebde42 100644
--- a/form/frm_driver.c
+++ b/form/frm_driver.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_driver.c,v 1.88 2008/10/18 16:25:00 tom Exp $")
+MODULE_ID("$Id: frm_driver.c,v 1.115 2014/09/25 21:55:24 tom Exp $")
 
 /*----------------------------------------------------------------------------
   This is the core module of the form library. It contains the majority
@@ -172,29 +172,30 @@
    instead of a derived window because it contains invisible parts.
    This is true for non-public fields and for scrollable fields. */
 #define Has_Invisible_Parts(field)     \
-  (!((field)->opts & O_PUBLIC)      || \
+  (!(Field_Has_Option(field, O_PUBLIC)) || \
    Is_Scroll_Field(field))
 
 /* Logic to decide whether or not a field needs justification */
 #define Justification_Allowed(field)        \
    (((field)->just != NO_JUSTIFICATION)  && \
     (Single_Line_Field(field))           && \
-    (((field)->dcols == (field)->cols)   && \
-    ((field)->opts & O_STATIC))             )
+    ((Field_Has_Option(field, O_STATIC)  && \
+     ((field)->dcols == (field)->cols))  || \
+    Field_Has_Option(field, O_DYNAMIC_JUSTIFY)))
 
 /* Logic to determine whether or not a dynamic field may still grow */
 #define Growable(field) ((field)->status & _MAY_GROW)
 
 /* Macro to set the attributes for a fields window */
 #define Set_Field_Window_Attributes(field,win) \
-(  wbkgdset((win),(chtype)((field)->pad | (field)->back)), \
-   wattrset((win),(field)->fore) )
+(  wbkgdset((win),(chtype)((chtype)((field)->pad) | (field)->back)), \
+   (void) wattrset((win), (int)(field)->fore) )
 
 /* Logic to decide whether or not a field really appears on the form */
 #define Field_Really_Appears(field)         \
   ((field->form)                          &&\
    (field->form->status & _POSTED)        &&\
-   (field->opts & O_VISIBLE)              &&\
+   (Field_Has_Option(field, O_VISIBLE))   &&\
    (field->page == field->form->curpage))
 
 /* Logic to determine whether or not we are on the first position in the
@@ -512,9 +513,10 @@
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
-|   Function      :  static void Window_To_Buffer(
+|   Function      :  void _nc_get_fieldbuffer(
 |                                          WINDOW * win,
-|                                          FIELD  * field)
+|                                          FIELD  * field,
+|                                          FIELD_CELL * buf)
 |
 |   Description   :  Copy the content of the window into the buffer.
 |                    The multiple lines of a window are simply
@@ -523,18 +525,22 @@
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-static void
-Window_To_Buffer(WINDOW *win, FIELD *field)
+NCURSES_EXPORT(void)
+_nc_get_fieldbuffer(FORM *form, FIELD *field, FIELD_CELL *buf)
 {
   int pad;
   int len = 0;
   FIELD_CELL *p;
   int row, height;
+  WINDOW *win;
 
-  assert(win && field && field->buf);
+  assert(form && field && buf);
+
+  win = form->w;
+  assert(win);
 
   pad = field->pad;
-  p = field->buf;
+  p = buf;
   height = getmaxy(win);
 
   for (row = 0; (row < height) && (row < field->drows); row++)
@@ -563,6 +569,25 @@
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
+|   Function      :  static void Window_To_Buffer(
+|                                          FORM   * form,
+|                                          FIELD  * field)
+|
+|   Description   :  Copy the content of the window into the buffer.
+|                    The multiple lines of a window are simply
+|                    concatenated into the buffer. Pad characters in
+|                    the window will be replaced by blanks in the buffer.
+|
+|   Return Values :  -
++--------------------------------------------------------------------------*/
+static void
+Window_To_Buffer(FORM *form, FIELD *field)
+{
+  _nc_get_fieldbuffer(form, field, field->buf);
+}
+
+/*---------------------------------------------------------------------------
+|   Facility      :  libnform
 |   Function      :  static void Synchronize_Buffer(FORM * form)
 |
 |   Description   :  If there was a change, copy the content of the
@@ -577,9 +602,9 @@
 {
   if (form->status & _WINDOW_MODIFIED)
     {
-      form->status &= ~_WINDOW_MODIFIED;
-      form->status |= _FCHECK_REQUIRED;
-      Window_To_Buffer(form->w, form->current);
+      ClrStatus(form, _WINDOW_MODIFIED);
+      SetStatus(form, _FCHECK_REQUIRED);
+      Window_To_Buffer(form, form->current);
       wmove(form->w, form->currow, form->curcol);
     }
 }
@@ -629,7 +654,7 @@
 	    growth = Minimum(field->maxgrow - field->dcols, growth);
 	  field->dcols += growth;
 	  if (field->dcols == field->maxgrow)
-	    field->status &= ~_MAY_GROW;
+	    ClrStatus(field, _MAY_GROW);
 	}
       else
 	{
@@ -638,7 +663,7 @@
 	    growth = Minimum(field->maxgrow - field->drows, growth);
 	  field->drows += growth;
 	  if (field->drows == field->maxgrow)
-	    field->status &= ~_MAY_GROW;
+	    ClrStatus(field, _MAY_GROW);
 	}
       /* drows, dcols changed, so we get really the new buffer length */
       new_buflen = Buffer_Length(field);
@@ -650,7 +675,7 @@
 	  field->drows = old_drows;
 	  if ((single_line_field && (field->dcols != field->maxgrow)) ||
 	      (!single_line_field && (field->drows != field->maxgrow)))
-	    field->status |= _MAY_GROW;
+	    SetStatus(field, _MAY_GROW);
 	}
       else
 	{
@@ -663,7 +688,7 @@
 
 	  result = TRUE;	/* allow sharing of recovery on failure */
 
-	  T((T_CREATE("fieldcell %p"), newbuf));
+	  T((T_CREATE("fieldcell %p"), (void *)newbuf));
 	  field->buf = newbuf;
 	  for (i = 0; i <= field->nbuf; i++)
 	    {
@@ -729,7 +754,7 @@
 		   (field->dcols != field->maxgrow)) ||
 		  (!single_line_field &&
 		   (field->drows != field->maxgrow)))
-		field->status |= _MAY_GROW;
+		SetStatus(field, _MAY_GROW);
 	      free(newbuf);
 	    }
 	}
@@ -752,7 +777,7 @@
 static int
 Field_encloses(FIELD *field, int ry, int rx)
 {
-  T((T_CALLED("Field_encloses(%p)"), field));
+  T((T_CALLED("Field_encloses(%p)"), (void *)field));
   if (field != 0
       && field->frow <= ry
       && (field->frow + field->rows) > ry
@@ -825,7 +850,7 @@
   WINDOW *formwin;
   FIELD *field;
 
-  T((T_CALLED("_nc_Refresh_Current_Field(%p)"), form));
+  T((T_CALLED("_nc_Refresh_Current_Field(%p)"), (void *)form));
 
   if (!form)
     RETURN(E_BAD_ARGUMENT);
@@ -836,7 +861,7 @@
   field = form->current;
   formwin = Get_Form_Window(form);
 
-  if (field->opts & O_PUBLIC)
+  if (Field_Has_Option(field, O_PUBLIC))
     {
       if (Is_Scroll_Field(field))
 	{
@@ -873,19 +898,19 @@
 		  if (form->currow < form->toprow)
 		    {
 		      form->toprow = form->currow;
-		      field->status |= _NEWTOP;
+		      SetStatus(field, _NEWTOP);
 		    }
 		  if (form->currow >= row_after_bottom)
 		    {
 		      form->toprow = form->currow - field->rows + 1;
-		      field->status |= _NEWTOP;
+		      SetStatus(field, _NEWTOP);
 		    }
 		  if (field->status & _NEWTOP)
 		    {
 		      /* means we have to copy whole range */
 		      first_modified_row = form->toprow;
 		      first_unmodified_row = first_modified_row + field->rows;
-		      field->status &= ~_NEWTOP;
+		      ClrStatus(field, _NEWTOP);
 		    }
 		  else
 		    {
@@ -959,21 +984,22 @@
 
   if (len > 0)
     {
-      assert(win && (field->drows == 1) && (field->dcols == field->cols));
+      assert(win && (field->drows == 1));
 
-      switch (field->just)
-	{
-	case JUSTIFY_LEFT:
-	  break;
-	case JUSTIFY_CENTER:
-	  col = (field->cols - len) / 2;
-	  break;
-	case JUSTIFY_RIGHT:
-	  col = field->cols - len;
-	  break;
-	default:
-	  break;
-	}
+      if (field->cols - len >= 0)
+	switch (field->just)
+	  {
+	  case JUSTIFY_LEFT:
+	    break;
+	  case JUSTIFY_CENTER:
+	    col = (field->cols - len) / 2;
+	    break;
+	  case JUSTIFY_RIGHT:
+	    col = field->cols - len;
+	    break;
+	  default:
+	    break;
+	  }
 
       wmove(win, 0, col);
       myADDNSTR(win, bp, len);
@@ -1010,7 +1036,8 @@
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
-|   Function      :  static bool Check_Char(
+|   Function      :  static bool Check_Char(FORM  *form,
+|                                           FIELD *field,
 |                                           FIELDTYPE * typ,
 |                                           int ch,
 |                                           TypeArgument *argp)
@@ -1022,7 +1049,11 @@
 |                    FALSE            - Character is invalid
 +--------------------------------------------------------------------------*/
 static bool
-Check_Char(FIELDTYPE *typ, int ch, TypeArgument *argp)
+Check_Char(FORM *form,
+	   FIELD *field,
+	   FIELDTYPE *typ,
+	   int ch,
+	   TypeArgument *argp)
 {
   if (typ)
     {
@@ -1030,13 +1061,23 @@
 	{
 	  assert(argp);
 	  return (
-		   Check_Char(typ->left, ch, argp->left) ||
-		   Check_Char(typ->right, ch, argp->right));
+		   Check_Char(form, field, typ->left, ch, argp->left) ||
+		   Check_Char(form, field, typ->right, ch, argp->right));
 	}
       else
 	{
+#if NCURSES_INTEROP_FUNCS
+	  if (typ->charcheck.occheck)
+	    {
+	      if (typ->status & _GENERIC)
+		return typ->charcheck.gccheck(ch, form, field, (void *)argp);
+	      else
+		return typ->charcheck.occheck(ch, (void *)argp);
+	    }
+#else
 	  if (typ->ccheck)
 	    return typ->ccheck(ch, (void *)argp);
+#endif
 	}
     }
   return (!iscntrl(UChar(ch)) ? TRUE : FALSE);
@@ -1072,23 +1113,27 @@
     return E_SYSTEM_ERROR;
   else
     {
-      if (field->opts & O_VISIBLE)
-	Set_Field_Window_Attributes(field, win);
+      if (Field_Has_Option(field, O_VISIBLE))
+	{
+	  Set_Field_Window_Attributes(field, win);
+	}
       else
-	wattrset(win, WINDOW_ATTRS(fwin));
+	{
+	  (void)wattrset(win, (int)WINDOW_ATTRS(fwin));
+	}
       werase(win);
     }
 
   if (!bEraseFlag)
     {
-      if (field->opts & O_PUBLIC)
+      if (Field_Has_Option(field, O_PUBLIC))
 	{
 	  if (Justification_Allowed(field))
 	    Perform_Justification(field, win);
 	  else
 	    Buffer_To_Window(field, win);
 	}
-      field->status &= ~_NEWTOP;
+      ClrStatus(field, _NEWTOP);
     }
   wsyncup(win);
   delwin(win);
@@ -1127,18 +1172,18 @@
 	  form->currow = form->curcol = form->toprow = form->begincol = 0;
 	  werase(form->w);
 
-	  if ((field->opts & O_PUBLIC) && Justification_Allowed(field))
+	  if ((Field_Has_Option(field, O_PUBLIC)) && Justification_Allowed(field))
 	    Undo_Justification(field, form->w);
 	  else
 	    Buffer_To_Window(field, form->w);
 
-	  field->status |= _NEWTOP;
+	  SetStatus(field, _NEWTOP);
 	  res = _nc_Refresh_Current_Field(form);
 	}
       else
 	res = Display_Field(field);
     }
-  field->status |= _CHANGED;
+  SetStatus(field, _CHANGED);
   return (res);
 }
 
@@ -1168,7 +1213,7 @@
     return (E_SYSTEM_ERROR);
 
   for (linked_field = field->link;
-       linked_field != field;
+       (linked_field != field) && (linked_field != 0);
        linked_field = linked_field->link)
     {
       if (((syncres = Synchronize_Field(linked_field)) != E_OK) &&
@@ -1197,7 +1242,7 @@
   int res = E_OK;
   WINDOW *formwin;
 
-  T((T_CALLED("_nc_Synchronize_Attributes(%p)"), field));
+  T((T_CALLED("_nc_Synchronize_Attributes(%p)"), (void *)field));
 
   if (!field)
     returnCode(E_BAD_ARGUMENT);
@@ -1213,7 +1258,7 @@
 	  werase(form->w);
 	  wmove(form->w, form->currow, form->curcol);
 
-	  if (field->opts & O_PUBLIC)
+	  if (Field_Has_Option(field, O_PUBLIC))
 	    {
 	      if (Justification_Allowed(field))
 		Undo_Justification(field, form->w);
@@ -1229,7 +1274,7 @@
 		      field->rows - 1, field->cols - 1, 0);
 	      wsyncup(formwin);
 	      Buffer_To_Window(field, form->w);
-	      field->status |= _NEWTOP;		/* fake refresh to paint all */
+	      SetStatus(field, _NEWTOP);	/* fake refresh to paint all */
 	      _nc_Refresh_Current_Field(form);
 	    }
 	}
@@ -1264,7 +1309,7 @@
   FORM *form;
   int res = E_OK;
 
-  T((T_CALLED("_nc_Synchronize_Options(%p,%#x)"), field, newopts));
+  T((T_CALLED("_nc_Synchronize_Options(%p,%#x)"), (void *)field, newopts));
 
   if (!field)
     returnCode(E_BAD_ARGUMENT);
@@ -1276,42 +1321,41 @@
 
   if (form)
     {
-      if (form->current == field)
-	{
-	  field->opts = oldopts;
-	  returnCode(E_CURRENT);
-	}
-
       if (form->status & _POSTED)
 	{
-	  if ((form->curpage == field->page))
+	  if (form->current == field)
 	    {
-	      if (changed_opts & O_VISIBLE)
+	      field->opts = oldopts;
+	      returnCode(E_CURRENT);
+	    }
+	  if (form->curpage == field->page)
+	    {
+	      if ((unsigned)changed_opts & O_VISIBLE)
 		{
-		  if (newopts & O_VISIBLE)
+		  if ((unsigned)newopts & O_VISIBLE)
 		    res = Display_Field(field);
 		  else
 		    res = Erase_Field(field);
 		}
 	      else
 		{
-		  if ((changed_opts & O_PUBLIC) &&
-		      (newopts & O_VISIBLE))
+		  if (((unsigned)changed_opts & O_PUBLIC) &&
+		      ((unsigned)newopts & O_VISIBLE))
 		    res = Display_Field(field);
 		}
 	    }
 	}
     }
 
-  if (changed_opts & O_STATIC)
+  if ((unsigned)changed_opts & O_STATIC)
     {
       bool single_line_field = Single_Line_Field(field);
       int res2 = E_OK;
 
-      if (newopts & O_STATIC)
+      if ((unsigned)newopts & O_STATIC)
 	{
 	  /* the field becomes now static */
-	  field->status &= ~_MAY_GROW;
+	  ClrStatus(field, _MAY_GROW);
 	  /* if actually we have no hidden columns, justification may
 	     occur again */
 	  if (single_line_field &&
@@ -1329,7 +1373,7 @@
 	      (single_line_field && (field->dcols < field->maxgrow)) ||
 	      (!single_line_field && (field->drows < field->maxgrow)))
 	    {
-	      field->status |= _MAY_GROW;
+	      SetStatus(field, _MAY_GROW);
 	      /* a field with justification now changes its behavior,
 	         so we must redisplay it */
 	      if (single_line_field &&
@@ -1365,7 +1409,7 @@
   FIELD *field;
   WINDOW *new_window;
 
-  T((T_CALLED("_nc_Set_Current_Field(%p,%p)"), form, newfield));
+  T((T_CALLED("_nc_Set_Current_Field(%p,%p)"), (void *)form, (void *)newfield));
 
   if (!form || !newfield || !form->current || (newfield->form != form))
     returnCode(E_BAD_ARGUMENT);
@@ -1382,27 +1426,44 @@
       !(form->status & _POSTED))
     {
       if ((form->w) &&
-	  (field->opts & O_VISIBLE) &&
+	  (Field_Has_Option(field, O_VISIBLE)) &&
 	  (field->form->curpage == field->page))
 	{
 	  _nc_Refresh_Current_Field(form);
-	  if (field->opts & O_PUBLIC)
+	  if (Field_Has_Option(field, O_PUBLIC))
 	    {
 	      if (field->drows > field->rows)
 		{
 		  if (form->toprow == 0)
-		    field->status &= ~_NEWTOP;
+		    ClrStatus(field, _NEWTOP);
 		  else
-		    field->status |= _NEWTOP;
+		    SetStatus(field, _NEWTOP);
 		}
 	      else
 		{
 		  if (Justification_Allowed(field))
 		    {
-		      Window_To_Buffer(form->w, field);
+		      Window_To_Buffer(form, field);
 		      werase(form->w);
 		      Perform_Justification(field, form->w);
-		      wsyncup(form->w);
+		      if (Field_Has_Option(field, O_DYNAMIC_JUSTIFY) &&
+			  (form->w->_parent == 0))
+			{
+			  copywin(form->w,
+				  Get_Form_Window(form),
+				  0,
+				  0,
+				  field->frow,
+				  field->fcol,
+				  field->frow,
+				  field->cols + field->fcol - 1,
+				  0);
+			  wsyncup(Get_Form_Window(form));
+			}
+		      else
+			{
+			  wsyncup(form->w);
+			}
 		    }
 		}
 	    }
@@ -1427,7 +1488,7 @@
 	delwin(form->w);
       form->w = new_window;
 
-      form->status &= ~_WINDOW_MODIFIED;
+      ClrStatus(form, _WINDOW_MODIFIED);
       Set_Field_Window_Attributes(field, form->w);
 
       if (Has_Invisible_Parts(field))
@@ -1472,7 +1533,7 @@
   FIELD *field = form->current;
   int step = myWCWIDTH(form->w, form->currow, form->curcol);
 
-  T((T_CALLED("IFN_Next_Character(%p)"), form));
+  T((T_CALLED("IFN_Next_Character(%p)"), (void *)form));
   if ((form->curcol += step) == field->dcols)
     {
       if ((++(form->currow)) == field->drows)
@@ -1514,7 +1575,7 @@
   int amount = myWCWIDTH(form->w, form->currow, form->curcol - 1);
   int oldcol = form->curcol;
 
-  T((T_CALLED("IFN_Previous_Character(%p)"), form));
+  T((T_CALLED("IFN_Previous_Character(%p)"), (void *)form));
   if ((form->curcol -= amount) < 0)
     {
       if ((--(form->currow)) < 0)
@@ -1542,7 +1603,7 @@
 {
   FIELD *field = form->current;
 
-  T((T_CALLED("IFN_Next_Line(%p)"), form));
+  T((T_CALLED("IFN_Next_Line(%p)"), (void *)form));
   if ((++(form->currow)) == field->drows)
     {
 #if GROW_IF_NAVIGATE
@@ -1568,7 +1629,7 @@
 static int
 IFN_Previous_Line(FORM *form)
 {
-  T((T_CALLED("IFN_Previous_Line(%p)"), form));
+  T((T_CALLED("IFN_Previous_Line(%p)"), (void *)form));
   if ((--(form->currow)) < 0)
     {
       form->currow++;
@@ -1595,7 +1656,7 @@
   FIELD_CELL *s;
   FIELD_CELL *t;
 
-  T((T_CALLED("IFN_Next_Word(%p)"), form));
+  T((T_CALLED("IFN_Next_Word(%p)"), (void *)form));
 
   /* We really need access to the data, so we have to synchronize */
   Synchronize_Buffer(form);
@@ -1638,7 +1699,7 @@
   FIELD_CELL *t;
   bool again = FALSE;
 
-  T((T_CALLED("IFN_Previous_Word(%p)"), form));
+  T((T_CALLED("IFN_Previous_Word(%p)"), (void *)form));
 
   /* We really need access to the data, so we have to synchronize */
   Synchronize_Buffer(form);
@@ -1688,7 +1749,7 @@
 {
   FIELD *field = form->current;
 
-  T((T_CALLED("IFN_Beginning_Of_Field(%p)"), form));
+  T((T_CALLED("IFN_Beginning_Of_Field(%p)"), (void *)form));
   Synchronize_Buffer(form);
   Adjust_Cursor_Position(form,
 			 Get_Start_Of_Data(field->buf, Buffer_Length(field)));
@@ -1712,7 +1773,7 @@
   FIELD *field = form->current;
   FIELD_CELL *pos;
 
-  T((T_CALLED("IFN_End_Of_Field(%p)"), form));
+  T((T_CALLED("IFN_End_Of_Field(%p)"), (void *)form));
   Synchronize_Buffer(form);
   pos = After_End_Of_Data(field->buf, Buffer_Length(field));
   if (pos == (field->buf + Buffer_Length(field)))
@@ -1735,7 +1796,7 @@
 {
   FIELD *field = form->current;
 
-  T((T_CALLED("IFN_Beginning_Of_Line(%p)"), form));
+  T((T_CALLED("IFN_Beginning_Of_Line(%p)"), (void *)form));
   Synchronize_Buffer(form);
   Adjust_Cursor_Position(form,
 			 Get_Start_Of_Data(Address_Of_Current_Row_In_Buffer(form),
@@ -1761,7 +1822,7 @@
   FIELD_CELL *pos;
   FIELD_CELL *bp;
 
-  T((T_CALLED("IFN_End_Of_Line(%p)"), form));
+  T((T_CALLED("IFN_End_Of_Line(%p)"), (void *)form));
   Synchronize_Buffer(form);
   bp = Address_Of_Current_Row_In_Buffer(form);
   pos = After_End_Of_Data(bp, field->dcols);
@@ -1787,7 +1848,7 @@
   int amount = myWCWIDTH(form->w, form->currow, form->curcol - 1);
   int oldcol = form->curcol;
 
-  T((T_CALLED("IFN_Left_Character(%p)"), form));
+  T((T_CALLED("IFN_Left_Character(%p)"), (void *)form));
   if ((form->curcol -= amount) < 0)
     {
       form->curcol = oldcol;
@@ -1812,7 +1873,7 @@
   int amount = myWCWIDTH(form->w, form->currow, form->curcol);
   int oldcol = form->curcol;
 
-  T((T_CALLED("IFN_Right_Character(%p)"), form));
+  T((T_CALLED("IFN_Right_Character(%p)"), (void *)form));
   if ((form->curcol += amount) >= form->current->dcols)
     {
 #if GROW_IF_NAVIGATE
@@ -1840,7 +1901,7 @@
 static int
 IFN_Up_Character(FORM *form)
 {
-  T((T_CALLED("IFN_Up_Character(%p)"), form));
+  T((T_CALLED("IFN_Up_Character(%p)"), (void *)form));
   if ((--(form->currow)) < 0)
     {
       form->currow++;
@@ -1864,7 +1925,7 @@
 {
   FIELD *field = form->current;
 
-  T((T_CALLED("IFN_Down_Character(%p)"), form));
+  T((T_CALLED("IFN_Down_Character(%p)"), (void *)form));
   if ((++(form->currow)) == field->drows)
     {
 #if GROW_IF_NAVIGATE
@@ -1956,7 +2017,7 @@
     {
       res = fct(form);
       if (res == E_OK)
-	form->current->status |= _NEWTOP;
+	SetStatus(form->current, _NEWTOP);
     }
   return (res);
 }
@@ -1973,7 +2034,7 @@
 static int
 VSC_Scroll_Line_Forward(FORM *form)
 {
-  T((T_CALLED("VSC_Scroll_Line_Forward(%p)"), form));
+  T((T_CALLED("VSC_Scroll_Line_Forward(%p)"), (void *)form));
   returnCode(VSC_Generic(form, 1));
 }
 
@@ -1989,7 +2050,7 @@
 static int
 VSC_Scroll_Line_Backward(FORM *form)
 {
-  T((T_CALLED("VSC_Scroll_Line_Backward(%p)"), form));
+  T((T_CALLED("VSC_Scroll_Line_Backward(%p)"), (void *)form));
   returnCode(VSC_Generic(form, -1));
 }
 
@@ -2005,7 +2066,7 @@
 static int
 VSC_Scroll_Page_Forward(FORM *form)
 {
-  T((T_CALLED("VSC_Scroll_Page_Forward(%p)"), form));
+  T((T_CALLED("VSC_Scroll_Page_Forward(%p)"), (void *)form));
   returnCode(VSC_Generic(form, form->current->rows));
 }
 
@@ -2021,7 +2082,7 @@
 static int
 VSC_Scroll_Half_Page_Forward(FORM *form)
 {
-  T((T_CALLED("VSC_Scroll_Half_Page_Forward(%p)"), form));
+  T((T_CALLED("VSC_Scroll_Half_Page_Forward(%p)"), (void *)form));
   returnCode(VSC_Generic(form, (form->current->rows + 1) / 2));
 }
 
@@ -2037,7 +2098,7 @@
 static int
 VSC_Scroll_Page_Backward(FORM *form)
 {
-  T((T_CALLED("VSC_Scroll_Page_Backward(%p)"), form));
+  T((T_CALLED("VSC_Scroll_Page_Backward(%p)"), (void *)form));
   returnCode(VSC_Generic(form, -(form->current->rows)));
 }
 
@@ -2053,7 +2114,7 @@
 static int
 VSC_Scroll_Half_Page_Backward(FORM *form)
 {
-  T((T_CALLED("VSC_Scroll_Half_Page_Backward(%p)"), form));
+  T((T_CALLED("VSC_Scroll_Half_Page_Backward(%p)"), (void *)form));
   returnCode(VSC_Generic(form, -((form->current->rows + 1) / 2)));
 }
 /*----------------------------------------------------------------------------
@@ -2147,7 +2208,7 @@
 static int
 HSC_Scroll_Char_Forward(FORM *form)
 {
-  T((T_CALLED("HSC_Scroll_Char_Forward(%p)"), form));
+  T((T_CALLED("HSC_Scroll_Char_Forward(%p)"), (void *)form));
   returnCode(HSC_Generic(form, 1));
 }
 
@@ -2163,7 +2224,7 @@
 static int
 HSC_Scroll_Char_Backward(FORM *form)
 {
-  T((T_CALLED("HSC_Scroll_Char_Backward(%p)"), form));
+  T((T_CALLED("HSC_Scroll_Char_Backward(%p)"), (void *)form));
   returnCode(HSC_Generic(form, -1));
 }
 
@@ -2179,7 +2240,7 @@
 static int
 HSC_Horizontal_Line_Forward(FORM *form)
 {
-  T((T_CALLED("HSC_Horizontal_Line_Forward(%p)"), form));
+  T((T_CALLED("HSC_Horizontal_Line_Forward(%p)"), (void *)form));
   returnCode(HSC_Generic(form, form->current->cols));
 }
 
@@ -2195,7 +2256,7 @@
 static int
 HSC_Horizontal_Half_Line_Forward(FORM *form)
 {
-  T((T_CALLED("HSC_Horizontal_Half_Line_Forward(%p)"), form));
+  T((T_CALLED("HSC_Horizontal_Half_Line_Forward(%p)"), (void *)form));
   returnCode(HSC_Generic(form, (form->current->cols + 1) / 2));
 }
 
@@ -2211,7 +2272,7 @@
 static int
 HSC_Horizontal_Line_Backward(FORM *form)
 {
-  T((T_CALLED("HSC_Horizontal_Line_Backward(%p)"), form));
+  T((T_CALLED("HSC_Horizontal_Line_Backward(%p)"), (void *)form));
   returnCode(HSC_Generic(form, -(form->current->cols)));
 }
 
@@ -2227,7 +2288,7 @@
 static int
 HSC_Horizontal_Half_Line_Backward(FORM *form)
 {
-  T((T_CALLED("HSC_Horizontal_Half_Line_Backward(%p)"), form));
+  T((T_CALLED("HSC_Horizontal_Half_Line_Backward(%p)"), (void *)form));
   returnCode(HSC_Generic(form, -((form->current->cols + 1) / 2)));
 }
 
@@ -2388,7 +2449,7 @@
   int result = E_REQUEST_DENIED;
   bool Last_Row = ((field->drows - 1) == form->currow);
 
-  if ((field->opts & O_WRAP) &&	/* wrapping wanted     */
+  if ((Field_Has_Option(field, O_WRAP)) &&	/* wrapping wanted     */
       (!Single_Line_Field(field)) &&	/* must be multi-line  */
       (There_Is_No_Room_For_A_Char_In_Line(form)) &&	/* line is full        */
       (!Last_Row || Growable(field)))	/* there are more lines */
@@ -2406,7 +2467,7 @@
 	    return E_SYSTEM_ERROR;
 	}
       bp = Address_Of_Current_Row_In_Buffer(form);
-      Window_To_Buffer(form->w, field);
+      Window_To_Buffer(form, field);
       split = After_Last_Whitespace_Character(bp, field->dcols);
       /* split points to the first character of the sequence to be brought
          on the next line */
@@ -2432,7 +2493,7 @@
       if (result != E_OK)
 	{
 	  DeleteChar(form);
-	  Window_To_Buffer(form->w, field);
+	  Window_To_Buffer(form, field);
 	  result = E_REQUEST_DENIED;
 	}
     }
@@ -2471,7 +2532,7 @@
      editable fields.
    */
   if ((fct == FE_Delete_Previous) &&
-      (form->opts & O_BS_OVERLOAD) &&
+      ((unsigned)form->opts & O_BS_OVERLOAD) &&
       First_Position_In_Current_Field(form))
     {
       res = Inter_Field_Navigation(FN_Previous_Field, form);
@@ -2480,7 +2541,7 @@
     {
       if (fct == FE_New_Line)
 	{
-	  if ((form->opts & O_NL_OVERLOAD) &&
+	  if (((unsigned)form->opts & O_NL_OVERLOAD) &&
 	      First_Position_In_Current_Field(form))
 	    {
 	      res = Inter_Field_Navigation(FN_Next_Field, form);
@@ -2492,11 +2553,11 @@
       else
 	{
 	  /* From now on, everything must be editable */
-	  if (form->current->opts & O_EDIT)
+	  if ((unsigned)form->current->opts & O_EDIT)
 	    {
 	      res = fct(form);
 	      if (res == E_OK)
-		form->status |= _WINDOW_MODIFIED;
+		SetStatus(form, _WINDOW_MODIFIED);
 	    }
 	}
     }
@@ -2523,13 +2584,13 @@
   FIELD_CELL *bp, *t;
   bool Last_Row = ((field->drows - 1) == form->currow);
 
-  T((T_CALLED("FE_New_Line(%p)"), form));
+  T((T_CALLED("FE_New_Line(%p)"), (void *)form));
   if (form->status & _OVLMODE)
     {
       if (Last_Row &&
 	  (!(Growable(field) && !Single_Line_Field(field))))
 	{
-	  if (!(form->opts & O_NL_OVERLOAD))
+	  if (!((unsigned)form->opts & O_NL_OVERLOAD))
 	    returnCode(E_REQUEST_DENIED);
 	  wmove(form->w, form->currow, form->curcol);
 	  wclrtoeol(form->w);
@@ -2537,7 +2598,7 @@
 	     handled in the generic routine. The reason is,
 	     that FN_Next_Field may fail, but the form is
 	     definitively changed */
-	  form->status |= _WINDOW_MODIFIED;
+	  SetStatus(form, _WINDOW_MODIFIED);
 	  returnCode(Inter_Field_Navigation(FN_Next_Field, form));
 	}
       else
@@ -2553,7 +2614,7 @@
 	  wclrtoeol(form->w);
 	  form->currow++;
 	  form->curcol = 0;
-	  form->status |= _WINDOW_MODIFIED;
+	  SetStatus(form, _WINDOW_MODIFIED);
 	  returnCode(E_OK);
 	}
     }
@@ -2563,7 +2624,7 @@
       if (Last_Row &&
 	  !(Growable(field) && !Single_Line_Field(field)))
 	{
-	  if (!(form->opts & O_NL_OVERLOAD))
+	  if (!((unsigned)form->opts & O_NL_OVERLOAD))
 	    returnCode(E_REQUEST_DENIED);
 	  returnCode(Inter_Field_Navigation(FN_Next_Field, form));
 	}
@@ -2585,7 +2646,7 @@
 	  wmove(form->w, form->currow, form->curcol);
 	  winsertln(form->w);
 	  myADDNSTR(form->w, bp, (int)(t - bp));
-	  form->status |= _WINDOW_MODIFIED;
+	  SetStatus(form, _WINDOW_MODIFIED);
 	  returnCode(E_OK);
 	}
     }
@@ -2606,8 +2667,9 @@
   FIELD *field = form->current;
   int result = E_REQUEST_DENIED;
 
-  T((T_CALLED("FE_Insert_Character(%p)"), form));
-  if (Check_Char(field->type, (int)C_BLANK, (TypeArgument *)(field->arg)))
+  T((T_CALLED("FE_Insert_Character(%p)"), (void *)form));
+  if (Check_Char(form, field, field->type, (int)C_BLANK,
+		 (TypeArgument *)(field->arg)))
     {
       bool There_Is_Room = Is_There_Room_For_A_Char_In_Line(form);
 
@@ -2641,8 +2703,9 @@
   FIELD *field = form->current;
   int result = E_REQUEST_DENIED;
 
-  T((T_CALLED("FE_Insert_Line(%p)"), form));
-  if (Check_Char(field->type, (int)C_BLANK, (TypeArgument *)(field->arg)))
+  T((T_CALLED("FE_Insert_Line(%p)"), (void *)form));
+  if (Check_Char(form, field,
+		 field->type, (int)C_BLANK, (TypeArgument *)(field->arg)))
     {
       bool Maybe_Done = (form->currow != (field->drows - 1)) &&
       Is_There_Room_For_A_Line(form);
@@ -2674,7 +2737,7 @@
 static int
 FE_Delete_Character(FORM *form)
 {
-  T((T_CALLED("FE_Delete_Character(%p)"), form));
+  T((T_CALLED("FE_Delete_Character(%p)"), (void *)form));
   DeleteChar(form);
   returnCode(E_OK);
 }
@@ -2697,7 +2760,7 @@
 {
   FIELD *field = form->current;
 
-  T((T_CALLED("FE_Delete_Previous(%p)"), form));
+  T((T_CALLED("FE_Delete_Previous(%p)"), (void *)form));
   if (First_Position_In_Current_Field(form))
     returnCode(E_REQUEST_DENIED);
 
@@ -2765,7 +2828,7 @@
 static int
 FE_Delete_Line(FORM *form)
 {
-  T((T_CALLED("FE_Delete_Line(%p)"), form));
+  T((T_CALLED("FE_Delete_Line(%p)"), (void *)form));
   form->curcol = 0;
   wdeleteln(form->w);
   returnCode(E_OK);
@@ -2789,7 +2852,7 @@
   FIELD_CELL *cp = bp + form->curcol;
   FIELD_CELL *s;
 
-  T((T_CALLED("FE_Delete_Word(%p)"), form));
+  T((T_CALLED("FE_Delete_Word(%p)"), (void *)form));
   Synchronize_Buffer(form);
   if (ISBLANK(*cp))
     returnCode(E_REQUEST_DENIED);	/* not in word */
@@ -2823,7 +2886,7 @@
 static int
 FE_Clear_To_End_Of_Line(FORM *form)
 {
-  T((T_CALLED("FE_Clear_To_End_Of_Line(%p)"), form));
+  T((T_CALLED("FE_Clear_To_End_Of_Line(%p)"), (void *)form));
   wmove(form->w, form->currow, form->curcol);
   wclrtoeol(form->w);
   returnCode(E_OK);
@@ -2840,7 +2903,7 @@
 static int
 FE_Clear_To_End_Of_Field(FORM *form)
 {
-  T((T_CALLED("FE_Clear_To_End_Of_Field(%p)"), form));
+  T((T_CALLED("FE_Clear_To_End_Of_Field(%p)"), (void *)form));
   wmove(form->w, form->currow, form->curcol);
   wclrtobot(form->w);
   returnCode(E_OK);
@@ -2857,7 +2920,7 @@
 static int
 FE_Clear_Field(FORM *form)
 {
-  T((T_CALLED("FE_Clear_Field(%p)"), form));
+  T((T_CALLED("FE_Clear_Field(%p)"), (void *)form));
   form->currow = form->curcol = 0;
   werase(form->w);
   returnCode(E_OK);
@@ -2881,8 +2944,8 @@
 static int
 EM_Overlay_Mode(FORM *form)
 {
-  T((T_CALLED("EM_Overlay_Mode(%p)"), form));
-  form->status |= _OVLMODE;
+  T((T_CALLED("EM_Overlay_Mode(%p)"), (void *)form));
+  SetStatus(form, _OVLMODE);
   returnCode(E_OK);
 }
 
@@ -2897,8 +2960,8 @@
 static int
 EM_Insert_Mode(FORM *form)
 {
-  T((T_CALLED("EM_Insert_Mode(%p)"), form));
-  form->status &= ~_OVLMODE;
+  T((T_CALLED("EM_Insert_Mode(%p)"), (void *)form));
+  ClrStatus(form, _OVLMODE);
   returnCode(E_OK);
 }
 
@@ -2912,7 +2975,7 @@
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
-|   Function      :  static bool Next_Choice(
+|   Function      :  static bool Next_Choice(FORM * form,
 |                                            FIELDTYPE * typ,
 |                                            FIELD * field,
 |                                            TypeArgument *argp)
@@ -2924,7 +2987,7 @@
 |                    FALSE   - couldn't retrieve next choice
 +--------------------------------------------------------------------------*/
 static bool
-Next_Choice(FIELDTYPE *typ, FIELD *field, TypeArgument *argp)
+Next_Choice(FORM *form, FIELDTYPE *typ, FIELD *field, TypeArgument *argp)
 {
   if (!typ || !(typ->status & _HAS_CHOICE))
     return FALSE;
@@ -2933,19 +2996,27 @@
     {
       assert(argp);
       return (
-	       Next_Choice(typ->left, field, argp->left) ||
-	       Next_Choice(typ->right, field, argp->right));
+	       Next_Choice(form, typ->left, field, argp->left) ||
+	       Next_Choice(form, typ->right, field, argp->right));
     }
   else
     {
+#if NCURSES_INTEROP_FUNCS
+      assert(typ->enum_next.onext);
+      if (typ->status & _GENERIC)
+	return typ->enum_next.gnext(form, field, (void *)argp);
+      else
+	return typ->enum_next.onext(field, (void *)argp);
+#else
       assert(typ->next);
       return typ->next(field, (void *)argp);
+#endif
     }
 }
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
-|   Function      :  static bool Previous_Choice(
+|   Function      :  static bool Previous_Choice(FORM * form,
 |                                                FIELDTYPE * typ,
 |                                                FIELD * field,
 |                                                TypeArgument *argp)
@@ -2957,7 +3028,7 @@
 |                    FALSE   - couldn't retrieve previous choice
 +--------------------------------------------------------------------------*/
 static bool
-Previous_Choice(FIELDTYPE *typ, FIELD *field, TypeArgument *argp)
+Previous_Choice(FORM *form, FIELDTYPE *typ, FIELD *field, TypeArgument *argp)
 {
   if (!typ || !(typ->status & _HAS_CHOICE))
     return FALSE;
@@ -2966,13 +3037,21 @@
     {
       assert(argp);
       return (
-	       Previous_Choice(typ->left, field, argp->left) ||
-	       Previous_Choice(typ->right, field, argp->right));
+	       Previous_Choice(form, typ->left, field, argp->left) ||
+	       Previous_Choice(form, typ->right, field, argp->right));
     }
   else
     {
+#if NCURSES_INTEROP_FUNCS
+      assert(typ->enum_prev.oprev);
+      if (typ->status & _GENERIC)
+	return typ->enum_prev.gprev(form, field, (void *)argp);
+      else
+	return typ->enum_prev.oprev(field, (void *)argp);
+#else
       assert(typ->prev);
       return typ->prev(field, (void *)argp);
+#endif
     }
 }
 /*----------------------------------------------------------------------------
@@ -2997,9 +3076,9 @@
 {
   FIELD *field = form->current;
 
-  T((T_CALLED("CR_Next_Choice(%p)"), form));
+  T((T_CALLED("CR_Next_Choice(%p)"), (void *)form));
   Synchronize_Buffer(form);
-  returnCode((Next_Choice(field->type, field, (TypeArgument *)(field->arg)))
+  returnCode((Next_Choice(form, field->type, field, (TypeArgument *)(field->arg)))
 	     ? E_OK
 	     : E_REQUEST_DENIED);
 }
@@ -3018,9 +3097,9 @@
 {
   FIELD *field = form->current;
 
-  T((T_CALLED("CR_Previous_Choice(%p)"), form));
+  T((T_CALLED("CR_Previous_Choice(%p)"), (void *)form));
   Synchronize_Buffer(form);
-  returnCode((Previous_Choice(field->type, field, (TypeArgument *)(field->arg)))
+  returnCode((Previous_Choice(form, field->type, field, (TypeArgument *)(field->arg)))
 	     ? E_OK
 	     : E_REQUEST_DENIED);
 }
@@ -3034,7 +3113,7 @@
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
-|   Function      :  static bool Check_Field(
+|   Function      :  static bool Check_Field(FORM* form,
 |                                            FIELDTYPE * typ,
 |                                            FIELD * field,
 |                                            TypeArgument * argp)
@@ -3047,11 +3126,11 @@
 |                    FALSE      - field is invalid.
 +--------------------------------------------------------------------------*/
 static bool
-Check_Field(FIELDTYPE *typ, FIELD *field, TypeArgument *argp)
+Check_Field(FORM *form, FIELDTYPE *typ, FIELD *field, TypeArgument *argp)
 {
   if (typ)
     {
-      if (field->opts & O_NULLOK)
+      if (Field_Has_Option(field, O_NULLOK))
 	{
 	  FIELD_CELL *bp = field->buf;
 
@@ -3068,13 +3147,23 @@
 	{
 	  assert(argp);
 	  return (
-		   Check_Field(typ->left, field, argp->left) ||
-		   Check_Field(typ->right, field, argp->right));
+		   Check_Field(form, typ->left, field, argp->left) ||
+		   Check_Field(form, typ->right, field, argp->right));
 	}
       else
 	{
+#if NCURSES_INTEROP_FUNCS
+	  if (typ->fieldcheck.ofcheck)
+	    {
+	      if (typ->status & _GENERIC)
+		return typ->fieldcheck.gfcheck(form, field, (void *)argp);
+	      else
+		return typ->fieldcheck.ofcheck(field, (void *)argp);
+	    }
+#else
 	  if (typ->fcheck)
 	    return typ->fcheck(field, (void *)argp);
+#endif
 	}
     }
   return TRUE;
@@ -3098,12 +3187,12 @@
 
   Synchronize_Buffer(form);
   if ((form->status & _FCHECK_REQUIRED) ||
-      (!(field->opts & O_PASSOK)))
+      (!(Field_Has_Option(field, O_PASSOK))))
     {
-      if (!Check_Field(field->type, field, (TypeArgument *)(field->arg)))
+      if (!Check_Field(form, field->type, field, (TypeArgument *)(field->arg)))
 	return FALSE;
-      form->status &= ~_FCHECK_REQUIRED;
-      field->status |= _CHANGED;
+      ClrStatus(form, _FCHECK_REQUIRED);
+      SetStatus(field, _CHANGED);
       Synchronize_Linked_Fields(field);
     }
   return TRUE;
@@ -3128,7 +3217,7 @@
 static int
 FV_Validation(FORM *form)
 {
-  T((T_CALLED("FV_Validation(%p)"), form));
+  T((T_CALLED("FV_Validation(%p)"), (void *)form));
   if (_nc_Internal_Validation(form))
     returnCode(E_OK);
   else
@@ -3203,14 +3292,15 @@
 	  do
 	    {
 	      field = (field == last_on_page) ? first : field + 1;
-	      if (((*field)->opts & O_VISIBLE))
+	      if (Field_Has_Option(*field, O_VISIBLE))
 		break;
 	    }
 	  while (proposed != (*field));
 
 	  proposed = *field;
 
-	  if ((proposed == *last_on_page) && !(proposed->opts & O_VISIBLE))
+	  if ((proposed == *last_on_page) &&
+	      !((unsigned)proposed->opts & O_VISIBLE))
 	    {
 	      /* This means, there is also no visible field on the page.
 	         So we propose the first one and hope the very best...
@@ -3506,7 +3596,7 @@
 static int
 FN_Next_Field(FORM *form)
 {
-  T((T_CALLED("FN_Next_Field(%p)"), form));
+  T((T_CALLED("FN_Next_Field(%p)"), (void *)form));
   returnCode(_nc_Set_Current_Field(form,
 				   Next_Field_On_Page(form->current)));
 }
@@ -3524,7 +3614,7 @@
 static int
 FN_Previous_Field(FORM *form)
 {
-  T((T_CALLED("FN_Previous_Field(%p)"), form));
+  T((T_CALLED("FN_Previous_Field(%p)"), (void *)form));
   returnCode(_nc_Set_Current_Field(form,
 				   Previous_Field_On_Page(form->current)));
 }
@@ -3541,7 +3631,7 @@
 static int
 FN_First_Field(FORM *form)
 {
-  T((T_CALLED("FN_First_Field(%p)"), form));
+  T((T_CALLED("FN_First_Field(%p)"), (void *)form));
   returnCode(_nc_Set_Current_Field(form,
 				   Next_Field_On_Page(form->field[form->page[form->curpage].pmax])));
 }
@@ -3558,7 +3648,7 @@
 static int
 FN_Last_Field(FORM *form)
 {
-  T((T_CALLED("FN_Last_Field(%p)"), form));
+  T((T_CALLED("FN_Last_Field(%p)"), (void *)form));
   returnCode(
 	      _nc_Set_Current_Field(form,
 				    Previous_Field_On_Page(form->field[form->page[form->curpage].pmin])));
@@ -3577,7 +3667,7 @@
 static int
 FN_Sorted_Next_Field(FORM *form)
 {
-  T((T_CALLED("FN_Sorted_Next_Field(%p)"), form));
+  T((T_CALLED("FN_Sorted_Next_Field(%p)"), (void *)form));
   returnCode(_nc_Set_Current_Field(form,
 				   Sorted_Next_Field(form->current)));
 }
@@ -3595,7 +3685,7 @@
 static int
 FN_Sorted_Previous_Field(FORM *form)
 {
-  T((T_CALLED("FN_Sorted_Previous_Field(%p)"), form));
+  T((T_CALLED("FN_Sorted_Previous_Field(%p)"), (void *)form));
   returnCode(_nc_Set_Current_Field(form,
 				   Sorted_Previous_Field(form->current)));
 }
@@ -3613,7 +3703,7 @@
 static int
 FN_Sorted_First_Field(FORM *form)
 {
-  T((T_CALLED("FN_Sorted_First_Field(%p)"), form));
+  T((T_CALLED("FN_Sorted_First_Field(%p)"), (void *)form));
   returnCode(_nc_Set_Current_Field(form,
 				   Sorted_Next_Field(form->field[form->page[form->curpage].smax])));
 }
@@ -3631,7 +3721,7 @@
 static int
 FN_Sorted_Last_Field(FORM *form)
 {
-  T((T_CALLED("FN_Sorted_Last_Field(%p)"), form));
+  T((T_CALLED("FN_Sorted_Last_Field(%p)"), (void *)form));
   returnCode(_nc_Set_Current_Field(form,
 				   Sorted_Previous_Field(form->field[form->page[form->curpage].smin])));
 }
@@ -3649,7 +3739,7 @@
 static int
 FN_Left_Field(FORM *form)
 {
-  T((T_CALLED("FN_Left_Field(%p)"), form));
+  T((T_CALLED("FN_Left_Field(%p)"), (void *)form));
   returnCode(_nc_Set_Current_Field(form,
 				   Left_Neighbor_Field(form->current)));
 }
@@ -3667,7 +3757,7 @@
 static int
 FN_Right_Field(FORM *form)
 {
-  T((T_CALLED("FN_Right_Field(%p)"), form));
+  T((T_CALLED("FN_Right_Field(%p)"), (void *)form));
   returnCode(_nc_Set_Current_Field(form,
 				   Right_Neighbor_Field(form->current)));
 }
@@ -3687,7 +3777,7 @@
 static int
 FN_Up_Field(FORM *form)
 {
-  T((T_CALLED("FN_Up_Field(%p)"), form));
+  T((T_CALLED("FN_Up_Field(%p)"), (void *)form));
   returnCode(_nc_Set_Current_Field(form,
 				   Upper_Neighbor_Field(form->current)));
 }
@@ -3707,7 +3797,7 @@
 static int
 FN_Down_Field(FORM *form)
 {
-  T((T_CALLED("FN_Down_Field(%p)"), form));
+  T((T_CALLED("FN_Down_Field(%p)"), (void *)form));
   returnCode(_nc_Set_Current_Field(form,
 				   Down_Neighbor_Field(form->current)));
 }
@@ -3746,11 +3836,11 @@
       FIELD *last_field, *field_on_page;
 
       werase(Get_Form_Window(form));
-      form->curpage = page;
+      form->curpage = (short)page;
       last_field = field_on_page = form->field[form->page[page].smin];
       do
 	{
-	  if (field_on_page->opts & O_VISIBLE)
+	  if ((unsigned)field_on_page->opts & O_VISIBLE)
 	    if ((res = Display_Field(field_on_page)) != E_OK)
 	      return (res);
 	  field_on_page = field_on_page->snext;
@@ -3851,7 +3941,7 @@
 static int
 PN_Next_Page(FORM *form)
 {
-  T((T_CALLED("PN_Next_Page(%p)"), form));
+  T((T_CALLED("PN_Next_Page(%p)"), (void *)form));
   returnCode(_nc_Set_Form_Page(form, Next_Page_Number(form), (FIELD *)0));
 }
 
@@ -3867,7 +3957,7 @@
 static int
 PN_Previous_Page(FORM *form)
 {
-  T((T_CALLED("PN_Previous_Page(%p)"), form));
+  T((T_CALLED("PN_Previous_Page(%p)"), (void *)form));
   returnCode(_nc_Set_Form_Page(form, Previous_Page_Number(form), (FIELD *)0));
 }
 
@@ -3883,7 +3973,7 @@
 static int
 PN_First_Page(FORM *form)
 {
-  T((T_CALLED("PN_First_Page(%p)"), form));
+  T((T_CALLED("PN_First_Page(%p)"), (void *)form));
   returnCode(_nc_Set_Form_Page(form, 0, (FIELD *)0));
 }
 
@@ -3899,7 +3989,7 @@
 static int
 PN_Last_Page(FORM *form)
 {
-  T((T_CALLED("PN_Last_Page(%p)"), form));
+  T((T_CALLED("PN_Last_Page(%p)"), (void *)form));
   returnCode(_nc_Set_Form_Page(form, form->maxpage - 1, (FIELD *)0));
 }
 
@@ -3911,6 +4001,94 @@
   Helper routines for the core form driver.
   --------------------------------------------------------------------------*/
 
+# if USE_WIDEC_SUPPORT
+/*---------------------------------------------------------------------------
+|   Facility      :  libnform
+|   Function      :  static int Data_Entry_w(FORM * form, wchar_t c)
+|
+|   Description   :  Enter the wide character c into at the current
+|                    position of the current field of the form.
+|
+|   Return Values :  E_OK              - success
+|                    E_REQUEST_DENIED  - driver could not process the request
+|                    E_SYSTEM_ERROR    -
++--------------------------------------------------------------------------*/
+static int
+Data_Entry_w(FORM *form, wchar_t c)
+{
+  FIELD *field = form->current;
+  int result = E_REQUEST_DENIED;
+
+  T((T_CALLED("Data_Entry(%p,%s)"), (void *)form, _tracechtype((chtype)c)));
+  if ((Field_Has_Option(field, O_EDIT))
+#if FIX_FORM_INACTIVE_BUG
+      && (Field_Has_Option(field, O_ACTIVE))
+#endif
+    )
+    {
+      wchar_t given[2];
+      cchar_t temp_ch;
+
+      given[0] = c;
+      given[1] = 1;
+      setcchar(&temp_ch, given, 0, 0, (void *)0);
+      if ((Field_Has_Option(field, O_BLANK)) &&
+	  First_Position_In_Current_Field(form) &&
+	  !(form->status & _FCHECK_REQUIRED) &&
+	  !(form->status & _WINDOW_MODIFIED))
+	werase(form->w);
+
+      if (form->status & _OVLMODE)
+	{
+	  wadd_wch(form->w, &temp_ch);
+	}
+      else
+	/* no _OVLMODE */
+	{
+	  bool There_Is_Room = Is_There_Room_For_A_Char_In_Line(form);
+
+	  if (!(There_Is_Room ||
+		((Single_Line_Field(field) && Growable(field)))))
+	    RETURN(E_REQUEST_DENIED);
+
+	  if (!There_Is_Room && !Field_Grown(field, 1))
+	    RETURN(E_SYSTEM_ERROR);
+
+	  wins_wch(form->w, &temp_ch);
+	}
+
+      if ((result = Wrapping_Not_Necessary_Or_Wrapping_Ok(form)) == E_OK)
+	{
+	  bool End_Of_Field = (((field->drows - 1) == form->currow) &&
+			       ((field->dcols - 1) == form->curcol));
+
+	  form->status |= _WINDOW_MODIFIED;
+	  if (End_Of_Field && !Growable(field) && (Field_Has_Option(field, O_AUTOSKIP)))
+	    result = Inter_Field_Navigation(FN_Next_Field, form);
+	  else
+	    {
+	      if (End_Of_Field && Growable(field) && !Field_Grown(field, 1))
+		result = E_SYSTEM_ERROR;
+	      else
+		{
+		  /*
+		   * We have just added a byte to the form field.  It may have
+		   * been part of a multibyte character.  If it was, the
+		   * addch_used field is nonzero and we should not try to move
+		   * to a new column.
+		   */
+		  if (WINDOW_EXT(form->w, addch_used) == 0)
+		    IFN_Next_Character(form);
+
+		  result = E_OK;
+		}
+	    }
+	}
+    }
+  RETURN(result);
+}
+# endif
+
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
 |   Function      :  static int Data_Entry(FORM * form,int c)
@@ -3928,14 +4106,14 @@
   FIELD *field = form->current;
   int result = E_REQUEST_DENIED;
 
-  T((T_CALLED("Data_Entry(%p,%s)"), form, _tracechtype((chtype)c)));
-  if ((field->opts & O_EDIT)
+  T((T_CALLED("Data_Entry(%p,%s)"), (void *)form, _tracechtype((chtype)c)));
+  if ((Field_Has_Option(field, O_EDIT))
 #if FIX_FORM_INACTIVE_BUG
-      && (field->opts & O_ACTIVE)
+      && (Field_Has_Option(field, O_ACTIVE))
 #endif
     )
     {
-      if ((field->opts & O_BLANK) &&
+      if ((Field_Has_Option(field, O_BLANK)) &&
 	  First_Position_In_Current_Field(form) &&
 	  !(form->status & _FCHECK_REQUIRED) &&
 	  !(form->status & _WINDOW_MODIFIED))
@@ -3965,8 +4143,8 @@
 	  bool End_Of_Field = (((field->drows - 1) == form->currow) &&
 			       ((field->dcols - 1) == form->curcol));
 
-	  form->status |= _WINDOW_MODIFIED;
-	  if (End_Of_Field && !Growable(field) && (field->opts & O_AUTOSKIP))
+	  SetStatus(form, _WINDOW_MODIFIED);
+	  if (End_Of_Field && !Growable(field) && (Field_Has_Option(field, O_AUTOSKIP)))
 	    result = Inter_Field_Navigation(FN_Next_Field, form);
 	  else
 	    {
@@ -4129,7 +4307,7 @@
   const Binding_Info *BI = (Binding_Info *) 0;
   int res = E_UNKNOWN_COMMAND;
 
-  T((T_CALLED("form_driver(%p,%d)"), form, c));
+  T((T_CALLED("form_driver(%p,%d)"), (void *)form, c));
 
   if (!form)
     RETURN(E_BAD_ARGUMENT);
@@ -4158,7 +4336,10 @@
 
   if ((c >= MIN_FORM_COMMAND && c <= MAX_FORM_COMMAND) &&
       ((bindings[c - MIN_FORM_COMMAND].keycode & Key_Mask) == c))
-    BI = &(bindings[c - MIN_FORM_COMMAND]);
+    {
+      TR(TRACE_CALLS, ("form_request %s", form_request_name(c)));
+      BI = &(bindings[c - MIN_FORM_COMMAND]);
+    }
 
   if (BI)
     {
@@ -4176,7 +4357,7 @@
 	NULL			/* Choice Request is generic           */
       };
       size_t nMethods = (sizeof(Generic_Methods) / sizeof(Generic_Methods[0]));
-      size_t method = (BI->keycode >> ID_Shft) & 0xffff;	/* see ID_Mask */
+      size_t method = (size_t) ((BI->keycode >> ID_Shft) & 0xffff);	/* see ID_Mask */
 
       if ((method >= nMethods) || !(BI->cmd))
 	res = E_SYSTEM_ERROR;
@@ -4185,16 +4366,20 @@
 	  Generic_Method fct = Generic_Methods[method];
 
 	  if (fct)
-	    res = fct(BI->cmd, form);
+	    {
+	      res = fct(BI->cmd, form);
+	    }
 	  else
-	    res = (BI->cmd) (form);
+	    {
+	      res = (BI->cmd) (form);
+	    }
 	}
     }
 #ifdef NCURSES_MOUSE_VERSION
   else if (KEY_MOUSE == c)
     {
       MEVENT event;
-      WINDOW *win = form->win ? form->win : stdscr;
+      WINDOW *win = form->win ? form->win : StdScreen(Get_Form_Screen(form));
       WINDOW *sub = form->sub ? form->sub : win;
 
       getmouse(&event);
@@ -4281,7 +4466,7 @@
       if (!iscntrl(UChar(c)))
 #else
       if (isprint(UChar(c)) &&
-	  Check_Char(form->current->type, c,
+	  Check_Char(form, form->current, form->current->type, c,
 		     (TypeArgument *)(form->current->arg)))
 #endif
 	res = Data_Entry(form, c);
@@ -4290,6 +4475,195 @@
   RETURN(res);
 }
 
+# if USE_WIDEC_SUPPORT
+/*---------------------------------------------------------------------------
+|   Facility      :  libnform
+|   Function      :  int form_driver_w(FORM * form,int type,wchar_t  c)
+|
+|   Description   :  This is the workhorse of the forms system.
+|
+|                    Input is either a key code (request) or a wide char
+|                    returned by e.g. get_wch (). The type must be passed
+|                    as well,so that we are able to determine whether the char
+|                    is a multibyte char or a request.
+
+|                    If it is a request, the form driver executes
+|                    the request and returns the result. If it is data
+|                    (printable character), it enters the data into the
+|                    current position in the current field. If it is not
+|                    recognized, the form driver assumes it is an application
+|                    defined command and returns E_UNKNOWN_COMMAND.
+|                    Application defined command should be defined relative
+|                    to MAX_FORM_COMMAND, the maximum value of a request.
+|
+|   Return Values :  E_OK              - success
+|                    E_SYSTEM_ERROR    - system error
+|                    E_BAD_ARGUMENT    - an argument is incorrect
+|                    E_NOT_POSTED      - form is not posted
+|                    E_INVALID_FIELD   - field contents are invalid
+|                    E_BAD_STATE       - called from inside a hook routine
+|                    E_REQUEST_DENIED  - request failed
+|                    E_NOT_CONNECTED   - no fields are connected to the form
+|                    E_UNKNOWN_COMMAND - command not known
++--------------------------------------------------------------------------*/
+NCURSES_EXPORT(int)
+form_driver_w(FORM *form, int type, wchar_t c)
+{
+  const Binding_Info *BI = (Binding_Info *) 0;
+  int res = E_UNKNOWN_COMMAND;
+
+  T((T_CALLED("form_driver(%p,%d)"), (void *)form, (int)c));
+
+  if (!form)
+    RETURN(E_BAD_ARGUMENT);
+
+  if (!(form->field))
+    RETURN(E_NOT_CONNECTED);
+
+  assert(form->page);
+
+  if (c == (wchar_t)FIRST_ACTIVE_MAGIC)
+    {
+      form->current = _nc_First_Active_Field(form);
+      RETURN(E_OK);
+    }
+
+  assert(form->current &&
+	 form->current->buf &&
+	 (form->current->form == form)
+    );
+
+  if (form->status & _IN_DRIVER)
+    RETURN(E_BAD_STATE);
+
+  if (!(form->status & _POSTED))
+    RETURN(E_NOT_POSTED);
+
+  /* check if this is a keycode or a (wide) char */
+  if (type == KEY_CODE_YES)
+    {
+      if ((c >= MIN_FORM_COMMAND && c <= MAX_FORM_COMMAND) &&
+	  ((bindings[c - MIN_FORM_COMMAND].keycode & Key_Mask) == c))
+	BI = &(bindings[c - MIN_FORM_COMMAND]);
+    }
+
+  if (BI)
+    {
+      typedef int (*Generic_Method) (int (*const) (FORM *), FORM *);
+      static const Generic_Method Generic_Methods[] =
+      {
+	Page_Navigation,	/* overloaded to call field&form hooks */
+	Inter_Field_Navigation,	/* overloaded to call field hooks      */
+	NULL,			/* Intra-Field is generic              */
+	Vertical_Scrolling,	/* Overloaded to check multi-line      */
+	Horizontal_Scrolling,	/* Overloaded to check single-line     */
+	Field_Editing,		/* Overloaded to mark modification     */
+	NULL,			/* Edit Mode is generic                */
+	NULL,			/* Field Validation is generic         */
+	NULL			/* Choice Request is generic           */
+      };
+      size_t nMethods = (sizeof(Generic_Methods) / sizeof(Generic_Methods[0]));
+      size_t method = (size_t) (BI->keycode >> ID_Shft) & 0xffff;	/* see ID_Mask */
+
+      if ((method >= nMethods) || !(BI->cmd))
+	res = E_SYSTEM_ERROR;
+      else
+	{
+	  Generic_Method fct = Generic_Methods[method];
+
+	  if (fct)
+	    res = fct(BI->cmd, form);
+	  else
+	    res = (BI->cmd) (form);
+	}
+    }
+#ifdef NCURSES_MOUSE_VERSION
+  else if (KEY_MOUSE == c)
+    {
+      MEVENT event;
+      WINDOW *win = form->win ? form->win : StdScreen(Get_Form_Screen(form));
+      WINDOW *sub = form->sub ? form->sub : win;
+
+      getmouse(&event);
+      if ((event.bstate & (BUTTON1_CLICKED |
+			   BUTTON1_DOUBLE_CLICKED |
+			   BUTTON1_TRIPLE_CLICKED))
+	  && wenclose(win, event.y, event.x))
+	{			/* we react only if the click was in the userwin, that means
+				   * inside the form display area or at the decoration window.
+				 */
+	  int ry = event.y, rx = event.x;	/* screen coordinates */
+
+	  res = E_REQUEST_DENIED;
+	  if (mouse_trafo(&ry, &rx, FALSE))
+	    {			/* rx, ry are now "curses" coordinates */
+	      if (ry < sub->_begy)
+		{		/* we clicked above the display region; this is
+				   * interpreted as "scroll up" request
+				 */
+		  if (event.bstate & BUTTON1_CLICKED)
+		    res = form_driver(form, REQ_PREV_FIELD);
+		  else if (event.bstate & BUTTON1_DOUBLE_CLICKED)
+		    res = form_driver(form, REQ_PREV_PAGE);
+		  else if (event.bstate & BUTTON1_TRIPLE_CLICKED)
+		    res = form_driver(form, REQ_FIRST_FIELD);
+		}
+	      else if (ry > sub->_begy + sub->_maxy)
+		{		/* we clicked below the display region; this is
+				   * interpreted as "scroll down" request
+				 */
+		  if (event.bstate & BUTTON1_CLICKED)
+		    res = form_driver(form, REQ_NEXT_FIELD);
+		  else if (event.bstate & BUTTON1_DOUBLE_CLICKED)
+		    res = form_driver(form, REQ_NEXT_PAGE);
+		  else if (event.bstate & BUTTON1_TRIPLE_CLICKED)
+		    res = form_driver(form, REQ_LAST_FIELD);
+		}
+	      else if (wenclose(sub, event.y, event.x))
+		{		/* Inside the area we try to find the hit item */
+		  int i;
+
+		  ry = event.y;
+		  rx = event.x;
+		  if (wmouse_trafo(sub, &ry, &rx, FALSE))
+		    {
+		      int min_field = form->page[form->curpage].pmin;
+		      int max_field = form->page[form->curpage].pmax;
+
+		      for (i = min_field; i <= max_field; ++i)
+			{
+			  FIELD *field = form->field[i];
+
+			  if (Field_Is_Selectable(field)
+			      && Field_encloses(field, ry, rx) == E_OK)
+			    {
+			      res = _nc_Set_Current_Field(form, field);
+			      if (res == E_OK)
+				res = _nc_Position_Form_Cursor(form);
+			      if (res == E_OK
+				  && (event.bstate & BUTTON1_DOUBLE_CLICKED))
+				res = E_UNKNOWN_COMMAND;
+			      break;
+			    }
+			}
+		    }
+		}
+	    }
+	}
+      else
+	res = E_REQUEST_DENIED;
+    }
+#endif /* NCURSES_MOUSE_VERSION */
+  else if (type == OK)
+    {
+      res = Data_Entry_w(form, c);
+    }
+
+  _nc_Refresh_Current_Field(form);
+  RETURN(res);
+}
+# endif	/* USE_WIDEC_SUPPORT */
+
 /*----------------------------------------------------------------------------
   Field-Buffer manipulation routines.
   The effects of setting a buffer are tightly coupled to the core of the form
@@ -4319,14 +4693,14 @@
 {
   FIELD_CELL *p;
   int res = E_OK;
-  unsigned int i;
-  unsigned int len;
+  int i;
+  int len;
 
 #if USE_WIDEC_SUPPORT
   FIELD_CELL *widevalue = 0;
 #endif
 
-  T((T_CALLED("set_field_buffer(%p,%d,%s)"), field, buffer, _nc_visbuf(value)));
+  T((T_CALLED("set_field_buffer(%p,%d,%s)"), (void *)field, buffer, _nc_visbuf(value)));
 
   if (!field || !value || ((buffer < 0) || (buffer > field->nbuf)))
     RETURN(E_BAD_ARGUMENT);
@@ -4338,7 +4712,7 @@
       /* for a growable field we must assume zero terminated strings, because
          somehow we have to detect the length of what should be copied.
        */
-      unsigned int vlen = strlen(value);
+      int vlen = (int)strlen(value);
 
       if (vlen > len)
 	{
@@ -4347,7 +4721,9 @@
 						     * field->cols))))
 	    RETURN(E_SYSTEM_ERROR);
 
+#if !USE_WIDEC_SUPPORT
 	  len = vlen;
+#endif
 	}
     }
 
@@ -4360,14 +4736,15 @@
    * and other special cases that we really do not want to handle here.
    */
 #if NCURSES_EXT_FUNCS
-  if (wresize(field->working, field->drows, field->dcols) == ERR)
+  if (wresize(field->working, 1, Buffer_Length(field) + 1) == ERR)
 #endif
     {
       delwin(field->working);
-      field->working = newpad(field->drows, field->dcols);
+      field->working = newpad(1, Buffer_Length(field) + 1);
     }
+  len = Buffer_Length(field);
   wclear(field->working);
-  mvwaddstr(field->working, 0, 0, value);
+  (void)mvwaddstr(field->working, 0, 0, value);
 
   if ((widevalue = typeCalloc(FIELD_CELL, len + 1)) == 0)
     {
@@ -4375,11 +4752,11 @@
     }
   else
     {
-      for (i = 0; i < (unsigned)field->drows; ++i)
+      for (i = 0; i < field->drows; ++i)
 	{
-	  mvwin_wchnstr(field->working, i, 0,
-			widevalue + (i * field->dcols),
-			field->dcols);
+	  (void)mvwin_wchnstr(field->working, 0, (int)i * field->dcols,
+			      widevalue + ((int)i * field->dcols),
+			      field->dcols);
 	}
       for (i = 0; i < len; ++i)
 	{
@@ -4433,27 +4810,27 @@
 {
   char *result = 0;
 
-  T((T_CALLED("field_buffer(%p,%d)"), field, buffer));
+  T((T_CALLED("field_buffer(%p,%d)"), (const void *)field, buffer));
 
   if (field && (buffer >= 0) && (buffer <= field->nbuf))
     {
 #if USE_WIDEC_SUPPORT
       FIELD_CELL *data = Address_Of_Nth_Buffer(field, buffer);
-      unsigned need = 0;
+      size_t need = 0;
       int size = Buffer_Length(field);
       int n;
 
       /* determine the number of bytes needed to store the expanded string */
       for (n = 0; n < size; ++n)
 	{
-	  if (!isWidecExt(data[n]))
+	  if (!isWidecExt(data[n]) && data[n].chars[0] != L'\0')
 	    {
 	      mbstate_t state;
 	      size_t next;
 
 	      init_mb(state);
 	      next = _nc_wcrtomb(0, data[n].chars[0], &state);
-	      if (!isEILSEQ(next))
+	      if (next > 0)
 		need += next;
 	    }
 	}
@@ -4463,12 +4840,25 @@
 	free(field->expanded[buffer]);
       field->expanded[buffer] = typeMalloc(char, need + 1);
 
-      /* expand the multibyte data */
+      /*
+       * Expand the multibyte data.
+       *
+       * It may also be multi-column data.  In that case, the data for a row
+       * may be null-padded to align to the dcols/drows layout (or it may
+       * contain embedded wide-character extensions).  Change the null-padding
+       * to blanks as needed.
+       */
       if ((result = field->expanded[buffer]) != 0)
 	{
 	  wclear(field->working);
-	  mvwadd_wchnstr(field->working, 0, 0, data, size);
-	  mvwinnstr(field->working, 0, 0, result, (int)need);
+	  wmove(field->working, 0, 0);
+	  for (n = 0; n < size; ++n)
+	    {
+	      if (!isWidecExt(data[n]) && data[n].chars[0] != L'\0')
+		wadd_wch(field->working, &data[n]);
+	    }
+	  wmove(field->working, 0, 0);
+	  winnstr(field->working, result, (int)need);
 	}
 #else
       result = Address_Of_Nth_Buffer(field, buffer);
@@ -4479,22 +4869,6 @@
 
 #if USE_WIDEC_SUPPORT
 
-/* FIXME: see lib_get_wch.c */
-#if HAVE_MBTOWC && HAVE_MBLEN
-#define reset_mbytes(state) mblen(NULL, 0), mbtowc(NULL, NULL, 0)
-#define count_mbytes(buffer,length,state) mblen(buffer,length)
-#define trans_mbytes(wch,buffer,length,state) \
-	(int) mbtowc(&wch, buffer, length)
-#elif HAVE_MBRTOWC && HAVE_MBRLEN
-#define NEED_STATE
-#define reset_mbytes(state) init_mb(state)
-#define count_mbytes(buffer,length,state) mbrlen(buffer,length,&state)
-#define trans_mbytes(wch,buffer,length,state) \
-	(int) mbrtowc(&wch, buffer, length, &state)
-#else
-make an error
-#endif
-
 /*---------------------------------------------------------------------------
 | Convert a multibyte string to a wide-character string.  The result must be
 | freed by the caller.
@@ -4509,7 +4883,7 @@
   int pass;
   int status;
 
-#ifdef NEED_STATE
+#ifndef state_unused
   mbstate_t state;
 #endif
 
@@ -4528,8 +4902,8 @@
 
 	      source[passed + tries] = 0;
 	      reset_mbytes(state);
-	      status = trans_mbytes(wch, source + passed, tries, state);
-	      source[passed + tries] = save;
+	      status = check_mbytes(wch, source + passed, tries, state);
+	      source[passed + tries] = (char)save;
 
 	      if (status > 0)
 		{
@@ -4543,14 +4917,14 @@
 		{
 		  result[need] = wch;
 		}
-	      passed += status;
+	      passed += (size_t) status;
 	      ++need;
 	    }
 	  else
 	    {
 	      if (pass)
 		{
-		  result[need] = source[passed];
+		  result[need] = (wchar_t)source[passed];
 		}
 	      ++need;
 	      ++passed;
@@ -4563,7 +4937,7 @@
 	    break;
 	  result = typeCalloc(wchar_t, need);
 
-	  *lengthp = need;
+	  *lengthp = (int)need;
 	  if (result == 0)
 	    break;
 	}
diff --git a/form/frm_hook.c b/form/frm_hook.c
index 18e6d71..23850bf 100644
--- a/form/frm_hook.c
+++ b/form/frm_hook.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,13 +32,13 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_hook.c,v 1.14 2004/12/25 22:37:27 tom Exp $")
+MODULE_ID("$Id: frm_hook.c,v 1.16 2012/03/11 00:37:16 tom Exp $")
 
 /* "Template" macro to generate function to set application specific hook */
 #define GEN_HOOK_SET_FUNCTION( typ, name ) \
 NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\
 {\
-   T((T_CALLED("set_" #typ"_"#name"(%p,%p)"), form, func));\
+   T((T_CALLED("set_" #typ"_"#name"(%p,%p)"), (void *) form, func));\
    (Normalize_Form( form ) -> typ ## name) = func ;\
    RETURN(E_OK);\
 }
@@ -47,7 +47,7 @@
 #define GEN_HOOK_GET_FUNCTION( typ, name ) \
 NCURSES_IMPEXP Form_Hook NCURSES_API typ ## _ ## name ( const FORM *form )\
 {\
-   T((T_CALLED(#typ "_" #name "(%p)"), form));\
+   T((T_CALLED(#typ "_" #name "(%p)"), (const void *) form));\
    returnFormHook( Normalize_Form( form ) -> typ ## name );\
 }
 
diff --git a/form/frm_opts.c b/form/frm_opts.c
index d36d618..42d6267 100644
--- a/form/frm_opts.c
+++ b/form/frm_opts.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_opts.c,v 1.14 2005/04/16 16:59:18 tom Exp $")
+MODULE_ID("$Id: frm_opts.c,v 1.17 2013/08/24 22:58:47 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -47,10 +47,10 @@
 NCURSES_EXPORT(int)
 set_form_opts(FORM *form, Form_Options opts)
 {
-  T((T_CALLED("set_form_opts(%p,%d)"), form, opts));
+  T((T_CALLED("set_form_opts(%p,%d)"), (void *)form, opts));
 
-  opts &= ALL_FORM_OPTS;
-  if (opts & ~ALL_FORM_OPTS)
+  opts &= (Form_Options) ALL_FORM_OPTS;
+  if ((unsigned)opts & ~ALL_FORM_OPTS)
     RETURN(E_BAD_ARGUMENT);
   else
     {
@@ -70,8 +70,8 @@
 NCURSES_EXPORT(Form_Options)
 form_opts(const FORM *form)
 {
-  T((T_CALLED("form_opts(%p)"), form));
-  returnCode((int)(Normalize_Form(form)->opts & ALL_FORM_OPTS));
+  T((T_CALLED("form_opts(%p)"), (const void *)form));
+  returnCode((Form_Options) ((unsigned)Normalize_Form(form)->opts & ALL_FORM_OPTS));
 }
 
 /*---------------------------------------------------------------------------
@@ -87,10 +87,10 @@
 NCURSES_EXPORT(int)
 form_opts_on(FORM *form, Form_Options opts)
 {
-  T((T_CALLED("form_opts_on(%p,%d)"), form, opts));
+  T((T_CALLED("form_opts_on(%p,%d)"), (void *)form, opts));
 
-  opts &= ALL_FORM_OPTS;
-  if (opts & ~ALL_FORM_OPTS)
+  opts &= (Form_Options) ALL_FORM_OPTS;
+  if ((unsigned)opts & ~ALL_FORM_OPTS)
     RETURN(E_BAD_ARGUMENT);
   else
     {
@@ -112,10 +112,10 @@
 NCURSES_EXPORT(int)
 form_opts_off(FORM *form, Form_Options opts)
 {
-  T((T_CALLED("form_opts_off(%p,%d)"), form, opts));
+  T((T_CALLED("form_opts_off(%p,%d)"), (void *)form, opts));
 
-  opts &= ALL_FORM_OPTS;
-  if (opts & ~ALL_FORM_OPTS)
+  opts &= (Form_Options) ALL_FORM_OPTS;
+  if ((unsigned)opts & ~ALL_FORM_OPTS)
     RETURN(E_BAD_ARGUMENT);
   else
     {
diff --git a/form/frm_page.c b/form/frm_page.c
index a371838..13520da 100644
--- a/form/frm_page.c
+++ b/form/frm_page.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_page.c,v 1.10 2004/12/11 22:08:21 tom Exp $")
+MODULE_ID("$Id: frm_page.c,v 1.12 2012/06/10 00:28:04 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -51,14 +51,14 @@
 {
   int err = E_OK;
 
-  T((T_CALLED("set_form_page(%p,%d)"), form, page));
+  T((T_CALLED("set_form_page(%p,%d)"), (void *)form, page));
 
   if (!form || (page < 0) || (page >= form->maxpage))
     RETURN(E_BAD_ARGUMENT);
 
   if (!(form->status & _POSTED))
     {
-      form->curpage = page;
+      form->curpage = (short)page;
       form->current = _nc_First_Active_Field(form);
     }
   else
@@ -98,7 +98,7 @@
 NCURSES_EXPORT(int)
 form_page(const FORM *form)
 {
-  T((T_CALLED("form_page(%p)"), form));
+  T((T_CALLED("form_page(%p)"), (const void *)form));
 
   returnCode(Normalize_Form(form)->curpage);
 }
diff --git a/form/frm_post.c b/form/frm_post.c
index 28937e9..31568b2 100644
--- a/form/frm_post.c
+++ b/form/frm_post.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_post.c,v 1.9 2004/12/11 22:19:06 tom Exp $")
+MODULE_ID("$Id: frm_post.c,v 1.11 2012/06/10 00:27:49 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -54,7 +54,7 @@
   int err;
   int page;
 
-  T((T_CALLED("post_form(%p)"), form));
+  T((T_CALLED("post_form(%p)"), (void *)form));
 
   if (!form)
     RETURN(E_BAD_ARGUMENT);
@@ -77,7 +77,7 @@
   if ((err = _nc_Set_Form_Page(form, page, form->current)) != E_OK)
     RETURN(err);
 
-  form->status |= _POSTED;
+  SetStatus(form, _POSTED);
 
   Call_Hook(form, forminit);
   Call_Hook(form, fieldinit);
@@ -100,7 +100,7 @@
 NCURSES_EXPORT(int)
 unpost_form(FORM *form)
 {
-  T((T_CALLED("unpost_form(%p)"), form));
+  T((T_CALLED("unpost_form(%p)"), (void *)form));
 
   if (!form)
     RETURN(E_BAD_ARGUMENT);
@@ -117,7 +117,7 @@
   werase(Get_Form_Window(form));
   delwin(form->w);
   form->w = (WINDOW *)0;
-  form->status &= ~_POSTED;
+  ClrStatus(form, _POSTED);
   RETURN(E_OK);
 }
 
diff --git a/form/frm_req_name.c b/form/frm_req_name.c
index 7ac9abe..5686b22 100644
--- a/form/frm_req_name.c
+++ b/form/frm_req_name.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2005,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2015 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -37,73 +37,77 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_req_name.c,v 1.16 2008/07/05 23:22:08 tom Exp $")
+MODULE_ID("$Id: frm_req_name.c,v 1.19 2015/04/04 17:11:46 tom Exp $")
 
-static const char *request_names[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] =
+#define DATA(s) { s }
+
+static const char request_names[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1][13] =
 {
-  "NEXT_PAGE",
-  "PREV_PAGE",
-  "FIRST_PAGE",
-  "LAST_PAGE",
+  DATA("NEXT_PAGE"),
+  DATA("PREV_PAGE"),
+  DATA("FIRST_PAGE"),
+  DATA("LAST_PAGE"),
 
-  "NEXT_FIELD",
-  "PREV_FIELD",
-  "FIRST_FIELD",
-  "LAST_FIELD",
-  "SNEXT_FIELD",
-  "SPREV_FIELD",
-  "SFIRST_FIELD",
-  "SLAST_FIELD",
-  "LEFT_FIELD",
-  "RIGHT_FIELD",
-  "UP_FIELD",
-  "DOWN_FIELD",
+  DATA("NEXT_FIELD"),
+  DATA("PREV_FIELD"),
+  DATA("FIRST_FIELD"),
+  DATA("LAST_FIELD"),
+  DATA("SNEXT_FIELD"),
+  DATA("SPREV_FIELD"),
+  DATA("SFIRST_FIELD"),
+  DATA("SLAST_FIELD"),
+  DATA("LEFT_FIELD"),
+  DATA("RIGHT_FIELD"),
+  DATA("UP_FIELD"),
+  DATA("DOWN_FIELD"),
 
-  "NEXT_CHAR",
-  "PREV_CHAR",
-  "NEXT_LINE",
-  "PREV_LINE",
-  "NEXT_WORD",
-  "PREV_WORD",
-  "BEG_FIELD",
-  "END_FIELD",
-  "BEG_LINE",
-  "END_LINE",
-  "LEFT_CHAR",
-  "RIGHT_CHAR",
-  "UP_CHAR",
-  "DOWN_CHAR",
+  DATA("NEXT_CHAR"),
+  DATA("PREV_CHAR"),
+  DATA("NEXT_LINE"),
+  DATA("PREV_LINE"),
+  DATA("NEXT_WORD"),
+  DATA("PREV_WORD"),
+  DATA("BEG_FIELD"),
+  DATA("END_FIELD"),
+  DATA("BEG_LINE"),
+  DATA("END_LINE"),
+  DATA("LEFT_CHAR"),
+  DATA("RIGHT_CHAR"),
+  DATA("UP_CHAR"),
+  DATA("DOWN_CHAR"),
 
-  "NEW_LINE",
-  "INS_CHAR",
-  "INS_LINE",
-  "DEL_CHAR",
-  "DEL_PREV",
-  "DEL_LINE",
-  "DEL_WORD",
-  "CLR_EOL",
-  "CLR_EOF",
-  "CLR_FIELD",
-  "OVL_MODE",
-  "INS_MODE",
-  "SCR_FLINE",
-  "SCR_BLINE",
-  "SCR_FPAGE",
-  "SCR_BPAGE",
-  "SCR_FHPAGE",
-  "SCR_BHPAGE",
-  "SCR_FCHAR",
-  "SCR_BCHAR",
-  "SCR_HFLINE",
-  "SCR_HBLINE",
-  "SCR_HFHALF",
-  "SCR_HBHALF",
+  DATA("NEW_LINE"),
+  DATA("INS_CHAR"),
+  DATA("INS_LINE"),
+  DATA("DEL_CHAR"),
+  DATA("DEL_PREV"),
+  DATA("DEL_LINE"),
+  DATA("DEL_WORD"),
+  DATA("CLR_EOL"),
+  DATA("CLR_EOF"),
+  DATA("CLR_FIELD"),
+  DATA("OVL_MODE"),
+  DATA("INS_MODE"),
+  DATA("SCR_FLINE"),
+  DATA("SCR_BLINE"),
+  DATA("SCR_FPAGE"),
+  DATA("SCR_BPAGE"),
+  DATA("SCR_FHPAGE"),
+  DATA("SCR_BHPAGE"),
+  DATA("SCR_FCHAR"),
+  DATA("SCR_BCHAR"),
+  DATA("SCR_HFLINE"),
+  DATA("SCR_HBLINE"),
+  DATA("SCR_HFHALF"),
+  DATA("SCR_HBHALF"),
 
-  "VALIDATION",
-  "NEXT_CHOICE",
-  "PREV_CHOICE"
+  DATA("VALIDATION"),
+  DATA("NEXT_CHOICE"),
+  DATA("PREV_CHOICE")
 };
 
+#undef DATA
+
 #define A_SIZE (sizeof(request_names)/sizeof(request_names[0]))
 
 /*---------------------------------------------------------------------------
@@ -144,24 +148,27 @@
   /* because the table is so small, it doesn't really hurt
      to run sequentially through it.
    */
-  unsigned int i = 0;
-  char buf[16];
+  size_t i = 0;
+  char buf[16];			/* longest name is 10 chars */
 
   T((T_CALLED("form_request_by_name(%s)"), _nc_visbuf(str)));
 
-  if (str)
+  if (str != 0 && (i = strlen(str)) != 0)
     {
-      strncpy(buf, str, sizeof(buf));
-      while ((i < sizeof(buf)) && (buf[i] != '\0'))
+      if (i > sizeof(buf) - 2)
+	i = sizeof(buf) - 2;
+      memcpy(buf, str, i);
+      buf[i] = '\0';
+
+      for (i = 0; buf[i] != '\0'; ++i)
 	{
-	  buf[i] = toupper(UChar(buf[i]));
-	  i++;
+	  buf[i] = (char)toupper(UChar(buf[i]));
 	}
 
       for (i = 0; i < A_SIZE; i++)
 	{
-	  if (strncmp(request_names[i], buf, sizeof(buf)) == 0)
-	    returnCode(MIN_FORM_COMMAND + (int) i);
+	  if (strcmp(request_names[i], buf) == 0)
+	    returnCode(MIN_FORM_COMMAND + (int)i);
 	}
     }
   RETURN(E_NO_MATCH);
diff --git a/form/frm_scale.c b/form/frm_scale.c
index 2ebf72d..27e154e 100644
--- a/form/frm_scale.c
+++ b/form/frm_scale.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_scale.c,v 1.9 2004/12/11 22:12:34 tom Exp $")
+MODULE_ID("$Id: frm_scale.c,v 1.10 2010/01/23 21:14:36 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -47,7 +47,10 @@
 NCURSES_EXPORT(int)
 scale_form(const FORM *form, int *rows, int *cols)
 {
-  T((T_CALLED("scale_form(%p,%p,%p)"), form, rows, cols));
+  T((T_CALLED("scale_form(%p,%p,%p)"),
+     (const void *)form,
+     (void *)rows,
+     (void *)cols));
 
   if (!form)
     RETURN(E_BAD_ARGUMENT);
diff --git a/form/frm_sub.c b/form/frm_sub.c
index 6db0023..1ab131a 100644
--- a/form/frm_sub.c
+++ b/form/frm_sub.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -27,12 +27,12 @@
  ****************************************************************************/
 
 /****************************************************************************
- *   Author:  Juergen Pfeifer, 1995,1997                                    *
+ *   Author:  Juergen Pfeifer, 1995-1997,2009                               *
  ****************************************************************************/
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_sub.c,v 1.9 2004/12/11 22:13:39 tom Exp $")
+MODULE_ID("$Id: frm_sub.c,v 1.12 2010/01/23 21:14:36 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -46,13 +46,22 @@
 NCURSES_EXPORT(int)
 set_form_sub(FORM *form, WINDOW *win)
 {
-  T((T_CALLED("set_form_sub(%p,%p)"), form, win));
+  T((T_CALLED("set_form_sub(%p,%p)"), (void *)form, (void *)win));
 
   if (form && (form->status & _POSTED))
     RETURN(E_POSTED);
+  else
+    {
+#if NCURSES_SP_FUNCS
+      FORM *f = Normalize_Form(form);
 
-  Normalize_Form(form)->sub = win;
-  RETURN(E_OK);
+      f->sub = win ? win : StdScreen(Get_Form_Screen(f));
+      RETURN(E_OK);
+#else
+      Normalize_Form(form)->sub = win;
+      RETURN(E_OK);
+#endif
+    }
 }
 
 /*---------------------------------------------------------------------------
@@ -68,7 +77,7 @@
 {
   const FORM *f;
 
-  T((T_CALLED("form_sub(%p)"), form));
+  T((T_CALLED("form_sub(%p)"), (const void *)form));
 
   f = Normalize_Form(form);
   returnWin(Get_Form_Window(f));
diff --git a/form/frm_user.c b/form/frm_user.c
index 4d5e0e4..1375b5e 100644
--- a/form/frm_user.c
+++ b/form/frm_user.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_user.c,v 1.14 2004/12/25 22:37:56 tom Exp $")
+MODULE_ID("$Id: frm_user.c,v 1.15 2010/01/23 21:14:36 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -46,7 +46,7 @@
 NCURSES_EXPORT(int)
 set_form_userptr(FORM *form, void *usrptr)
 {
-  T((T_CALLED("set_form_userptr(%p,%p)"), form, usrptr));
+  T((T_CALLED("set_form_userptr(%p,%p)"), (void *)form, (void *)usrptr));
 
   Normalize_Form(form)->usrptr = usrptr;
   RETURN(E_OK);
@@ -65,7 +65,7 @@
 NCURSES_EXPORT(void *)
 form_userptr(const FORM *form)
 {
-  T((T_CALLED("form_userptr(%p)"), form));
+  T((T_CALLED("form_userptr(%p)"), (const void *)form));
   returnVoidPtr(Normalize_Form(form)->usrptr);
 }
 
diff --git a/form/frm_win.c b/form/frm_win.c
index 2258f0a..a65cc59 100644
--- a/form/frm_win.c
+++ b/form/frm_win.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_win.c,v 1.13 2004/12/11 22:15:27 tom Exp $")
+MODULE_ID("$Id: frm_win.c,v 1.16 2010/01/23 21:14:36 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -46,13 +46,22 @@
 NCURSES_EXPORT(int)
 set_form_win(FORM *form, WINDOW *win)
 {
-  T((T_CALLED("set_form_win(%p,%p)"), form, win));
+  T((T_CALLED("set_form_win(%p,%p)"), (void *)form, (void *)win));
 
   if (form && (form->status & _POSTED))
     RETURN(E_POSTED);
+  else
+    {
+#if NCURSES_SP_FUNCS
+      FORM *f = Normalize_Form(form);
 
-  Normalize_Form(form)->win = win;
-  RETURN(E_OK);
+      f->win = win ? win : StdScreen(Get_Form_Screen(f));
+      RETURN(E_OK);
+#else
+      Normalize_Form(form)->win = win;
+      RETURN(E_OK);
+#endif
+    }
 }
 
 /*---------------------------------------------------------------------------
@@ -66,12 +75,18 @@
 NCURSES_EXPORT(WINDOW *)
 form_win(const FORM *form)
 {
+  WINDOW *result;
   const FORM *f;
 
-  T((T_CALLED("form_win(%p)"), form));
+  T((T_CALLED("form_win(%p)"), (const void *)form));
 
   f = Normalize_Form(form);
-  returnWin(f->win ? f->win : stdscr);
+#if NCURSES_SP_FUNCS
+  result = (f->win ? f->win : StdScreen(Get_Form_Screen(f)));
+#else
+  result = (f->win ? f->win : stdscr);
+#endif
+  returnWin(result);
 }
 
 /* frm_win.c ends here */
diff --git a/form/fty_alnum.c b/form/fty_alnum.c
index 59dd273..cda23dc 100644
--- a/form/fty_alnum.c
+++ b/form/fty_alnum.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,7 +34,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fty_alnum.c,v 1.21 2007/10/13 19:31:52 tom Exp $")
+MODULE_ID("$Id: fty_alnum.c,v 1.24 2010/01/23 21:14:36 tom Exp $")
 
 #define thisARG alnumARG
 
@@ -46,6 +46,32 @@
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
+|   Function      :  static void *Generic_This_Type(void *arg)
+|
+|   Description   :  Allocate structure for alphanumeric type argument.
+|
+|   Return Values :  Pointer to argument structure or NULL on error
++--------------------------------------------------------------------------*/
+static void *
+Generic_This_Type(void *arg)
+{
+  thisARG *argp = (thisARG *) 0;
+
+  if (arg)
+    {
+      argp = typeMalloc(thisARG, 1);
+
+      if (argp)
+	{
+	  T((T_CREATE("thisARG %p"), (void *)argp));
+	  argp->width = *((int *)arg);
+	}
+    }
+  return ((void *)argp);
+}
+
+/*---------------------------------------------------------------------------
+|   Facility      :  libnform
 |   Function      :  static void *Make_This_Type(va_list *ap)
 |
 |   Description   :  Allocate structure for alphanumeric type argument.
@@ -55,15 +81,9 @@
 static void *
 Make_This_Type(va_list *ap)
 {
-  thisARG *argp = typeMalloc(thisARG, 1);
+  int w = va_arg(*ap, int);
 
-  if (argp)
-    {
-      T((T_CREATE("thisARG %p"), argp));
-      argp->width = va_arg(*ap, int);
-    }
-
-  return ((void *)argp);
+  return Generic_This_Type((void *)&w);
 }
 
 /*---------------------------------------------------------------------------
@@ -82,7 +102,7 @@
 
   if (result)
     {
-      T((T_CREATE("thisARG %p"), result));
+      T((T_CREATE("thisARG %p"), (void *)result));
       *result = *ap;
     }
 
@@ -156,12 +176,27 @@
   Make_This_Type,
   Copy_This_Type,
   Free_This_Type,
-  Check_This_Field,
-  Check_This_Character,
-  NULL,
-  NULL
+  INIT_FT_FUNC(Check_This_Field),
+  INIT_FT_FUNC(Check_This_Character),
+  INIT_FT_FUNC(NULL),
+  INIT_FT_FUNC(NULL),
+#if NCURSES_INTEROP_FUNCS
+  Generic_This_Type
+#endif
 };
 
 NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALNUM = &typeTHIS;
 
+#if NCURSES_INTEROP_FUNCS
+/* The next routines are to simplify the use of ncurses from
+   programming languages with restictions on interop with C level
+   constructs (e.g. variable access or va_list + ellipsis constructs)
+*/
+NCURSES_EXPORT(FIELDTYPE *)
+_nc_TYPE_ALNUM(void)
+{
+  return TYPE_ALNUM;
+}
+#endif
+
 /* fty_alnum.c ends here */
diff --git a/form/fty_alpha.c b/form/fty_alpha.c
index bd49544..917a9e0 100644
--- a/form/fty_alpha.c
+++ b/form/fty_alpha.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,7 +34,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fty_alpha.c,v 1.23 2007/10/13 19:32:09 tom Exp $")
+MODULE_ID("$Id: fty_alpha.c,v 1.26 2010/01/23 21:14:36 tom Exp $")
 
 #define thisARG alphaARG
 
@@ -46,6 +46,32 @@
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
+|   Function      :  static void *Generic_This_Type(va_list *ap)
+|
+|   Description   :  Allocate structure for alpha type argument.
+|
+|   Return Values :  Pointer to argument structure or NULL on error
++--------------------------------------------------------------------------*/
+static void *
+Generic_This_Type(void *arg)
+{
+  thisARG *argp = (thisARG *) 0;
+
+  if (arg)
+    {
+      argp = typeMalloc(thisARG, 1);
+
+      if (argp)
+	{
+	  T((T_CREATE("thisARG %p"), (void *)argp));
+	  argp->width = *((int *)arg);
+	}
+    }
+  return ((void *)argp);
+}
+
+/*---------------------------------------------------------------------------
+|   Facility      :  libnform
 |   Function      :  static void *Make_This_Type(va_list *ap)
 |
 |   Description   :  Allocate structure for alpha type argument.
@@ -55,15 +81,9 @@
 static void *
 Make_This_Type(va_list *ap)
 {
-  thisARG *argp = typeMalloc(thisARG, 1);
+  int w = va_arg(*ap, int);
 
-  if (argp)
-    {
-      T((T_CREATE("thisARG %p"), argp));
-      argp->width = va_arg(*ap, int);
-    }
-
-  return ((void *)argp);
+  return Generic_This_Type((void *)&w);
 }
 
 /*---------------------------------------------------------------------------
@@ -82,7 +102,7 @@
 
   if (result)
     {
-      T((T_CREATE("thisARG %p"), result));
+      T((T_CREATE("thisARG %p"), (void *)result));
       *result = *ap;
     }
 
@@ -156,12 +176,27 @@
   Make_This_Type,
   Copy_This_Type,
   Free_This_Type,
-  Check_This_Field,
-  Check_This_Character,
-  NULL,
-  NULL
+  INIT_FT_FUNC(Check_This_Field),
+  INIT_FT_FUNC(Check_This_Character),
+  INIT_FT_FUNC(NULL),
+  INIT_FT_FUNC(NULL),
+#if NCURSES_INTEROP_FUNCS
+  Generic_This_Type
+#endif
 };
 
 NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALPHA = &typeTHIS;
 
+#if NCURSES_INTEROP_FUNCS
+/* The next routines are to simplify the use of ncurses from
+   programming languages with restictions on interop with C level
+   constructs (e.g. variable access or va_list + ellipsis constructs)
+*/
+NCURSES_EXPORT(FIELDTYPE *)
+_nc_TYPE_ALPHA(void)
+{
+  return TYPE_ALPHA;
+}
+#endif
+
 /* fty_alpha.c ends here */
diff --git a/form/fty_enum.c b/form/fty_enum.c
index c96a080..d335164 100644
--- a/form/fty_enum.c
+++ b/form/fty_enum.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,7 +34,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fty_enum.c,v 1.22 2007/10/13 19:32:26 tom Exp $")
+MODULE_ID("$Id: fty_enum.c,v 1.26 2010/05/01 21:11:07 tom Exp $")
 
 typedef struct
   {
@@ -45,6 +45,77 @@
   }
 enumARG;
 
+typedef struct
+  {
+    char **kwds;
+    int ccase;
+    int cunique;
+  }
+enumParams;
+
+/*---------------------------------------------------------------------------
+|   Facility      :  libnform  
+|   Function      :  static void *Generic_Enum_Type(void * arg)
+|   
+|   Description   :  Allocate structure for enumeration type argument.
+|
+|   Return Values :  Pointer to argument structure or NULL on error
++--------------------------------------------------------------------------*/
+static void *
+Generic_Enum_Type(void *arg)
+{
+  enumARG *argp = (enumARG *)0;
+  enumParams *params = (enumParams *) arg;
+
+  if (params)
+    {
+      argp = typeMalloc(enumARG, 1);
+
+      if (argp)
+	{
+	  int cnt = 0;
+	  char **kp = (char **)0;
+	  char **kwds = (char **)0;
+	  char **kptarget;
+	  int ccase, cunique;
+
+	  T((T_CREATE("enumARG %p"), (void *)argp));
+	  kwds = params->kwds;
+	  ccase = params->ccase;
+	  cunique = params->cunique;
+
+	  argp->checkcase = ccase ? TRUE : FALSE;
+	  argp->checkunique = cunique ? TRUE : FALSE;
+	  argp->kwds = (char **)0;
+
+	  kp = kwds;
+	  while (kp && (*kp++))
+	    cnt++;
+	  argp->count = cnt;
+
+	  if (cnt > 0)
+	    {
+	      /* We copy the keywords, because we can't rely on the fact
+	         that the caller doesn't relocate or free the memory used
+	         for the keywords (maybe he has GC)
+	       */
+	      argp->kwds = typeMalloc(char *, cnt + 1);
+
+	      kp = kwds;
+	      if ((kptarget = argp->kwds) != 0)
+		{
+		  while (kp && (*kp))
+		    {
+		      (*kptarget++) = strdup(*kp++);
+		    }
+		  *kptarget = (char *)0;
+		}
+	    }
+	}
+    }
+  return (void *)argp;
+}
+
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
 |   Function      :  static void *Make_Enum_Type( va_list * ap )
@@ -56,28 +127,13 @@
 static void *
 Make_Enum_Type(va_list *ap)
 {
-  enumARG *argp = typeMalloc(enumARG, 1);
+  enumParams params;
 
-  if (argp)
-    {
-      int cnt = 0;
-      char **kp = (char **)0;
-      int ccase, cunique;
+  params.kwds = va_arg(*ap, char **);
+  params.ccase = va_arg(*ap, int);
+  params.cunique = va_arg(*ap, int);
 
-      T((T_CREATE("enumARG %p"), argp));
-      argp->kwds = va_arg(*ap, char **);
-      ccase = va_arg(*ap, int);
-      cunique = va_arg(*ap, int);
-
-      argp->checkcase = ccase ? TRUE : FALSE;
-      argp->checkunique = cunique ? TRUE : FALSE;
-
-      kp = argp->kwds;
-      while (kp && (*kp++))
-	cnt++;
-      argp->count = cnt;
-    }
-  return (void *)argp;
+  return Generic_Enum_Type((void *)&params);
 }
 
 /*---------------------------------------------------------------------------
@@ -101,8 +157,24 @@
 
       if (result)
 	{
-	  T((T_CREATE("enumARG %p"), result));
+	  T((T_CREATE("enumARG %p"), (void *)result));
 	  *result = *ap;
+
+	  if (ap->count > 0)
+	    {
+	      char **kptarget;
+	      char **kp = ap->kwds;
+	      result->kwds = typeMalloc(char *, 1 + ap->count);
+
+	      if ((kptarget = result->kwds) != 0)
+		{
+		  while (kp && (*kp))
+		    {
+		      (*kptarget++) = strdup(*kp++);
+		    }
+		  *kptarget = (char *)0;
+		}
+	    }
 	}
     }
   return (void *)result;
@@ -120,7 +192,24 @@
 Free_Enum_Type(void *argp)
 {
   if (argp)
-    free(argp);
+    {
+      const enumARG *ap = (const enumARG *)argp;
+
+      if (ap->kwds && ap->count > 0)
+	{
+	  char **kp = ap->kwds;
+	  int cnt = 0;
+
+	  while (kp && (*kp))
+	    {
+	      free(*kp++);
+	      cnt++;
+	    }
+	  assert(cnt == ap->count);
+	  free(ap->kwds);
+	}
+      free(argp);
+    }
 }
 
 #define SKIP_SPACE(x) while(((*(x))!='\0') && (is_blank(*(x)))) (x)++
@@ -326,13 +415,28 @@
   Make_Enum_Type,
   Copy_Enum_Type,
   Free_Enum_Type,
-  Check_Enum_Field,
-  NULL,
-  Next_Enum,
-  Previous_Enum
+  INIT_FT_FUNC(Check_Enum_Field),
+  INIT_FT_FUNC(NULL),
+  INIT_FT_FUNC(Next_Enum),
+  INIT_FT_FUNC(Previous_Enum),
+#if NCURSES_INTEROP_FUNCS
+  Generic_Enum_Type
+#endif
 };
 
 NCURSES_EXPORT_VAR(FIELDTYPE *)
 TYPE_ENUM = &typeENUM;
 
+#if NCURSES_INTEROP_FUNCS
+/* The next routines are to simplify the use of ncurses from
+   programming languages with restictions on interop with C level
+   constructs (e.g. variable access or va_list + ellipsis constructs)
+*/
+NCURSES_EXPORT(FIELDTYPE *)
+_nc_TYPE_ENUM(void)
+{
+  return TYPE_ENUM;
+}
+#endif
+
 /* fty_enum.c ends here */
diff --git a/form/fty_generic.c b/form/fty_generic.c
new file mode 100644
index 0000000..429ceac
--- /dev/null
+++ b/form/fty_generic.c
@@ -0,0 +1,297 @@
+/****************************************************************************
+ * Copyright (c) 2008-2010,2012 Free Software Foundation, Inc.              *
+ *                                                                          *
+ * Permission is hereby granted, free of charge, to any person obtaining a  *
+ * copy of this software and associated documentation files (the            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/***************************************************************************
+*                                                                          *
+*  Author : Juergen Pfeifer                                                *
+*                                                                          *
+***************************************************************************/
+
+#include "form.priv.h"
+
+MODULE_ID("$Id: fty_generic.c,v 1.6 2012/06/10 00:27:49 tom Exp $")
+
+/*
+ * This is not a full implementation of a field type, but adds some
+ * support for higher level languages with some restrictions to interop
+ * with C language. Especially the collection of arguments for the
+ * various fieldtypes is not based on the vararg C mechanism, but on a
+ * iterator based callback mechanism that allowes the high level language
+ * to provide the arguments as a structure. Most languages have mechanisms
+ * to layout structures so that they can be passed to C.
+ * The languages can register a new generic fieldtype dynamically and store
+ * a handle (key) to the calling object as an argument. Together with that
+ * it can register a freearg callback, so that the high level language
+ * remains in control of the memory management of the arguments they pass.
+ * The design idea is, that the high-level language - typically a OO
+ * language like C# or Java, uses it's own dispatching mechanisms
+ * (polymorphism) to call the proper check routines responsible for the
+ * argument type. So these language implement typically only one generic
+ * fieldtype they register with the forms library using this call.
+ *
+ * For that purpose we have extended the fieldtype struc by a new element
+ * that gets the arguments from a single struct passed by the caller. 
+ * 
+ */
+#if NCURSES_INTEROP_FUNCS
+
+/*---------------------------------------------------------------------------
+|   Facility      :  libnform  
+|   Function      :  static void *Generic_This_Type( void * arg )
+|   
+|   Description   :  We interpret the passed arg just as a handle the
+|                    calling language uses to keep track of its allocated
+|                    argument structures. We can simply copy it back.
+|
+|   Return Values :  Pointer to argument structure
++--------------------------------------------------------------------------*/
+static void *
+Generic_This_Type(void *arg)
+{
+  return (arg);
+}
+
+/*---------------------------------------------------------------------------
+|   Facility      :  libnform
+|   Function      :  FIELDTYPE *_nc_generic_fieldtype(
+|                       bool (* const field_check)(FIELD *,const void *),
+|                       bool (* const char_check) (int, const void *),
+|   		        bool (*const next)(FORM*,FIELD*,const void*),
+|		        bool (*const prev)(FORM*,FIELD*,const void*),
+|                       void (*freecallback)(void*))
+|
+|   Description   :  Create a new fieldtype. The application programmer must
+|                    write a field_check and a char_check function and give
+|                    them as input to this call. A callback to allow the
+|                    release of the allocated memory must also be provided.
+|                    For generic field types, we provide some more 
+|                    information about the field as parameters.
+|
+|                    If an error occurs, errno is set to
+|                       E_BAD_ARGUMENT  - invalid arguments
+|                       E_SYSTEM_ERROR  - system error (no memory)
+|
+|   Return Values :  Fieldtype pointer or NULL if error occurred
++--------------------------------------------------------------------------*/
+NCURSES_EXPORT(FIELDTYPE *)
+_nc_generic_fieldtype(bool (*const field_check) (FORM *, FIELD *, const void *),
+		      bool (*const char_check) (int, FORM *, FIELD *, const
+						void *),
+		      bool (*const next) (FORM *, FIELD *, const void *),
+		      bool (*const prev) (FORM *, FIELD *, const void *),
+		      void (*freecallback) (void *))
+{
+  int code = E_SYSTEM_ERROR;
+  FIELDTYPE *res = (FIELDTYPE *)0;
+
+  T((T_CALLED("_nc_generic_fieldtype(%p,%p,%p,%p,%p)"),
+     field_check, char_check, next, prev, freecallback));
+
+  if (field_check || char_check)
+    {
+      res = typeMalloc(FIELDTYPE, 1);
+
+      if (res)
+	{
+	  *res = *_nc_Default_FieldType;
+	  SetStatus(res, (_HAS_ARGS | _GENERIC));
+	  res->fieldcheck.gfcheck = field_check;
+	  res->charcheck.gccheck = char_check;
+	  res->genericarg = Generic_This_Type;
+	  res->freearg = freecallback;
+	  res->enum_next.gnext = next;
+	  res->enum_prev.gprev = prev;
+	  code = E_OK;
+	}
+    }
+  else
+    code = E_BAD_ARGUMENT;
+
+  if (E_OK != code)
+    SET_ERROR(code);
+
+  returnFieldType(res);
+}
+
+/*---------------------------------------------------------------------------
+|   Facility      :  libnform  
+|   Function      :  static TypeArgument *GenericArgument(
+|                      const FIELDTYPE* typ,
+|                      int (*argiterator)(void**),
+|                      int* err)
+|   
+|   Description   :  The iterator callback must browse through all fieldtype
+|                    parameters that have an argument associated with the
+|                    type. The iterator returns 1 if the operation to get
+|                    the next element was successfull, 0 otherwise. If the
+|                    iterator could move to the next argument, it fills
+|                    the void* pointer representing the argument into the
+|                    location provided as argument to the iterator.
+|                    The err reference is used to keep track of errors.
+|
+|   Return Values :  Pointer to argument structure
++--------------------------------------------------------------------------*/
+static TypeArgument *
+GenericArgument(const FIELDTYPE *typ,
+		int (*argiterator) (void **), int *err)
+{
+  TypeArgument *res = (TypeArgument *)0;
+
+  if (typ != 0 && (typ->status & _HAS_ARGS) != 0 && err != 0 && argiterator != 0)
+    {
+      if (typ->status & _LINKED_TYPE)
+	{
+	  /* Composite fieldtypes keep track internally of their own memory */
+	  TypeArgument *p = typeMalloc(TypeArgument, 1);
+
+	  if (p)
+	    {
+	      p->left = GenericArgument(typ->left, argiterator, err);
+	      p->right = GenericArgument(typ->right, argiterator, err);
+	      return p;
+	    }
+	  else
+	    *err += 1;
+	}
+      else
+	{
+	  assert(typ->genericarg != (void *)0);
+	  if (typ->genericarg == 0)
+	    *err += 1;
+	  else
+	    {
+	      void *argp;
+	      int valid = argiterator(&argp);
+
+	      if (valid == 0 || argp == 0 ||
+		  !(res = (TypeArgument *)typ->genericarg(argp)))
+		{
+		  *err += 1;
+		}
+	    }
+	}
+    }
+  return res;
+}
+
+/*---------------------------------------------------------------------------
+|   Facility      :  libnform  
+|   Function      :  int _nc_set_generic_fieldtype(
+|                      FIELD* field,
+|                      FIELDTYPE* ftyp,
+|                      int (*argiterator)(void**))
+|   
+|   Description   :  Assign the fieldtype to the field and use the iterator
+|                    mechanism to get the arguments when a check is 
+|                    performed.
+|
+|   Return Values :  E_OK if all went well
+|                    E_SYSTEM_ERROR if an error occurred
++--------------------------------------------------------------------------*/
+NCURSES_EXPORT(int)
+_nc_set_generic_fieldtype(FIELD *field,
+			  FIELDTYPE *ftyp,
+			  int (*argiterator) (void **))
+{
+  int code = E_SYSTEM_ERROR;
+  int err = 0;
+
+  if (field)
+    {
+      if (field && field->type)
+	_nc_Free_Type(field);
+
+      field->type = ftyp;
+      if (ftyp)
+	{
+	  if (argiterator)
+	    {
+	      /* The precondition is that the iterator is reset */
+	      field->arg = (void *)GenericArgument(field->type, argiterator, &err);
+
+	      if (err)
+		{
+		  _nc_Free_Argument(field->type, (TypeArgument *)(field->arg));
+		  field->type = (FIELDTYPE *)0;
+		  field->arg = (void *)0;
+		}
+	      else
+		{
+		  code = E_OK;
+		  if (field->type)
+		    field->type->ref++;
+		}
+	    }
+	}
+      else
+	{
+	  field->arg = (void *)0;
+	  code = E_OK;
+	}
+    }
+  return code;
+}
+
+/*---------------------------------------------------------------------------
+|   Facility      :  libnform  
+|   Function      :  WINDOW* _nc_form_cursor(
+|                      FORM* form,
+|                      int *pRow, int *pCol)
+|   
+|   Description   :  Get the current position of the form cursor position
+|                    We also return the field window
+|
+|   Return Values :  The fields Window or NULL on error
++--------------------------------------------------------------------------*/
+NCURSES_EXPORT(WINDOW *)
+_nc_form_cursor(const FORM *form, int *pRow, int *pCol)
+{
+  int code = E_SYSTEM_ERROR;
+  WINDOW *res = (WINDOW *)0;
+
+  if (!(form == 0 || pRow == 0 || pCol == 0))
+    {
+      *pRow = form->currow;
+      *pCol = form->curcol;
+      res = form->w;
+      code = E_OK;
+    }
+  if (code != E_OK)
+    SET_ERROR(code);
+  return res;
+}
+
+#else
+extern void _nc_fty_generic(void);
+void
+_nc_fty_generic(void)
+{
+}
+#endif
+
+/* fty_generic.c ends here */
diff --git a/form/fty_int.c b/form/fty_int.c
index 8a5367f..1e43874 100644
--- a/form/fty_int.c
+++ b/form/fty_int.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,7 +34,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fty_int.c,v 1.22 2007/10/13 19:32:40 tom Exp $")
+MODULE_ID("$Id: fty_int.c,v 1.26 2012/02/23 10:02:15 tom Exp $")
 
 #if USE_WIDEC_SUPPORT
 #define isDigit(c) (iswdigit((wint_t)(c)) || isdigit(UChar(c)))
@@ -52,6 +52,41 @@
   }
 thisARG;
 
+typedef struct
+  {
+    int precision;
+    long low;
+    long high;
+  }
+integerPARM;
+
+/*---------------------------------------------------------------------------
+|   Facility      :  libnform  
+|   Function      :  static void *Generic_This_Type( void * arg )
+|   
+|   Description   :  Allocate structure for integer type argument.
+|
+|   Return Values :  Pointer to argument structure or NULL on error
++--------------------------------------------------------------------------*/
+static void *
+Generic_This_Type(void *arg)
+{
+  thisARG *argp = (thisARG *) 0;
+  thisARG *param = (thisARG *) arg;
+
+  if (param)
+    {
+      argp = typeMalloc(thisARG, 1);
+
+      if (argp)
+	{
+	  T((T_CREATE("thisARG %p"), (void *)argp));
+	  *argp = *param;
+	}
+    }
+  return (void *)argp;
+}
+
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
 |   Function      :  static void *Make_This_Type( va_list * ap )
@@ -63,16 +98,13 @@
 static void *
 Make_This_Type(va_list *ap)
 {
-  thisARG *argp = typeMalloc(thisARG, 1);
+  thisARG arg;
 
-  if (argp)
-    {
-      T((T_CREATE("thisARG %p"), argp));
-      argp->precision = va_arg(*ap, int);
-      argp->low = va_arg(*ap, long);
-      argp->high = va_arg(*ap, long);
-    }
-  return (void *)argp;
+  arg.precision = va_arg(*ap, int);
+  arg.low = va_arg(*ap, long);
+  arg.high = va_arg(*ap, long);
+
+  return Generic_This_Type((void *)&arg);
 }
 
 /*---------------------------------------------------------------------------
@@ -94,7 +126,7 @@
       result = typeMalloc(thisARG, 1);
       if (result)
 	{
-	  T((T_CREATE("thisARG %p"), result));
+	  T((T_CREATE("thisARG %p"), (void *)result));
 	  *result = *ap;
 	}
     }
@@ -201,7 +233,8 @@
 	    }
 	  if (result)
 	    {
-	      sprintf(buf, "%.*ld", (prec > 0 ? prec : 0), val);
+	      _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf))
+			  "%.*ld", (prec > 0 ? prec : 0), val);
 	      set_field_buffer(field, 0, buf);
 	    }
 	}
@@ -235,12 +268,27 @@
   Make_This_Type,
   Copy_This_Type,
   Free_This_Type,
-  Check_This_Field,
-  Check_This_Character,
-  NULL,
-  NULL
+  INIT_FT_FUNC(Check_This_Field),
+  INIT_FT_FUNC(Check_This_Character),
+  INIT_FT_FUNC(NULL),
+  INIT_FT_FUNC(NULL),
+#if NCURSES_INTEROP_FUNCS
+  Generic_This_Type
+#endif
 };
 
 NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_INTEGER = &typeTHIS;
 
+#if NCURSES_INTEROP_FUNCS
+/* The next routines are to simplify the use of ncurses from
+   programming languages with restictions on interop with C level
+   constructs (e.g. variable access or va_list + ellipsis constructs)
+*/
+NCURSES_EXPORT(FIELDTYPE *)
+_nc_TYPE_INTEGER(void)
+{
+  return TYPE_INTEGER;
+}
+#endif
+
 /* fty_int.c ends here */
diff --git a/form/fty_ipv4.c b/form/fty_ipv4.c
index 5d1a209..8dc04f8 100644
--- a/form/fty_ipv4.c
+++ b/form/fty_ipv4.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2006 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2006,2009 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,7 +34,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fty_ipv4.c,v 1.8 2006/12/02 19:33:02 tom Exp $")
+MODULE_ID("$Id: fty_ipv4.c,v 1.10 2009/11/07 20:17:58 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -94,12 +94,27 @@
   NULL,
   NULL,
   NULL,
-  Check_IPV4_Field,
-  Check_IPV4_Character,
-  NULL,
+  INIT_FT_FUNC(Check_IPV4_Field),
+  INIT_FT_FUNC(Check_IPV4_Character),
+  INIT_FT_FUNC(NULL),
+  INIT_FT_FUNC(NULL),
+#if NCURSES_INTEROP_FUNCS
   NULL
+#endif
 };
 
 NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_IPV4 = &typeIPV4;
 
+#if NCURSES_INTEROP_FUNCS
+/* The next routines are to simplify the use of ncurses from
+   programming languages with restictions on interop with C level
+   constructs (e.g. variable access or va_list + ellipsis constructs)
+*/
+NCURSES_EXPORT(FIELDTYPE *)
+_nc_TYPE_IPV4(void)
+{
+  return TYPE_IPV4;
+}
+#endif
+
 /* fty_ipv4.c ends here */
diff --git a/form/fty_num.c b/form/fty_num.c
index e74e8e3..8cce43f 100644
--- a/form/fty_num.c
+++ b/form/fty_num.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,7 +34,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fty_num.c,v 1.25 2007/10/13 19:32:54 tom Exp $")
+MODULE_ID("$Id: fty_num.c,v 1.29 2012/02/23 10:02:15 tom Exp $")
 
 #if HAVE_LOCALE_H
 #include <locale.h>
@@ -63,6 +63,49 @@
   }
 thisARG;
 
+typedef struct
+  {
+    int precision;
+    double low;
+    double high;
+  }
+thisPARM;
+
+/*---------------------------------------------------------------------------
+|   Facility      :  libnform
+|   Function      :  static void *Generic_This_Type(void * arg)
+|
+|   Description   :  Allocate structure for numeric type argument.
+|
+|   Return Values :  Pointer to argument structure or NULL on error
++--------------------------------------------------------------------------*/
+static void *
+Generic_This_Type(void *arg)
+{
+  thisARG *argn = (thisARG *) 0;
+  thisPARM *args = (thisPARM *) arg;
+
+  if (args)
+    {
+      argn = typeMalloc(thisARG, 1);
+
+      if (argn)
+	{
+	  T((T_CREATE("thisARG %p"), (void *)argn));
+	  argn->precision = args->precision;
+	  argn->low = args->low;
+	  argn->high = args->high;
+
+#if HAVE_LOCALE_H
+	  argn->L = localeconv();
+#else
+	  argn->L = NULL;
+#endif
+	}
+    }
+  return (void *)argn;
+}
+
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
 |   Function      :  static void *Make_This_Type(va_list * ap)
@@ -74,22 +117,13 @@
 static void *
 Make_This_Type(va_list *ap)
 {
-  thisARG *argn = typeMalloc(thisARG, 1);
+  thisPARM arg;
 
-  if (argn)
-    {
-      T((T_CREATE("thisARG %p"), argn));
-      argn->precision = va_arg(*ap, int);
-      argn->low = va_arg(*ap, double);
-      argn->high = va_arg(*ap, double);
+  arg.precision = va_arg(*ap, int);
+  arg.low = va_arg(*ap, double);
+  arg.high = va_arg(*ap, double);
 
-#if HAVE_LOCALE_H
-      argn->L = localeconv();
-#else
-      argn->L = NULL;
-#endif
-    }
-  return (void *)argn;
+  return Generic_This_Type((void *)&arg);
 }
 
 /*---------------------------------------------------------------------------
@@ -111,7 +145,7 @@
       result = typeMalloc(thisARG, 1);
       if (result)
 	{
-	  T((T_CREATE("thisARG %p"), result));
+	  T((T_CREATE("thisARG %p"), (void *)result));
 	  *result = *ap;
 	}
     }
@@ -237,7 +271,8 @@
 	    }
 	  if (result)
 	    {
-	      sprintf(buf, "%.*f", (prec > 0 ? prec : 0), val);
+	      _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf))
+			  "%.*f", (prec > 0 ? prec : 0), val);
 	      set_field_buffer(field, 0, buf);
 	    }
 	}
@@ -279,12 +314,27 @@
   Make_This_Type,
   Copy_This_Type,
   Free_This_Type,
-  Check_This_Field,
-  Check_This_Character,
-  NULL,
-  NULL
+  INIT_FT_FUNC(Check_This_Field),
+  INIT_FT_FUNC(Check_This_Character),
+  INIT_FT_FUNC(NULL),
+  INIT_FT_FUNC(NULL),
+#if NCURSES_INTEROP_FUNCS
+  Generic_This_Type
+#endif
 };
 
 NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_NUMERIC = &typeTHIS;
 
+#if NCURSES_INTEROP_FUNCS
+/* The next routines are to simplify the use of ncurses from
+   programming languages with restictions on interop with C level
+   constructs (e.g. variable access or va_list + ellipsis constructs)
+*/
+NCURSES_EXPORT(FIELDTYPE *)
+_nc_TYPE_NUMERIC(void)
+{
+  return TYPE_NUMERIC;
+}
+#endif
+
 /* fty_num.c ends here */
diff --git a/form/fty_regex.c b/form/fty_regex.c
index 247779f..194a52e 100644
--- a/form/fty_regex.c
+++ b/form/fty_regex.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2015 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,7 +34,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fty_regex.c,v 1.21 2007/10/13 19:33:50 tom Exp $")
+MODULE_ID("$Id: fty_regex.c,v 1.26 2015/01/10 17:10:25 tom Exp $")
 
 #if HAVE_REGEX_H_FUNCS		/* We prefer POSIX regex */
 #include <regex.h>
@@ -90,6 +90,114 @@
 
 #endif
 
+#if HAVE_REGEX_H_FUNCS | HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS
+# define MAYBE_UNUSED
+#else
+# define MAYBE_UNUSED GCC_UNUSED
+#endif
+
+/*---------------------------------------------------------------------------
+|   Facility      :  libnform
+|   Function      :  static void *Generic_RegularExpression_Type(void * arg)
+|
+|   Description   :  Allocate structure for regex type argument.
+|
+|   Return Values :  Pointer to argument structure or NULL on error
++--------------------------------------------------------------------------*/
+static void *
+Generic_RegularExpression_Type(void *arg MAYBE_UNUSED)
+{
+#if HAVE_REGEX_H_FUNCS
+  char *rx = (char *)arg;
+  RegExp_Arg *preg = (RegExp_Arg *)0;
+
+  if (rx)
+    {
+      preg = typeCalloc(RegExp_Arg, 1);
+
+      if (preg)
+	{
+	  T((T_CREATE("RegExp_Arg %p"), (void *)preg));
+	  if (((preg->pRegExp = typeMalloc(regex_t, 1)) != 0)
+	      && !regcomp(preg->pRegExp, rx,
+			  (REG_EXTENDED | REG_NOSUB | REG_NEWLINE)))
+	    {
+	      T((T_CREATE("regex_t %p"), (void *)preg->pRegExp));
+	      if ((preg->refCount = typeMalloc(unsigned long, 1)) != 0)
+		 *(preg->refCount) = 1;
+	    }
+	  else
+	    {
+	      if (preg->pRegExp)
+		free(preg->pRegExp);
+	      free(preg);
+	      preg = (RegExp_Arg *)0;
+	    }
+	}
+    }
+  return ((void *)preg);
+#elif HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS
+  char *rx = (char *)arg;
+  RegExp_Arg *pArg = (RegExp_Arg *)0;
+
+  if (rx)
+    {
+      pArg = typeMalloc(RegExp_Arg, 1);
+
+      if (pArg)
+	{
+	  int blen = RX_INCREMENT;
+
+	  T((T_CREATE("RegExp_Arg %p"), pArg));
+	  pArg->compiled_expression = NULL;
+	  if ((pArg->refCount = typeMalloc(unsigned long, 1)) != 0)
+	     *(pArg->refCount) = 1;
+
+	  do
+	    {
+	      char *buf = typeMalloc(char, blen);
+
+	      if (buf)
+		{
+#if HAVE_REGEXP_H_FUNCS
+		  char *last_pos = compile(rx, buf, &buf[blen], '\0');
+
+#else /* HAVE_REGEXPR_H_FUNCS */
+		  char *last_pos = compile(rx, buf, &buf[blen]);
+#endif
+		  if (reg_errno)
+		    {
+		      free(buf);
+		      if (reg_errno == 50)
+			blen += RX_INCREMENT;
+		      else
+			{
+			  free(pArg);
+			  pArg = NULL;
+			  break;
+			}
+		    }
+		  else
+		    {
+		      pArg->compiled_expression = buf;
+		      break;
+		    }
+		}
+	    }
+	  while (blen <= MAX_RX_LEN);
+	}
+      if (pArg && !pArg->compiled_expression)
+	{
+	  free(pArg);
+	  pArg = NULL;
+	}
+    }
+  return (void *)pArg;
+#else
+  return 0;
+#endif
+}
+
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
 |   Function      :  static void *Make_RegularExpression_Type(va_list * ap)
@@ -101,91 +209,9 @@
 static void *
 Make_RegularExpression_Type(va_list *ap)
 {
-#if HAVE_REGEX_H_FUNCS
   char *rx = va_arg(*ap, char *);
-  RegExp_Arg *preg;
 
-  preg = typeMalloc(RegExp_Arg, 1);
-
-  if (preg)
-    {
-      T((T_CREATE("RegExp_Arg %p"), preg));
-      if (((preg->pRegExp = typeMalloc(regex_t, 1)) != 0)
-	  && !regcomp(preg->pRegExp, rx,
-		      (REG_EXTENDED | REG_NOSUB | REG_NEWLINE)))
-	{
-	  T((T_CREATE("regex_t %p"), preg->pRegExp));
-	  preg->refCount = typeMalloc(unsigned long, 1);
-
-	  *(preg->refCount) = 1;
-	}
-      else
-	{
-	  if (preg->pRegExp)
-	    free(preg->pRegExp);
-	  free(preg);
-	  preg = (RegExp_Arg *)0;
-	}
-    }
-  return ((void *)preg);
-#elif HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS
-  char *rx = va_arg(*ap, char *);
-  RegExp_Arg *pArg;
-
-  pArg = typeMalloc(RegExp_Arg, 1);
-
-  if (pArg)
-    {
-      int blen = RX_INCREMENT;
-
-      T((T_CREATE("RegExp_Arg %p"), pArg));
-      pArg->compiled_expression = NULL;
-      pArg->refCount = typeMalloc(unsigned long, 1);
-
-      *(pArg->refCount) = 1;
-
-      do
-	{
-	  char *buf = typeMalloc(char, blen);
-
-	  if (buf)
-	    {
-#if HAVE_REGEXP_H_FUNCS
-	      char *last_pos = compile(rx, buf, &buf[blen], '\0');
-
-#else /* HAVE_REGEXPR_H_FUNCS */
-	      char *last_pos = compile(rx, buf, &buf[blen]);
-#endif
-	      if (reg_errno)
-		{
-		  free(buf);
-		  if (reg_errno == 50)
-		    blen += RX_INCREMENT;
-		  else
-		    {
-		      free(pArg);
-		      pArg = NULL;
-		      break;
-		    }
-		}
-	      else
-		{
-		  pArg->compiled_expression = buf;
-		  break;
-		}
-	    }
-	}
-      while (blen <= MAX_RX_LEN);
-    }
-  if (pArg && !pArg->compiled_expression)
-    {
-      free(pArg);
-      pArg = NULL;
-    }
-  return (void *)pArg;
-#else
-  return 0;
-#endif
+  return Generic_RegularExpression_Type((void *)rx);
 }
 
 /*---------------------------------------------------------------------------
@@ -198,7 +224,7 @@
 |   Return Values :  Pointer to argument structure or NULL on error.
 +--------------------------------------------------------------------------*/
 static void *
-Copy_RegularExpression_Type(const void *argp)
+Copy_RegularExpression_Type(const void *argp MAYBE_UNUSED)
 {
 #if (HAVE_REGEX_H_FUNCS | HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS)
   const RegExp_Arg *ap = (const RegExp_Arg *)argp;
@@ -224,7 +250,7 @@
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
 static void
-Free_RegularExpression_Type(void *argp)
+Free_RegularExpression_Type(void *argp MAYBE_UNUSED)
 {
 #if HAVE_REGEX_H_FUNCS | HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS
   RegExp_Arg *ap = (RegExp_Arg *)argp;
@@ -238,6 +264,7 @@
 	    {
 	      free(ap->refCount);
 	      regfree(ap->pRegExp);
+	      free(ap->pRegExp);
 	    }
 #elif HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS
 	  if (ap->compiled_expression)
@@ -264,7 +291,8 @@
 |                    FALSE - field is invalid
 +--------------------------------------------------------------------------*/
 static bool
-Check_RegularExpression_Field(FIELD *field, const void *argp)
+Check_RegularExpression_Field(FIELD *field MAYBE_UNUSED,
+			      const void *argp MAYBE_UNUSED)
 {
   bool match = FALSE;
 
@@ -295,12 +323,27 @@
   Make_RegularExpression_Type,
   Copy_RegularExpression_Type,
   Free_RegularExpression_Type,
-  Check_RegularExpression_Field,
-  NULL,
-  NULL,
-  NULL
+  INIT_FT_FUNC(Check_RegularExpression_Field),
+  INIT_FT_FUNC(NULL),
+  INIT_FT_FUNC(NULL),
+  INIT_FT_FUNC(NULL),
+#if NCURSES_INTEROP_FUNCS
+  Generic_RegularExpression_Type
+#endif
 };
 
 NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_REGEXP = &typeREGEXP;
 
+#if NCURSES_INTEROP_FUNCS
+/* The next routines are to simplify the use of ncurses from
+   programming languages with restictions on interop with C level
+   constructs (e.g. variable access or va_list + ellipsis constructs)
+*/
+NCURSES_EXPORT(FIELDTYPE *)
+_nc_TYPE_REGEXP(void)
+{
+  return TYPE_REGEXP;
+}
+#endif
+
 /* fty_regex.c ends here */
diff --git a/form/llib-lform b/form/llib-lform
index bd7c3a4..4371d54 100644
--- a/form/llib-lform
+++ b/form/llib-lform
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2002,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,2015 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -27,13 +27,13 @@
  ****************************************************************************/
 
 /****************************************************************************
- *  Author: Thomas E. Dickey       1996,1997,2002,2005                      *
+ *  Author: Thomas E. Dickey       1996-on                                  *
  ****************************************************************************/
 /* LINTLIBRARY */
 
 /* ./f_trace.c */
 
-#include "form.priv.h"
+#include <form.priv.h>
 
 #undef _nc_retrace_field_ptr
 FIELD	**_nc_retrace_field_ptr(
@@ -264,7 +264,7 @@
 /* ./fld_newftyp.c */
 
 #undef _nc_Default_FieldType
-const FIELDTYPE *_nc_Default_FieldType = {0};
+FIELDTYPE *_nc_Default_FieldType;
 
 #undef new_fieldtype
 FIELDTYPE *new_fieldtype(
@@ -396,6 +396,12 @@
 #undef _nc_Default_Form
 FORM	*_nc_Default_Form;
 
+#undef new_form_sp
+FORM	*new_form_sp(
+		SCREEN	*sp, 
+		FIELD	**fields)
+		{ return(*(FORM **)0); }
+
 #undef new_form
 FORM	*new_form(
 		FIELD	**fields)
@@ -424,6 +430,13 @@
 
 /* ./frm_driver.c */
 
+#undef _nc_get_fieldbuffer
+void	_nc_get_fieldbuffer(
+		FORM	*form, 
+		FIELD	*field, 
+		char	*buf)
+		{ /* void */ }
+
 #undef _nc_Position_Form_Cursor
 int	_nc_Position_Form_Cursor(
 		FORM	*form)
@@ -661,6 +674,10 @@
 #undef TYPE_ALNUM
 FIELDTYPE *TYPE_ALNUM;
 
+#undef _nc_TYPE_ALNUM
+FIELDTYPE *_nc_TYPE_ALNUM(void)
+		{ return(*(FIELDTYPE **)0); }
+
 /* ./fty_alpha.c */
 
 typedef struct
@@ -672,6 +689,10 @@
 #undef TYPE_ALPHA
 FIELDTYPE *TYPE_ALPHA;
 
+#undef _nc_TYPE_ALPHA
+FIELDTYPE *_nc_TYPE_ALPHA(void)
+		{ return(*(FIELDTYPE **)0); }
+
 /* ./fty_enum.c */
 
 typedef struct
@@ -683,9 +704,61 @@
   }
 enumARG;
 
+typedef struct
+  {
+    char **kwds;
+    int ccase;
+    int cunique;
+  }
+enumParams;
+
 #undef TYPE_ENUM
 FIELDTYPE *TYPE_ENUM;
 
+#undef _nc_TYPE_ENUM
+FIELDTYPE *_nc_TYPE_ENUM(void)
+		{ return(*(FIELDTYPE **)0); }
+
+/* ./fty_generic.c */
+
+#undef _nc_generic_fieldtype
+FIELDTYPE *_nc_generic_fieldtype(
+		NCURSES_BOOL (*const field_check)(
+		FORM	*p1, 
+		FIELD	*p2, 
+		const void *p3), 
+		NCURSES_BOOL (*const char_check)(
+		int	p1, 
+		FORM	*p2, 
+		FIELD	*p3, 
+		const void *p4), 
+		NCURSES_BOOL (*const next)(
+		FORM	*p1, 
+		FIELD	*p2, 
+		const void *p3), 
+		NCURSES_BOOL (*const prev)(
+		FORM	*p1, 
+		FIELD	*p2, 
+		const void *p3), 
+		void	(*freecallback)(
+		void	*p1))
+		{ return(*(FIELDTYPE **)0); }
+
+#undef _nc_set_generic_fieldtype
+int	_nc_set_generic_fieldtype(
+		FIELD	*field, 
+		FIELDTYPE *ftyp, 
+		int	(*argiterator)(
+		void	**p1))
+		{ return(*(int *)0); }
+
+#undef _nc_form_cursor
+WINDOW	*_nc_form_cursor(
+		const FORM *form, 
+		int	*pRow, 
+		int	*pCol)
+		{ return(*(WINDOW **)0); }
+
 /* ./fty_int.c */
 
 typedef struct
@@ -696,13 +769,30 @@
   }
 integerARG;
 
+typedef struct
+  {
+    int precision;
+    long low;
+    long high;
+  }
+integerPARM;
+
 #undef TYPE_INTEGER
 FIELDTYPE *TYPE_INTEGER;
 
+#undef _nc_TYPE_INTEGER
+FIELDTYPE *_nc_TYPE_INTEGER(void)
+		{ return(*(FIELDTYPE **)0); }
+
 /* ./fty_ipv4.c */
+
 #undef TYPE_IPV4
 FIELDTYPE *TYPE_IPV4;
 
+#undef _nc_TYPE_IPV4
+FIELDTYPE *_nc_TYPE_IPV4(void)
+		{ return(*(FIELDTYPE **)0); }
+
 /* ./fty_num.c */
 
 #include <locale.h>
@@ -716,9 +806,21 @@
   }
 numericARG;
 
+typedef struct
+  {
+    int precision;
+    double low;
+    double high;
+  }
+thisPARM;
+
 #undef TYPE_NUMERIC
 FIELDTYPE *TYPE_NUMERIC;
 
+#undef _nc_TYPE_NUMERIC
+FIELDTYPE *_nc_TYPE_NUMERIC(void)
+		{ return(*(FIELDTYPE **)0); }
+
 /* ./fty_regex.c */
 
 #include <regex.h>
@@ -732,3 +834,7 @@
 
 #undef TYPE_REGEXP
 FIELDTYPE *TYPE_REGEXP;
+
+#undef _nc_TYPE_REGEXP
+FIELDTYPE *_nc_TYPE_REGEXP(void)
+		{ return(*(FIELDTYPE **)0); }
diff --git a/form/llib-lformt b/form/llib-lformt
new file mode 100644
index 0000000..967a4a7
--- /dev/null
+++ b/form/llib-lformt
@@ -0,0 +1,840 @@
+/****************************************************************************
+ * Copyright (c) 2010-2010,2015 Free Software Foundation, Inc.              *
+ *                                                                          *
+ * Permission is hereby granted, free of charge, to any person obtaining a  *
+ * copy of this software and associated documentation files (the            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Thomas E. Dickey       2010-on                                  *
+ ****************************************************************************/
+/* LINTLIBRARY */
+
+/* ./f_trace.c */
+
+#include <form.priv.h>
+
+#undef _nc_retrace_field_ptr
+FIELD	**_nc_retrace_field_ptr(
+		FIELD	**code)
+		{ return(*(FIELD ***)0); }
+
+#undef _nc_retrace_field
+FIELD	*_nc_retrace_field(
+		FIELD	*code)
+		{ return(*(FIELD **)0); }
+
+#undef _nc_retrace_field_type
+FIELDTYPE *_nc_retrace_field_type(
+		FIELDTYPE *code)
+		{ return(*(FIELDTYPE **)0); }
+
+#undef _nc_retrace_form
+FORM	*_nc_retrace_form(
+		FORM	*code)
+		{ return(*(FORM **)0); }
+
+#undef _nc_retrace_form_hook
+Form_Hook _nc_retrace_form_hook(
+		Form_Hook code)
+		{ return(*(Form_Hook *)0); }
+
+/* ./fld_arg.c */
+
+#undef set_fieldtype_arg
+int	set_fieldtype_arg(
+		FIELDTYPE *typ, 
+		void	*(*const make_arg)(
+		va_list	*p1), 
+		void	*(*const copy_arg)(
+		const void *p1), 
+		void	(*const free_arg)(
+		void	*p1))
+		{ return(*(int *)0); }
+
+#undef field_arg
+void	*field_arg(
+		const FIELD *field)
+		{ return(*(void **)0); }
+
+/* ./fld_attr.c */
+
+#undef set_field_fore
+int	set_field_fore(
+		FIELD	*field, 
+		chtype	attr)
+		{ return(*(int *)0); }
+
+#undef field_fore
+chtype	field_fore(
+		const FIELD *field)
+		{ return(*(chtype *)0); }
+
+#undef set_field_back
+int	set_field_back(
+		FIELD	*field, 
+		chtype	attr)
+		{ return(*(int *)0); }
+
+#undef field_back
+chtype	field_back(
+		const FIELD *field)
+		{ return(*(chtype *)0); }
+
+/* ./fld_current.c */
+
+#undef set_current_field
+int	set_current_field(
+		FORM	*form, 
+		FIELD	*field)
+		{ return(*(int *)0); }
+
+#undef current_field
+FIELD	*current_field(
+		const FORM *form)
+		{ return(*(FIELD **)0); }
+
+#undef field_index
+int	field_index(
+		const FIELD *field)
+		{ return(*(int *)0); }
+
+/* ./fld_def.c */
+
+#undef _nc_Default_Field
+FIELD	*_nc_Default_Field;
+
+#undef _nc_Make_Argument
+TypeArgument *_nc_Make_Argument(
+		const FIELDTYPE *typ, 
+		va_list	*ap, 
+		int	*err)
+		{ return(*(TypeArgument **)0); }
+
+#undef _nc_Copy_Argument
+TypeArgument *_nc_Copy_Argument(
+		const FIELDTYPE *typ, 
+		const TypeArgument *argp, 
+		int	*err)
+		{ return(*(TypeArgument **)0); }
+
+#undef _nc_Free_Argument
+void	_nc_Free_Argument(
+		const FIELDTYPE *typ, 
+		TypeArgument *argp)
+		{ /* void */ }
+
+#undef _nc_Copy_Type
+NCURSES_BOOL _nc_Copy_Type(
+		FIELD	*dst, 
+		FIELD const *src)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_Free_Type
+void	_nc_Free_Type(
+		FIELD	*field)
+		{ /* void */ }
+
+#undef new_field
+FIELD	*new_field(
+		int	rows, 
+		int	cols, 
+		int	frow, 
+		int	fcol, 
+		int	nrow, 
+		int	nbuf)
+		{ return(*(FIELD **)0); }
+
+#undef free_field
+int	free_field(
+		FIELD	*field)
+		{ return(*(int *)0); }
+
+/* ./fld_dup.c */
+
+#undef dup_field
+FIELD	*dup_field(
+		FIELD	*field, 
+		int	frow, 
+		int	fcol)
+		{ return(*(FIELD **)0); }
+
+/* ./fld_ftchoice.c */
+
+#undef set_fieldtype_choice
+int	set_fieldtype_choice(
+		FIELDTYPE *typ, 
+		NCURSES_BOOL (*const next_choice)(
+		FIELD	*p1, 
+		const void *p2), 
+		NCURSES_BOOL (*const prev_choice)(
+		FIELD	*p1, 
+		const void *p2))
+		{ return(*(int *)0); }
+
+/* ./fld_ftlink.c */
+
+#undef link_fieldtype
+FIELDTYPE *link_fieldtype(
+		FIELDTYPE *type1, 
+		FIELDTYPE *type2)
+		{ return(*(FIELDTYPE **)0); }
+
+/* ./fld_info.c */
+
+#undef field_info
+int	field_info(
+		const FIELD *field, 
+		int	*rows, 
+		int	*cols, 
+		int	*frow, 
+		int	*fcol, 
+		int	*nrow, 
+		int	*nbuf)
+		{ return(*(int *)0); }
+
+#undef dynamic_field_info
+int	dynamic_field_info(
+		const FIELD *field, 
+		int	*drows, 
+		int	*dcols, 
+		int	*maxgrow)
+		{ return(*(int *)0); }
+
+/* ./fld_just.c */
+
+#undef set_field_just
+int	set_field_just(
+		FIELD	*field, 
+		int	just)
+		{ return(*(int *)0); }
+
+#undef field_just
+int	field_just(
+		const FIELD *field)
+		{ return(*(int *)0); }
+
+/* ./fld_link.c */
+
+#undef link_field
+FIELD	*link_field(
+		FIELD	*field, 
+		int	frow, 
+		int	fcol)
+		{ return(*(FIELD **)0); }
+
+/* ./fld_max.c */
+
+#undef set_max_field
+int	set_max_field(
+		FIELD	*field, 
+		int	maxgrow)
+		{ return(*(int *)0); }
+
+/* ./fld_move.c */
+
+#undef move_field
+int	move_field(
+		FIELD	*field, 
+		int	frow, 
+		int	fcol)
+		{ return(*(int *)0); }
+
+/* ./fld_newftyp.c */
+
+#undef _nc_Default_FieldType
+FIELDTYPE *_nc_Default_FieldType;
+
+#undef new_fieldtype
+FIELDTYPE *new_fieldtype(
+		NCURSES_BOOL (*const field_check)(
+		FIELD	*p1, 
+		const void *p2), 
+		NCURSES_BOOL (*const char_check)(
+		int	p1, 
+		const void *p2))
+		{ return(*(FIELDTYPE **)0); }
+
+#undef free_fieldtype
+int	free_fieldtype(
+		FIELDTYPE *typ)
+		{ return(*(int *)0); }
+
+/* ./fld_opts.c */
+
+#undef set_field_opts
+int	set_field_opts(
+		FIELD	*field, 
+		Field_Options opts)
+		{ return(*(int *)0); }
+
+#undef field_opts
+Field_Options field_opts(
+		const FIELD *field)
+		{ return(*(Field_Options *)0); }
+
+#undef field_opts_on
+int	field_opts_on(
+		FIELD	*field, 
+		Field_Options opts)
+		{ return(*(int *)0); }
+
+#undef field_opts_off
+int	field_opts_off(
+		FIELD	*field, 
+		Field_Options opts)
+		{ return(*(int *)0); }
+
+/* ./fld_pad.c */
+
+#undef set_field_pad
+int	set_field_pad(
+		FIELD	*field, 
+		int	ch)
+		{ return(*(int *)0); }
+
+#undef field_pad
+int	field_pad(
+		const FIELD *field)
+		{ return(*(int *)0); }
+
+/* ./fld_page.c */
+
+#undef set_new_page
+int	set_new_page(
+		FIELD	*field, 
+		NCURSES_BOOL new_page_flag)
+		{ return(*(int *)0); }
+
+#undef new_page
+NCURSES_BOOL new_page(
+		const FIELD *field)
+		{ return(*(NCURSES_BOOL *)0); }
+
+/* ./fld_stat.c */
+
+#undef set_field_status
+int	set_field_status(
+		FIELD	*field, 
+		NCURSES_BOOL status)
+		{ return(*(int *)0); }
+
+#undef field_status
+NCURSES_BOOL field_status(
+		const FIELD *field)
+		{ return(*(NCURSES_BOOL *)0); }
+
+/* ./fld_type.c */
+
+#undef set_field_type
+int	set_field_type(
+		FIELD	*field, 
+		FIELDTYPE *type, 
+		...)
+		{ return(*(int *)0); }
+
+#undef field_type
+FIELDTYPE *field_type(
+		const FIELD *field)
+		{ return(*(FIELDTYPE **)0); }
+
+/* ./fld_user.c */
+
+#undef set_field_userptr
+int	set_field_userptr(
+		FIELD	*field, 
+		void	*usrptr)
+		{ return(*(int *)0); }
+
+#undef field_userptr
+void	*field_userptr(
+		const FIELD *field)
+		{ return(*(void **)0); }
+
+/* ./frm_cursor.c */
+
+#undef pos_form_cursor
+int	pos_form_cursor(
+		FORM	*form)
+		{ return(*(int *)0); }
+
+/* ./frm_data.c */
+
+#undef data_behind
+NCURSES_BOOL data_behind(
+		const FORM *form)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef data_ahead
+NCURSES_BOOL data_ahead(
+		const FORM *form)
+		{ return(*(NCURSES_BOOL *)0); }
+
+/* ./frm_def.c */
+
+#undef _nc_Default_Form
+FORM	*_nc_Default_Form;
+
+#undef new_form_sp
+FORM	*new_form_sp(
+		SCREEN	*sp, 
+		FIELD	**fields)
+		{ return(*(FORM **)0); }
+
+#undef new_form
+FORM	*new_form(
+		FIELD	**fields)
+		{ return(*(FORM **)0); }
+
+#undef free_form
+int	free_form(
+		FORM	*form)
+		{ return(*(int *)0); }
+
+#undef set_form_fields
+int	set_form_fields(
+		FORM	*form, 
+		FIELD	**fields)
+		{ return(*(int *)0); }
+
+#undef form_fields
+FIELD	**form_fields(
+		const FORM *form)
+		{ return(*(FIELD ***)0); }
+
+#undef field_count
+int	field_count(
+		const FORM *form)
+		{ return(*(int *)0); }
+
+/* ./frm_driver.c */
+
+#undef _nc_get_fieldbuffer
+void	_nc_get_fieldbuffer(
+		FORM	*form, 
+		FIELD	*field, 
+		char	*buf)
+		{ /* void */ }
+
+#undef _nc_Position_Form_Cursor
+int	_nc_Position_Form_Cursor(
+		FORM	*form)
+		{ return(*(int *)0); }
+
+#undef _nc_Refresh_Current_Field
+int	_nc_Refresh_Current_Field(
+		FORM	*form)
+		{ return(*(int *)0); }
+
+#undef _nc_Synchronize_Attributes
+int	_nc_Synchronize_Attributes(
+		FIELD	*field)
+		{ return(*(int *)0); }
+
+#undef _nc_Synchronize_Options
+int	_nc_Synchronize_Options(
+		FIELD	*field, 
+		Field_Options newopts)
+		{ return(*(int *)0); }
+
+#undef _nc_Set_Current_Field
+int	_nc_Set_Current_Field(
+		FORM	*form, 
+		FIELD	*newfield)
+		{ return(*(int *)0); }
+
+#undef _nc_Internal_Validation
+NCURSES_BOOL _nc_Internal_Validation(
+		FORM	*form)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_First_Active_Field
+FIELD	*_nc_First_Active_Field(
+		FORM	*form)
+		{ return(*(FIELD **)0); }
+
+#undef _nc_Set_Form_Page
+int	_nc_Set_Form_Page(
+		FORM	*form, 
+		int	page, 
+		FIELD	*field)
+		{ return(*(int *)0); }
+
+typedef struct
+{
+  int keycode; 
+  int (*cmd) (FORM *); 
+}
+Binding_Info;
+
+#undef form_driver
+int	form_driver(
+		FORM	*form, 
+		int	c)
+		{ return(*(int *)0); }
+
+#undef set_field_buffer
+int	set_field_buffer(
+		FIELD	*field, 
+		int	buffer, 
+		const char *value)
+		{ return(*(int *)0); }
+
+#undef field_buffer
+char	*field_buffer(
+		const FIELD *field, 
+		int	buffer)
+		{ return(*(char **)0); }
+
+/* ./frm_hook.c */
+
+#undef set_field_init
+int	set_field_init(
+		FORM	*form, 
+		Form_Hook func)
+		{ return(*(int *)0); }
+
+#undef field_init
+Form_Hook field_init(
+		const FORM *form)
+		{ return(*(Form_Hook *)0); }
+
+#undef set_field_term
+int	set_field_term(
+		FORM	*form, 
+		Form_Hook func)
+		{ return(*(int *)0); }
+
+#undef field_term
+Form_Hook field_term(
+		const FORM *form)
+		{ return(*(Form_Hook *)0); }
+
+#undef set_form_init
+int	set_form_init(
+		FORM	*form, 
+		Form_Hook func)
+		{ return(*(int *)0); }
+
+#undef form_init
+Form_Hook form_init(
+		const FORM *form)
+		{ return(*(Form_Hook *)0); }
+
+#undef set_form_term
+int	set_form_term(
+		FORM	*form, 
+		Form_Hook func)
+		{ return(*(int *)0); }
+
+#undef form_term
+Form_Hook form_term(
+		const FORM *form)
+		{ return(*(Form_Hook *)0); }
+
+/* ./frm_opts.c */
+
+#undef set_form_opts
+int	set_form_opts(
+		FORM	*form, 
+		Form_Options opts)
+		{ return(*(int *)0); }
+
+#undef form_opts
+Form_Options form_opts(
+		const FORM *form)
+		{ return(*(Form_Options *)0); }
+
+#undef form_opts_on
+int	form_opts_on(
+		FORM	*form, 
+		Form_Options opts)
+		{ return(*(int *)0); }
+
+#undef form_opts_off
+int	form_opts_off(
+		FORM	*form, 
+		Form_Options opts)
+		{ return(*(int *)0); }
+
+/* ./frm_page.c */
+
+#undef set_form_page
+int	set_form_page(
+		FORM	*form, 
+		int	page)
+		{ return(*(int *)0); }
+
+#undef form_page
+int	form_page(
+		const FORM *form)
+		{ return(*(int *)0); }
+
+/* ./frm_post.c */
+
+#undef post_form
+int	post_form(
+		FORM	*form)
+		{ return(*(int *)0); }
+
+#undef unpost_form
+int	unpost_form(
+		FORM	*form)
+		{ return(*(int *)0); }
+
+/* ./frm_req_name.c */
+
+#undef form_request_name
+const char *form_request_name(
+		int	request)
+		{ return(*(const char **)0); }
+
+#undef form_request_by_name
+int	form_request_by_name(
+		const char *str)
+		{ return(*(int *)0); }
+
+/* ./frm_scale.c */
+
+#undef scale_form
+int	scale_form(
+		const FORM *form, 
+		int	*rows, 
+		int	*cols)
+		{ return(*(int *)0); }
+
+/* ./frm_sub.c */
+
+#undef set_form_sub
+int	set_form_sub(
+		FORM	*form, 
+		WINDOW	*win)
+		{ return(*(int *)0); }
+
+#undef form_sub
+WINDOW	*form_sub(
+		const FORM *form)
+		{ return(*(WINDOW **)0); }
+
+/* ./frm_user.c */
+
+#undef set_form_userptr
+int	set_form_userptr(
+		FORM	*form, 
+		void	*usrptr)
+		{ return(*(int *)0); }
+
+#undef form_userptr
+void	*form_userptr(
+		const FORM *form)
+		{ return(*(void **)0); }
+
+/* ./frm_win.c */
+
+#undef set_form_win
+int	set_form_win(
+		FORM	*form, 
+		WINDOW	*win)
+		{ return(*(int *)0); }
+
+#undef form_win
+WINDOW	*form_win(
+		const FORM *form)
+		{ return(*(WINDOW **)0); }
+
+/* ./fty_alnum.c */
+
+typedef struct
+  {
+    int width;
+  }
+alnumARG;
+
+#undef TYPE_ALNUM
+FIELDTYPE *TYPE_ALNUM;
+
+#undef _nc_TYPE_ALNUM
+FIELDTYPE *_nc_TYPE_ALNUM(void)
+		{ return(*(FIELDTYPE **)0); }
+
+/* ./fty_alpha.c */
+
+typedef struct
+  {
+    int width;
+  }
+alphaARG;
+
+#undef TYPE_ALPHA
+FIELDTYPE *TYPE_ALPHA;
+
+#undef _nc_TYPE_ALPHA
+FIELDTYPE *_nc_TYPE_ALPHA(void)
+		{ return(*(FIELDTYPE **)0); }
+
+/* ./fty_enum.c */
+
+typedef struct
+  {
+    char **kwds;
+    int count;
+    NCURSES_BOOL checkcase;
+    NCURSES_BOOL checkunique;
+  }
+enumARG;
+
+typedef struct
+  {
+    char **kwds;
+    int ccase;
+    int cunique;
+  }
+enumParams;
+
+#undef TYPE_ENUM
+FIELDTYPE *TYPE_ENUM;
+
+#undef _nc_TYPE_ENUM
+FIELDTYPE *_nc_TYPE_ENUM(void)
+		{ return(*(FIELDTYPE **)0); }
+
+/* ./fty_generic.c */
+
+#undef _nc_generic_fieldtype
+FIELDTYPE *_nc_generic_fieldtype(
+		NCURSES_BOOL (*const field_check)(
+		FORM	*p1, 
+		FIELD	*p2, 
+		const void *p3), 
+		NCURSES_BOOL (*const char_check)(
+		int	p1, 
+		FORM	*p2, 
+		FIELD	*p3, 
+		const void *p4), 
+		NCURSES_BOOL (*const next)(
+		FORM	*p1, 
+		FIELD	*p2, 
+		const void *p3), 
+		NCURSES_BOOL (*const prev)(
+		FORM	*p1, 
+		FIELD	*p2, 
+		const void *p3), 
+		void	(*freecallback)(
+		void	*p1))
+		{ return(*(FIELDTYPE **)0); }
+
+#undef _nc_set_generic_fieldtype
+int	_nc_set_generic_fieldtype(
+		FIELD	*field, 
+		FIELDTYPE *ftyp, 
+		int	(*argiterator)(
+		void	**p1))
+		{ return(*(int *)0); }
+
+#undef _nc_form_cursor
+WINDOW	*_nc_form_cursor(
+		const FORM *form, 
+		int	*pRow, 
+		int	*pCol)
+		{ return(*(WINDOW **)0); }
+
+/* ./fty_int.c */
+
+typedef struct
+  {
+    int precision;
+    long low;
+    long high;
+  }
+integerARG;
+
+typedef struct
+  {
+    int precision;
+    long low;
+    long high;
+  }
+integerPARM;
+
+#undef TYPE_INTEGER
+FIELDTYPE *TYPE_INTEGER;
+
+#undef _nc_TYPE_INTEGER
+FIELDTYPE *_nc_TYPE_INTEGER(void)
+		{ return(*(FIELDTYPE **)0); }
+
+/* ./fty_ipv4.c */
+
+#undef TYPE_IPV4
+FIELDTYPE *TYPE_IPV4;
+
+#undef _nc_TYPE_IPV4
+FIELDTYPE *_nc_TYPE_IPV4(void)
+		{ return(*(FIELDTYPE **)0); }
+
+/* ./fty_num.c */
+
+#include <locale.h>
+
+typedef struct
+  {
+    int precision;
+    double low;
+    double high;
+    struct lconv *L;
+  }
+numericARG;
+
+typedef struct
+  {
+    int precision;
+    double low;
+    double high;
+  }
+thisPARM;
+
+#undef TYPE_NUMERIC
+FIELDTYPE *TYPE_NUMERIC;
+
+#undef _nc_TYPE_NUMERIC
+FIELDTYPE *_nc_TYPE_NUMERIC(void)
+		{ return(*(FIELDTYPE **)0); }
+
+/* ./fty_regex.c */
+
+#include <regex.h>
+
+typedef struct
+  {
+    regex_t *pRegExp;
+    unsigned long *refCount;
+  }
+RegExp_Arg;
+
+#undef TYPE_REGEXP
+FIELDTYPE *TYPE_REGEXP;
+
+#undef _nc_TYPE_REGEXP
+FIELDTYPE *_nc_TYPE_REGEXP(void)
+		{ return(*(FIELDTYPE **)0); }
diff --git a/form/llib-lformtw b/form/llib-lformtw
new file mode 100644
index 0000000..da8682c
--- /dev/null
+++ b/form/llib-lformtw
@@ -0,0 +1,853 @@
+/****************************************************************************
+ * Copyright (c) 2010-2013,2015 Free Software Foundation, Inc.              *
+ *                                                                          *
+ * Permission is hereby granted, free of charge, to any person obtaining a  *
+ * copy of this software and associated documentation files (the            *
+ * "Software"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Thomas E. Dickey       2010-on                                  *
+ ****************************************************************************/
+/* LINTLIBRARY */
+
+/* ./f_trace.c */
+
+#include <form.priv.h>
+
+#undef _nc_retrace_field_ptr
+FIELD	**_nc_retrace_field_ptr(
+		FIELD	**code)
+		{ return(*(FIELD ***)0); }
+
+#undef _nc_retrace_field
+FIELD	*_nc_retrace_field(
+		FIELD	*code)
+		{ return(*(FIELD **)0); }
+
+#undef _nc_retrace_field_type
+FIELDTYPE *_nc_retrace_field_type(
+		FIELDTYPE *code)
+		{ return(*(FIELDTYPE **)0); }
+
+#undef _nc_retrace_form
+FORM	*_nc_retrace_form(
+		FORM	*code)
+		{ return(*(FORM **)0); }
+
+#undef _nc_retrace_form_hook
+Form_Hook _nc_retrace_form_hook(
+		Form_Hook code)
+		{ return(*(Form_Hook *)0); }
+
+/* ./fld_arg.c */
+
+#undef set_fieldtype_arg
+int	set_fieldtype_arg(
+		FIELDTYPE *typ, 
+		void	*(*const make_arg)(
+		va_list	*p1), 
+		void	*(*const copy_arg)(
+		const void *p1), 
+		void	(*const free_arg)(
+		void	*p1))
+		{ return(*(int *)0); }
+
+#undef field_arg
+void	*field_arg(
+		const FIELD *field)
+		{ return(*(void **)0); }
+
+/* ./fld_attr.c */
+
+#undef set_field_fore
+int	set_field_fore(
+		FIELD	*field, 
+		chtype	attr)
+		{ return(*(int *)0); }
+
+#undef field_fore
+chtype	field_fore(
+		const FIELD *field)
+		{ return(*(chtype *)0); }
+
+#undef set_field_back
+int	set_field_back(
+		FIELD	*field, 
+		chtype	attr)
+		{ return(*(int *)0); }
+
+#undef field_back
+chtype	field_back(
+		const FIELD *field)
+		{ return(*(chtype *)0); }
+
+/* ./fld_current.c */
+
+#undef set_current_field
+int	set_current_field(
+		FORM	*form, 
+		FIELD	*field)
+		{ return(*(int *)0); }
+
+#undef current_field
+FIELD	*current_field(
+		const FORM *form)
+		{ return(*(FIELD **)0); }
+
+#undef field_index
+int	field_index(
+		const FIELD *field)
+		{ return(*(int *)0); }
+
+/* ./fld_def.c */
+
+#undef _nc_Default_Field
+FIELD	*_nc_Default_Field;
+
+#undef _nc_Make_Argument
+TypeArgument *_nc_Make_Argument(
+		const FIELDTYPE *typ, 
+		va_list	*ap, 
+		int	*err)
+		{ return(*(TypeArgument **)0); }
+
+#undef _nc_Copy_Argument
+TypeArgument *_nc_Copy_Argument(
+		const FIELDTYPE *typ, 
+		const TypeArgument *argp, 
+		int	*err)
+		{ return(*(TypeArgument **)0); }
+
+#undef _nc_Free_Argument
+void	_nc_Free_Argument(
+		const FIELDTYPE *typ, 
+		TypeArgument *argp)
+		{ /* void */ }
+
+#undef _nc_Copy_Type
+NCURSES_BOOL _nc_Copy_Type(
+		FIELD	*dst, 
+		FIELD const *src)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_Free_Type
+void	_nc_Free_Type(
+		FIELD	*field)
+		{ /* void */ }
+
+#undef new_field
+FIELD	*new_field(
+		int	rows, 
+		int	cols, 
+		int	frow, 
+		int	fcol, 
+		int	nrow, 
+		int	nbuf)
+		{ return(*(FIELD **)0); }
+
+#undef free_field
+int	free_field(
+		FIELD	*field)
+		{ return(*(int *)0); }
+
+/* ./fld_dup.c */
+
+#undef dup_field
+FIELD	*dup_field(
+		FIELD	*field, 
+		int	frow, 
+		int	fcol)
+		{ return(*(FIELD **)0); }
+
+/* ./fld_ftchoice.c */
+
+#undef set_fieldtype_choice
+int	set_fieldtype_choice(
+		FIELDTYPE *typ, 
+		NCURSES_BOOL (*const next_choice)(
+		FIELD	*p1, 
+		const void *p2), 
+		NCURSES_BOOL (*const prev_choice)(
+		FIELD	*p1, 
+		const void *p2))
+		{ return(*(int *)0); }
+
+/* ./fld_ftlink.c */
+
+#undef link_fieldtype
+FIELDTYPE *link_fieldtype(
+		FIELDTYPE *type1, 
+		FIELDTYPE *type2)
+		{ return(*(FIELDTYPE **)0); }
+
+/* ./fld_info.c */
+
+#undef field_info
+int	field_info(
+		const FIELD *field, 
+		int	*rows, 
+		int	*cols, 
+		int	*frow, 
+		int	*fcol, 
+		int	*nrow, 
+		int	*nbuf)
+		{ return(*(int *)0); }
+
+#undef dynamic_field_info
+int	dynamic_field_info(
+		const FIELD *field, 
+		int	*drows, 
+		int	*dcols, 
+		int	*maxgrow)
+		{ return(*(int *)0); }
+
+/* ./fld_just.c */
+
+#undef set_field_just
+int	set_field_just(
+		FIELD	*field, 
+		int	just)
+		{ return(*(int *)0); }
+
+#undef field_just
+int	field_just(
+		const FIELD *field)
+		{ return(*(int *)0); }
+
+/* ./fld_link.c */
+
+#undef link_field
+FIELD	*link_field(
+		FIELD	*field, 
+		int	frow, 
+		int	fcol)
+		{ return(*(FIELD **)0); }
+
+/* ./fld_max.c */
+
+#undef set_max_field
+int	set_max_field(
+		FIELD	*field, 
+		int	maxgrow)
+		{ return(*(int *)0); }
+
+/* ./fld_move.c */
+
+#undef move_field
+int	move_field(
+		FIELD	*field, 
+		int	frow, 
+		int	fcol)
+		{ return(*(int *)0); }
+
+/* ./fld_newftyp.c */
+
+#undef _nc_Default_FieldType
+FIELDTYPE *_nc_Default_FieldType;
+
+#undef new_fieldtype
+FIELDTYPE *new_fieldtype(
+		NCURSES_BOOL (*const field_check)(
+		FIELD	*p1, 
+		const void *p2), 
+		NCURSES_BOOL (*const char_check)(
+		int	p1, 
+		const void *p2))
+		{ return(*(FIELDTYPE **)0); }
+
+#undef free_fieldtype
+int	free_fieldtype(
+		FIELDTYPE *typ)
+		{ return(*(int *)0); }
+
+/* ./fld_opts.c */
+
+#undef set_field_opts
+int	set_field_opts(
+		FIELD	*field, 
+		Field_Options opts)
+		{ return(*(int *)0); }
+
+#undef field_opts
+Field_Options field_opts(
+		const FIELD *field)
+		{ return(*(Field_Options *)0); }
+
+#undef field_opts_on
+int	field_opts_on(
+		FIELD	*field, 
+		Field_Options opts)
+		{ return(*(int *)0); }
+
+#undef field_opts_off
+int	field_opts_off(
+		FIELD	*field, 
+		Field_Options opts)
+		{ return(*(int *)0); }
+
+/* ./fld_pad.c */
+
+#undef set_field_pad
+int	set_field_pad(
+		FIELD	*field, 
+		int	ch)
+		{ return(*(int *)0); }
+
+#undef field_pad
+int	field_pad(
+		const FIELD *field)
+		{ return(*(int *)0); }
+
+/* ./fld_page.c */
+
+#undef set_new_page
+int	set_new_page(
+		FIELD	*field, 
+		NCURSES_BOOL new_page_flag)
+		{ return(*(int *)0); }
+
+#undef new_page
+NCURSES_BOOL new_page(
+		const FIELD *field)
+		{ return(*(NCURSES_BOOL *)0); }
+
+/* ./fld_stat.c */
+
+#undef set_field_status
+int	set_field_status(
+		FIELD	*field, 
+		NCURSES_BOOL status)
+		{ return(*(int *)0); }
+
+#undef field_status
+NCURSES_BOOL field_status(
+		const FIELD *field)
+		{ return(*(NCURSES_BOOL *)0); }
+
+/* ./fld_type.c */
+
+#undef set_field_type
+int	set_field_type(
+		FIELD	*field, 
+		FIELDTYPE *type, 
+		...)
+		{ return(*(int *)0); }
+
+#undef field_type
+FIELDTYPE *field_type(
+		const FIELD *field)
+		{ return(*(FIELDTYPE **)0); }
+
+/* ./fld_user.c */
+
+#undef set_field_userptr
+int	set_field_userptr(
+		FIELD	*field, 
+		void	*usrptr)
+		{ return(*(int *)0); }
+
+#undef field_userptr
+void	*field_userptr(
+		const FIELD *field)
+		{ return(*(void **)0); }
+
+/* ./frm_cursor.c */
+
+#undef pos_form_cursor
+int	pos_form_cursor(
+		FORM	*form)
+		{ return(*(int *)0); }
+
+/* ./frm_data.c */
+
+#undef data_behind
+NCURSES_BOOL data_behind(
+		const FORM *form)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef data_ahead
+NCURSES_BOOL data_ahead(
+		const FORM *form)
+		{ return(*(NCURSES_BOOL *)0); }
+
+/* ./frm_def.c */
+
+#undef _nc_Default_Form
+FORM	*_nc_Default_Form;
+
+#undef new_form_sp
+FORM	*new_form_sp(
+		SCREEN	*sp, 
+		FIELD	**fields)
+		{ return(*(FORM **)0); }
+
+#undef new_form
+FORM	*new_form(
+		FIELD	**fields)
+		{ return(*(FORM **)0); }
+
+#undef free_form
+int	free_form(
+		FORM	*form)
+		{ return(*(int *)0); }
+
+#undef set_form_fields
+int	set_form_fields(
+		FORM	*form, 
+		FIELD	**fields)
+		{ return(*(int *)0); }
+
+#undef form_fields
+FIELD	**form_fields(
+		const FORM *form)
+		{ return(*(FIELD ***)0); }
+
+#undef field_count
+int	field_count(
+		const FORM *form)
+		{ return(*(int *)0); }
+
+/* ./frm_driver.c */
+
+#undef _nc_get_fieldbuffer
+void	_nc_get_fieldbuffer(
+		FORM	*form, 
+		FIELD	*field, 
+		cchar_t	*buf)
+		{ /* void */ }
+
+#undef _nc_Position_Form_Cursor
+int	_nc_Position_Form_Cursor(
+		FORM	*form)
+		{ return(*(int *)0); }
+
+#undef _nc_Refresh_Current_Field
+int	_nc_Refresh_Current_Field(
+		FORM	*form)
+		{ return(*(int *)0); }
+
+#undef _nc_Synchronize_Attributes
+int	_nc_Synchronize_Attributes(
+		FIELD	*field)
+		{ return(*(int *)0); }
+
+#undef _nc_Synchronize_Options
+int	_nc_Synchronize_Options(
+		FIELD	*field, 
+		Field_Options newopts)
+		{ return(*(int *)0); }
+
+#undef _nc_Set_Current_Field
+int	_nc_Set_Current_Field(
+		FORM	*form, 
+		FIELD	*newfield)
+		{ return(*(int *)0); }
+
+#undef _nc_Internal_Validation
+NCURSES_BOOL _nc_Internal_Validation(
+		FORM	*form)
+		{ return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_First_Active_Field
+FIELD	*_nc_First_Active_Field(
+		FORM	*form)
+		{ return(*(FIELD **)0); }
+
+#undef _nc_Set_Form_Page
+int	_nc_Set_Form_Page(
+		FORM	*form, 
+		int	page, 
+		FIELD	*field)
+		{ return(*(int *)0); }
+
+typedef struct
+{
+  int keycode; 
+  int (*cmd) (FORM *); 
+}
+Binding_Info;
+
+#undef form_driver
+int	form_driver(
+		FORM	*form, 
+		int	c)
+		{ return(*(int *)0); }
+
+#undef form_driver_w
+int	form_driver_w(
+		FORM	*form, 
+		int	type, 
+		wchar_t	c)
+		{ return(*(int *)0); }
+
+#undef set_field_buffer
+int	set_field_buffer(
+		FIELD	*field, 
+		int	buffer, 
+		const char *value)
+		{ return(*(int *)0); }
+
+#undef field_buffer
+char	*field_buffer(
+		const FIELD *field, 
+		int	buffer)
+		{ return(*(char **)0); }
+
+#undef _nc_Widen_String
+wchar_t	*_nc_Widen_String(
+		char	*source, 
+		int	*lengthp)
+		{ return(*(wchar_t **)0); }
+
+/* ./frm_hook.c */
+
+#undef set_field_init
+int	set_field_init(
+		FORM	*form, 
+		Form_Hook func)
+		{ return(*(int *)0); }
+
+#undef field_init
+Form_Hook field_init(
+		const FORM *form)
+		{ return(*(Form_Hook *)0); }
+
+#undef set_field_term
+int	set_field_term(
+		FORM	*form, 
+		Form_Hook func)
+		{ return(*(int *)0); }
+
+#undef field_term
+Form_Hook field_term(
+		const FORM *form)
+		{ return(*(Form_Hook *)0); }
+
+#undef set_form_init
+int	set_form_init(
+		FORM	*form, 
+		Form_Hook func)
+		{ return(*(int *)0); }
+
+#undef form_init
+Form_Hook form_init(
+		const FORM *form)
+		{ return(*(Form_Hook *)0); }
+
+#undef set_form_term
+int	set_form_term(
+		FORM	*form, 
+		Form_Hook func)
+		{ return(*(int *)0); }
+
+#undef form_term
+Form_Hook form_term(
+		const FORM *form)
+		{ return(*(Form_Hook *)0); }
+
+/* ./frm_opts.c */
+
+#undef set_form_opts
+int	set_form_opts(
+		FORM	*form, 
+		Form_Options opts)
+		{ return(*(int *)0); }
+
+#undef form_opts
+Form_Options form_opts(
+		const FORM *form)
+		{ return(*(Form_Options *)0); }
+
+#undef form_opts_on
+int	form_opts_on(
+		FORM	*form, 
+		Form_Options opts)
+		{ return(*(int *)0); }
+
+#undef form_opts_off
+int	form_opts_off(
+		FORM	*form, 
+		Form_Options opts)
+		{ return(*(int *)0); }
+
+/* ./frm_page.c */
+
+#undef set_form_page
+int	set_form_page(
+		FORM	*form, 
+		int	page)
+		{ return(*(int *)0); }
+
+#undef form_page
+int	form_page(
+		const FORM *form)
+		{ return(*(int *)0); }
+
+/* ./frm_post.c */
+
+#undef post_form
+int	post_form(
+		FORM	*form)
+		{ return(*(int *)0); }
+
+#undef unpost_form
+int	unpost_form(
+		FORM	*form)
+		{ return(*(int *)0); }
+
+/* ./frm_req_name.c */
+
+#undef form_request_name
+const char *form_request_name(
+		int	request)
+		{ return(*(const char **)0); }
+
+#undef form_request_by_name
+int	form_request_by_name(
+		const char *str)
+		{ return(*(int *)0); }
+
+/* ./frm_scale.c */
+
+#undef scale_form
+int	scale_form(
+		const FORM *form, 
+		int	*rows, 
+		int	*cols)
+		{ return(*(int *)0); }
+
+/* ./frm_sub.c */
+
+#undef set_form_sub
+int	set_form_sub(
+		FORM	*form, 
+		WINDOW	*win)
+		{ return(*(int *)0); }
+
+#undef form_sub
+WINDOW	*form_sub(
+		const FORM *form)
+		{ return(*(WINDOW **)0); }
+
+/* ./frm_user.c */
+
+#undef set_form_userptr
+int	set_form_userptr(
+		FORM	*form, 
+		void	*usrptr)
+		{ return(*(int *)0); }
+
+#undef form_userptr
+void	*form_userptr(
+		const FORM *form)
+		{ return(*(void **)0); }
+
+/* ./frm_win.c */
+
+#undef set_form_win
+int	set_form_win(
+		FORM	*form, 
+		WINDOW	*win)
+		{ return(*(int *)0); }
+
+#undef form_win
+WINDOW	*form_win(
+		const FORM *form)
+		{ return(*(WINDOW **)0); }
+
+/* ./fty_alnum.c */
+
+typedef struct
+  {
+    int width;
+  }
+alnumARG;
+
+#undef TYPE_ALNUM
+FIELDTYPE *TYPE_ALNUM;
+
+#undef _nc_TYPE_ALNUM
+FIELDTYPE *_nc_TYPE_ALNUM(void)
+		{ return(*(FIELDTYPE **)0); }
+
+/* ./fty_alpha.c */
+
+typedef struct
+  {
+    int width;
+  }
+alphaARG;
+
+#undef TYPE_ALPHA
+FIELDTYPE *TYPE_ALPHA;
+
+#undef _nc_TYPE_ALPHA
+FIELDTYPE *_nc_TYPE_ALPHA(void)
+		{ return(*(FIELDTYPE **)0); }
+
+/* ./fty_enum.c */
+
+typedef struct
+  {
+    char **kwds;
+    int count;
+    NCURSES_BOOL checkcase;
+    NCURSES_BOOL checkunique;
+  }
+enumARG;
+
+typedef struct
+  {
+    char **kwds;
+    int ccase;
+    int cunique;
+  }
+enumParams;
+
+#undef TYPE_ENUM
+FIELDTYPE *TYPE_ENUM;
+
+#undef _nc_TYPE_ENUM
+FIELDTYPE *_nc_TYPE_ENUM(void)
+		{ return(*(FIELDTYPE **)0); }
+
+/* ./fty_generic.c */
+
+#undef _nc_generic_fieldtype
+FIELDTYPE *_nc_generic_fieldtype(
+		NCURSES_BOOL (*const field_check)(
+		FORM	*p1, 
+		FIELD	*p2, 
+		const void *p3), 
+		NCURSES_BOOL (*const char_check)(
+		int	p1, 
+		FORM	*p2, 
+		FIELD	*p3, 
+		const void *p4), 
+		NCURSES_BOOL (*const next)(
+		FORM	*p1, 
+		FIELD	*p2, 
+		const void *p3), 
+		NCURSES_BOOL (*const prev)(
+		FORM	*p1, 
+		FIELD	*p2, 
+		const void *p3), 
+		void	(*freecallback)(
+		void	*p1))
+		{ return(*(FIELDTYPE **)0); }
+
+#undef _nc_set_generic_fieldtype
+int	_nc_set_generic_fieldtype(
+		FIELD	*field, 
+		FIELDTYPE *ftyp, 
+		int	(*argiterator)(
+		void	**p1))
+		{ return(*(int *)0); }
+
+#undef _nc_form_cursor
+WINDOW	*_nc_form_cursor(
+		const FORM *form, 
+		int	*pRow, 
+		int	*pCol)
+		{ return(*(WINDOW **)0); }
+
+/* ./fty_int.c */
+
+typedef struct
+  {
+    int precision;
+    long low;
+    long high;
+  }
+integerARG;
+
+typedef struct
+  {
+    int precision;
+    long low;
+    long high;
+  }
+integerPARM;
+
+#undef TYPE_INTEGER
+FIELDTYPE *TYPE_INTEGER;
+
+#undef _nc_TYPE_INTEGER
+FIELDTYPE *_nc_TYPE_INTEGER(void)
+		{ return(*(FIELDTYPE **)0); }
+
+/* ./fty_ipv4.c */
+
+#undef TYPE_IPV4
+FIELDTYPE *TYPE_IPV4;
+
+#undef _nc_TYPE_IPV4
+FIELDTYPE *_nc_TYPE_IPV4(void)
+		{ return(*(FIELDTYPE **)0); }
+
+/* ./fty_num.c */
+
+#include <locale.h>
+
+typedef struct
+  {
+    int precision;
+    double low;
+    double high;
+    struct lconv *L;
+  }
+numericARG;
+
+typedef struct
+  {
+    int precision;
+    double low;
+    double high;
+  }
+thisPARM;
+
+#undef TYPE_NUMERIC
+FIELDTYPE *TYPE_NUMERIC;
+
+#undef _nc_TYPE_NUMERIC
+FIELDTYPE *_nc_TYPE_NUMERIC(void)
+		{ return(*(FIELDTYPE **)0); }
+
+/* ./fty_regex.c */
+
+#include <regex.h>
+
+typedef struct
+  {
+    regex_t *pRegExp;
+    unsigned long *refCount;
+  }
+RegExp_Arg;
+
+#undef TYPE_REGEXP
+FIELDTYPE *TYPE_REGEXP;
+
+#undef _nc_TYPE_REGEXP
+FIELDTYPE *_nc_TYPE_REGEXP(void)
+		{ return(*(FIELDTYPE **)0); }
diff --git a/form/llib-lformw b/form/llib-lformw
index 7690c5b..f6a685f 100644
--- a/form/llib-lformw
+++ b/form/llib-lformw
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2002,2005 Free Software Foundation, Inc.                        *
+ * Copyright (c) 2002-2013,2015 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -27,13 +27,13 @@
  ****************************************************************************/
 
 /****************************************************************************
- *  Author: Thomas E. Dickey                    2002,2005                   *
+ *  Author: Thomas E. Dickey       2002-on                                  *
  ****************************************************************************/
 /* LINTLIBRARY */
 
 /* ./f_trace.c */
 
-#include "form.priv.h"
+#include <form.priv.h>
 
 #undef _nc_retrace_field_ptr
 FIELD	**_nc_retrace_field_ptr(
@@ -264,7 +264,7 @@
 /* ./fld_newftyp.c */
 
 #undef _nc_Default_FieldType
-const FIELDTYPE *_nc_Default_FieldType = {0};
+FIELDTYPE *_nc_Default_FieldType;
 
 #undef new_fieldtype
 FIELDTYPE *new_fieldtype(
@@ -396,6 +396,12 @@
 #undef _nc_Default_Form
 FORM	*_nc_Default_Form;
 
+#undef new_form_sp
+FORM	*new_form_sp(
+		SCREEN	*sp, 
+		FIELD	**fields)
+		{ return(*(FORM **)0); }
+
 #undef new_form
 FORM	*new_form(
 		FIELD	**fields)
@@ -424,6 +430,13 @@
 
 /* ./frm_driver.c */
 
+#undef _nc_get_fieldbuffer
+void	_nc_get_fieldbuffer(
+		FORM	*form, 
+		FIELD	*field, 
+		cchar_t	*buf)
+		{ /* void */ }
+
 #undef _nc_Position_Form_Cursor
 int	_nc_Position_Form_Cursor(
 		FORM	*form)
@@ -481,6 +494,13 @@
 		int	c)
 		{ return(*(int *)0); }
 
+#undef form_driver_w
+int	form_driver_w(
+		FORM	*form, 
+		int	type, 
+		wchar_t	c)
+		{ return(*(int *)0); }
+
 #undef set_field_buffer
 int	set_field_buffer(
 		FIELD	*field, 
@@ -667,6 +687,10 @@
 #undef TYPE_ALNUM
 FIELDTYPE *TYPE_ALNUM;
 
+#undef _nc_TYPE_ALNUM
+FIELDTYPE *_nc_TYPE_ALNUM(void)
+		{ return(*(FIELDTYPE **)0); }
+
 /* ./fty_alpha.c */
 
 typedef struct
@@ -678,6 +702,10 @@
 #undef TYPE_ALPHA
 FIELDTYPE *TYPE_ALPHA;
 
+#undef _nc_TYPE_ALPHA
+FIELDTYPE *_nc_TYPE_ALPHA(void)
+		{ return(*(FIELDTYPE **)0); }
+
 /* ./fty_enum.c */
 
 typedef struct
@@ -689,9 +717,61 @@
   }
 enumARG;
 
+typedef struct
+  {
+    char **kwds;
+    int ccase;
+    int cunique;
+  }
+enumParams;
+
 #undef TYPE_ENUM
 FIELDTYPE *TYPE_ENUM;
 
+#undef _nc_TYPE_ENUM
+FIELDTYPE *_nc_TYPE_ENUM(void)
+		{ return(*(FIELDTYPE **)0); }
+
+/* ./fty_generic.c */
+
+#undef _nc_generic_fieldtype
+FIELDTYPE *_nc_generic_fieldtype(
+		NCURSES_BOOL (*const field_check)(
+		FORM	*p1, 
+		FIELD	*p2, 
+		const void *p3), 
+		NCURSES_BOOL (*const char_check)(
+		int	p1, 
+		FORM	*p2, 
+		FIELD	*p3, 
+		const void *p4), 
+		NCURSES_BOOL (*const next)(
+		FORM	*p1, 
+		FIELD	*p2, 
+		const void *p3), 
+		NCURSES_BOOL (*const prev)(
+		FORM	*p1, 
+		FIELD	*p2, 
+		const void *p3), 
+		void	(*freecallback)(
+		void	*p1))
+		{ return(*(FIELDTYPE **)0); }
+
+#undef _nc_set_generic_fieldtype
+int	_nc_set_generic_fieldtype(
+		FIELD	*field, 
+		FIELDTYPE *ftyp, 
+		int	(*argiterator)(
+		void	**p1))
+		{ return(*(int *)0); }
+
+#undef _nc_form_cursor
+WINDOW	*_nc_form_cursor(
+		const FORM *form, 
+		int	*pRow, 
+		int	*pCol)
+		{ return(*(WINDOW **)0); }
+
 /* ./fty_int.c */
 
 typedef struct
@@ -702,13 +782,30 @@
   }
 integerARG;
 
+typedef struct
+  {
+    int precision;
+    long low;
+    long high;
+  }
+integerPARM;
+
 #undef TYPE_INTEGER
 FIELDTYPE *TYPE_INTEGER;
 
+#undef _nc_TYPE_INTEGER
+FIELDTYPE *_nc_TYPE_INTEGER(void)
+		{ return(*(FIELDTYPE **)0); }
+
 /* ./fty_ipv4.c */
+
 #undef TYPE_IPV4
 FIELDTYPE *TYPE_IPV4;
 
+#undef _nc_TYPE_IPV4
+FIELDTYPE *_nc_TYPE_IPV4(void)
+		{ return(*(FIELDTYPE **)0); }
+
 /* ./fty_num.c */
 
 #include <locale.h>
@@ -722,9 +819,21 @@
   }
 numericARG;
 
+typedef struct
+  {
+    int precision;
+    double low;
+    double high;
+  }
+thisPARM;
+
 #undef TYPE_NUMERIC
 FIELDTYPE *TYPE_NUMERIC;
 
+#undef _nc_TYPE_NUMERIC
+FIELDTYPE *_nc_TYPE_NUMERIC(void)
+		{ return(*(FIELDTYPE **)0); }
+
 /* ./fty_regex.c */
 
 #include <regex.h>
@@ -738,3 +847,7 @@
 
 #undef TYPE_REGEXP
 FIELDTYPE *TYPE_REGEXP;
+
+#undef _nc_TYPE_REGEXP
+FIELDTYPE *_nc_TYPE_REGEXP(void)
+		{ return(*(FIELDTYPE **)0); }
diff --git a/form/modules b/form/modules
index 89f9f9f..205356b 100644
--- a/form/modules
+++ b/form/modules
@@ -1,6 +1,6 @@
-# $Id: modules,v 1.15 2006/12/24 00:52:58 tom Exp $
+# $Id: modules,v 1.17 2010/01/23 16:26:37 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2004,2006 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.                #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -28,49 +28,51 @@
 ##############################################################################
 #
 # Author: Thomas E. Dickey	1995-on
+#    and: Juergen Pfeifer       2008
 #
 
 @ base
 # Library objects
-f_trace		lib		$(srcdir)	$(FORM_PRIV_H)
-fld_arg		lib		$(srcdir)	$(FORM_PRIV_H)
-fld_attr	lib		$(srcdir)	$(FORM_PRIV_H)
-fld_current	lib		$(srcdir)	$(FORM_PRIV_H)
-fld_def		lib		$(srcdir)	$(FORM_PRIV_H)
-fld_dup		lib		$(srcdir)	$(FORM_PRIV_H)
-fld_ftchoice	lib		$(srcdir)	$(FORM_PRIV_H)
-fld_ftlink	lib		$(srcdir)	$(FORM_PRIV_H)
-fld_info	lib		$(srcdir)	$(FORM_PRIV_H)
-fld_just	lib		$(srcdir)	$(FORM_PRIV_H)
-fld_link	lib		$(srcdir)	$(FORM_PRIV_H)
-fld_max		lib		$(srcdir)	$(FORM_PRIV_H)
-fld_move	lib		$(srcdir)	$(FORM_PRIV_H)
-fld_newftyp	lib		$(srcdir)	$(FORM_PRIV_H)
-fld_opts	lib		$(srcdir)	$(FORM_PRIV_H)
-fld_pad		lib		$(srcdir)	$(FORM_PRIV_H)
-fld_page	lib		$(srcdir)	$(FORM_PRIV_H)
-fld_stat	lib		$(srcdir)	$(FORM_PRIV_H)
-fld_type	lib		$(srcdir)	$(FORM_PRIV_H)
-fld_user	lib		$(srcdir)	$(FORM_PRIV_H)
-frm_cursor	lib		$(srcdir)	$(FORM_PRIV_H)
-frm_data	lib		$(srcdir)	$(FORM_PRIV_H)
-frm_def		lib		$(srcdir)	$(FORM_PRIV_H)
-frm_driver	lib		$(srcdir)	$(FORM_PRIV_H)
-frm_hook	lib		$(srcdir)	$(FORM_PRIV_H)
-frm_opts	lib		$(srcdir)	$(FORM_PRIV_H)
-frm_page	lib		$(srcdir)	$(FORM_PRIV_H)
-frm_post	lib		$(srcdir)	$(FORM_PRIV_H)
-frm_req_name	lib		$(srcdir)	$(FORM_PRIV_H)
-frm_scale	lib		$(srcdir)	$(FORM_PRIV_H)
-frm_sub		lib		$(srcdir)	$(FORM_PRIV_H)
-frm_user	lib		$(srcdir)	$(FORM_PRIV_H)
-frm_win		lib		$(srcdir)	$(FORM_PRIV_H)
-fty_alnum	lib		$(srcdir)	$(FORM_PRIV_H)
-fty_alpha	lib		$(srcdir)	$(FORM_PRIV_H)
-fty_enum	lib		$(srcdir)	$(FORM_PRIV_H)
-fty_int		lib		$(srcdir)	$(FORM_PRIV_H)
-fty_ipv4	lib		$(srcdir)	$(FORM_PRIV_H)
-fty_num		lib		$(srcdir)	$(FORM_PRIV_H)
-fty_regex	lib		$(srcdir)	$(FORM_PRIV_H)
+f_trace		lib		$(srcdir)	$(HEADER_DEPS)
+fld_arg		lib		$(srcdir)	$(HEADER_DEPS)
+fld_attr	lib		$(srcdir)	$(HEADER_DEPS)
+fld_current	lib		$(srcdir)	$(HEADER_DEPS)
+fld_def		lib		$(srcdir)	$(HEADER_DEPS)
+fld_dup		lib		$(srcdir)	$(HEADER_DEPS)
+fld_ftchoice	lib		$(srcdir)	$(HEADER_DEPS)
+fld_ftlink	lib		$(srcdir)	$(HEADER_DEPS)
+fld_info	lib		$(srcdir)	$(HEADER_DEPS)
+fld_just	lib		$(srcdir)	$(HEADER_DEPS)
+fld_link	lib		$(srcdir)	$(HEADER_DEPS)
+fld_max		lib		$(srcdir)	$(HEADER_DEPS)
+fld_move	lib		$(srcdir)	$(HEADER_DEPS)
+fld_newftyp	lib		$(srcdir)	$(HEADER_DEPS)
+fld_opts	lib		$(srcdir)	$(HEADER_DEPS)
+fld_pad		lib		$(srcdir)	$(HEADER_DEPS)
+fld_page	lib		$(srcdir)	$(HEADER_DEPS)
+fld_stat	lib		$(srcdir)	$(HEADER_DEPS)
+fld_type	lib		$(srcdir)	$(HEADER_DEPS)
+fld_user	lib		$(srcdir)	$(HEADER_DEPS)
+frm_cursor	lib		$(srcdir)	$(HEADER_DEPS)
+frm_data	lib		$(srcdir)	$(HEADER_DEPS)
+frm_def		lib		$(srcdir)	$(HEADER_DEPS)
+frm_driver	lib		$(srcdir)	$(HEADER_DEPS)
+frm_hook	lib		$(srcdir)	$(HEADER_DEPS)
+frm_opts	lib		$(srcdir)	$(HEADER_DEPS)
+frm_page	lib		$(srcdir)	$(HEADER_DEPS)
+frm_post	lib		$(srcdir)	$(HEADER_DEPS)
+frm_req_name	lib		$(srcdir)	$(HEADER_DEPS)
+frm_scale	lib		$(srcdir)	$(HEADER_DEPS)
+frm_sub		lib		$(srcdir)	$(HEADER_DEPS)
+frm_user	lib		$(srcdir)	$(HEADER_DEPS)
+frm_win		lib		$(srcdir)	$(HEADER_DEPS)
+fty_alnum	lib		$(srcdir)	$(HEADER_DEPS)
+fty_alpha	lib		$(srcdir)	$(HEADER_DEPS)
+fty_enum	lib		$(srcdir)	$(HEADER_DEPS)
+fty_generic	lib		$(srcdir)	$(HEADER_DEPS)
+fty_int		lib		$(srcdir)	$(HEADER_DEPS)
+fty_ipv4	lib		$(srcdir)	$(HEADER_DEPS)
+fty_num		lib		$(srcdir)	$(HEADER_DEPS)
+fty_regex	lib		$(srcdir)	$(HEADER_DEPS)
 
 # vile:makemode