]> ncurses.scripts.mit.edu Git - ncurses.git/blob - Ada95/html/man/form_fieldtype.3x.html
ncurses 5.0
[ncurses.git] / Ada95 / html / man / form_fieldtype.3x.html
1 <HTML>
2 <BODY>
3 <PRE>
4        <STRONG>form_fieldtype</STRONG> - define validation-field types
5
6
7 </PRE>
8 <H2>SYNOPSIS</H2><PRE>
9        <STRONG>#include</STRONG> <STRONG><form.h></STRONG>
10        FIELDTYPE *new_fieldtype(
11            bool (* const field_check)(FIELD *, const void *),
12            bool (* const char_check)(int, const void *));
13        int free_fieldtype(FIELDTYPE *fieldtype);
14        int set_fieldtype_arg(
15            FIELDTYPE *fieldtype,
16            void *(* const make_arg)(va_list *),
17            void *(* const copy_arg)(const void *),
18            void  (* const free_arg)(void *));
19        int set_fieldtype_choice(
20            FIELDTYPE *fieldtype
21            bool (* const next_choice)(FIELD *, const void *),
22            bool (* const prev_choice)(FIELD *, const void *));
23        FIELDTYPE *link_fieldtype(FIELDTYPE *type1,
24                                  FIELDTYPE *type2);
25
26
27 </PRE>
28 <H2>DESCRIPTION</H2><PRE>
29        The function <STRONG>new_fieldtype</STRONG> creates a new field type usable
30        for data validation.  You supply it  with  <EM>field</EM><STRONG>_</STRONG><EM>check</EM>,  a
31        predicate  to check the validity of an entered data string
32        whenever the user attempt to leave a field.  The (FIELD *)
33        argument  is passed in so the validation predicate can see
34        the field's buffer, sizes and other attributes; the second
35        argument  is an argument-block structure, about which more
36        below.
37
38        You also supply <STRONG>new_fieldtype</STRONG> with <EM>char</EM><STRONG>_</STRONG><EM>check</EM>, a  function
39        to  validate input characters as they are entered; it will
40        be passed the character to be checked and a pointer to  an
41        argument-block structure.
42
43        The  function <STRONG>free_fieldtype</STRONG> frees the space allocated for
44        a given validation type.
45
46        The function <STRONG>set_fieldtype</STRONG> associates  three  storage-man-
47        agement functions with a field type.  The <EM>mak</EM><STRONG>_</STRONG><EM>arg</EM> function
48        is automatically applied to the list of arguments you give
49        <STRONG>set_field_type</STRONG>  when  attaching validation to a field; its
50        job is to bundle these into  an  allocated  argument-block
51        object which can later be passed to validation predicated.
52        The other two hook arguments should copy  and  free  argu-
53        ment-block  structures.   They  will be used by the forms-
54        driver code. You must supply  the  <EM>mak</EM><STRONG>_</STRONG><EM>arg</EM>  function,  the
55        other  two  are optional, you may supply NULL for them. In
56        this case it is assumed,  that  <EM>mak</EM><STRONG>_</STRONG><EM>arg</EM>  doesn't  allocate
57        memory  but simply loads the argument into a single scalar
58        value.
59
60        form an ordered set, and provide the forms user with a way
61        to  move  through the set.  The <STRONG>set_fieldtype_choice</STRONG> func-
62        tion allows forms programmers to define successor and pre-
63        decessor  functions  for  the field type.  These functions
64        take the field pointer and an argument-block structure  as
65        arguments.
66
67
68 </PRE>
69 <H2>RETURN VALUE</H2><PRE>
70        The pointer-valued routines return NULL on error.
71
72        The  integer-valued  routines  return one of the following
73        codes on error:
74
75        <STRONG>E_OK</STRONG> The routine succeeded.
76
77        <STRONG>E_SYSTEM_ERROR</STRONG>
78             System error occurred (see <STRONG>errno</STRONG>).
79
80        <STRONG>E_BAD_ARGUMENT</STRONG>
81             Routine detected an incorrect or  out-of-range  argu-
82             ment.
83
84        <STRONG>E_CONNECTED</STRONG>
85             The field is already connected to a form.
86
87
88 </PRE>
89 <H2>SEE ALSO</H2><PRE>
90        <STRONG><A HREF="ncurses.3x.html">curses(3X)</A></STRONG>, <STRONG><A HREF="form.3x.html">form(3X)</A></STRONG>.
91
92
93 </PRE>
94 <H2>NOTES</H2><PRE>
95        The header file <STRONG><form.h></STRONG> automatically includes the header
96        file <STRONG><curses.h></STRONG>.
97
98        All of the <STRONG>(char</STRONG> <STRONG>*)</STRONG> arguments of  these  functions  should
99        actually  be <STRONG>(void</STRONG> <STRONG>*)</STRONG>.  The type has been left uncorrected
100        for strict compatibility with System V.
101
102
103 </PRE>
104 <H2>PORTABILITY</H2><PRE>
105        These routines emulate the System V forms  library.   They
106        were not supported on Version 7 or BSD versions.
107
108
109 </PRE>
110 <H2>AUTHORS</H2><PRE>
111        Juergen  Pfeifer.   Manual  pages  and  adaptation for new
112        curses by Eric S. Raymond.
113
114
115
116
117
118
119
120
121
122 </PRE>
123 </BODY>
124 </HTML>