aboutsummaryrefslogtreecommitdiff
path: root/form
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2014-02-28 19:18:07 +0000
committerXin LI <delphij@FreeBSD.org>2014-02-28 19:18:07 +0000
commita0044ffc69cfe39a3b0b2d208e0952254555afc6 (patch)
tree7b2d708d03277cdd2560e9ce6572bdafc2e58bab /form
parent4b819fa20a8d007a10f2d3e8d6a5dedf7f18fc9a (diff)
downloadsrc-a0044ffc69cfe39a3b0b2d208e0952254555afc6.tar.gz
src-a0044ffc69cfe39a3b0b2d208e0952254555afc6.zip
Redo import of ncurses 5.9 (stripped).vendor/ncurses/5.9-20110404_stripped
Notes
Notes: svn path=/vendor/ncurses/dist/; revision=262617 svn path=/vendor/ncurses/5.9-20110404_stripped/; revision=262631; tag=vendor/ncurses/5.9-20110404_stripped
Diffstat (limited to 'form')
-rw-r--r--form/Makefile.in19
-rw-r--r--form/f_trace.c12
-rw-r--r--form/fld_arg.c8
-rw-r--r--form/fld_attr.c6
-rw-r--r--form/fld_current.c10
-rw-r--r--form/fld_def.c10
-rw-r--r--form/fld_dup.c8
-rw-r--r--form/fld_ftchoice.c11
-rw-r--r--form/fld_ftlink.c8
-rw-r--r--form/fld_info.c18
-rw-r--r--form/fld_just.c8
-rw-r--r--form/fld_link.c8
-rw-r--r--form/fld_max.c6
-rw-r--r--form/fld_move.c6
-rw-r--r--form/fld_newftyp.c28
-rw-r--r--form/fld_opts.c12
-rw-r--r--form/fld_pad.c8
-rw-r--r--form/fld_page.c8
-rw-r--r--form/fld_stat.c8
-rw-r--r--form/fld_type.c8
-rw-r--r--form/fld_user.c8
-rw-r--r--form/form.h81
-rw-r--r--form/form.priv.h61
-rw-r--r--form/frm_cursor.c6
-rw-r--r--form/frm_data.c8
-rw-r--r--form/frm_def.c67
-rw-r--r--form/frm_driver.c350
-rw-r--r--form/frm_hook.c6
-rw-r--r--form/frm_opts.c12
-rw-r--r--form/frm_page.c8
-rw-r--r--form/frm_post.c8
-rw-r--r--form/frm_req_name.c8
-rw-r--r--form/frm_scale.c9
-rw-r--r--form/frm_sub.c23
-rw-r--r--form/frm_user.c8
-rw-r--r--form/frm_win.c29
-rw-r--r--form/fty_alnum.c63
-rw-r--r--form/fty_alpha.c63
-rw-r--r--form/fty_enum.c160
-rw-r--r--form/fty_generic.c297
-rw-r--r--form/fty_int.c77
-rw-r--r--form/fty_ipv4.c25
-rw-r--r--form/fty_num.c83
-rw-r--r--form/fty_regex.c172
-rw-r--r--form/llib-lform51
-rw-r--r--form/llib-lformt777
-rw-r--r--form/llib-lformtw783
-rw-r--r--form/llib-lformw51
-rw-r--r--form/modules86
49 files changed, 3040 insertions, 550 deletions
diff --git a/form/Makefile.in b/form/Makefile.in
index 2bf31e15f347..1a07e140d3e9 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.53 2010/11/27 21:45:27 tom Exp $
##############################################################################
-# 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 "Software"), #
@@ -43,6 +43,7 @@
.SUFFIXES:
SHELL = /bin/sh
+VPATH = @srcdir@
THIS = Makefile
x = @EXEEXT@
@@ -63,6 +64,7 @@ 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,11 +72,14 @@ INSTALL_PROG = @INSTALL_PROGRAM@
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@
@@ -124,7 +129,7 @@ sources : $(AUTO_SRC)
$(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 +137,7 @@ $(DESTDIR)$(libdir) :
-rm -f $@
cp $(srcdir)/form.h $@
-FORM_PRIV_H = \
+HEADER_DEPS = \
$(srcdir)/form.priv.h \
$(srcdir)/form.h \
../include/mf_common.h \
@@ -140,10 +145,10 @@ FORM_PRIV_H = \
../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
diff --git a/form/f_trace.c b/form/f_trace.c
index 3bb4ccd9d772..6044e03c6e3a 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 f79a157aa5fc..a07bdb195900 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-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_arg.c,v 1.11 2004/12/25 22:20:18 tom Exp $")
+MODULE_ID("$Id: fld_arg.c,v 1.12 2010/01/23 21:14:35 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -67,7 +67,7 @@ set_fieldtype_arg(FIELDTYPE *typ,
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)
{
@@ -91,7 +91,7 @@ set_fieldtype_arg(FIELDTYPE *typ,
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 c9c08384bc7f..0112f009ecd4 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 @@ NCURSES_IMPEXP int NCURSES_API set_field_ ## name (FIELD * field, chtype attr)\
#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 7c3a90af511d..ef9ec007ecaf 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 @@ set_current_field(FORM *form, FIELD *field)
{
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 @@ set_current_field(FORM *form, FIELD *field)
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 @@ current_field(const FORM *form)
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 3559ba67241c..6d7bd34a16ca 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-2007,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_def.c,v 1.36 2007/10/13 19:29:58 tom Exp $")
+MODULE_ID("$Id: fld_def.c,v 1.38 2010/01/23 21:14:35 tom Exp $")
/* this can't be readonly */
static FIELD default_field =
@@ -252,8 +252,8 @@ _nc_Free_Type(FIELD *field)
if (field->type != 0)
{
field->type->ref--;
+ _nc_Free_Argument(field->type, (TypeArgument *)(field->arg));
}
- _nc_Free_Argument(field->type, (TypeArgument *)(field->arg));
}
/*---------------------------------------------------------------------------
@@ -291,7 +291,7 @@ new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf)
((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;
@@ -355,7 +355,7 @@ new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf)
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 bbc38a3eb715..b8e501b38329 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-2007,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_dup.c,v 1.12 2007/10/13 19:30:21 tom Exp $")
+MODULE_ID("$Id: fld_dup.c,v 1.13 2010/01/23 21:14:35 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -53,12 +53,12 @@ dup_field(FIELD *field, int frow, int fcol)
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;
diff --git a/form/fld_ftchoice.c b/form/fld_ftchoice.c
index 9237f96d1d0c..3aac5be2b158 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-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: fld_ftchoice.c,v 1.9 2004/12/11 21:44:57 tom Exp $")
+MODULE_ID("$Id: fld_ftchoice.c,v 1.12 2010/01/23 21:14:35 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -51,14 +51,19 @@ set_fieldtype_choice(FIELDTYPE *typ,
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;
+#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 4ed2219262aa..c2cd251f42a7 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-2007,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_ftlink.c,v 1.13 2007/10/13 19:30:35 tom Exp $")
+MODULE_ID("$Id: fld_ftlink.c,v 1.14 2010/01/23 21:14:35 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -53,14 +53,14 @@ link_fieldtype(FIELDTYPE *type1, FIELDTYPE *type2)
{
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;
if ((type1->status & _HAS_ARGS) || (type2->status & _HAS_ARGS))
diff --git a/form/fld_info.c b/form/fld_info.c
index 324198c42bae..13fe8e72a03c 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 @@ field_info(const FIELD *field,
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 @@ field_info(const FIELD *field,
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 e021fb1cfb92..58a1750cc092 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-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_just.c,v 1.11 2004/12/11 22:55:48 tom Exp $")
+MODULE_ID("$Id: fld_just.c,v 1.12 2010/01/23 21:14:35 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -49,7 +49,7 @@ set_field_just(FIELD *field, int just)
{
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) ||
@@ -79,7 +79,7 @@ set_field_just(FIELD *field, int just)
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 0aac7db78d12..18103bee1910 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-2007,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_link.c,v 1.11 2007/10/13 19:30:43 tom Exp $")
+MODULE_ID("$Id: fld_link.c,v 1.12 2010/01/23 21:14:35 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -54,12 +54,12 @@ link_field(FIELD *field, int frow, int fcol)
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;
diff --git a/form/fld_max.c b/form/fld_max.c
index 7f5352e00d6e..5ce918e4e079 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-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_max.c,v 1.9 2004/12/11 21:51:54 tom Exp $")
+MODULE_ID("$Id: fld_max.c,v 1.10 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -47,7 +47,7 @@ MODULE_ID("$Id: fld_max.c,v 1.9 2004/12/11 21:51:54 tom Exp $")
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);
diff --git a/form/fld_move.c b/form/fld_move.c
index d9ceaaec2c9c..dfba22d72aaa 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-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_move.c,v 1.9 2004/12/11 21:52:44 tom Exp $")
+MODULE_ID("$Id: fld_move.c,v 1.10 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -48,7 +48,7 @@ MODULE_ID("$Id: fld_move.c,v 1.9 2004/12/11 21:52:44 tom Exp $")
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);
diff --git a/form/fld_newftyp.c b/form/fld_newftyp.c
index c2984b10e3c7..4351aed6b3c8 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 @@ static FIELDTYPE const default_fieldtype =
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 @@ new_fieldtype(bool (*const field_check) (FIELD *, const void *),
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 @@ new_fieldtype(bool (*const field_check) (FIELD *, const void *),
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 3c881acf081a..a52f1e2ad88f 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 @@ set_field_opts(FIELD *field, Field_Options opts)
{
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 @@ set_field_opts(FIELD *field, Field_Options opts)
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 @@ field_opts_on(FIELD *field, Field_Options opts)
{
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 @@ field_opts_off(FIELD *field, Field_Options opts)
{
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 63d8ad1cdbfa..4f8ff1f54f04 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 @@ set_field_pad(FIELD *field, int ch)
{
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 @@ set_field_pad(FIELD *field, int ch)
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 e1af4962b148..e4d18c556be6 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-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_page.c,v 1.9 2004/12/11 21:58:19 tom Exp $")
+MODULE_ID("$Id: fld_page.c,v 1.10 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -47,7 +47,7 @@ MODULE_ID("$Id: fld_page.c,v 1.9 2004/12/11 21:58:19 tom Exp $")
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)
@@ -74,7 +74,7 @@ set_new_page(FIELD *field, bool new_page_flag)
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 b85b4d55f244..46f89e674836 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-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_stat.c,v 1.11 2004/12/11 22:28:00 tom Exp $")
+MODULE_ID("$Id: fld_stat.c,v 1.12 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -46,7 +46,7 @@ MODULE_ID("$Id: fld_stat.c,v 1.11 2004/12/11 22:28:00 tom Exp $")
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);
@@ -71,7 +71,7 @@ set_field_status(FIELD *field, bool status)
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 c9a3fbe5c804..0b35b7eb9e56 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 @@ set_field_type(FIELD *field, FIELDTYPE *type,...)
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 @@ set_field_type(FIELD *field, FIELDTYPE *type,...)
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 323622c7b379..30bcf7a415d4 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 @@ MODULE_ID("$Id: fld_user.c,v 1.15 2004/12/25 22:24:50 tom Exp $")
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 @@ set_field_userptr(FIELD *field, void *usrptr)
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 a4691a86e8e7..f52893b952d6 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-2004,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 *
@@ -30,7 +30,7 @@
* Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
-/* $Id: form.h,v 0.20 2004/12/04 22:22:10 tom Exp $ */
+/* $Id: form.h,v 0.21 2009/11/07 19:31:11 tom Exp $ */
#ifndef FORM_H
#define FORM_H
@@ -105,34 +105,13 @@ typedef struct fieldnode {
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 +137,49 @@ typedef struct formnode {
} 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 *);
/***************************
@@ -279,13 +301,6 @@ extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP;
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 (
@@ -396,6 +411,10 @@ extern NCURSES_EXPORT(Form_Options) form_opts (const FORM *);
extern NCURSES_EXPORT(bool) data_ahead (const FORM *);
extern NCURSES_EXPORT(bool) data_behind (const FORM *);
+#if NCURSES_SP_FUNCS
+extern NCURSES_EXPORT(FORM *) NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **);
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/form/form.priv.h b/form/form.priv.h
index fea627d30d7d..49250b4e5b3b 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-2008,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -30,7 +30,7 @@
* 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.32 2009/11/07 21:26:43 tom Exp $ */
#ifndef FORM_PRIV_H
#define FORM_PRIV_H 1
@@ -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,9 +99,20 @@
#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)
@@ -144,8 +163,6 @@ TypeArgument;
#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,6 +178,36 @@ extern NCURSES_EXPORT(bool) _nc_Internal_Validation (FORM*);
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
@@ -176,8 +223,8 @@ extern NCURSES_EXPORT(wchar_t *) _nc_Widen_String(char *, int *);
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 */
diff --git a/form/frm_cursor.c b/form/frm_cursor.c
index 18dabab20889..7a4cd16116fc 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 @@ pos_form_cursor(FORM *form)
{
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 787a17919f04..93917d5bbea1 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-2005,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_data.c,v 1.14 2005/11/26 15:34:01 tom Exp $")
+MODULE_ID("$Id: frm_data.c,v 1.15 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -49,7 +49,7 @@ data_behind(const FORM *form)
{
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)
{
@@ -136,7 +136,7 @@ data_ahead(const FORM *form)
{
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 e6897514ffdd..86500f239863 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-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_def.c,v 1.23 2008/08/04 00:07:55 tom Exp $")
+MODULE_ID("$Id: frm_def.c,v 1.25 2010/01/23 21:14:36 tom Exp $")
/* this can't be readonly */
static FORM default_form =
@@ -160,7 +160,7 @@ Connect_Fields(FORM *form, FIELD **fields)
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 @@ Connect_Fields(FORM *form, FIELD **fields)
/* 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
@@ -283,7 +283,7 @@ Associate_Fields(FORM *form, FIELD **fields)
/*---------------------------------------------------------------------------
| 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 @@ Associate_Fields(FORM *form, FIELD **fields)
| 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 @@ new_form(FIELD **fields)
/*---------------------------------------------------------------------------
| 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 @@ new_form(FIELD **fields)
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 @@ set_form_fields(FORM *form, FIELD **fields)
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 @@ set_form_fields(FORM *form, FIELD **fields)
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 @@ form_fields(const FORM *form)
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 94323ed27788..e0892bf8d4f2 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-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_driver.c,v 1.88 2008/10/18 16:25:00 tom Exp $")
+MODULE_ID("$Id: frm_driver.c,v 1.98 2010/05/01 21:11:43 tom Exp $")
/*----------------------------------------------------------------------------
This is the core module of the form library. It contains the majority
@@ -188,7 +188,7 @@ static int FE_Delete_Previous(FORM *);
/* 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) )
+ (void) wattrset((win),(field)->fore) )
/* Logic to decide whether or not a field really appears on the form */
#define Field_Really_Appears(field) \
@@ -512,9 +512,10 @@ Buffer_To_Window(const FIELD *field, WINDOW *win)
/*---------------------------------------------------------------------------
| 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 +524,22 @@ Buffer_To_Window(const FIELD *field, WINDOW *win)
|
| 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 +568,25 @@ Window_To_Buffer(WINDOW *win, FIELD *field)
/*---------------------------------------------------------------------------
| 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
@@ -579,7 +603,7 @@ Synchronize_Buffer(FORM *form)
{
form->status &= ~_WINDOW_MODIFIED;
form->status |= _FCHECK_REQUIRED;
- Window_To_Buffer(form->w, form->current);
+ Window_To_Buffer(form, form->current);
wmove(form->w, form->currow, form->curcol);
}
}
@@ -663,7 +687,7 @@ Field_Grown(FIELD *field, int amount)
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++)
{
@@ -752,7 +776,7 @@ Field_Grown(FIELD *field, int amount)
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 +849,7 @@ _nc_Refresh_Current_Field(FORM *form)
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);
@@ -1010,7 +1034,8 @@ Undo_Justification(FIELD *field, WINDOW *win)
/*---------------------------------------------------------------------------
| Facility : libnform
-| Function : static bool Check_Char(
+| Function : static bool Check_Char(FORM *form,
+| FIELD *field,
| FIELDTYPE * typ,
| int ch,
| TypeArgument *argp)
@@ -1022,7 +1047,11 @@ Undo_Justification(FIELD *field, WINDOW *win)
| 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 +1059,23 @@ Check_Char(FIELDTYPE *typ, int ch, TypeArgument *argp)
{
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);
@@ -1073,9 +1112,13 @@ Display_Or_Erase_Field(FIELD *field, bool bEraseFlag)
else
{
if (field->opts & O_VISIBLE)
- Set_Field_Window_Attributes(field, win);
+ {
+ Set_Field_Window_Attributes(field, win);
+ }
else
- wattrset(win, WINDOW_ATTRS(fwin));
+ {
+ (void)wattrset(win, WINDOW_ATTRS(fwin));
+ }
werase(win);
}
@@ -1197,7 +1240,7 @@ _nc_Synchronize_Attributes(FIELD *field)
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);
@@ -1264,7 +1307,7 @@ _nc_Synchronize_Options(FIELD *field, Field_Options newopts)
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,14 +1319,13 @@ _nc_Synchronize_Options(FIELD *field, Field_Options newopts)
if (form)
{
- if (form->current == field)
- {
- field->opts = oldopts;
- returnCode(E_CURRENT);
- }
-
if (form->status & _POSTED)
{
+ if (form->current == field)
+ {
+ field->opts = oldopts;
+ returnCode(E_CURRENT);
+ }
if ((form->curpage == field->page))
{
if (changed_opts & O_VISIBLE)
@@ -1365,7 +1407,7 @@ _nc_Set_Current_Field(FORM *form, FIELD *newfield)
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);
@@ -1399,7 +1441,7 @@ _nc_Set_Current_Field(FORM *form, FIELD *newfield)
{
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);
@@ -1472,7 +1514,7 @@ IFN_Next_Character(FORM *form)
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 +1556,7 @@ IFN_Previous_Character(FORM *form)
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 +1584,7 @@ IFN_Next_Line(FORM *form)
{
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 +1610,7 @@ IFN_Next_Line(FORM *form)
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 +1637,7 @@ IFN_Next_Word(FORM *form)
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 +1680,7 @@ IFN_Previous_Word(FORM *form)
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 +1730,7 @@ IFN_Beginning_Of_Field(FORM *form)
{
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 +1754,7 @@ IFN_End_Of_Field(FORM *form)
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 +1777,7 @@ IFN_Beginning_Of_Line(FORM *form)
{
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 +1803,7 @@ IFN_End_Of_Line(FORM *form)
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 +1829,7 @@ IFN_Left_Character(FORM *form)
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 +1854,7 @@ IFN_Right_Character(FORM *form)
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 +1882,7 @@ IFN_Right_Character(FORM *form)
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 +1906,7 @@ IFN_Down_Character(FORM *form)
{
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
@@ -1973,7 +2015,7 @@ Vertical_Scrolling(int (*const fct) (FORM *), FORM *form)
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 +2031,7 @@ VSC_Scroll_Line_Forward(FORM *form)
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 +2047,7 @@ VSC_Scroll_Line_Backward(FORM *form)
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 +2063,7 @@ VSC_Scroll_Page_Forward(FORM *form)
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 +2079,7 @@ VSC_Scroll_Half_Page_Forward(FORM *form)
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 +2095,7 @@ VSC_Scroll_Page_Backward(FORM *form)
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 +2189,7 @@ Horizontal_Scrolling(int (*const fct) (FORM *), FORM *form)
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 +2205,7 @@ HSC_Scroll_Char_Forward(FORM *form)
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 +2221,7 @@ HSC_Scroll_Char_Backward(FORM *form)
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 +2237,7 @@ HSC_Horizontal_Line_Forward(FORM *form)
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 +2253,7 @@ HSC_Horizontal_Half_Line_Forward(FORM *form)
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 +2269,7 @@ HSC_Horizontal_Line_Backward(FORM *form)
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)));
}
@@ -2406,7 +2448,7 @@ Wrapping_Not_Necessary_Or_Wrapping_Ok(FORM *form)
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 +2474,7 @@ Wrapping_Not_Necessary_Or_Wrapping_Ok(FORM *form)
if (result != E_OK)
{
DeleteChar(form);
- Window_To_Buffer(form->w, field);
+ Window_To_Buffer(form, field);
result = E_REQUEST_DENIED;
}
}
@@ -2523,7 +2565,7 @@ FE_New_Line(FORM *form)
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 &&
@@ -2606,8 +2648,9 @@ FE_Insert_Character(FORM *form)
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 +2684,9 @@ FE_Insert_Line(FORM *form)
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 +2718,7 @@ FE_Insert_Line(FORM *form)
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 +2741,7 @@ FE_Delete_Previous(FORM *form)
{
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 +2809,7 @@ FE_Delete_Previous(FORM *form)
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 +2833,7 @@ FE_Delete_Word(FORM *form)
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 +2867,7 @@ FE_Delete_Word(FORM *form)
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 +2884,7 @@ FE_Clear_To_End_Of_Line(FORM *form)
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 +2901,7 @@ FE_Clear_To_End_Of_Field(FORM *form)
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,7 +2925,7 @@ FE_Clear_Field(FORM *form)
static int
EM_Overlay_Mode(FORM *form)
{
- T((T_CALLED("EM_Overlay_Mode(%p)"), form));
+ T((T_CALLED("EM_Overlay_Mode(%p)"), (void *)form));
form->status |= _OVLMODE;
returnCode(E_OK);
}
@@ -2897,7 +2941,7 @@ EM_Overlay_Mode(FORM *form)
static int
EM_Insert_Mode(FORM *form)
{
- T((T_CALLED("EM_Insert_Mode(%p)"), form));
+ T((T_CALLED("EM_Insert_Mode(%p)"), (void *)form));
form->status &= ~_OVLMODE;
returnCode(E_OK);
}
@@ -2912,7 +2956,7 @@ EM_Insert_Mode(FORM *form)
/*---------------------------------------------------------------------------
| Facility : libnform
-| Function : static bool Next_Choice(
+| Function : static bool Next_Choice(FORM * form,
| FIELDTYPE * typ,
| FIELD * field,
| TypeArgument *argp)
@@ -2924,7 +2968,7 @@ EM_Insert_Mode(FORM *form)
| 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 +2977,27 @@ Next_Choice(FIELDTYPE *typ, FIELD *field, TypeArgument *argp)
{
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 +3009,7 @@ Next_Choice(FIELDTYPE *typ, FIELD *field, TypeArgument *argp)
| 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 +3018,21 @@ Previous_Choice(FIELDTYPE *typ, FIELD *field, TypeArgument *argp)
{
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 +3057,9 @@ CR_Next_Choice(FORM *form)
{
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 +3078,9 @@ CR_Previous_Choice(FORM *form)
{
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 +3094,7 @@ CR_Previous_Choice(FORM *form)
/*---------------------------------------------------------------------------
| Facility : libnform
-| Function : static bool Check_Field(
+| Function : static bool Check_Field(FORM* form,
| FIELDTYPE * typ,
| FIELD * field,
| TypeArgument * argp)
@@ -3047,7 +3107,7 @@ CR_Previous_Choice(FORM *form)
| 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)
{
@@ -3068,13 +3128,23 @@ Check_Field(FIELDTYPE *typ, FIELD *field, TypeArgument *argp)
{
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;
@@ -3100,7 +3170,7 @@ _nc_Internal_Validation(FORM *form)
if ((form->status & _FCHECK_REQUIRED) ||
(!(field->opts & 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;
@@ -3128,7 +3198,7 @@ _nc_Internal_Validation(FORM *form)
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
@@ -3506,7 +3576,7 @@ Inter_Field_Navigation(int (*const fct) (FORM *), FORM *form)
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 +3594,7 @@ FN_Next_Field(FORM *form)
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 +3611,7 @@ FN_Previous_Field(FORM *form)
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 +3628,7 @@ FN_First_Field(FORM *form)
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 +3647,7 @@ FN_Last_Field(FORM *form)
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 +3665,7 @@ FN_Sorted_Next_Field(FORM *form)
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 +3683,7 @@ FN_Sorted_Previous_Field(FORM *form)
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 +3701,7 @@ FN_Sorted_First_Field(FORM *form)
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 +3719,7 @@ FN_Sorted_Last_Field(FORM *form)
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 +3737,7 @@ FN_Left_Field(FORM *form)
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 +3757,7 @@ FN_Right_Field(FORM *form)
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 +3777,7 @@ FN_Up_Field(FORM *form)
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)));
}
@@ -3851,7 +3921,7 @@ Page_Navigation(int (*const fct) (FORM *), FORM *form)
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 +3937,7 @@ PN_Next_Page(FORM *form)
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 +3953,7 @@ PN_Previous_Page(FORM *form)
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 +3969,7 @@ PN_First_Page(FORM *form)
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));
}
@@ -3928,7 +3998,7 @@ Data_Entry(FORM *form, int c)
FIELD *field = form->current;
int result = E_REQUEST_DENIED;
- T((T_CALLED("Data_Entry(%p,%s)"), form, _tracechtype((chtype)c)));
+ T((T_CALLED("Data_Entry(%p,%s)"), (void *)form, _tracechtype((chtype)c)));
if ((field->opts & O_EDIT)
#if FIX_FORM_INACTIVE_BUG
&& (field->opts & O_ACTIVE)
@@ -4129,7 +4199,7 @@ form_driver(FORM *form, int c)
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);
@@ -4194,7 +4264,7 @@ form_driver(FORM *form, int c)
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 +4351,7 @@ form_driver(FORM *form, int c)
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);
@@ -4326,7 +4396,7 @@ set_field_buffer(FIELD *field, int buffer, const char *value)
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);
@@ -4347,7 +4417,9 @@ set_field_buffer(FIELD *field, int buffer, const char *value)
* field->cols))))
RETURN(E_SYSTEM_ERROR);
+#if !USE_WIDEC_SUPPORT
len = vlen;
+#endif
}
}
@@ -4360,14 +4432,15 @@ set_field_buffer(FIELD *field, int buffer, const char *value)
* 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)
{
@@ -4377,9 +4450,9 @@ set_field_buffer(FIELD *field, int buffer, const char *value)
{
for (i = 0; i < (unsigned)field->drows; ++i)
{
- mvwin_wchnstr(field->working, i, 0,
- widevalue + (i * field->dcols),
- field->dcols);
+ (void)mvwin_wchnstr(field->working, 0, i * field->dcols,
+ widevalue + (i * field->dcols),
+ field->dcols);
}
for (i = 0; i < len; ++i)
{
@@ -4433,7 +4506,7 @@ field_buffer(const FIELD *field, int buffer)
{
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))
{
@@ -4446,7 +4519,7 @@ field_buffer(const FIELD *field, int buffer)
/* 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;
@@ -4463,12 +4536,25 @@ field_buffer(const FIELD *field, int buffer)
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 +4565,6 @@ field_buffer(const FIELD *field, int buffer)
#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 +4579,7 @@ _nc_Widen_String(char *source, int *lengthp)
int pass;
int status;
-#ifdef NEED_STATE
+#ifndef state_unused
mbstate_t state;
#endif
@@ -4528,8 +4598,8 @@ _nc_Widen_String(char *source, int *lengthp)
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)
{
diff --git a/form/frm_hook.c b/form/frm_hook.c
index 18e6d71f31ab..7daa396b704a 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-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_hook.c,v 1.14 2004/12/25 22:37:27 tom Exp $")
+MODULE_ID("$Id: frm_hook.c,v 1.15 2010/01/23 21:12:08 tom Exp $")
/* "Template" macro to generate function to set application specific hook */
#define GEN_HOOK_SET_FUNCTION( typ, name ) \
@@ -47,7 +47,7 @@ NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (FORM *form, Form_Hook f
#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 d36d618a5343..3557fcd7ff04 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-2005,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_opts.c,v 1.14 2005/04/16 16:59:18 tom Exp $")
+MODULE_ID("$Id: frm_opts.c,v 1.15 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -47,7 +47,7 @@ MODULE_ID("$Id: frm_opts.c,v 1.14 2005/04/16 16:59:18 tom Exp $")
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)
@@ -70,7 +70,7 @@ set_form_opts(FORM *form, Form_Options opts)
NCURSES_EXPORT(Form_Options)
form_opts(const FORM *form)
{
- T((T_CALLED("form_opts(%p)"), form));
+ T((T_CALLED("form_opts(%p)"), (const void *)form));
returnCode((int)(Normalize_Form(form)->opts & ALL_FORM_OPTS));
}
@@ -87,7 +87,7 @@ form_opts(const FORM *form)
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)
@@ -112,7 +112,7 @@ form_opts_on(FORM *form, Form_Options opts)
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)
diff --git a/form/frm_page.c b/form/frm_page.c
index a371838d950e..5a76ca995793 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-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_page.c,v 1.10 2004/12/11 22:08:21 tom Exp $")
+MODULE_ID("$Id: frm_page.c,v 1.11 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -51,7 +51,7 @@ set_form_page(FORM *form, int page)
{
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);
@@ -98,7 +98,7 @@ set_form_page(FORM *form, int page)
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 28937e91b0b2..8e29aff5f62a 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-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_post.c,v 1.9 2004/12/11 22:19:06 tom Exp $")
+MODULE_ID("$Id: frm_post.c,v 1.10 2010/01/23 21:14:36 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -54,7 +54,7 @@ post_form(FORM *form)
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);
@@ -100,7 +100,7 @@ post_form(FORM *form)
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);
diff --git a/form/frm_req_name.c b/form/frm_req_name.c
index 7ac9abe6e299..99abd7e3c1d9 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-2008,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -37,7 +37,7 @@
#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.17 2009/10/10 16:17:01 tom Exp $")
static const char *request_names[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] =
{
@@ -154,14 +154,14 @@ form_request_by_name(const char *str)
strncpy(buf, str, sizeof(buf));
while ((i < sizeof(buf)) && (buf[i] != '\0'))
{
- buf[i] = toupper(UChar(buf[i]));
+ buf[i] = (char)toupper(UChar(buf[i]));
i++;
}
for (i = 0; i < A_SIZE; i++)
{
if (strncmp(request_names[i], buf, sizeof(buf)) == 0)
- returnCode(MIN_FORM_COMMAND + (int) i);
+ returnCode(MIN_FORM_COMMAND + (int)i);
}
}
RETURN(E_NO_MATCH);
diff --git a/form/frm_scale.c b/form/frm_scale.c
index 2ebf72d06c67..27e154e243ee 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 @@ MODULE_ID("$Id: frm_scale.c,v 1.9 2004/12/11 22:12:34 tom Exp $")
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 6db0023db1ab..1ab131a593c8 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 @@ MODULE_ID("$Id: frm_sub.c,v 1.9 2004/12/11 22:13:39 tom Exp $")
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 @@ form_sub(const FORM *form)
{
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 4d5e0e463a43..1375b5e90af6 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 @@ MODULE_ID("$Id: frm_user.c,v 1.14 2004/12/25 22:37:56 tom Exp $")
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 @@ set_form_userptr(FORM *form, void *usrptr)
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 2258f0a6195b..a65cc59f843d 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 @@ MODULE_ID("$Id: frm_win.c,v 1.13 2004/12/11 22:15:27 tom Exp $")
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 @@ set_form_win(FORM *form, WINDOW *win)
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 59dd2736e8ab..cda23dc2b653 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,28 +46,48 @@ thisARG;
/*---------------------------------------------------------------------------
| Facility : libnform
-| Function : static void *Make_This_Type(va_list *ap)
+| 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 *
-Make_This_Type(va_list *ap)
+Generic_This_Type(void *arg)
{
- thisARG *argp = typeMalloc(thisARG, 1);
+ thisARG *argp = (thisARG *) 0;
- if (argp)
+ if (arg)
{
- T((T_CREATE("thisARG %p"), argp));
- argp->width = va_arg(*ap, int);
- }
+ 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.
+|
+| Return Values : Pointer to argument structure or NULL on error
++--------------------------------------------------------------------------*/
+static void *
+Make_This_Type(va_list *ap)
+{
+ int w = va_arg(*ap, int);
+
+ return Generic_This_Type((void *)&w);
+}
+
+/*---------------------------------------------------------------------------
+| Facility : libnform
| Function : static void *Copy_ThisType(const void *argp)
|
| Description : Copy structure for alphanumeric type argument.
@@ -82,7 +102,7 @@ Copy_This_Type(const void *argp)
if (result)
{
- T((T_CREATE("thisARG %p"), result));
+ T((T_CREATE("thisARG %p"), (void *)result));
*result = *ap;
}
@@ -156,12 +176,27 @@ static FIELDTYPE typeTHIS =
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 bd49544ffdb5..917a9e0ea0a4 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,28 +46,48 @@ thisARG;
/*---------------------------------------------------------------------------
| Facility : libnform
-| Function : static void *Make_This_Type(va_list *ap)
+| 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 *
-Make_This_Type(va_list *ap)
+Generic_This_Type(void *arg)
{
- thisARG *argp = typeMalloc(thisARG, 1);
+ thisARG *argp = (thisARG *) 0;
- if (argp)
+ if (arg)
{
- T((T_CREATE("thisARG %p"), argp));
- argp->width = va_arg(*ap, int);
- }
+ 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.
+|
+| Return Values : Pointer to argument structure or NULL on error
++--------------------------------------------------------------------------*/
+static void *
+Make_This_Type(va_list *ap)
+{
+ int w = va_arg(*ap, int);
+
+ return Generic_This_Type((void *)&w);
+}
+
+/*---------------------------------------------------------------------------
+| Facility : libnform
| Function : static void *Copy_This_Type(const void * argp)
|
| Description : Copy structure for alpha type argument.
@@ -82,7 +102,7 @@ Copy_This_Type(const void *argp)
if (result)
{
- T((T_CREATE("thisARG %p"), result));
+ T((T_CREATE("thisARG %p"), (void *)result));
*result = *ap;
}
@@ -156,12 +176,27 @@ static FIELDTYPE typeTHIS =
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 c96a080db09d..d3351644ef18 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,43 +45,99 @@ typedef struct
}
enumARG;
+typedef struct
+ {
+ char **kwds;
+ int ccase;
+ int cunique;
+ }
+enumParams;
+
/*---------------------------------------------------------------------------
| Facility : libnform
-| Function : static void *Make_Enum_Type( va_list * ap )
+| 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 *
-Make_Enum_Type(va_list *ap)
+Generic_Enum_Type(void *arg)
{
- enumARG *argp = typeMalloc(enumARG, 1);
+ enumARG *argp = (enumARG *)0;
+ enumParams *params = (enumParams *) arg;
- if (argp)
+ if (params)
{
- int cnt = 0;
- char **kp = (char **)0;
- int ccase, cunique;
-
- 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;
+ 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 )
+|
+| Description : Allocate structure for enumeration type argument.
+|
+| Return Values : Pointer to argument structure or NULL on error
++--------------------------------------------------------------------------*/
+static void *
+Make_Enum_Type(va_list *ap)
+{
+ enumParams params;
+
+ params.kwds = va_arg(*ap, char **);
+ params.ccase = va_arg(*ap, int);
+ params.cunique = va_arg(*ap, int);
+
+ return Generic_Enum_Type((void *)&params);
+}
+
+/*---------------------------------------------------------------------------
+| Facility : libnform
| Function : static void *Copy_Enum_Type( const void * argp )
|
| Description : Copy structure for enumeration type argument.
@@ -101,8 +157,24 @@ Copy_Enum_Type(const void *argp)
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 @@ static void
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 @@ static FIELDTYPE typeENUM =
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 000000000000..3e7a575a2623
--- /dev/null
+++ b/form/fty_generic.c
@@ -0,0 +1,297 @@
+/****************************************************************************
+ * Copyright (c) 2008-2009,2010 Free Software Foundation, Inc. *
+ * *
+ * Permission is hereby granted, free of charge, to any person obtaining a *
+ * copy of this software and associated documentation files (the *
+ * "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.5 2010/01/23 21:14:36 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;
+ res->status |= (_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 8a5367f74084..e643ad975fc5 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-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_int.c,v 1.22 2007/10/13 19:32:40 tom Exp $")
+MODULE_ID("$Id: fty_int.c,v 1.25 2010/01/23 21:14:36 tom Exp $")
#if USE_WIDEC_SUPPORT
#define isDigit(c) (iswdigit((wint_t)(c)) || isdigit(UChar(c)))
@@ -52,31 +52,63 @@ typedef struct
}
thisARG;
+typedef struct
+ {
+ int precision;
+ long low;
+ long high;
+ }
+integerPARM;
+
/*---------------------------------------------------------------------------
| Facility : libnform
-| Function : static void *Make_This_Type( va_list * ap )
+| 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 *
-Make_This_Type(va_list *ap)
+Generic_This_Type(void *arg)
{
- thisARG *argp = typeMalloc(thisARG, 1);
+ thisARG *argp = (thisARG *) 0;
+ thisARG *param = (thisARG *) arg;
- if (argp)
+ if (param)
{
- T((T_CREATE("thisARG %p"), argp));
- argp->precision = va_arg(*ap, int);
- argp->low = va_arg(*ap, long);
- argp->high = va_arg(*ap, long);
+ 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 )
+|
+| Description : Allocate structure for integer type argument.
+|
+| Return Values : Pointer to argument structure or NULL on error
++--------------------------------------------------------------------------*/
+static void *
+Make_This_Type(va_list *ap)
+{
+ thisARG arg;
+
+ arg.precision = va_arg(*ap, int);
+ arg.low = va_arg(*ap, long);
+ arg.high = va_arg(*ap, long);
+
+ return Generic_This_Type((void *)&arg);
+}
+
+/*---------------------------------------------------------------------------
+| Facility : libnform
| Function : static void *Copy_This_Type(const void * argp)
|
| Description : Copy structure for integer type argument.
@@ -94,7 +126,7 @@ Copy_This_Type(const void *argp)
result = typeMalloc(thisARG, 1);
if (result)
{
- T((T_CREATE("thisARG %p"), result));
+ T((T_CREATE("thisARG %p"), (void *)result));
*result = *ap;
}
}
@@ -235,12 +267,27 @@ static FIELDTYPE typeTHIS =
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 5d1a2098ef94..8dc04f8c5345 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 @@ static FIELDTYPE typeIPV4 =
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 e74e8e36fe25..4bd71321d66a 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-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_num.c,v 1.25 2007/10/13 19:32:54 tom Exp $")
+MODULE_ID("$Id: fty_num.c,v 1.28 2010/01/23 21:14:36 tom Exp $")
#if HAVE_LOCALE_H
#include <locale.h>
@@ -63,37 +63,71 @@ typedef struct
}
thisARG;
+typedef struct
+ {
+ int precision;
+ double low;
+ double high;
+ }
+thisPARM;
+
/*---------------------------------------------------------------------------
| Facility : libnform
-| Function : static void *Make_This_Type(va_list * ap)
+| 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 *
-Make_This_Type(va_list *ap)
+Generic_This_Type(void *arg)
{
- thisARG *argn = typeMalloc(thisARG, 1);
+ thisARG *argn = (thisARG *) 0;
+ thisPARM *args = (thisPARM *) arg;
- if (argn)
+ if (args)
{
- T((T_CREATE("thisARG %p"), argn));
- argn->precision = va_arg(*ap, int);
- argn->low = va_arg(*ap, double);
- argn->high = va_arg(*ap, double);
+ 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();
+ argn->L = localeconv();
#else
- argn->L = NULL;
+ argn->L = NULL;
#endif
+ }
}
return (void *)argn;
}
/*---------------------------------------------------------------------------
| Facility : libnform
+| Function : static void *Make_This_Type(va_list * ap)
+|
+| Description : Allocate structure for numeric type argument.
+|
+| Return Values : Pointer to argument structure or NULL on error
++--------------------------------------------------------------------------*/
+static void *
+Make_This_Type(va_list *ap)
+{
+ thisPARM arg;
+
+ arg.precision = va_arg(*ap, int);
+ arg.low = va_arg(*ap, double);
+ arg.high = va_arg(*ap, double);
+
+ return Generic_This_Type((void *)&arg);
+}
+
+/*---------------------------------------------------------------------------
+| Facility : libnform
| Function : static void *Copy_This_Type(const void * argp)
|
| Description : Copy structure for numeric type argument.
@@ -111,7 +145,7 @@ Copy_This_Type(const void *argp)
result = typeMalloc(thisARG, 1);
if (result)
{
- T((T_CREATE("thisARG %p"), result));
+ T((T_CREATE("thisARG %p"), (void *)result));
*result = *ap;
}
}
@@ -279,12 +313,27 @@ static FIELDTYPE typeTHIS =
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 247779f28c1d..2c0a4caa6bb3 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-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_regex.c,v 1.21 2007/10/13 19:33:50 tom Exp $")
+MODULE_ID("$Id: fty_regex.c,v 1.24 2010/01/23 21:14:37 tom Exp $")
#if HAVE_REGEX_H_FUNCS /* We prefer POSIX regex */
#include <regex.h>
@@ -90,97 +90,109 @@ RegExp_Arg;
#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 *Make_RegularExpression_Type(va_list * ap)
+| 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 *
-Make_RegularExpression_Type(va_list *ap)
+Generic_RegularExpression_Type(void *arg MAYBE_UNUSED)
{
#if HAVE_REGEX_H_FUNCS
- char *rx = va_arg(*ap, char *);
- RegExp_Arg *preg;
+ char *rx = (char *)arg;
+ RegExp_Arg *preg = (RegExp_Arg *)0;
- preg = typeMalloc(RegExp_Arg, 1);
-
- if (preg)
+ if (rx)
{
- 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 = typeMalloc(RegExp_Arg, 1);
- *(preg->refCount) = 1;
- }
- else
+ if (preg)
{
- if (preg->pRegExp)
- free(preg->pRegExp);
- free(preg);
- preg = (RegExp_Arg *)0;
+ 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));
+ 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;
+ char *rx = (char *)arg;
+ RegExp_Arg *pArg = (RegExp_Arg *)0;
- pArg = typeMalloc(RegExp_Arg, 1);
-
- if (pArg)
+ if (rx)
{
- int blen = RX_INCREMENT;
+ pArg = typeMalloc(RegExp_Arg, 1);
- T((T_CREATE("RegExp_Arg %p"), pArg));
- pArg->compiled_expression = NULL;
- pArg->refCount = typeMalloc(unsigned long, 1);
+ if (pArg)
+ {
+ int blen = RX_INCREMENT;
- *(pArg->refCount) = 1;
+ T((T_CREATE("RegExp_Arg %p"), pArg));
+ pArg->compiled_expression = NULL;
+ pArg->refCount = typeMalloc(unsigned long, 1);
- do
- {
- char *buf = typeMalloc(char, blen);
+ *(pArg->refCount) = 1;
- if (buf)
+ do
{
+ char *buf = typeMalloc(char, blen);
+
+ if (buf)
+ {
#if HAVE_REGEXP_H_FUNCS
- char *last_pos = compile(rx, buf, &buf[blen], '\0');
+ char *last_pos = compile(rx, buf, &buf[blen], '\0');
#else /* HAVE_REGEXPR_H_FUNCS */
- char *last_pos = compile(rx, buf, &buf[blen]);
+ char *last_pos = compile(rx, buf, &buf[blen]);
#endif
- if (reg_errno)
- {
- free(buf);
- if (reg_errno == 50)
- blen += RX_INCREMENT;
+ if (reg_errno)
+ {
+ free(buf);
+ if (reg_errno == 50)
+ blen += RX_INCREMENT;
+ else
+ {
+ free(pArg);
+ pArg = NULL;
+ break;
+ }
+ }
else
{
- free(pArg);
- pArg = NULL;
+ pArg->compiled_expression = buf;
break;
}
}
- else
- {
- pArg->compiled_expression = buf;
- break;
- }
}
+ while (blen <= MAX_RX_LEN);
+ }
+ if (pArg && !pArg->compiled_expression)
+ {
+ free(pArg);
+ pArg = NULL;
}
- while (blen <= MAX_RX_LEN);
- }
- if (pArg && !pArg->compiled_expression)
- {
- free(pArg);
- pArg = NULL;
}
return (void *)pArg;
#else
@@ -190,6 +202,22 @@ Make_RegularExpression_Type(va_list *ap)
/*---------------------------------------------------------------------------
| Facility : libnform
+| Function : static void *Make_RegularExpression_Type(va_list * ap)
+|
+| Description : Allocate structure for regex type argument.
+|
+| Return Values : Pointer to argument structure or NULL on error
++--------------------------------------------------------------------------*/
+static void *
+Make_RegularExpression_Type(va_list *ap)
+{
+ char *rx = va_arg(*ap, char *);
+
+ return Generic_RegularExpression_Type((void *)rx);
+}
+
+/*---------------------------------------------------------------------------
+| Facility : libnform
| Function : static void *Copy_RegularExpression_Type(
| const void * argp)
|
@@ -198,7 +226,7 @@ Make_RegularExpression_Type(va_list *ap)
| 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 +252,7 @@ Copy_RegularExpression_Type(const void *argp)
| 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;
@@ -264,7 +292,8 @@ Free_RegularExpression_Type(void *argp)
| 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 +324,27 @@ static FIELDTYPE typeREGEXP =
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 bd7c3a4f1d87..2b6abdcd7c99 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-2005,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,13 +27,13 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey 1996,1997,2002,2005 *
+ * Author: Thomas E. Dickey 1996-2005,2010 *
****************************************************************************/
/* 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 @@ int move_field(
/* ./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 @@ NCURSES_BOOL data_ahead(
#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 @@ int field_count(
/* ./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)
@@ -683,9 +696,23 @@ typedef struct
}
enumARG;
+typedef struct
+ {
+ char **kwds;
+ int ccase;
+ int cunique;
+ }
+enumParams;
+
#undef TYPE_ENUM
FIELDTYPE *TYPE_ENUM;
+/* ./fty_generic.c */
+
+#undef _nc_fty_generic
+void _nc_fty_generic(void)
+ { /* void */ }
+
/* ./fty_int.c */
typedef struct
@@ -696,6 +723,14 @@ typedef struct
}
integerARG;
+typedef struct
+ {
+ int precision;
+ long low;
+ long high;
+ }
+integerPARM;
+
#undef TYPE_INTEGER
FIELDTYPE *TYPE_INTEGER;
@@ -716,6 +751,14 @@ typedef struct
}
numericARG;
+typedef struct
+ {
+ int precision;
+ double low;
+ double high;
+ }
+thisPARM;
+
#undef TYPE_NUMERIC
FIELDTYPE *TYPE_NUMERIC;
diff --git a/form/llib-lformt b/form/llib-lformt
new file mode 100644
index 000000000000..33de63cde975
--- /dev/null
+++ b/form/llib-lformt
@@ -0,0 +1,777 @@
+/****************************************************************************
+ * Copyright (c) 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"), 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 *
+ ****************************************************************************/
+/* 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;
+
+/* ./fty_alpha.c */
+
+typedef struct
+ {
+ int width;
+ }
+alphaARG;
+
+#undef TYPE_ALPHA
+FIELDTYPE *TYPE_ALPHA;
+
+/* ./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;
+
+/* ./fty_generic.c */
+
+#undef _nc_fty_generic
+void _nc_fty_generic(void)
+ { /* void */ }
+
+/* ./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;
+
+/* ./fty_ipv4.c */
+#undef TYPE_IPV4
+FIELDTYPE *TYPE_IPV4;
+
+/* ./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;
+
+/* ./fty_regex.c */
+
+#include <regex.h>
+
+typedef struct
+ {
+ regex_t *pRegExp;
+ unsigned long *refCount;
+ }
+RegExp_Arg;
+
+#undef TYPE_REGEXP
+FIELDTYPE *TYPE_REGEXP;
diff --git a/form/llib-lformtw b/form/llib-lformtw
new file mode 100644
index 000000000000..10639490e399
--- /dev/null
+++ b/form/llib-lformtw
@@ -0,0 +1,783 @@
+/****************************************************************************
+ * Copyright (c) 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"), 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 *
+ ****************************************************************************/
+/* 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 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;
+
+/* ./fty_alpha.c */
+
+typedef struct
+ {
+ int width;
+ }
+alphaARG;
+
+#undef TYPE_ALPHA
+FIELDTYPE *TYPE_ALPHA;
+
+/* ./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;
+
+/* ./fty_generic.c */
+
+#undef _nc_fty_generic
+void _nc_fty_generic(void)
+ { /* void */ }
+
+/* ./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;
+
+/* ./fty_ipv4.c */
+#undef TYPE_IPV4
+FIELDTYPE *TYPE_IPV4;
+
+/* ./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;
+
+/* ./fty_regex.c */
+
+#include <regex.h>
+
+typedef struct
+ {
+ regex_t *pRegExp;
+ unsigned long *refCount;
+ }
+RegExp_Arg;
+
+#undef TYPE_REGEXP
+FIELDTYPE *TYPE_REGEXP;
diff --git a/form/llib-lformw b/form/llib-lformw
index 7690c5b0bd88..30c24b56029e 100644
--- a/form/llib-lformw
+++ b/form/llib-lformw
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2002,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 2002-2005,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,13 +27,13 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey 2002,2005 *
+ * Author: Thomas E. Dickey 2002-2005,2010 *
****************************************************************************/
/* 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 @@ int move_field(
/* ./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 @@ NCURSES_BOOL data_ahead(
#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 @@ int field_count(
/* ./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)
@@ -689,9 +702,23 @@ typedef struct
}
enumARG;
+typedef struct
+ {
+ char **kwds;
+ int ccase;
+ int cunique;
+ }
+enumParams;
+
#undef TYPE_ENUM
FIELDTYPE *TYPE_ENUM;
+/* ./fty_generic.c */
+
+#undef _nc_fty_generic
+void _nc_fty_generic(void)
+ { /* void */ }
+
/* ./fty_int.c */
typedef struct
@@ -702,6 +729,14 @@ typedef struct
}
integerARG;
+typedef struct
+ {
+ int precision;
+ long low;
+ long high;
+ }
+integerPARM;
+
#undef TYPE_INTEGER
FIELDTYPE *TYPE_INTEGER;
@@ -722,6 +757,14 @@ typedef struct
}
numericARG;
+typedef struct
+ {
+ int precision;
+ double low;
+ double high;
+ }
+thisPARM;
+
#undef TYPE_NUMERIC
FIELDTYPE *TYPE_NUMERIC;
diff --git a/form/modules b/form/modules
index 89f9f9f54346..205356bba554 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