1 /**************************************************************************** 2 * Copyright (c) 1998 Free Software Foundation, Inc. * 3 * * 4 * Permission is hereby granted, free of charge, to any person obtaining a * 5 * copy of this software and associated documentation files (the * 6 * "Software"), to deal in the Software without restriction, including * 7 * without limitation the rights to use, copy, modify, merge, publish, * 8 * distribute, distribute with modifications, sublicense, and/or sell * 9 * copies of the Software, and to permit persons to whom the Software is * 10 * furnished to do so, subject to the following conditions: * 11 * * 12 * The above copyright notice and this permission notice shall be included * 13 * in all copies or substantial portions of the Software. * 14 * * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 18 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 22 * * 23 * Except as contained in this notice, the name(s) of the above copyright * 24 * holders shall not be used in advertising or otherwise to promote the * 25 * sale, use or other dealings in this Software without prior written * 26 * authorization. * 27 ****************************************************************************/ 28 29 /**************************************************************************** 30 * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * 31 ****************************************************************************/ 32 33 #include "form.priv.h" 34 35 MODULE_ID("$Id: frm_hook.c,v 1.8 1999/05/16 17:21:04 juergen Exp $") 36 37 /* "Template" macro to generate function to set application specific hook */ 38 #define GEN_HOOK_SET_FUNCTION( typ, name ) \ 39 int set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\ 40 {\ 41 (Normalize_Form( form ) -> typ ## name) = func ;\ 42 RETURN(E_OK);\ 43 } 44 45 /* "Template" macro to generate function to get application specific hook */ 46 #define GEN_HOOK_GET_FUNCTION( typ, name ) \ 47 Form_Hook typ ## _ ## name ( const FORM *form )\ 48 {\ 49 return ( Normalize_Form( form ) -> typ ## name );\ 50 } 51 52 /*--------------------------------------------------------------------------- 53 | Facility : libnform 54 | Function : int set_field_init(FORM *form, Form_Hook f) 55 | 56 | Description : Assigns an application defined initialization function 57 | to be called when the form is posted and just after 58 | the current field changes. 59 | 60 | Return Values : E_OK - success 61 +--------------------------------------------------------------------------*/ 62 GEN_HOOK_SET_FUNCTION(field,init) 63 64 /*--------------------------------------------------------------------------- 65 | Facility : libnform 66 | Function : Form_Hook field_init(const FORM *form) 67 | 68 | Description : Retrieve field initialization routine address. 69 | 70 | Return Values : The address or NULL if no hook defined. 71 +--------------------------------------------------------------------------*/ 72 GEN_HOOK_GET_FUNCTION(field,init) 73 74 /*--------------------------------------------------------------------------- 75 | Facility : libnform 76 | Function : int set_field_term(FORM *form, Form_Hook f) 77 | 78 | Description : Assigns an application defined finalization function 79 | to be called when the form is unposted and just before 80 | the current field changes. 81 | 82 | Return Values : E_OK - success 83 +--------------------------------------------------------------------------*/ 84 GEN_HOOK_SET_FUNCTION(field,term) 85 86 /*--------------------------------------------------------------------------- 87 | Facility : libnform 88 | Function : Form_Hook field_term(const FORM *form) 89 | 90 | Description : Retrieve field finalization routine address. 91 | 92 | Return Values : The address or NULL if no hook defined. 93 +--------------------------------------------------------------------------*/ 94 GEN_HOOK_GET_FUNCTION(field,term) 95 96 /*--------------------------------------------------------------------------- 97 | Facility : libnform 98 | Function : int set_form_init(FORM *form, Form_Hook f) 99 | 100 | Description : Assigns an application defined initialization function 101 | to be called when the form is posted and just after 102 | a page change. 103 | 104 | Return Values : E_OK - success 105 +--------------------------------------------------------------------------*/ 106 GEN_HOOK_SET_FUNCTION(form,init) 107 108 /*--------------------------------------------------------------------------- 109 | Facility : libnform 110 | Function : Form_Hook form_init(const FORM *form) 111 | 112 | Description : Retrieve form initialization routine address. 113 | 114 | Return Values : The address or NULL if no hook defined. 115 +--------------------------------------------------------------------------*/ 116 GEN_HOOK_GET_FUNCTION(form,init) 117 118 /*--------------------------------------------------------------------------- 119 | Facility : libnform 120 | Function : int set_form_term(FORM *form, Form_Hook f) 121 | 122 | Description : Assigns an application defined finalization function 123 | to be called when the form is unposted and just before 124 | a page change. 125 | 126 | Return Values : E_OK - success 127 +--------------------------------------------------------------------------*/ 128 GEN_HOOK_SET_FUNCTION(form,term) 129 130 /*--------------------------------------------------------------------------- 131 | Facility : libnform 132 | Function : Form_Hook form_term(const FORM *form) 133 | 134 | Description : Retrieve form finalization routine address. 135 | 136 | Return Values : The address or NULL if no hook defined. 137 +--------------------------------------------------------------------------*/ 138 GEN_HOOK_GET_FUNCTION(form,term) 139 140 /* frm_hook.c ends here */ 141