Add man pages for libform.

This commit is contained in:
blymn 2001-07-08 12:10:28 +00:00
parent b0b7628145
commit e1a3174b3e
22 changed files with 2279 additions and 0 deletions

72
lib/libform/form_cursor.3 Normal file
View File

@ -0,0 +1,72 @@
.\" $NetBSD: form_cursor.3,v 1.1 2001/07/08 12:10:28 blymn 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, 2001
.Dt FORMS 3
.Os
.Sh NAME
.Nm pos_form_cursor
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.Fd #include <form.h>
.Ft int
.Fn pos_form_cursor "FORM *form"
.Sh DESCRIPTION
The function
.Fn pos_form_cursor
positions the screen cursor at the correct position for the form.
This function can be used to restore the cursor state after using
other curses routines.
.Sh 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:
.Pp
.Bl -tag -width E_UNKNOWN_COMMAND -compact
.It Er E_OK
The function was successful.
.It Er E_BAD_ARGUMENT
A bad argument was passed to the function.
.It Er E_NOT_POSTED
The form is not posted to the screen.
.El
.Sh SEE ALSO
.Xr curses 3 ,
.Xr forms 3
.Sh NOTES
The header
.Pa <form.h>
automatically includes both
.Pa <curses.h>
and
.Pa <eti.h> .

67
lib/libform/form_data.3 Normal file
View File

@ -0,0 +1,67 @@
.\" $NetBSD: form_data.3,v 1.1 2001/07/08 12:10:28 blymn 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, 2001
.Dt FORM_DATA 3
.Os
.Sh NAME
.Nm form
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.Fd #include <form.h>
.Ft int
.Fn data_ahead "FORM *form"
.Ft int
.Fn data_behind "FORM *form"
.Sh DESCRIPTION
If there is data offscreen to the right of the current field of the
given form then
.Fn data_ahead
will return TRUE, otherwise FALSE is returned. Similarly, if there is
data offscreen to the left of the current field of the given form then
.Fn data_behind
will return TRUE.
.Sh RETURN VALUES
If the condition is met then the functions will return TRUE, if there
is an error or there is no data offscreen the functions will return
FALSE.
.Sh SEE ALSO
.Xr curses 3 ,
.Xr forms 3
.Sh NOTES
The header
.Pa <form.h>
automatically includes both
.Pa <curses.h>
and
.Pa <eti.h> .

221
lib/libform/form_driver.3 Normal file
View File

