1*a0e6850fSThomas Cort.\" $NetBSD: form_driver.3,v 1.11 2010/03/22 21:58:31 joerg Exp $ 2*a0e6850fSThomas Cort.\" 3*a0e6850fSThomas Cort.\" Copyright (c) 2001 4*a0e6850fSThomas Cort.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au 5*a0e6850fSThomas Cort.\" 6*a0e6850fSThomas Cort.\" This code is donated to The NetBSD Foundation by the author. 7*a0e6850fSThomas Cort.\" 8*a0e6850fSThomas Cort.\" Redistribution and use in source and binary forms, with or without 9*a0e6850fSThomas Cort.\" modification, are permitted provided that the following conditions 10*a0e6850fSThomas Cort.\" are met: 11*a0e6850fSThomas Cort.\" 1. Redistributions of source code must retain the above copyright 12*a0e6850fSThomas Cort.\" notice, this list of conditions and the following disclaimer. 13*a0e6850fSThomas Cort.\" 2. Redistributions in binary form must reproduce the above copyright 14*a0e6850fSThomas Cort.\" notice, this list of conditions and the following disclaimer in the 15*a0e6850fSThomas Cort.\" documentation and/or other materials provided with the distribution. 16*a0e6850fSThomas Cort.\" 3. The name of the Author may not be used to endorse or promote 17*a0e6850fSThomas Cort.\" products derived from this software without specific prior written 18*a0e6850fSThomas Cort.\" permission. 19*a0e6850fSThomas Cort.\" 20*a0e6850fSThomas Cort.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND 21*a0e6850fSThomas Cort.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22*a0e6850fSThomas Cort.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23*a0e6850fSThomas Cort.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE 24*a0e6850fSThomas Cort.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25*a0e6850fSThomas Cort.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26*a0e6850fSThomas Cort.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27*a0e6850fSThomas Cort.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28*a0e6850fSThomas Cort.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29*a0e6850fSThomas Cort.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30*a0e6850fSThomas Cort.\" SUCH DAMAGE. 31*a0e6850fSThomas Cort.\" 32*a0e6850fSThomas Cort.Dd January 1, 2001 33*a0e6850fSThomas Cort.Dt FORMS 3 34*a0e6850fSThomas Cort.Os 35*a0e6850fSThomas Cort.Sh NAME 36*a0e6850fSThomas Cort.Nm form_driver 37*a0e6850fSThomas Cort.Nd form library 38*a0e6850fSThomas Cort.Sh LIBRARY 39*a0e6850fSThomas Cort.Lb libform 40*a0e6850fSThomas Cort.Sh SYNOPSIS 41*a0e6850fSThomas Cort.In form.h 42*a0e6850fSThomas Cort.Ft int 43*a0e6850fSThomas Cort.Fn form_driver "FORM *form" "int request" 44*a0e6850fSThomas Cort.Sh DESCRIPTION 45*a0e6850fSThomas CortThe 46*a0e6850fSThomas Cort.Fn form_driver 47*a0e6850fSThomas Cortis the heart of the forms library, it takes commands in the 48*a0e6850fSThomas Cort.Fa request 49*a0e6850fSThomas Cortparameter that is either a request to the driver to perform some 50*a0e6850fSThomas Cortaction or is a character to be inserted into the current field. 51*a0e6850fSThomas CortThe form driver will attempt to insert any printable character passed to 52*a0e6850fSThomas Cortit into the current field. 53*a0e6850fSThomas CortThis may or may not succeed depending on the state of the current field. 54*a0e6850fSThomas CortIf the character passed is not 55*a0e6850fSThomas Cortprintable then the driver attempts to process it as a driver request. 56*a0e6850fSThomas CortIf the character passed is not a valid request then the driver will 57*a0e6850fSThomas Cortreturn an unknown command error. 58*a0e6850fSThomas Cort.Sh PARAMETERS 59*a0e6850fSThomas CortThe forms driver recognizes the following requests: 60*a0e6850fSThomas Cort.Pp 61*a0e6850fSThomas Cort.Bl -tag -width REQ_SFIRST_FIELD -compact 62*a0e6850fSThomas Cort.It REQ_NEXT_PAGE 63*a0e6850fSThomas CortChange to the next page in the form. 64*a0e6850fSThomas Cort.It REQ_PREV_PAGE 65*a0e6850fSThomas CortChange to the previous page in the form. 66*a0e6850fSThomas Cort.It REQ_FIRST_PAGE 67*a0e6850fSThomas CortSelect the first page in the form. 68*a0e6850fSThomas Cort.It REQ_LAST_PAGE 69*a0e6850fSThomas CortGo to the last page in the form. 70*a0e6850fSThomas Cort.It REQ_NEXT_FIELD 71*a0e6850fSThomas CortMove to the next field in the form field array. 72*a0e6850fSThomas Cort.It REQ_PREV_FIELD 73*a0e6850fSThomas CortMove to the previous field in the form field array. 74*a0e6850fSThomas Cort.It REQ_FIRST_FIELD 75*a0e6850fSThomas CortGo to the first field in the form field array. 76*a0e6850fSThomas Cort.It REQ_LAST_FIELD 77*a0e6850fSThomas CortGo to the last field in the form field array. 78*a0e6850fSThomas Cort.It REQ_SNEXT_FIELD 79*a0e6850fSThomas CortMove to the next sorted field on the form. 80*a0e6850fSThomas Cort.It REQ_SPREV_FIELD 81*a0e6850fSThomas CortMove to the previous sorted field on the form. 82*a0e6850fSThomas Cort.It REQ_SFIRST_FIELD 83*a0e6850fSThomas CortGo to the first field in the sorted list. 84*a0e6850fSThomas Cort.It REQ_SLAST_FIELD 85*a0e6850fSThomas CortMove to the last field in the sorted list. 86*a0e6850fSThomas Cort.It REQ_LEFT_FIELD 87*a0e6850fSThomas CortGo one field to the left on the form page. 88*a0e6850fSThomas Cort.It REQ_RIGHT_FIELD 89*a0e6850fSThomas CortGo one field to the right on the form page. 90*a0e6850fSThomas Cort.It REQ_UP_FIELD 91*a0e6850fSThomas CortGo up one field on the form page. 92*a0e6850fSThomas Cort.It REQ_DOWN_FIELD 93*a0e6850fSThomas CortGo down one field on the form page. 94*a0e6850fSThomas Cort.It REQ_NEXT_CHAR 95*a0e6850fSThomas CortMove one char to the right within the field 96*a0e6850fSThomas Cort.It REQ_PREV_CHAR 97*a0e6850fSThomas CortMove one char to the left within the current field. 98*a0e6850fSThomas Cort.It REQ_NEXT_LINE 99*a0e6850fSThomas CortGo down one line in the current field. 100*a0e6850fSThomas Cort.It REQ_PREV_LINE 101*a0e6850fSThomas CortGo up one line in the current field. 102*a0e6850fSThomas Cort.It REQ_NEXT_WORD 103*a0e6850fSThomas CortGo forward one word in the current field 104*a0e6850fSThomas Cort.It REQ_PREV_WORD 105*a0e6850fSThomas CortGo backward one word in the current field. 106*a0e6850fSThomas Cort.It REQ_BEG_FIELD 107*a0e6850fSThomas CortMove the cursor to the beginning of the current field. 108*a0e6850fSThomas Cort.It REQ_END_FIELD 109*a0e6850fSThomas CortMove the cursor to the end of the current field. 110*a0e6850fSThomas Cort.It REQ_BEG_LINE 111*a0e6850fSThomas CortMove the cursor to the beginning of the line in the current field. 112*a0e6850fSThomas Cort.It REQ_END_LINE 113*a0e6850fSThomas CortMove the cursor to the end of the line. 114*a0e6850fSThomas Cort.It REQ_LEFT_CHAR 115*a0e6850fSThomas CortMove the cursor left one character 116*a0e6850fSThomas Cort.It REQ_RIGHT_CHAR 117*a0e6850fSThomas CortMove the cursor right one character 118*a0e6850fSThomas Cort.It REQ_UP_CHAR 119*a0e6850fSThomas CortMove the cursor up one line. 120*a0e6850fSThomas Cort.It REQ_DOWN_CHAR 121*a0e6850fSThomas CortMove the cursor down one line. 122*a0e6850fSThomas Cort.It REQ_NEW_LINE 123*a0e6850fSThomas CortInsert a new line at the current cursor position. 124*a0e6850fSThomas Cort.It REQ_INS_CHAR 125*a0e6850fSThomas CortInsert a blank character at the current cursor position 126*a0e6850fSThomas Cort.It REQ_INS_LINE 127*a0e6850fSThomas CortOpen a blank line at the current cursor position. 128*a0e6850fSThomas Cort.It REQ_DEL_CHAR 129*a0e6850fSThomas CortDelete the character at the current cursor position. 130*a0e6850fSThomas Cort.It REQ_DEL_PREV 131*a0e6850fSThomas CortDelete the character to the left of the current cursor position. 132*a0e6850fSThomas Cort.It REQ_DEL_LINE 133*a0e6850fSThomas CortDelete the current line. 134*a0e6850fSThomas Cort.It REQ_DEL_WORD 135*a0e6850fSThomas CortDelete the word at the current cursor position. 136*a0e6850fSThomas Cort.It REQ_CLR_EOL 137*a0e6850fSThomas CortClear the field from the current cursor position to the end of the 138*a0e6850fSThomas Cortcurrent line. 139*a0e6850fSThomas Cort.It REQ_CLR_EOF 140*a0e6850fSThomas CortClear the field from the current cursor position to the end of the field. 141*a0e6850fSThomas Cort.It REQ_CLR_FIELD 142*a0e6850fSThomas CortClear the field. 143*a0e6850fSThomas Cort.It REQ_OVL_MODE 144*a0e6850fSThomas CortEnter overlay mode, characters added to the field will replace the 145*a0e6850fSThomas Cortones already there. 146*a0e6850fSThomas Cort.It REQ_INS_MODE 147*a0e6850fSThomas CortEnter insert mode, characters will be inserted at the current cursor 148*a0e6850fSThomas Cortposition. 149*a0e6850fSThomas CortAny characters to the right of the cursor will be moved 150*a0e6850fSThomas Cortright to accommodate the new characters. 151*a0e6850fSThomas Cort.It REQ_SCR_FLINE 152*a0e6850fSThomas CortScroll the field forward one line. 153*a0e6850fSThomas Cort.It REQ_SCR_BLINE 154*a0e6850fSThomas CortScroll the field backward one line. 155*a0e6850fSThomas Cort.It REQ_SCR_FPAGE 156*a0e6850fSThomas CortScroll the field forward one field page. 157*a0e6850fSThomas Cort.It REQ_SCR_BPAGE 158*a0e6850fSThomas CortScroll the field backward one field page. 159*a0e6850fSThomas Cort.It REQ_SCR_FHPAGE 160*a0e6850fSThomas CortScroll the field forward half one field page. 161*a0e6850fSThomas Cort.It REQ_SCR_BHPAGE 162*a0e6850fSThomas CortScroll the field backward half one field page. 163*a0e6850fSThomas Cort.It REQ_SCR_FCHAR 164*a0e6850fSThomas CortScroll the field horizontally forward one character 165*a0e6850fSThomas Cort.It REQ_SCR_BCHAR 166*a0e6850fSThomas CortScroll the field horizontally backward one character 167*a0e6850fSThomas Cort.It REQ_SCR_HFLINE 168*a0e6850fSThomas CortScroll the field horizontally forward one field line. 169*a0e6850fSThomas Cort.It REQ_SCR_HBLINE 170*a0e6850fSThomas CortScroll the field horizontally backward one field line. 171*a0e6850fSThomas Cort.It REQ_SCR_HFHALF 172*a0e6850fSThomas CortScroll the field horizontally forward half a field line. 173*a0e6850fSThomas Cort.It REQ_SCR_HBHALF 174*a0e6850fSThomas CortScroll the field horizontally backward half a field line. 175*a0e6850fSThomas Cort.It REQ_VALIDATION 176*a0e6850fSThomas CortRequest the contents of the current field be validated using any field 177*a0e6850fSThomas Cortvalidation function that has been set for the field. 178*a0e6850fSThomas CortNormally, the field is validated before the current field changes. 179*a0e6850fSThomas CortThis request allows the current field to be validated. 180*a0e6850fSThomas Cort.It REQ_PREV_CHOICE 181*a0e6850fSThomas CortSelect the previous choice in an enumerated type field. 182*a0e6850fSThomas Cort.It REQ_NEXT_CHOICE 183*a0e6850fSThomas CortSelect the next choice in an enumerated type field. 184*a0e6850fSThomas Cort.El 185*a0e6850fSThomas Cort.Sh RETURN VALUES 186*a0e6850fSThomas CortFunctions returning pointers will return 187*a0e6850fSThomas Cort.Dv NULL 188*a0e6850fSThomas Cortif an error is detected. 189*a0e6850fSThomas CortThe functions that return an int will return one of the following error 190*a0e6850fSThomas Cortvalues: 191*a0e6850fSThomas Cort.Pp 192*a0e6850fSThomas Cort.Bl -tag -width E_UNKNOWN_COMMAND -compact 193*a0e6850fSThomas Cort.It Er E_OK 194*a0e6850fSThomas CortThe function was successful. 195*a0e6850fSThomas Cort.It Er E_REQUEST_DENIED 196*a0e6850fSThomas CortThe forms driver request could not be fulfilled 197*a0e6850fSThomas Cort.It Er E_UNKNOWN_COMMAND 198*a0e6850fSThomas CortThe passed character is not a printable character and is not a valid 199*a0e6850fSThomas Cortforms driver request. 200*a0e6850fSThomas Cort.It Er E_BAD_ARGUMENT 201*a0e6850fSThomas CortA bad argument was passed to the forms driver. 202*a0e6850fSThomas Cort.It Er E_INVALID_FIELD 203*a0e6850fSThomas CortThe form passed to the driver has no valid attached fields. 204*a0e6850fSThomas Cort.It Er E_NOT_POSTED 205*a0e6850fSThomas CortThe given form is not currently posted to the screen. 206*a0e6850fSThomas Cort.It Er E_BAD_STATE 207*a0e6850fSThomas CortThe forms driver was called from within an init or term function. 208*a0e6850fSThomas Cort.It Er E_INVALID_FIELD 209*a0e6850fSThomas CortThe character passed to the forms driver fails the character 210*a0e6850fSThomas Cortvalidation for the current field. 211*a0e6850fSThomas Cort.El 212*a0e6850fSThomas Cort.Sh SEE ALSO 213*a0e6850fSThomas Cort.Xr curses 3 , 214*a0e6850fSThomas Cort.Xr forms 3 215*a0e6850fSThomas Cort.Sh NOTES 216*a0e6850fSThomas CortField sorting is done by location of the field on the form page, the 217*a0e6850fSThomas Cortfields are sorted by position starting with the top-most, left-most 218*a0e6850fSThomas Cortfield and progressing left to right. 219*a0e6850fSThomas CortFor the purposes of sorting, the 220*a0e6850fSThomas Cortfields top left corner is used as the sort criteria. 221*a0e6850fSThomas CortThe header 222*a0e6850fSThomas Cort.In form.h 223*a0e6850fSThomas Cortautomatically includes both 224*a0e6850fSThomas Cort.In curses.h 225*a0e6850fSThomas Cortand 226*a0e6850fSThomas Cort.In eti.h . 227