1form_fieldtype(3X)                                          form_fieldtype(3X)
2
3
4

NAME

6       form_fieldtype - define validation-field types
7

SYNOPSIS

9       #include <form.h>
10
11       FIELDTYPE *new_fieldtype(
12           bool (* const field_check)(FIELD *, const void *),
13           bool (* const char_check)(int, const void *));
14       int free_fieldtype(FIELDTYPE *fieldtype);
15
16       int set_fieldtype_arg(
17           FIELDTYPE *fieldtype,
18           void *(* const make_arg)(va_list *),
19           void *(* const copy_arg)(const void *),
20           void  (* const free_arg)(void *));
21       int set_fieldtype_choice(
22           FIELDTYPE *fieldtype,
23           bool (* const next_choice)(FIELD *, const void *),
24           bool (* const prev_choice)(FIELD *, const void *));
25
26       FIELDTYPE *link_fieldtype(FIELDTYPE *type1,
27                                 FIELDTYPE *type2);
28

DESCRIPTION

30   new_fieldtype
31       The  function  new_fieldtype  creates  a new field type usable for data
32       validation.  Its parameters are function pointers:
33
34       field_check
35            This function checks the validity of an entered data string  when‐
36            ever the user attempts to leave a field.  It has two arguments:
37
38            •   The  (FIELD  *) argument is passed in so the validation predi‐
39                cate can see the field's buffer, sizes and other attributes.
40
41            •   The second argument  is  an  argument-block  structure,  about
42                which more below.
43
44       char_check
45            This function validates input characters as they are entered.  The
46            form library passes it the character to be checked and  a  pointer
47            to an argument-block structure.
48
49   free_fieldtype
50       The free_fieldtype function frees the space allocated for a given vali‐
51       dation type by new_fieldtype.
52
53   set_fieldtype_arg
54       The  function  set_fieldtype_arg  associates  three  storage-management
55       functions with a field type:
56
57       make_arg
58            This  function  is  automatically applied to the list of arguments
59            you give set_field_type when attaching validation to a field.   It
60            stores  the  arguments in an allocated argument-block object which
61            is used when validating input.
62
63       copy_arg
64            This function may be used by applications to copy argument-blocks.
65
66       free_arg
67            Frees an argument-block structure.
68
69       You must supply the make_arg function.  The other two are optional: you
70       may  supply NULL for them.  In this case, the form library assumes that
71       make_arg does not allocate memory but simply loads the argument into  a
72       single scalar value.
73
74   set_fieldtype_choice
75       The  form  driver  requests  REQ_NEXT_CHOICE and REQ_PREV_CHOICE assume
76       that the possible values of a field form an ordered  set,  and  provide
77       the forms user with a way to move through the set.
78
79       The  set_fieldtype_choice  function  allows forms programmers to define
80       successor and predecessor functions for the field  type.   These  func‐
81       tions  take  the field pointer and an argument-block structure as argu‐
82       ments.
83
84   link_fieldtype
85       The function link_fieldtype creates a new field type from the two given
86       types.  They are connected by an logical 'OR'.
87

RETURN VALUE

89       The  pointer-valued  routines return NULL on error.  They set errno ac‐
90       cording to their success:
91
92       E_OK The routine succeeded.
93
94       E_BAD_ARGUMENT
95            Routine detected an incorrect or out-of-range argument.
96
97       E_SYSTEM_ERROR
98            System error occurred, e.g., malloc failure.
99
100       The integer-valued routines return one of the following codes on error:
101
102       E_OK The routine succeeded.
103
104       E_BAD_ARGUMENT
105            Routine detected an incorrect or out-of-range argument.
106
107       E_CONNECTED
108            The field is already connected to a form.
109
110       E_CURRENT
111            The field is the current field.
112
113       E_SYSTEM_ERROR
114            System error occurred (see errno(3)).
115

SEE ALSO

117       curses(3X), form(3X), form_field_validation(3X).
118

NOTES

120       The  header  file  <form.h>  automatically  includes  the  header  file
121       <curses.h>.
122

PORTABILITY

124       These  routines emulate the System V forms library.  They were not sup‐
125       ported on Version 7 or BSD versions.
126

AUTHORS

128       Juergen Pfeifer.  Manual pages and adaptation for new curses by Eric S.
129       Raymond.
130
131
132
133                                                            form_fieldtype(3X)
Impressum