@ -0,0 +1,221 @@
.\" $NetBSD: form_driver.3,v 1.1 2001/07/08 12:10:28 blymn 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, 2001
.Dt FORMS 3
.Os
.Sh NAME
.Nm form_driver
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.Fd #include <form.h>
.Ft int
.Fn form_driver "FORM *form, int request"
.Sh DESCRIPTION
The
.Fn form_driver
is the heart of the forms library, it takes commands in the
.Fa request
parameter that is either a request to the driver to perform some
action or is a character to be inserted into the current field. The
form driver will attempt to insert any printable character passed to
it into the current field. This may or may not succeed depending on
the state of the current field. If the character passed is not
printable then the driver attempts to process it as a driver request.
If the character passed is not a valid request then the driver will
return an unknown command error.
.Sh PARAMETERS
The forms driver recognises the following requests:
.Pp
.Bl -tag -width REQ_SFIRST_FIELD -compact
.It REQ_NEXT_PAGE
Change to the next page in the form.
.It REQ_PREV_PAGE
Change to the previous page in the form.
.It REQ_FIRST_PAGE
Select the first page in the form.
.It REQ_LAST_PAGE
Go to the last page in the form.
.It REQ_NEXT_FIELD
Move to the next field in the form field array.
.It REQ_PREV_FIELD
Move to the previous field in the form field array.
.It REQ_FIRST_FIELD
Go to the first field in the form field array.
.It REQ_LAST_FIELD
Go to the last field in the form field array.
.It REQ_SNEXT_FIELD
Move to the next sorted field on the form.
.It REQ_SPREV_FIELD
Move to the previous sorted field on the form.
.It REQ_SFIRST_FIELD
Go to the first field in the sorted list.
.It REQ_SLAST_FIELD
Move to the last field in the sorted list.
.It REQ_LEFT_FIELD
Go one field to the left on the form page.
.It REQ_RIGHT_FIELD
Go one field to the right on the form page.
.It REQ_UP_FIELD
Go up one field on the form page.
.It REQ_DOWN_FIELD
Go down one field on the form page.
.It REQ_NEXT_CHAR
Move one char to the right within the field
.It REQ_PREV_CHAR
Move one char to the left within the current field.
.It REQ_NEXT_LINE
Go down one line in the current field.
.It REQ_PREV_LINE
Go up one line in the current field.
.It REQ_NEXT_WORD
Go forward one word in the current field
.It REQ_PREV_WORD
Go backward one word in the current field.
.It REQ_BEG_FIELD
Move the cursor to the beginning of the current field.
.It REQ_END_FIELD
Move the cursor to the end of the current field.
.It REQ_BEG_LINE
Move the cursor to the beginning of the line in the current field.
.It REQ_END_LINE
Move the cursor to the end of the line.
.It REQ_LEFT_CHAR
Move the cursor left one character
.It REQ_RIGHT_CHAR
Move the cursor right one character
.It REQ_UP_CHAR
Move the cursor up one line.
.It REQ_DOWN_CHAR
Move the cursor down one line.
.It REQ_NEW_LINE
Insert a new line at the current cursor position.
.It REQ_INS_CHAR
Insert a blank character at the current cursor position
.It REQ_INS_LINE
Open a blank line at the current cursor position.
.It REQ_DEL_CHAR
Delete the character at the currrent cursor position.
.It REQ_DEL_PREV
Delete the character to the left of the current cursor position.
.It REQ_DEL_LINE
Delete the current line.
.It REQ_DEL_WORD
Delete the word at the current cursor position.
.It REQ_CLR_EOL
Clear the field from the current cursor position to the end of the
current line.
.It REQ_CLR_EOF
Clear the field from the current cursor position to the end of the field.
.It REQ_CLR_FIELD
Clear the field.
.It REQ_OVL_MODE
Enter overlay mode, characters added to the field will replace the
ones already there.
.It REQ_INS_MODE
Enter insert mode, characters will be inserted at the current cursor
position. Any characters to the right of the cursor will be moved
right to accomodate the new characters.
.It REQ_SCR_FLINE
Scroll the field forward one line.
.It REQ_SCR_BLINE
Scroll the field backward one line.
.It REQ_SCR_FPAGE
Scroll the field forward one field page.
.It REQ_SCR_BPAGE
Scroll the field backward one field page.
.It REQ_SCR_FHPAGE
Scroll the field forward half one field page.
.It REQ_SCR_BHPAGE
Scroll the field backward half one field page.
.It REQ_SCR_FCHAR
Scroll the field horizontally forward one character
.It REQ_SCR_BCHAR
Scroll the field horizontally backward one character
.It REQ_SCR_HFLINE
Scroll the field horizontally forward one field line.
.It REQ_SCR_HBLINE
Scroll the field horizontally backward one field line.
.It REQ_SCR_HFHALF
Scroll the field horizontally forward half a field line.
.It REQ_SCR_HBHALF
Scroll the field horizontally backward half a field line.
.It REQ_VALIDATION
Request the contents of the current field be validated using any field
validation function that has been set for the field. Normally, the
field is validated before the current field changes. This request
allows the current field to be validated.
.It REQ_PREV_CHOICE
Select the previous choice in an enumerated type field.
.It REQ_NEXT_CHOICE
Select the next choice in an enumerated type field.
.El
.Sh 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:
.Pp
.Bl -tag -width E_UNKNOWN_COMMAND -compact
.It Er E_OK
The function was successful.
.It Er E_REQUEST_DENIED
The forms driver request could not be fulfilled
.It Er E_UNKNOWN_COMMAND
The passed character is not a printable character and is not a valid
forms driver request.
.It Er E_BAD_ARGUMENT
A bad argument was passed to the forms driver.
.It Er E_INVALID_FIELD
The form passed to the driver has no valid attached fields.
.It Er E_NOT_POSTED
The given form is not currently posted to the screen.
.It Er E_BAD_STATE
The forms driver was called from within an init or term function.
.It Er E_INVALID_FIELD
The character passed to the forms driver fails the character
validation for the current field.
.El
.Sh SEE ALSO
.Xr curses 3 ,
.Xr forms 3
.Sh NOTES
Field sorting is done by location of the field on the form page, the
fields are sorted by position starting with the top-most, left-most
field and progressing left to right. For the purposes of sorting, the
fields top left corner is used as the sort criteria.
The header
.Pa <form.h>
automatically includes both
.Pa <curses.h>
and
.Pa <eti.h> .

101
lib/libform/form_field.3 Normal file
View File

@ -0,0 +1,101 @@
.\" $NetBSD: form_field.3,v 1.1 2001/07/08 12:10:28 blymn 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, 2001
.Dt FORMS 3
.Os
.Sh NAME
.Nm field_count ,
.Nm form_fields ,
.Nm move_field ,
.Nm set_form_fields
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.Fd #include <form.h>
.Ft int
.Fn field_count "FORM *form"
.Ft FIELD **
.Fn form_fields "FORM *form"
.Ft int
.Fn move_field "FIELD *field, int frow, int fcol"
.Ft int
.Fn set_form_fields "FORM *form, FIELD **fields"
.Sh DESCRIPTION
The
.Fn field_count
function returns the number of fields that are attached to the given
form, if the form argument passed is NULL then
.Fn field_count
will return -1. The function
.Fn form_fields
will return a pointer to array of attach fields for the given form,
this array is not NULL terminated, fields may be attached to the given
form by calling
.Fn set_form_fields .
The
.Fa fields
argument in this function is a pointer to a NULL terminated array of
fields that will be attached to the form. If there are already fields
attached to the form then they will be detached before the new fields
are attached. The new fields given must not be attached to any other
form. The
.Fn move_field
function will move the given field to the location specified by
.Fa frow
and
.Fa fcol .
.Sh 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:
.Pp
.Bl -tag -width E_UNKNOWN_COMMAND -compact
.It Er E_OK
The function was successful.
.It Er E_CONNECTED
The field is connected to a form.
.It Er E_POSTED
The form is currently posted to the screen.
.It Er E_BAD_ARGUMENT
The function was passed a bad argument.
.El
.Sh SEE ALSO
.Xr curses 3 ,
.Xr forms 3
.Sh NOTES
The header
.Pa <form.h>
automatically includes both
.Pa <curses.h>
and
.Pa <eti.h> .

