MyWebUniversity.com Home Page
 



Darwin Mac OS X man pages main menu
formfieldtype(3X)                                          formfieldtype(3X)



NAME
       formfieldtype - define validation-field types

SYNOPSIS
       ##include <>
       FIELDTYPE *newfieldtype(
           bool (* const fieldcheck)(FIELD *, const void *),
           bool (* const charcheck)(int, const void *));
       int freefieldtype(FIELDTYPE *fieldtype);
       int setfieldtypearg(
           FIELDTYPE *fieldtype,
           void *(* const makearg)(valist *),
           void *(* const copyarg)(const void *),
           void  (* const freearg)(void *));
       int setfieldtypechoice(
           FIELDTYPE *fieldtype,
           bool (* const nextchoice)(FIELD *, const void *),
           bool (* const prevchoice)(FIELD *, const void *));
       FIELDTYPE *linkfieldtype(FIELDTYPE *type1,
                                 FIELDTYPE *type2);

DESCRIPTION
       The  function  newfieldtype  creates  a new field type usable for data
       validation.  You supply it with fieldcheck, a predicate to  check  the
       validity  of an entered data string whenever the user attempts to leave
       a field.  The (FIELD *) argument is passed in so the validation  predi-
       cate can see the field's buffer, sizes and other attributes; the second
       argument is an argument-block structure, about which more below.

       You also supply newfieldtype with charcheck, a function  to  validate
       input  characters  as they are entered; it will be passed the character
       to be checked and a pointer to an argument-block structure.

       The function freefieldtype frees the space allocated for a given vali-
       dation type.

       The  function  setfieldtypearg  associates  three  storage-management
       functions with a field type.  The makearg  function  is  automatically
       applied to the list of arguments you give setfieldtype when attaching
       validation to a field; its job is to bundle  these  into  an  allocated
       argument-block  object  which  can later be passed to validation predi-
       cated.  The other two hook arguments should  copy  and  free  argument-
       block  structures.   They  will  be used by the forms-driver code.  You
       must supply the makearg function, the other two are optional, you  may
       supply  NUL  for  them.  In this case it is assumed that makearg does
       not allocate memory but simply loads the argument into a single  scalar
       value.

       The function linkfieldtype creates a new field type from the two given
       types.  They are connected by an logical 'OR'.

       The form driver requests  REQNEXTCHOICE  and  REQPREVCHOICE  assume
       that  the  possible  values of a field form an ordered set, and provide
       the forms user with a way to move  through  the  set.   The  setfield-
       typechoice  function  allows forms programmers to define successor and
       predecessor functions for the field type.   These  functions  take  the
       field pointer and an argument-block structure as arguments.

RETURN VALUE
       The pointer-valued routines return NUL on error.

       The integer-valued routines return one of the following codes on error:

       EOK The routine succeeded.

       ESYSTEMEROR
            System error occurred (see errno).

       EBADARGUMENT
            Routine detected an incorrect or out-of-range argument.

       ECONECTED
            The field is already connected to a form.

SEE ALSO
       curses(3X), form(3X).

NOTES
       The  header  file  <>  automatically  includes  the  header  file
       <>.

       All  of  the  (char  **) arguments of these functions should actually be
       (void **).  The type has been left uncorrected for strict  compatibility
       with System V.

PORTABILITY
       These  routines emulate the System V forms library.  They were not sup-
       ported on Version 7 or BSD versions.

AUTHORS
       Juergen Pfeifer.  Manual pages and adaptation for new curses by Eric S.
       Raymond.



                                                            formfieldtype(3X)
Darwin Mac OS X man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™