Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

new_fieldtype(3) [netbsd man page]

FORMS(3)						   BSD Library Functions Manual 						  FORMS(3)

free_fieldtype, link_fieldtype, new_fieldtype, set_fieldtype_arg, set_fieldtype_choice -- form library LIBRARY
Curses Form Library (libform, -lform) SYNOPSIS
#include <form.h> int free_fieldtype(FIELDTYPE *fieldtype); FIELDTYPE * link_fieldtype(FIELDTYPE *type1, FIELDTYPE *type2); FIELDTYPE * new_fieldtype(int (*field_check)(FIELD *, char *), int (*char_check)(int, char *)); int set_fieldtype_arg(FIELDTYPE *fieldtype, char * (*make_args)(va_list *), char * (*copy_args)(char *), void (*free_args)(char *)); int set_fieldtype_choice(FIELDTYPE *fieldtype, int (*next_choice)(FIELD *, char *), int (*prev_choice)(FIELD *, char *)); DESCRIPTION
The function free_fieldtype() frees the storage associated with the field type and destroys it. The function link_fieldtype() links together the two given field types to produce a new field type. A new field type can be created by calling new_fieldtype() which requires pointers to two functions which perform validation, the field_check function must validate the field contents and return TRUE if they are acceptable and FALSE if they are not. The char_check validates the character input into the field, this function will be called for each character entered, if the character can be entered into the field then char_check must return TRUE. Neither field_check nor char_check may be NULL. The func- tions for handling the field type arguments can be defined by using the set_fieldtype_arg() function, the make_args function is used to cre- ate new arguments for the fieldtype, the copy_args is used to copy the fieldtype arguments to a new arguments structure and free_args is used to destroy the fieldtype arguments and release any associated storage, none of these function pointers may be NULL. The field type choice functions can be set by calling set_fieldtype_choice(), the next_choice and prev_choice specify the next and previous choice functions for the field type. These functions must perform the necessary actions to select the next or previous choice for the field, updating the field buffer if necessary. The choice functions must return TRUE if the function succeeded and FALSE otherwise. RETURN VALUES
Functions returning pointers will return NULL if an error is detected. The functions that return an int will return one of the following error values: E_OK The function was successful. E_BAD_ARGUMENT The function was passed a bad argument. E_CONNECTED The field is connected to a form. SEE ALSO
curses(3), forms(3) NOTES
The header <form.h> automatically includes both <curses.h> and <eti.h>. BSD
January 1, 2001 BSD

Check Out this Related Man Page

form_fieldtype(3CURSES) 				     Curses Library Functions					   form_fieldtype(3CURSES)

form_fieldtype, new_fieldtype, free_fieldtype, set_fieldtype_arg, set_fieldtype_choice, link_fieldtype - forms fieldtype routines SYNOPSIS
cc [ flag... ] file... -lform -lcurses [ library... ] #include <form.h> FIELDTYPE *new_fieldtype(int (* field_check)(FIELD *, char *), int (*char_check)(int, char *)); int free_fieldtype(FIELDTYPE *fieldtype); int set_fieldtype_arg(FIELDTYPE *fieldtype, char *(* mak_arg)(va_list *), char *(* copy_arg)(char *), void (* free_arg)(char *)); int set_fieldtype_choice(FIELDTYPE *fieldtype, int (* next_choice) (FIELD *, char *), int (*prev_choice)(FIELD *, char *)); FIELDTYPE *link_fieldtype(FIELDTYPE *type1, FIELDTYPE *type2); DESCRIPTION
new_fieldtype() creates a new field type. The application programmer must write the function field_check, which validates the field value, and the function char_check, which validates each character. free_fieldtype() frees the space allocated for the field type. By associating function pointers with a field type, set_fieldtype_arg() connects to the field type additional arguments necessary for a set_field_type() call. Function mak_arg allocates a structure for the field specific parameters to set_field_type() 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 form_driver() requests REQ_NEXT_CHOICE and REQ_PREV_CHOICE let the user request the next or previous value of a field type comprising an ordered set of values. set_fieldtype_choice() allows the application programmer to implement these requests for the given field type. It associates with the given field type those application-defined functions that return pointers to the next or previous choice for the field. link_fieldtype() 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 VALUES
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. E_SYSTEM_ERROR System error. E_BAD_ARGUMENT An argument is incorrect. E_CONNECTED Type is connected to one or more fields. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
curses(3CURSES), forms(3CURSES), attributes(5) NOTES
The header <form.h> automatically includes the headers <eti.h> and <curses.h>. SunOS 5.11 31 Dec 1996 form_fieldtype(3CURSES)
Man Page