a0e6850f82
No Minix-specific changes needed. Change-Id: Ia8ddbdb57ac04dfb42d79c374b9e25b189f9dc3b
150 lines
4.4 KiB
Groff
150 lines
4.4 KiB
Groff
.\" $NetBSD: form_fieldtype.3,v 1.11 2010/03/22 21:58:31 joerg Exp $
|
|
.\"
|
|
.\" Copyright (c) 2001
|
|
.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au
|
|
.\"
|
|
.\" This code is donated to The NetBSD Foundation by the author.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\" 3. The name of the Author may not be used to endorse or promote
|
|
.\" products derived from this software without specific prior written
|
|
.\" permission.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
.\" SUCH DAMAGE.
|
|
.\"
|
|
.Dd January 1, 2001
|
|
.Dt FORMS 3
|
|
.Os
|
|
.Sh NAME
|
|
.Nm free_fieldtype ,
|
|
.Nm link_fieldtype ,
|
|
.Nm new_fieldtype ,
|
|
.Nm set_fieldtype_arg ,
|
|
.Nm set_fieldtype_choice
|
|
.Nd form library
|
|
.Sh LIBRARY
|
|
.Lb libform
|
|
.Sh SYNOPSIS
|
|
.In form.h
|
|
.Ft int
|
|
.Fn free_fieldtype "FIELDTYPE *fieldtype"
|
|
.Ft FIELDTYPE *
|
|
.Fn link_fieldtype "FIELDTYPE *type1" "FIELDTYPE *type2"
|
|
.Ft FIELDTYPE *
|
|
.Fo new_fieldtype
|
|
.Fa "int (*field_check)(FIELD *, char *)"
|
|
.Fa "int (*char_check)(int, char *)"
|
|
.Fc
|
|
.Ft int
|
|
.Fo "set_fieldtype_arg"
|
|
.Fa "FIELDTYPE *fieldtype"
|
|
.Fa "char * (*make_args)(va_list *)"
|
|
.Fa "char * (*copy_args)(char *)"
|
|
.Fa "void (*free_args)(char *)"
|
|
.Fc
|
|
.Ft int
|
|
.Fo set_fieldtype_choice
|
|
.Fa "FIELDTYPE *fieldtype"
|
|
.Fa "int (*next_choice)(FIELD *, char *)"
|
|
.Fa "int (*prev_choice)(FIELD *, char *)"
|
|
.Fc
|
|
.Sh DESCRIPTION
|
|
The function
|
|
.Fn free_fieldtype
|
|
frees the storage associated with the field type and destroys it.
|
|
The function
|
|
.Fn link_fieldtype
|
|
links together the two given field types to produce a new field type.
|
|
A new field type can be created by calling
|
|
.Fn new_fieldtype
|
|
which requires pointers to two functions which perform validation, the
|
|
.Fa field_check
|
|
function must validate the field contents and return
|
|
.Dv TRUE
|
|
if they are acceptable and
|
|
.Dv FALSE
|
|
if they are not.
|
|
The
|
|
.Fa 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
|
|
.Fa char_check
|
|
must return
|
|
.Dv TRUE .
|
|
Neither
|
|
.Fa field_check
|
|
nor
|
|
.Fa char_check
|
|
may be
|
|
.Dv NULL .
|
|
The functions for handling the field type arguments can
|
|
be defined by using the
|
|
.Fn set_fieldtype_arg
|
|
function, the
|
|
.Fa make_args
|
|
function is used to create new arguments for the fieldtype, the
|
|
.Fa copy_args
|
|
is used to copy the fieldtype arguments to a new arguments structure
|
|
and
|
|
.Fa free_args
|
|
is used to destroy the fieldtype arguments and release any associated
|
|
storage, none of these function pointers may be
|
|
.Dv NULL .
|
|
The field type choice functions can be set by calling
|
|
.Fn set_fieldtype_choice ,
|
|
the
|
|
.Fa next_choice
|
|
and
|
|
.Fa 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
|
|
.Dv TRUE
|
|
if the function succeeded and
|
|
.Dv FALSE
|
|
otherwise.
|
|
.Sh RETURN VALUES
|
|
Functions returning pointers will return
|
|
.Dv NULL
|
|
if an error is detected.
|
|
The functions that return an int will return one of the following error
|
|
values:
|
|
.Pp
|
|
.Bl -tag -width E_UNKNOWN_COMMAND -compact
|
|
.It Er E_OK
|
|
The function was successful.
|
|
.It Er E_BAD_ARGUMENT
|
|
The function was passed a bad argument.
|
|
.It Er E_CONNECTED
|
|
The field is connected to a form.
|
|
.El
|
|
.Sh SEE ALSO
|
|
.Xr curses 3 ,
|
|
.Xr forms 3
|
|
.Sh NOTES
|
|
The header
|
|
.In form.h
|
|
automatically includes both
|
|
.In curses.h
|
|
and
|
|
.In eti.h .
|