Explicitly specify `all' as the default target(as it used to be), so as
[dragonfly.git] / lib / libncurses / man / form_fieldtype.3
1 '\" t
2 .\"***************************************************************************
3 .\" Copyright (c) 1998-2002,2003 Free Software Foundation, Inc.              *
4 .\"                                                                          *
5 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
6 .\" copy of this software and associated documentation files (the            *
7 .\" "Software"), to deal in the Software without restriction, including      *
8 .\" without limitation the rights to use, copy, modify, merge, publish,      *
9 .\" distribute, distribute with modifications, sublicense, and/or sell       *
10 .\" copies of the Software, and to permit persons to whom the Software is    *
11 .\" furnished to do so, subject to the following conditions:                 *
12 .\"                                                                          *
13 .\" The above copyright notice and this permission notice shall be included  *
14 .\" in all copies or substantial portions of the Software.                   *
15 .\"                                                                          *
16 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
17 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
18 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
19 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
20 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
21 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
22 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
23 .\"                                                                          *
24 .\" Except as contained in this notice, the name(s) of the above copyright   *
25 .\" holders shall not be used in advertising or otherwise to promote the     *
26 .\" sale, use or other dealings in this Software without prior written       *
27 .\" authorization.                                                           *
28 .\"***************************************************************************
29 .\"
30 .\" $Id: form_fieldtype.3x,v 1.12 2003/05/10 20:33:49 jmc Exp $
31 .\" $DragonFly: src/lib/libncurses/man/form_fieldtype.3,v 1.1 2005/03/12 19:13:54 eirikn Exp $
32 .TH form_fieldtype 3X ""
33 .SH NAME
34 \fBform_fieldtype\fR - define validation-field types
35 .SH SYNOPSIS
36 \fB#include <form.h>\fR
37 .br
38 FIELDTYPE *new_fieldtype(
39     bool (* const field_check)(FIELD *, const void *),
40     bool (* const char_check)(int, const void *));
41 .br
42 int free_fieldtype(FIELDTYPE *fieldtype);
43 .br
44 int set_fieldtype_arg(
45     FIELDTYPE *fieldtype,
46     void *(* const make_arg)(va_list *),
47     void *(* const copy_arg)(const void *),
48     void  (* const free_arg)(void *));
49 .br
50 int set_fieldtype_choice(
51     FIELDTYPE *fieldtype,
52     bool (* const next_choice)(FIELD *, const void *),
53     bool (* const prev_choice)(FIELD *, const void *));
54 .br
55 FIELDTYPE *link_fieldtype(FIELDTYPE *type1,
56                           FIELDTYPE *type2);
57 .br
58 .SH DESCRIPTION
59 The function \fBnew_fieldtype\fR creates a new field type usable for data
60 validation.  You supply it with \fIfield_check\fR, a predicate to check the
61 validity of an entered data string whenever the user attempts to leave a field.
62 The (FIELD *) argument is passed in so the validation predicate can see the
63 field's buffer, sizes and other attributes; the second argument is an
64 argument-block structure, about which more below.
65
66 You also supply \fBnew_fieldtype\fR with \fIchar_check\fR,
67 a function to validate input characters as they are entered; it will be passed
68 the character to be checked and a pointer to an argument-block structure.
69
70 The function \fBfree_fieldtype\fR frees the space allocated for a given
71 validation type.
72
73 The function \fBset_fieldtype_arg\fR associates three storage-management functions
74 with a field type.
75 The \fImake_arg\fR function is automatically applied to the
76 list of arguments you give \fBset_field_type\fR when attaching validation
77 to a field; its job is to bundle these into an allocated argument-block
78 object which can later be passed to validation predicated.
79 The other two hook arguments should copy and free argument-block structures.
80 They will be used by the forms-driver code.
81 You must supply the \fImake_arg\fR function,
82 the other two are optional, you may supply NULL for them.
83 In this case it is assumed
84 that \fImake_arg\fR does not allocate memory but simply loads the
85 argument into a single scalar value.
86
87 The function \fBlink_fieldtype\fR creates
88 a new field type from the two given types.
89 They are connected by an logical 'OR'.
90
91 The form driver requests \fBREQ_NEXT_CHOICE\fR and \fBREQ_PREV_CHOICE\fR assume
92 that the possible values of a field form an ordered set, and provide the forms
93 user with a way to move through the set.
94 The \fBset_fieldtype_choice\fR
95 function allows forms programmers to define successor and predecessor functions
96 for the field type.
97 These functions take the field pointer and an
98 argument-block structure as arguments.
99 .SH RETURN VALUE
100 The pointer-valued routines return NULL on error.
101
102 The integer-valued routines return one of the following codes on
103 error:
104 .TP 5
105 \fBE_OK\fR
106 The routine succeeded.
107 .TP 5
108 \fBE_SYSTEM_ERROR\fR
109 System error occurred (see \fBerrno\fR).
110 .TP 5
111 \fBE_BAD_ARGUMENT\fR
112 Routine detected an incorrect or out-of-range argument.
113 .TP 5
114 \fBE_CONNECTED\fR
115 The field is already connected to a form.
116 .SH SEE ALSO
117 \fBcurses\fR(3X), \fBform\fR(3X).
118 .SH NOTES
119 The header file \fB<form.h>\fR automatically includes the header file
120 \fB<curses.h>\fR.
121
122 All of the \fB(char *)\fR arguments of these functions should actually be
123 \fB(void *)\fR.  The type has been left uncorrected for strict compatibility
124 with System V.
125 .SH PORTABILITY
126 These routines emulate the System V forms library.  They were not supported on
127 Version 7 or BSD versions.
128 .SH AUTHORS
129 Juergen Pfeifer.  Manual pages and adaptation for new curses by Eric
130 S. Raymond.
131 .\"#
132 .\"# The following sets edit modes for GNU EMACS
133 .\"# Local Variables:
134 .\"# mode:nroff
135 .\"# fill-column:79
136 .\"# End: