1form_fieldtype(3CURSES) Curses Library Functions form_fieldtype(3CURSES)
2
3
4
6 form_fieldtype, new_fieldtype, free_fieldtype, set_fieldtype_arg,
7 set_fieldtype_choice, link_fieldtype - forms fieldtype routines
8
10 cc [ flag... ] file... -lform -lcurses [ library... ]
11 #include <form.h>
12
13 FIELDTYPE *new_fieldtype(int (* field_check)(FIELD *, char *),
14 int (*char_check)(int, char *));
15
16
17 int free_fieldtype(FIELDTYPE *fieldtype);
18
19
20 int set_fieldtype_arg(FIELDTYPE *fieldtype, char *(* mak_arg)(va_list *),
21 char *(* copy_arg)(char *), void (* free_arg)(char *));
22
23
24 int set_fieldtype_choice(FIELDTYPE *fieldtype, int (* next_choice)
25 (FIELD *, char *), int (*prev_choice)(FIELD *, char *));
26
27
28 FIELDTYPE *link_fieldtype(FIELDTYPE *type1, FIELDTYPE *type2);
29
30
32 new_fieldtype() creates a new field type. The application programmer
33 must write the function field_check, which validates the field value,
34 and the function char_check, which validates each character.
35 free_fieldtype() frees the space allocated for the field type.
36
37
38 By associating function pointers with a field type, set_fieldtype_arg()
39 connects to the field type additional arguments necessary for a
40 set_field_type() call. Function mak_arg allocates a structure for the
41 field specific parameters to set_field_type() and returns a pointer to
42 the saved data. Function copy_arg duplicates the structure created by
43 make_arg. Function free_arg frees any storage allocated by make_arg or
44 copy_arg.
45
46
47 The form_driver() requests REQ_NEXT_CHOICE and REQ_PREV_CHOICE let the
48 user request the next or previous value of a field type comprising an
49 ordered set of values. set_fieldtype_choice() allows the application
50 programmer to implement these requests for the given field type. It as‐
51 sociates with the given field type those application-defined functions
52 that return pointers to the next or previous choice for the field.
53
54
55 link_fieldtype() returns a pointer to the field type built from the two
56 given types. The constituent types may be any application-defined or
57 pre-defined types.
58
60 Routines that return pointers always return NULL on error. Routines
61 that return an integer return one of the following:
62
63 E_OK The function returned successfully.
64
65
66 E_SYSTEM_ERROR System error.
67
68
69 E_BAD_ARGUMENT An argument is incorrect.
70
71
72 E_CONNECTED Type is connected to one or more fields.
73
74
76 See attributes(5) for descriptions of the following attributes:
77
78
79
80
81 ┌─────────────────────────────┬─────────────────────────────┐
82 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
83 ├─────────────────────────────┼─────────────────────────────┤
84 │MT-Level │Unsafe │
85 └─────────────────────────────┴─────────────────────────────┘
86
88 curses(3CURSES), forms(3CURSES), attributes(5)
89
91 The header <form.h> automatically includes the headers <eti.h> and
92 <curses.h>.
93
94
95
96SunOS 5.11 31 Dec 1996 form_fieldtype(3CURSES)