4 <!-- Manpage converted by man2html 3.0.1 -->
8 <B>form_fieldtype</B> - define validation-field types
12 <H2>SYNOPSIS</H2><PRE>
13 <B>#include</B> <B><form.h></B>
14 FIELDTYPE *new_fieldtype(
15 bool (* const field_check)(FIELD *, const void *),
16 bool (* const char_check)(int, const void *));
17 int free_fieldtype(FIELDTYPE *fieldtype);
18 int set_fieldtype_arg(
20 void *(* const make_arg)(va_list *),
21 void *(* const copy_arg)(const void *),
22 void (* const free_arg)(void *));
23 int set_fieldtype_choice(
25 bool (* const next_choice)(FIELD *, const void *),
26 bool (* const prev_choice)(FIELD *, const void *));
27 FIELDTYPE *link_fieldtype(FIELDTYPE *type1,
32 <H2>DESCRIPTION</H2><PRE>
33 The function <B>new_fieldtype</B> creates a new field type usable
34 for data validation. You supply it with <I>field</I><B>_</B><I>check</I>, a
35 predicate to check the validity of an entered data string
36 whenever the user attempt to leave a field. The (FIELD *)
37 argument is passed in so the validation predicate can see
38 the field's buffer, sizes and other attributes; the second
39 argument is an argument-block structure, about which more
42 You also supply <B>new_fieldtype</B> with <I>char</I><B>_</B><I>check</I>, a function
43 to validate input characters as they are entered; it will
44 be passed the character to be checked and a pointer to an
45 argument-block structure.
47 The function <B>free_fieldtype</B> frees the space allocated for
48 a given validation type.
50 The function <B>set_fieldtype</B> associates three storage-man-
51 agement functions with a field type. The <I>mak</I><B>_</B><I>arg</I> function
52 is automatically applied to the list of arguments you give
53 <B>set_field_type</B> when attaching validation to a field; its
54 job is to bundle these into an allocated argument-block
55 object which can later be passed to validation predicated.
56 The other two hook arguments should copy and free argu-
57 ment-block structures. They will be used by the forms-
58 driver code. You must supply the <I>mak</I><B>_</B><I>arg</I> function, the
59 other two are optional, you may supply NULL for them. In
60 this case it is assumed, that <I>mak</I><B>_</B><I>arg</I> doesn't allocate
61 memory but simply loads the argument into a single scalar
64 The form driver requests <B>REQ_NEXT_CHOICE</B> and
65 <B>REQ_PREV_CHOICE</B> assume that the possible values of a field
66 form an ordered set, and provide the forms user with a way
67 to move through the set. The <B>set_fieldtype_choice</B> func-
68 tion allows forms programmers to define successor and pre-
69 decessor functions for the field type. These functions
70 take the field pointer and an argument-block structure as
75 <H2>RETURN VALUE</H2><PRE>
76 The pointer-valued routines return NULL on error.
78 The integer-valued routines return one of the following
81 <B>E_OK</B> The routine succeeded.
84 System error occurred (see <B>errno</B>).
87 Routine detected an incorrect or out-of-range argu-
91 The field is already connected to a form.
95 <H2>SEE ALSO</H2><PRE>
96 <B><A HREF="ncurses.3x.html">curses(3x)</A></B>, <B><A HREF="form.3x.html">form(3x)</A></B>.
101 The header file <B><form.h></B> automatically includes the header
102 file <B><curses.h></B>.
104 All of the <B>(char</B> <B>*)</B> arguments of these functions should
105 actually be <B>(void</B> <B>*)</B>. The type has been left uncorrected
106 for strict compatibility with System V.
110 <H2>PORTABILITY</H2><PRE>
111 These routines emulate the System V forms library. They
112 were not supported on Version 7 or BSD versions.
116 <H2>AUTHORS</H2><PRE>
117 Juergen Pfeifer. Manual pages and adaptation for new
118 curses by Eric S. Raymond.
132 Man(1) output converted with
133 <a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>