View File

@ -0,0 +1,97 @@
.\" $NetBSD: form_field_attributes.3,v 1.1 2001/07/08 12:10:28 blymn 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, 2001
.Dt FORMS 3
.Os
.Sh NAME
.Nm field_back ,
.Nm field_fore ,
.Nm field_pad ,
.Nm set_field_back ,
.Nm set_field_fore ,
.Nm set_field_pad
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.Fd #include <form.h>
.Ft chtype
.Fn field_back "FIELD *field"
.Ft chtype
.Fn field_fore "FIELD *field"
.Ft int
.Fn field_pad "FIELD *field"
.Ft int
.Fn set_field_back "FIELD *field, chtype attribute"
.Ft int
.Fn set_field_fore "FIELD *field, chtype attribute"
.Ft int
.Fn set_field_pad "FIELD *field, int pad"
.Sh DESCRIPTION
Calling the function
.Fn field_back
will return the character attributes that will be applied to a field
that is not the current field, these attributes can be set by the
.Fn set_field_back
function. The
.Fn field_fore
function returns the character attributes that will be used to
indicate that a field is the currently active one on the form, this
attribute may be set by using the
.Fn set_field_fore
function. The
pad character for a field is the character that will be printed in all
field locations not occupied with actual field contents. The pad
character can be retrieved by calling the
.Fn field_pad
function, the pad character is set by using the
.Fn set_field_pad
function.
.Sh 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:
.Pp
.Bl -tag -width E_UNKNOWN_COMMAND -compact
.It Er E_OK
The function was successful.
.El
.Sh SEE ALSO
.Xr curses 3 ,
.Xr forms 3
.Sh NOTES
The header
.Pa <form.h>
automatically includes both
.Pa <curses.h>
and
.Pa <eti.h> .

View File

@ -0,0 +1,97 @@
.\" $NetBSD: form_field_buffer.3,v 1.1 2001/07/08 12:10:28 blymn 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, 2001
.Dt FORMS 3
.Os
.Sh NAME
.Nm field_buffer ,
.Nm field_status ,
.Nm set_field_buffer ,
.Nm set_field_status ,
.Nm set_max_field
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.Fd #include <form.h>
.Ft char *
.Fn field_buffer "FIELD *field, int buffer"
.Ft int
.Fn field_status "FIELD *field"
.Ft int
.Fn set_field_buffer "FIELD *field, int buffer, char *value"
.Ft int
.Fn set_field_status "FIELD *field, int status"
.Sh DESCRIPTION
The
.Fn field_buffer
function returns the contents of the buffer number specified by
.Fa buffer
for the given field. If the requested buffer number exceeds the
number of buffers attached to the field then NULL will be returned.
The field buffer may be set by calling
.Fn set_field_buffer
which will set the given buffer number to the contents of the string
passed. Calling
.Fn field_status
will return the status of the first buffer attached to the field. If
the field has been modified then the function will return TRUE
otherwise FALSE is returned, the status of the first buffer may be
programmatically set by calling
.Fn set_field_status .
The maximum growth of a dynamic field can be set by calling
.Fn set_max_field
which limits the fields rows if the field is a multiline field or the
fields columns if the field only has a single row.
.Sh 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:
.Pp
.Bl -tag -width E_UNKNOWN_COMMAND -compact
.It Er E_OK
The function was successful.
.It Er E_BAD_ARGUMENT
A bad parameter was passed to the function.
.It Er E_SYSTEM_ERROR
A system error occurred performing the function.
.El
.Sh SEE ALSO
.Xr curses 3 ,
.Xr forms 3
.Sh NOTES
The header
.Pa <form.h>
automatically includes both
.Pa <curses.h>
and
.Pa <eti.h> .

View File

@ -0,0 +1,87 @@
.\" $NetBSD: form_field_info.3,v 1.1 2001/07/08 12:10:29 blymn 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, 2001
.Dt FORMS 3
.Os
.Sh NAME
.Nm dynamic_field_info ,
.Nm field_info
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.Fd #include <form.h>
.Ft int
.Fn dynamic_field_info "FIELD *field, int *drows, int *dcols, int *max"
.Ft int
.Fn field_info "FIELD *field, int *rows, int *cols, int *frow, int *fcol, int *nrow, int *nbuf"
.Sh DESCRIPTION
The function
.Fn dynamic_field_info
returns the sizing information for the field given. The function will
return the number of rows, columns and the maximum growth of the field
in the storage pointed to by the drows, dcols and max parameters
respectively. Dynamic field information cannot be requested for the
default field. If the field given is not dynamic then
.Fn dynamic_field_info
will simply return the size of the actual field. The
.Fn field_info
will return the number or rows, columns, field starting row, field
starting column, number of off screen rows and number of buffers in
.Fa rows ,
.Fa cols ,
.Fa frow ,
.Fa fcol ,
.Fa nrow
and
.Fa nbuf
respectively.
.Sh RETURN VALUES
The functions 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
A bad argument was passed to the function.
.El
.Sh SEE ALSO
.Xr curses 3 ,
.Xr forms 3
.Sh NOTES
The header
.Pa <form.h>
automatically includes both
.Pa <curses.h>
and
.Pa <eti.h> .

View File

