]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/form_fieldtype.3x.html
d4ff4f34b8efb213865eb393d2fc3d4c0f5ec6de
[ncurses.git] / doc / html / man / form_fieldtype.3x.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
2 <!-- 
3   * t
4   ****************************************************************************
5   * Copyright (c) 1998,2000,2001 Free Software Foundation, Inc.              *
6   *                                                                          *
7   * Permission is hereby granted, free of charge, to any person obtaining a  *
8   * copy of this software and associated documentation files (the            *
9   * "Software"), to deal in the Software without restriction, including      *
10   * without limitation the rights to use, copy, modify, merge, publish,      *
11   * distribute, distribute with modifications, sublicense, and/or sell       *
12   * copies of the Software, and to permit persons to whom the Software is    *
13   * furnished to do so, subject to the following conditions:                 *
14   *                                                                          *
15   * The above copyright notice and this permission notice shall be included  *
16   * in all copies or substantial portions of the Software.                   *
17   *                                                                          *
18   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
19   * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
20   * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
21   * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
22   * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
23   * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
24   * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
25   *                                                                          *
26   * Except as contained in this notice, the name(s) of the above copyright   *
27   * holders shall not be used in advertising or otherwise to promote the     *
28   * sale, use or other dealings in this Software without prior written       *
29   * authorization.                                                           *
30   ****************************************************************************
31   * @Id: form_fieldtype.3x,v 1.9 2001/08/04 20:36:25 William.Setzer Exp @
32 -->
33 <HTML>
34 <HEAD>
35 <TITLE>form_fieldtype 3x</TITLE>
36 <link rev=made href="mailto:bug-ncurses@gnu.org">
37 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
38 </HEAD>
39 <BODY>
40 <H1>form_fieldtype 3x</H1>
41 <HR>
42 <PRE>
43 <!-- Manpage converted by man2html 3.0.1 -->
44
45 </PRE>
46 <H2>NAME</H2><PRE>
47        <STRONG>form_fieldtype</STRONG> - define validation-field types
48
49
50 </PRE>
51 <H2>SYNOPSIS</H2><PRE>
52        <STRONG>#include</STRONG> <STRONG>&lt;form.h&gt;</STRONG>
53        FIELDTYPE *new_fieldtype(
54            bool (* const field_check)(FIELD *, const void *),
55            bool (* const char_check)(int, const void *));
56        int free_fieldtype(FIELDTYPE *fieldtype);
57        int set_fieldtype_arg(
58            FIELDTYPE *fieldtype,
59            void *(* const make_arg)(va_list *),
60            void *(* const copy_arg)(const void *),
61            void  (* const free_arg)(void *));
62        int set_fieldtype_choice(
63            FIELDTYPE *fieldtype,
64            bool (* const next_choice)(FIELD *, const void *),
65            bool (* const prev_choice)(FIELD *, const void *));
66        FIELDTYPE *link_fieldtype(FIELDTYPE *type1,
67                                  FIELDTYPE *type2);
68
69
70 </PRE>
71 <H2>DESCRIPTION</H2><PRE>
72        The function <STRONG>new_fieldtype</STRONG> creates a new field type usable
73        for data validation.  You supply it  with  <EM>field</EM><STRONG>_</STRONG><EM>check</EM>,  a
74        predicate  to check the validity of an entered data string
75        whenever the user attempt to leave a field.  The (FIELD *)
76        argument  is passed in so the validation predicate can see
77        the field's buffer, sizes and other attributes; the second
78        argument  is an argument-block structure, about which more
79        below.
80
81        You also supply <STRONG>new_fieldtype</STRONG> with <EM>char</EM><STRONG>_</STRONG><EM>check</EM>, a  function
82        to  validate input characters as they are entered; it will
83        be passed the character to be checked and a pointer to  an
84        argument-block structure.
85
86        The  function <STRONG>free_fieldtype</STRONG> frees the space allocated for
87        a given validation type.
88
89        The function <STRONG>set_fieldtype</STRONG> associates  three  storage-man-
90        agement functions with a field type.  The <EM>mak</EM><STRONG>_</STRONG><EM>arg</EM> function
91        is automatically applied to the list of arguments you give
92        <STRONG>set_field_type</STRONG>  when  attaching validation to a field; its
93        job is to bundle these into  an  allocated  argument-block
94        object which can later be passed to validation predicated.
95        The other two hook arguments should copy  and  free  argu-
96        ment-block  structures.   They  will be used by the forms-
97        driver code. You must supply  the  <EM>mak</EM><STRONG>_</STRONG><EM>arg</EM>  function,  the
98        other  two  are optional, you may supply NULL for them. In
99        this case it is assumed,  that  <EM>mak</EM><STRONG>_</STRONG><EM>arg</EM>  doesn't  allocate
100        memory  but simply loads the argument into a single scalar
101        value.
102
103        The   form    driver    requests    <STRONG>REQ_NEXT_CHOICE</STRONG>    and
104        <STRONG>REQ_PREV_CHOICE</STRONG> assume that the possible values of a field
105        form an ordered set, and provide the forms user with a way
106        to  move  through the set.  The <STRONG>set_fieldtype_choice</STRONG> func-
107        tion allows forms programmers to define successor and pre-
108        decessor  functions  for  the field type.  These functions
109        take the field pointer and an argument-block structure  as
110        arguments.
111
112
113 </PRE>
114 <H2>RETURN VALUE</H2><PRE>
115        The pointer-valued routines return NULL on error.
116
117        The  integer-valued  routines  return one of the following
118        codes on error:
119
120        <STRONG>E_OK</STRONG> The routine succeeded.
121
122        <STRONG>E_SYSTEM_ERROR</STRONG>
123             System error occurred (see <STRONG>errno</STRONG>).
124
125        <STRONG>E_BAD_ARGUMENT</STRONG>
126             Routine detected an incorrect or  out-of-range  argu-
127             ment.
128
129        <STRONG>E_CONNECTED</STRONG>
130             The field is already connected to a form.
131
132
133 </PRE>
134 <H2>SEE ALSO</H2><PRE>
135        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="form.3x.html">form(3x)</A></STRONG>.
136
137
138 </PRE>
139 <H2>NOTES</H2><PRE>
140        The header file <STRONG>&lt;form.h&gt;</STRONG> automatically includes the header
141        file <STRONG>&lt;curses.h&gt;</STRONG>.
142
143        All of the <STRONG>(char</STRONG> <STRONG>*)</STRONG> arguments of  these  functions  should
144        actually  be <STRONG>(void</STRONG> <STRONG>*)</STRONG>.  The type has been left uncorrected
145        for strict compatibility with System V.
146
147
148 </PRE>
149 <H2>PORTABILITY</H2><PRE>
150        These routines emulate the System V forms  library.   They
151        were not supported on Version 7 or BSD versions.
152
153
154 </PRE>
155 <H2>AUTHORS</H2><PRE>
156        Juergen  Pfeifer.   Manual  pages  and  adaptation for new
157        curses by Eric S. Raymond.
158
159
160
161
162
163
164
165
166
167
168 </PRE>
169 <HR>
170 <ADDRESS>
171 Man(1) output converted with
172 <a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
173 </ADDRESS>
174 </BODY>
175 </HTML>