1 2 /*************************************************************************** 3 * COPYRIGHT NOTICE * 4 **************************************************************************** 5 * ncurses is copyright (C) 1992-1995 * 6 * Zeyd M. Ben-Halim * 7 * zmbenhal@netcom.com * 8 * Eric S. Raymond * 9 * esr@snark.thyrsus.com * 10 * * 11 * Permission is hereby granted to reproduce and distribute ncurses * 12 * by any means and for any fee, whether alone or as part of a * 13 * larger distribution, in source or in binary form, PROVIDED * 14 * this notice is included with any such distribution, and is not * 15 * removed from any of its header files. Mention of ncurses in any * 16 * applications linked with it is highly appreciated. * 17 * * 18 * ncurses comes AS IS with no warranty, implied or expressed. * 19 * * 20 ***************************************************************************/ 21 22 #include "form.priv.h" 23 24 /* "Template" macro to generate function to set application specific hook */ 25 #define GEN_HOOK_SET_FUNCTION( typ, name ) \ 26 int set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\ 27 {\ 28 (Normalize_Form( form ) -> typ ## name) = func ;\ 29 RETURN(E_OK);\ 30 } 31 32 /* "Template" macro to generate function to get application specific hook */ 33 #define GEN_HOOK_GET_FUNCTION( typ, name ) \ 34 Form_Hook typ ## _ ## name ( const FORM *form )\ 35 {\ 36 return ( Normalize_Form( form ) -> typ ## name );\ 37 } 38 39 /*--------------------------------------------------------------------------- 40 | Facility : libnform 41 | Function : int set_field_init(FORM *form, Form_Hook f) 42 | 43 | Description : Assigns an application defined initialization function 44 | to be called when the form is posted and just after 45 | the current field changes. 46 | 47 | Return Values : E_OK - success 48 +--------------------------------------------------------------------------*/ 49 GEN_HOOK_SET_FUNCTION(field,init) 50 51 /*--------------------------------------------------------------------------- 52 | Facility : libnform 53 | Function : Form_Hook field_init(const FORM *form) 54 | 55 | Description : Retrieve field initialization routine address. 56 | 57 | Return Values : The address or NULL if no hook defined. 58 +--------------------------------------------------------------------------*/ 59 GEN_HOOK_GET_FUNCTION(field,init) 60 61 /*--------------------------------------------------------------------------- 62 | Facility : libnform 63 | Function : int set_field_term(FORM *form, Form_Hook f) 64 | 65 | Description : Assigns an application defined finalization function 66 | to be called when the form is unposted and just before 67 | the current field changes. 68 | 69 | Return Values : E_OK - success 70 +--------------------------------------------------------------------------*/ 71 GEN_HOOK_SET_FUNCTION(field,term) 72 73 /*--------------------------------------------------------------------------- 74 | Facility : libnform 75 | Function : Form_Hook field_term(const FORM *form) 76 | 77 | Description : Retrieve field finalization routine address. 78 | 79 | Return Values : The address or NULL if no hook defined. 80 +--------------------------------------------------------------------------*/ 81 GEN_HOOK_GET_FUNCTION(field,term) 82 83 /*--------------------------------------------------------------------------- 84 | Facility : libnform 85 | Function : int set_form_init(FORM *form, Form_Hook f) 86 | 87 | Description : Assigns an application defined initialization function 88 | to be called when the form is posted and just after 89 | a page change. 90 | 91 | Return Values : E_OK - success 92 +--------------------------------------------------------------------------*/ 93 GEN_HOOK_SET_FUNCTION(form,init) 94 95 /*--------------------------------------------------------------------------- 96 | Facility : libnform 97 | Function : Form_Hook form_init(const FORM *form) 98 | 99 | Description : Retrieve form initialization routine address. 100 | 101 | Return Values : The address or NULL if no hook defined. 102 +--------------------------------------------------------------------------*/ 103 GEN_HOOK_GET_FUNCTION(form,init) 104 105 /*--------------------------------------------------------------------------- 106 | Facility : libnform 107 | Function : int set_form_term(FORM *form, Form_Hook f) 108 | 109 | Description : Assigns an application defined finalization function 110 | to be called when the form is unposted and just before 111 | a page change. 112 | 113 | Return Values : E_OK - success 114 +--------------------------------------------------------------------------*/ 115 GEN_HOOK_SET_FUNCTION(form,term) 116 117 /*--------------------------------------------------------------------------- 118 | Facility : libnform 119 | Function : Form_Hook form_term(const FORM *form) 120 | 121 | Description : Retrieve form finalization routine address. 122 | 123 | Return Values : The address or NULL if no hook defined. 124 +--------------------------------------------------------------------------*/ 125 GEN_HOOK_GET_FUNCTION(form,term) 126 127 /* frm_hook.c ends here */ 128