@ -0,0 +1,95 @@
.\" $NetBSD: form_field_just.3,v 1.1 2001/07/08 12:10:29 blymn 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, 2001
.Dt FORMS 3
.Os
.Sh NAME
.Nm field_just ,
.Nm set_field_just
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.Fd #include <form.h>
.Ft int
.Fn field_just "FIELD *field"
.Ft int
.Fn set_field_just "FIELD *field, int justification"
.Sh DESCRIPTION
Field justification is only applied to static fields, a dynamic field
will not be justified. The default justification for a field is
NO_JUSTIFICATION. The
.Fn field_just
will return the current justification value of the given field and the
justification may be set by calling the
.Fn set_field_just
function.
.Sh PARAMETERS
The following are the valid justifications for a field:
.Pp
.Bl -tag -width NO_JUSTIFICATION -compact
.It NO_JUSTIFICATION
No justification is to be applied to the field. In practice, this is
the same as JUSTIFY_LEFT.
.It JUSTIFY_RIGHT
The field will be right justified. That is, the end of each line will
be butted up against the right hand side of the field.
.It JUSTIFY_LEFT
The field will be left justified. That is, the start of each line
will be butted up against the left hand side of the field.
.It JUSTIFY_CENTER
The field will be centre justified, padding will be applied to either
end of the line to make the line centred in the field.
.El
.Sh 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:
.Pp
.Bl -tag -width E_UNKNOWN_COMMAND -compact
.It Er E_OK
The function was successful.
.It Er E_CURRENT
The field specified is the currently active one on the form.
.It Er E_BAD_ARGUMENT
A bad argument was passed to the function.
.El
.Sh SEE ALSO
.Xr curses 3 ,
.Xr forms 3
.Sh NOTES
The header
.Pa <form.h>
automatically includes both
.Pa <curses.h>
and
.Pa <eti.h> .

View File

@ -0,0 +1,107 @@
.\" $NetBSD: form_field_new.3,v 1.1 2001/07/08 12:10:29 blymn 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, 2001
.Dt FORMS 3
.Os
.Sh NAME
.Nm dup_field ,
.Nm free_field ,
.Nm link_field ,
.Nm new_field
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.Fd #include <form.h>
.Ft FIELD *
.Fn dup_field "FIELD *field, int frow, int fcol"
.Ft int
.Fn free_field "FIELD *field"
.Ft FIELD *
.Fn link_field "FIELD *field, int frow, int fcol"
.Ft FIELD *
.Fn new_field "int rows, int cols, int frow, int fcol, int nrows, int nbuf"
.Sh DESCRIPTION
The
.Fn dup_field
function duplicates the given field, including any buffers associated
with the field and returns the pointer to the newly created field.
.Fn free_field
destroys the field and frees any allocated resources associated with
the field. The function
.Fn link_field
copies the given field to a new field at the location
.Fa frow
and
.Fa fcol
but shares the buffers with the original field.
.Fn new_field
creates a new field of size
.Fa rows
by
.Fa cols
at location
.Fa frow ,
.Fa fcol
on the page, the argument
.Fa nrows
specified the number of off screen rows the field has and the
.Fa nbuf
parameter specifies the number of extra buffers attached to the
field. There will always be one buffer associated with a field.
.Sh RETURN VALUES
On error
.Fn dup_field
and
.Fn new_field
will return NULL.
The functions will 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
A bad argument was passed to the function.
.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
.Pa <form.h>
automatically includes both
.Pa <curses.h>
and
.Pa <eti.h> .

View File

@ -0,0 +1,125 @@
.\" $NetBSD: form_field_opts.3,v 1.1 2001/07/08 12:10:29 blymn 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, 2001
.Dt FORMS 3
.Os
.Sh NAME
.Nm field_opts ,
.Nm field_opts_off ,
.Nm field_opts_on ,
.Nm set_field_opts
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.Fd #include <form.h>
.Ft Form_Options
.Fn field_opts "FIELD *field"
.Ft int
.Fn field_opts_off "FIELD *field, Form_Options options"
.Ft int
.Fn field_opts_on "FIELD *field, Form_Options options"
.Ft int
.Fn set_field_opts "FIELD *field, Form_Options options"
.Sh DESCRIPTION
The function
.Fn field_opts
returns the current options settings for the given field. The
.Fn field_opts_off
will turn the options given in
.Fa options
off for the given field, options not specified in
.Fa options
will remain unchanged. Conversely, the function
.Fn field_opts_on
will turn on the options given in
.Fa options
for the specified field, again, any options not specified will remain
unchanged. The options for a field may be set to a specific set of
options by calling the
.Fn set_field_opts
function. Options may only be changed if the field given is not the
currently active one.
.Sh PARAMETERS
The following options are available for a field:
.Pp
.Bl -tag -width O_AUTOSKIP -compact
.It O_VISIBLE
The field is visible, hence is displayed when the form is posted.
.It O_ACTIVE
The field is active in the form, meaning that it can be visited during
form processing.
.It O_PUBLIC
The contents of the field are echoed to the screen.
.It O_EDIT
The contents of the field can be modified
.It O_WRAP
The contents of the field are wrapped on a word boundary, if this
option is off then the field will be wrapped on a character boundary.
.It O_BLANK
Blank the field on new data being entered if and only if the field
cursor is at the left hand side of the field.
.It O_AUTOSKIP
Skip to the next field when the current field reaches it's maximum
size.
.It O_NULLOK
The field is allowed to contain no data
.It O_STATIC
The field is not dynamic, it has a fixed size.
.It O_PASSOK
An unmodified field is allowed.
.El
.Pp
The following options are on by default for a field: O_VISIBLE,
O_ACTIVE, O_PUBLIC, O_EDIT, O_WRAP, O_BLANK, O_AUTOSKIP, O_NULLOK,
O_PASSOK and O_STATIC.
.Sh 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:
.Pp
.Bl -tag -width E_UNKNOWN_COMMAND -compact
.It Er E_OK
The function was successful.
.It Er E_CURRENT
The field specified is the currently active one in the form.
.El
.Sh SEE ALSO
.Xr curses 3 ,
.Xr forms 3
.Sh NOTES
The header
.Pa <form.h>
automatically includes both
.Pa <curses.h>
and
.Pa <eti.h> .

