form_fieldtype(3X) LIBRARY FUNCTIONS form_fieldtype(3X)
NAME
formfieldtype: newfieldtype, freefieldtype,
setfieldtypearg, setfieldtypechoice, linkfieldtype -
forms fieldtype routines
SYNOPSIS
#include <form.h>
FIELDTYPE *newfieldtype(int (* fieldcheck)(FIELD *, char *),
int (* charcheck)(int, char *));
int freefieldtype(FIELDTYPE *fieldtype);
int setfieldtypearg(FIELDTYPE *fieldtype,
char *(* makarg)(valist *),
char *(* copyarg)(char *), void (* freearg)(char *));
int setfieldtypechoice(FIELDTYPE *fieldtype,
int (* nextchoice)(FIELD *, char *),
int (* prevchoice)(FIELD *, char *));
FIELDTYPE *linkfieldtype(FIELDTYPE *type1, FIELDTYPE *type2);
DESCRIPTION
newfieldtype creates a new field type. The application
programmer must write the function field_check, which vali-
dates the field value, and the function char_check, which
validates each character. freefieldtype frees the space
allocated for the field type.
By associating function pointers with a field type,
setfieldtypearg connects to the field type additional
arguments necessary for a setfieldtype call. Function
mak_arg allocates a structure for the field specific parame-
ters to setfieldtype and returns a pointer to the saved
data. Function copy_arg duplicates the structure created by
make_arg. Function free_arg frees any storage allocated by
make_arg or copy_arg.
The formdriver requests REQNEXTCHOICE and REQPREVCHOICE
let the user request the next or previous value of a field
type comprising an ordered set of values.
setfieldtypechoice allows the application programmer to
implement these requests for the given field type. It asso-
ciates with the given field type those application-defined
functions that return pointers to the next or previous
choice for the field.
linkfieldtype returns a pointer to the field type built
from the two given types. The constituent types may be any
application-defined or pre-defined types.
RETURN VALUE
Routines that return pointers always return NULL on error.
Routines that return an integer return one of the following:
E_OK - The function returned successfully.
1
form_fieldtype(3X) LIBRARY FUNCTIONS form_fieldtype(3X)
E_SYSTEM_ERROR - System error.
E_BAD_ARGUMENT - An argument is incorrect.
E_CONNECTED - Type is connected to one or more fields.
NOTES
The header file <form.h> automatically includes the header
files <eti.h> and <curses.h>.
SEE ALSO
curses(3X), forms(3X).
2