frm_hook.c revision 1.2
1/*-----------------------------------------------------------------------------+ 2| The ncurses form library is Copyright (C) 1995-1997 | 3| by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> | 4| All Rights Reserved. | 5| | 6| Permission to use, copy, modify, and distribute this software and its | 7| documentation for any purpose and without fee is hereby granted, provided | 8| that the above copyright notice appear in all copies and that both that | 9| copyright notice and this permission notice appear in supporting | 10| documentation, and that the name of the above listed copyright holder(s) not | 11| be used in advertising or publicity pertaining to distribution of the | 12| software without specific, written prior permission. | 13| | 14| THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO | 15| THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- | 16| NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR | 17| ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- | 18| SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | 19| NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH | 20| THE USE OR PERFORMANCE OF THIS SOFTWARE. | 21+-----------------------------------------------------------------------------*/ 22 23#include "form.priv.h" 24 25MODULE_ID("Id: frm_hook.c,v 1.5 1997/05/01 16:47:54 juergen Exp $") 26 27/* "Template" macro to generate function to set application specific hook */ 28#define GEN_HOOK_SET_FUNCTION( typ, name ) \ 29int set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\ 30{\ 31 (Normalize_Form( form ) -> typ ## name) = func ;\ 32 RETURN(E_OK);\ 33} 34 35/* "Template" macro to generate function to get application specific hook */ 36#define GEN_HOOK_GET_FUNCTION( typ, name ) \ 37Form_Hook typ ## _ ## name ( const FORM *form )\ 38{\ 39 return ( Normalize_Form( form ) -> typ ## name );\ 40} 41 42/*--------------------------------------------------------------------------- 43| Facility : libnform 44| Function : int set_field_init(FORM *form, Form_Hook f) 45| 46| Description : Assigns an application defined initialization function 47| to be called when the form is posted and just after 48| the current field changes. 49| 50| Return Values : E_OK - success 51+--------------------------------------------------------------------------*/ 52GEN_HOOK_SET_FUNCTION(field,init) 53 54/*--------------------------------------------------------------------------- 55| Facility : libnform 56| Function : Form_Hook field_init(const FORM *form) 57| 58| Description : Retrieve field initialization routine address. 59| 60| Return Values : The address or NULL if no hook defined. 61+--------------------------------------------------------------------------*/ 62GEN_HOOK_GET_FUNCTION(field,init) 63 64/*--------------------------------------------------------------------------- 65| Facility : libnform 66| Function : int set_field_term(FORM *form, Form_Hook f) 67| 68| Description : Assigns an application defined finalization function 69| to be called when the form is unposted and just before 70| the current field changes. 71| 72| Return Values : E_OK - success 73+--------------------------------------------------------------------------*/ 74GEN_HOOK_SET_FUNCTION(field,term) 75 76/*--------------------------------------------------------------------------- 77| Facility : libnform 78| Function : Form_Hook field_term(const FORM *form) 79| 80| Description : Retrieve field finalization routine address. 81| 82| Return Values : The address or NULL if no hook defined. 83+--------------------------------------------------------------------------*/ 84GEN_HOOK_GET_FUNCTION(field,term) 85 86/*--------------------------------------------------------------------------- 87| Facility : libnform 88| Function : int set_form_init(FORM *form, Form_Hook f) 89| 90| Description : Assigns an application defined initialization function 91| to be called when the form is posted and just after 92| a page change. 93| 94| Return Values : E_OK - success 95+--------------------------------------------------------------------------*/ 96GEN_HOOK_SET_FUNCTION(form,init) 97 98/*--------------------------------------------------------------------------- 99| Facility : libnform 100| Function : Form_Hook form_init(const FORM *form) 101| 102| Description : Retrieve form initialization routine address. 103| 104| Return Values : The address or NULL if no hook defined. 105+--------------------------------------------------------------------------*/ 106GEN_HOOK_GET_FUNCTION(form,init) 107 108/*--------------------------------------------------------------------------- 109| Facility : libnform 110| Function : int set_form_term(FORM *form, Form_Hook f) 111| 112| Description : Assigns an application defined finalization function 113| to be called when the form is unposted and just before 114| a page change. 115| 116| Return Values : E_OK - success 117+--------------------------------------------------------------------------*/ 118GEN_HOOK_SET_FUNCTION(form,term) 119 120/*--------------------------------------------------------------------------- 121| Facility : libnform 122| Function : Form_Hook form_term(const FORM *form) 123| 124| Description : Retrieve form finalization routine address. 125| 126| Return Values : The address or NULL if no hook defined. 127+--------------------------------------------------------------------------*/ 128GEN_HOOK_GET_FUNCTION(form,term) 129 130/* frm_hook.c ends here */ 131