View File

@ -0,0 +1,72 @@
.\" $NetBSD: form_field_userptr.3,v 1.1 2001/07/08 12:10:29 blymn 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, 2001
.Dt FORMS 3
.Os
.Sh NAME
.Nm field_userptr ,
.Nm set_field_userptr
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.Fd #include <form.h>
.Ft void *
.Fn field_userptr "FIELD *field"
.Ft int
.Fn set_field_userptr "FIELD *field, void *ptr"
.Sh DESCRIPTION
The
.Fn field_userptr
function returns the pointer to the user defined data for the field,
this pointer may be set by calling the
.Fn set_field_userptr
function.
.Sh 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:
.Pp
.Bl -tag -width E_UNKNOWN_COMMAND -compact
.It Er E_OK
The function was successful.
.El
.Sh SEE ALSO
.Xr curses 3 ,
.Xr forms 3
.Sh NOTES
The header
.Pa <form.h>
automatically includes both
.Pa <curses.h>
and
.Pa <eti.h> .

View File

@ -0,0 +1,79 @@
.\" $NetBSD: form_field_validation.3,v 1.1 2001/07/08 12:10:29 blymn 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, 2001
.Dt FORMS 3
.Os
.Sh NAME
.Nm field_arg ,
.Nm field_type ,
.Nm set_field_type
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.Fd #include <form.h>
.Ft char *
.Fn field_arg "FIELD *field"
.Ft FIELDTYPE *
.Fn field_type "FIELD *field"
.Ft int
.Fn set_field_type "FIELD *field, FIELDTYPE *type, ..."
.Sh DESCRIPTION
The
.Fn field_arg
function returns the field type arguments that are associated with the
given field. The
.Fn field_type
function returns the field type structure associated with the given
field, this type can be set by calling the
.Fn set_field_type
function which associates the given field type with the field, the
third and subsequent parameters are field dependent arguments.
.Sh 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:
.Pp
.Bl -tag -width E_UNKNOWN_COMMAND -compact
.It Er E_OK
The function was successful.
.El
.Sh SEE ALSO
.Xr curses 3 ,
.Xr forms 3
.Sh NOTES
The header
.Pa <form.h>
automatically includes both
.Pa <curses.h>
and
.Pa <eti.h> .

View File

@ -0,0 +1,135 @@
.\" $NetBSD: form_fieldtype.3,v 1.1 2001/07/08 12:10:29 blymn 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, 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
.Fd #include <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 TRUE if they are
acceptable and 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 TRUE. Neither
.Fa field_check
nor
.Fa char_check
may be 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 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 TRUE if the function
succeeded and FALSE otherwise.
.Sh 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:
.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
.Pa <form.h>
automatically includes both
.Pa <curses.h>
and
.Pa <eti.h> .

109
lib/libform/form_hook.3 Normal file
View File

@ -0,0 +1,109 @@
.\" $NetBSD: form_hook.3,v 1.1 2001/07/08 12:10:29 blymn 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, 2001
.Dt FORMS 3
.Os
.Sh NAME
.Nm field_init ,
.Nm field_term ,
.Nm form_init ,
.Nm form_term ,
.Nm set_field_init ,
.Nm set_field_term ,
.Nm set_form_init ,
.Nm set_form_term
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.Fd #include <form.h>
.Ft void (*)(FORM *)
.Fn field_init "FORM *form"
.Ft void (*)(FORM *)
.Fn field_term "FORM *form"
.Ft void (*)(FORM *)
.Fn form_init "FORM *form"
.Ft void (*)(FORM *)
.Fn form_term "FORM *form"
.Ft int
.Fn set_field_init "FORM *form, void (*function)(FORM *)"
.Ft int
.Fn set_field_term "FORM *form, void (*function)(FORM *)"
.Ft int
.Fn set_form_init "FORM *form, void (*function)(FORM *)"
.Ft int
.Fn set_form_term "FORM *form, void (*function)(FORM *)"
.Sh DESCRIPTION
The
.Fn field_init
function returns a pointer to the function that will be called just
after the current field changes and just before the form is posted,
this function may be set by using the
.Fn set_field_init
function. Similarly, the function
.Fn field_term
will return a pointer to the function that will be called just before
the current field changes and just after the form is unposted, this
function pointer may be set by using the
.Fn set_field_term
function. The
.Fn form_init
function will return a pointer to the function that will be called
just before the form is posted to the screen, this function can be set
by calling the
.Fn set_form_init
function. The
.Fn form_term
function will return a pointer to the function that will be called
just after the form is unposted from the screen, this function may be
set by using the
.Fn set_form_term
function. By default, the init and term function pointers are NULL.
.Sh 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:
.Pp
.Bl -tag -width E_UNKNOWN_COMMAND -compact
.It Er E_OK
The function was successful.
.El
.Sh SEE ALSO
.Xr curses 3 ,
.Xr forms 3
.Sh NOTES
The header
.Pa <form.h>
automatically includes both
.Pa <curses.h>
and
.Pa <eti.h> .

