[Top] [Prev] [Next] [Bottom]

frmmisc(3)

frmmisc(3)

Name

frmmisc-miscellaneous forms routines

Synopsis

#include "fml.h"

extern char *extmskpath; /* maskpath */
extern char *extcache; /* mask cache */

int frmval(frmname,fbfr,fldid,oc,errmsg)
char *frmname; /* form name, without the .M suffix */
FBFR *fbfr; /* fielded buffer to be validated */
FLDID *fldid; /* field id of field in error */
int *oc; /* occurrence number of field in error */
char **errmsg; /* error message for incorrect field */

int frmflds(frmname,fldids,occs,max)
char *frmname; /* form name, without the .M suffix */
FLDID *fldids; /* points to array of field ids */
int *occs; /* points to array of occurrences */
int max; /* size of fldids and occs arrays */

Description

frmval() validates a fielded buffer, fbfr, based on the validations present in the compiled mask frmname. It returns 1 if fbfr passes the validation, \-1 if frmname is non-existent or can't be read in for any reason, and 0 if fbfr fails the validations. In the last case fldid and occno point to the field id and occurrence number of the field in error. errmsg points to a character array that contains the error message that would appear on the form's status line if the form were actually displayed on the screen. The value pointed to by errmsg is valid only until the next call of frmval().

frmflds() returns the number of fields present in frmname and places the field ids and occurrence numbers of those fields in arrays fldids and occs respectively. Only max fields are placed in the arrays, however the actual number of fields on the mask is always returned. frmflds() returns a \-1 if it couldn't access frmname for any reason.

Prior to calling these routines extmskpath should be set to the mask path, and extcache should be set to the mask cache address (see loadfiles(1)). When these routines are called from within a validation function that is linked into mio(1) it is not necessary to initialize these variables because they are initialized by mio. For the routines listed above, frmname should be passed as the form name without the .M suffix.

Programs callling these functions should be linked with the following libraries in the given order:

$TUXDIR/lib/libtfrm.a, 
$TUXDIR/lib/libfml.a,
$TUXDIR/lib/libgp.a,
and the standard math library.

Notices

The callers of these routines may want to supply their own version of formexit, a routine that is called in fatal situations, such as malloc failures.

See Also

loadfiles(1), mio(1)



[Top] [Prev] [Next] [Bottom]