81
lib/libform/form_new.3 Normal file
View File

@ -0,0 +1,81 @@
.\" $NetBSD: form_new.3,v 1.1 2001/07/08 12:10:29 blymn 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, 2001
.Dt FORMS 3
.Os
.Sh NAME
.Nm free_form ,
.Nm new_form
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.Fd #include <form.h>
.Ft int
.Fn free_form "FORM *form"
.Ft FORM *
.Fn new_form "FIELD **fields"
.Sh DESCRIPTION
The function
.Fn free_form
frees all the resources associated with the form and destroys the
form. Calling
.Fn new_form
will create a new form, set the form parameters to the current
defaults and attach the passed fields to the form. The array of
fields passed to
.Fn new_form
must be terminated with a NULL pointer to indicate the end of the
fields.
.Sh 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:
.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_POSTED
The form is posted to the screen.
.El
.Sh SEE ALSO
.Xr curses 3 ,
.Xr forms 3
.Sh NOTES
The header
.Pa <form.h>
automatically includes both
.Pa <curses.h>
and
.Pa <eti.h> .

View File

@ -0,0 +1,75 @@
.\" $NetBSD: form_new_page.3,v 1.1 2001/07/08 12:10:29 blymn 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, 2001
.Dt FORMS 3
.Os
.Sh NAME
.Nm new_page ,
.Nm set_new_page
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.Fd #include <form.h>
.Ft int
.Fn new_page "FIELD *field"
.Ft int
.Fn set_new_page "FIELD *field, int page"
.Sh DESCRIPTION
The
.Fn new_page
function returns TRUE if the given field is the start of a new page,
otherwise it returns FALSE, the new page status of a field can be set
or unset using the
.Fn set_new_page
function.
.Sh 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:
.Pp
.Bl -tag -width E_UNKNOWN_COMMAND -compact
.It Er E_OK
The function was successful.
.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
.Pa <form.h>
automatically includes both
.Pa <curses.h>
and
.Pa <eti.h> .

101
lib/libform/form_opts.3 Normal file
View File

@ -0,0 +1,101 @@
.\" $NetBSD: form_opts.3,v 1.1 2001/07/08 12:10:29 blymn 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, 2001
.Dt FORMS 3
.Os
.Sh NAME
.Nm form_opts ,
.Nm form_opts_off ,
.Nm form_opts_on ,
.Nm set_form_opts
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.Fd #include <form.h>
.Ft Form_Options
.Fn form_opts "FORM *form"
.Ft int
.Fn form_opts_off "FORM *form, Form_Options options"
.Ft int
.Fn form_opts_on "FORM *form, Form_Options options"
.Ft int
.Fn set_form_opts "FORM *form, Form_Options options"
.Sh DESCRIPTION
The function
.Fn form_opts
returns the current options that are set on the given form. The
.Fn form_opts_off
will turn off the form options given in
.Fa options
for the form, similarly,
.Fn form_opts_on
will turn on the options specified in
.Fa options
for the given form. The form options can be set to an explicit set by
calling
.Fn set_form_opts .
.Sh PARAMETERS
The following form options are valid:
.Pp
.Bl -tag -width O_BS_OVERLOAD -compact
.It O_BS_OVERLOAD
If this option is set and the cursor is at the first character in the
field then the backspace character will perform the same function as a
REQ_PREV_FIELD driver request, moving to the previous field in the
form.
.It O_NL_OVERLOAD
If this option is set and the cursor is at the end of the field then
the new line character will perform the same function as a
REQ_NEXT_FIELD driver request, moving to the next field in the form.
.El
.Pp
By default no form options are set.
.Sh 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:
.Pp
.Bl -tag -width E_UNKNOWN_COMMAND -compact
.It Er E_OK
The function was successful.
.El
.Sh SEE ALSO
.Xr curses 3 ,
.Xr forms 3
.Sh NOTES
The header
.Pa <form.h>
automatically includes both
.Pa <curses.h>
and
.Pa <eti.h> .

110
lib/libform/form_page.3 Normal file
View File

@ -0,0 +1,110 @@
.\" $NetBSD: form_page.3,v 1.1 2001/07/08 12:10:29 blymn Exp $
.\"
.\" Copyright (c) 1999
.\" 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, 2001
.Dt FORM_PAGE 3
.Os
.Sh NAME
.Nm current_field ,
.Nm field_index ,
.Nm form_page ,
.Nm form_max_page ,
.Nm set_current_field ,
.Nm set_form_page
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.Fd #include <form.h>
.Ft FIELD *
.Fn current_field "FORM *form"
.Ft int
.Fn field_index "FIELD *field"
.Ft int
.Fn form_page "FORM *form"
.Ft int
.Fn form_max_page "FORM *form"
.Ft int
.Fn set_current_field "FORM *form, FIELD *field"
.Ft int
.Fn set_form_page "FORM *form, int page"
.Sh DESCRIPTION
The
.Fn current_field
returns a pointer to the structure for the field that is currently
active on the page. If there is an error,
.Fn current_field
will return NULL. Calling
.Fn field_index
will return the index of the given field in the form field array. The
current page the form is on can be determined by using
.Fn form_page ,
the current page of a form can be programmatically set by calling
.Fn set_form_page .
The maximum page number for a form can be found by
calling the function
.Fn form_max_page
but note that this function is a NetBSD extension and must not be used
in portable forms library programs. The current field on the form may
be set by calling
.Fn set_current_field
which will set the current field to the one given.
.Sh 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:
.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_NOT_CONNECTED
The given field is not associated with a form.
.It Er E_BAD_STATE
The function was called from within an init or term function.
.It Er E_INVALID_FIELD
The field given is not part of the given form.
.El
.Sh SEE ALSO
.Xr curses 3 ,
.Xr forms 3
.Sh NOTES
The header
.Pa <form.h>
automatically includes both
.Pa <curses.h>
and
.Pa <eti.h> .
.Pp
The
.Nm form_max_page
is a NetBSD extension and should not be used in portable applications.

86
lib/libform/form_post.3 Normal file
View File

@ -0,0 +1,86 @@
.\" $NetBSD: form_post.3,v 1.1 2001/07/08 12:10:29 blymn 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, 2001
.Dt FORMS 3
.Os
.Sh NAME
.Nm post_form ,
.Nm unpost_form
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.Fd #include <form.h>
.Ft int
.Fn post_form "FORM *form"
.Ft int
.Fn unpost_form "FORM *form"
.Sh DESCRIPTION
The
.Fn post_form
function performs the actions necessary to present the form on the
curses screen. If there are any init functions that need to be called
then they will be called prior to the form being posted and the cursor
will be positioned on the first active field that can be visited.
Conversely, the function
.Fn unpost_form
removes the form from the screen and calls any termination functions
that were specified.
.Sh 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:
.Pp
.Bl -tag -width E_UNKNOWN_COMMAND -compact
.It Er E_OK
The function was successful.
.It Er E_BAD_ARGUMENT
A bad argument was passed to the function.
.It Er E_POSTED
The form is already posted to the screen.
.It Er E_NOT_POSTED
The form was not posted to the screen.
.It Er E_NOT_CONNECTED
There are no fields associated with the form.
.It Er E_BAD_STATE
The function was called from within a init or term function.
.El
.Sh SEE ALSO
.Xr curses 3 ,
.Xr forms 3
.Sh NOTES
The header
.Pa <form.h>
automatically includes both
.Pa <curses.h>
and
.Pa <eti.h> .

View File

@ -0,0 +1,72 @@
.\" $NetBSD: form_userptr.3,v 1.1 2001/07/08 12:10:29 blymn 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, 2001
.Dt FORMS 3
.Os
.Sh NAME
.Nm form_userptr ,
.Nm set_form_userptr
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.Fd #include <form.h>
.Ft void *
.Fn form_userptr "FORM *form"
.Ft int
.Fn set_form_userptr "FORM *form, void *ptr"
.Sh DESCRIPTION
The
.Fn form_userptr
function returns the pointer to the user defined data associated with
the form, this pointer may be set using the
.Fn set_form_userptr
call.
.Sh 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:
.Pp
.Bl -tag -width E_UNKNOWN_COMMAND -compact
.It Er E_OK
The function was successful.
.El
.Sh SEE ALSO
.Xr curses 3 ,
.Xr forms 3
.Sh NOTES
The header
.Pa <form.h>
automatically includes both
.Pa <curses.h>
and
.Pa <eti.h> .

102
lib/libform/form_win.3 Normal file
View File

@ -0,0 +1,102 @@
.\" $NetBSD: form_win.3,v 1.1 2001/07/08 12:10:29 blymn 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, 2001
.Dt FORMS 3
.Os
.Sh NAME
.Nm form_sub ,
.Nm form_win ,
.Nm scale_form ,
.Nm set_form_sub ,
.Nm set_form_win
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.Fd #include <form.h>
.Ft WINDOW *
.Fn form_sub "FORM *form"
.Ft WINDOW *
.Fn form_win "FORM *form"
.Ft int
.Fn scale_form "FORM *form, int *rows, int *cols"
.Ft int
.Fn set_form_sub "FORM *form, WINDOW *window"
.Ft int
.Fn set_form_win "FORM *form, WINDOW *window"
.Sh DESCRIPTION
All output to the screen done by the forms library is handled by the
curses library routines. By default, the forms library will output to
the curses
.Fa stdscr ,
but if the forms window has been set via
.Fn set_form_win
then output will be sent to the window specified by
.Fn set_form_win ,
unless the forms subwindow has been set using
.Fn set_form_sub .
If a subwindow has been specified using
.Fn set_form_sub
then it will be used by the forms library to for screen output. The
current setting for the form window can be retrieved by calling
.Fn form_win .
If the forms window has not been set then NULL will be returned.
Similarly, the forms subwindow can be found by calling the
.Fn form_sub
function, again, if the subwindow has not been set then NULL will be
returned. The
.Fn scale_form
function will return the minimum number of rows and columns that will
entirely contain the given form.
.Sh 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:
.Pp
.Bl -tag -width E_UNKNOWN_COMMAND -compact
.It Er E_OK
The function was successful.
.It Er E_NOT_CONNECTED
The form has no fields connected to it.
.It Er E_POSTED
The form is posted to the screen.
.El
.Sh SEE ALSO
.Xr curses 3 ,
.Xr forms 3
.Sh NOTES
The header
.Pa <form.h>
automatically includes both
.Pa <curses.h>
and
.Pa <eti.h> .

188
lib/libform/forms.3 Normal file
View File

@ -0,0 +1,188 @@
.\" $NetBSD: forms.3,v 1.1 2001/07/08 12:10:29 blymn 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, 2001
.Dt FORMS 3
.Os
.Sh NAME
.Nm form
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.Fd #include <form.h>
.Sh DESCRIPTION
The
.Xr form 3
provides a terminal independent form system using the
.Xr curses 3
library. Before using the
.Xr menu 3
functions the terminal must be set up by
.Xr curses 3
using the
.Fn initscr
function or similar. Programs using
.Xr form
functions must be linked with the
.Xr curses 3
library
.Xr -lcurses .
.Pp
The
.Xr form 3
library provides facilties for defining form fields, placing a form on the
terminal screen, assign pre and post change operations and setting the
attributes of both the form and it's fields.
.Sh Defining default attributes for forms and fields
The
.Xr form 3
library allows any settable attribute or option of both the form and field
objects to be defined such that any new form or field automatically inherits
the value as default. Setting the default value will not affect any field or
form that has already been created but will be applied to subsequent objects.
To set the default attribute or option the set routine is passed a NULL
pointer in the field or form parameter when calling the set routine. The
current default value can be retrieved by calling the get routine with a
NULL pointer for the field or form parameter.
.Pp
.ta 20
.nf
.ft 3
Form Routine Name Manual Page Name
.sp 0.5
current_field form_page(3)
data_ahead form_data(3
data_behind form_data(3)
dup_field form_field_new(3)
dynamic_field_info form_field_info(3)
field_arg form_field_validation(3)
field_back form_field_attributes(3)
field_buffer form_field_buffer(3)
field_count form_field(3)
field_fore form_field_attributes(3)
field_index form_page(3)
field_info form_field_info(3)
field_init form_hook(3)
field_just form_field_just(3)
field_opts form_field_opts(3)
field_opts_off form_field_opts(3)
field_opts_on form_field_opts(3)
field_pad form_field_attributes(3)
field_status form_field_buffer(3)
field_term form_hook(3)
field_type form_field_validation(3)
field_userptr form_field_userptr(3)
form_driver form_driver(3)
form_fields form_field(3)
form_init form_hook(3)
form_max_page form_page(3)
form_opts form_opts(3)
form_opts_off form_opts(3)
form_opts_on form_opts(3)
form_page form_page(3)
form_sub form_win(3)
form_term form_hook(3)
form_userptr form_userptr(3)
form_win form_win(3)
free_field form_field_new(3)
free_fieldtype form_fieldtype(3)
free_form form_new(3)
link_field form_field_new(3)
link_fieldtype form_fieldtype(3)
move_field form_field(3)
new_field form_field_new(3)
new_fieldtype form_fieldtype(3)
new_form form_new(3)
new_page form_new_page(3)
pos_form_cursor form_cursor(3)
post_form form_post(3)
scale_form form_win(3)
set_current_field form_page(3)
set_field_back form_field_attributes(3)
set_field_buffer form_field_buffer(3)
set_field_fore form_field_attributes(3)
set_field_init form_hook(3)
set_field_just form_field_just(3)
set_field_opts form_field_opts(3)
set_field_pad form_field_attributes(3)
set_field_status form_field_buffer(3)
set_field_term form_hook(3)
set_field_type form_field_validation(3)
set_field_userptr form_field_userptr(3)
set_fieldtype_arg form_fieldtype(3)
set_fieldtype_choice form_fieldtype(3)
set_form_fields form_field(3)
set_form_init form_hook(3)
set_form_opts form_opts(3)
set_form_page form_page(3)
set_form_sub form_win(3)
set_form_term form_hook(3)
set_form_userptr form_userptr(3)
set_form_win form_win(3)
set_max_field form_field_buffer(3)
set_new_page form_new_page(3)
unpost_form form_post(3)
.fi
.ft 1
.br
.ne 8
.Sh RETURN VALUES
Any function returning a string pointer will return NULL if an error
occurs. Functions returning an integer will return one of the
following:
.Pp
.ta 20
.nf
E_OK The function was successful
E_SYSTEM_ERROR There was a system error during the call.
E_BAD_ARGUMENT One or more of the arguments passed to the function
was incorrect.
E_POSTED The form is already posted.
E_CONNECTED An field was already connected to a form.
E_BAD_STATE The function was called from within an initialisation
or termination routine.
E_NO_ROOM The form does not fit within the subwindow.
E_NOT_POSTED The form is not posted
E_UNKNOWN_COMMAND The form driver does not recognise the request
passed to it.
E_NOT_SELECTABLE The field could not be selected.
E_NOT_CONNECTED The field is not connected to a form.
E_REQUEST_DENIED The form driver could not process the request.
E_INVALID_FIELD The field is invalid.
E_CURRENT The field is the active one on the form.
.fi
.ft 1
.br
.ne 8
.Sh SEE ALSO
.Xr curses 3