1 /*-----------------------------------------------------------------------------+
2 | The ncurses form library is Copyright (C) 1995-1997 |
3 | by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> |
4 | All Rights Reserved. |
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. |
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 +-----------------------------------------------------------------------------*/
23 #include "form.priv.h"
25 MODULE_ID("$Id: frm_hook.c,v 1.5 1997/05/01 16:47:54 juergen Exp $")
27 /* "Template" macro to generate function to set application specific hook */
28 #define GEN_HOOK_SET_FUNCTION( typ, name ) \
29 int set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\
31 (Normalize_Form( form ) -> typ ## name) = func ;\
35 /* "Template" macro to generate function to get application specific hook */
36 #define GEN_HOOK_GET_FUNCTION( typ, name ) \
37 Form_Hook typ ## _ ## name ( const FORM *form )\
39 return ( Normalize_Form( form ) -> typ ## name );\
42 /*---------------------------------------------------------------------------
44 | Function : int set_field_init(FORM *form, Form_Hook f)
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.
50 | Return Values : E_OK - success
51 +--------------------------------------------------------------------------*/
52 GEN_HOOK_SET_FUNCTION(field,init)
54 /*---------------------------------------------------------------------------
56 | Function : Form_Hook field_init(const FORM *form)
58 | Description : Retrieve field initialization routine address.
60 | Return Values : The address or NULL if no hook defined.
61 +--------------------------------------------------------------------------*/
62 GEN_HOOK_GET_FUNCTION(field,init)
64 /*---------------------------------------------------------------------------
66 | Function : int set_field_term(FORM *form, Form_Hook f)
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.
72 | Return Values : E_OK - success
73 +--------------------------------------------------------------------------*/
74 GEN_HOOK_SET_FUNCTION(field,term)
76 /*---------------------------------------------------------------------------
78 | Function : Form_Hook field_term(const FORM *form)
80 | Description : Retrieve field finalization routine address.
82 | Return Values : The address or NULL if no hook defined.
83 +--------------------------------------------------------------------------*/
84 GEN_HOOK_GET_FUNCTION(field,term)
86 /*---------------------------------------------------------------------------
88 | Function : int set_form_init(FORM *form, Form_Hook f)
90 | Description : Assigns an application defined initialization function
91 | to be called when the form is posted and just after
94 | Return Values : E_OK - success
95 +--------------------------------------------------------------------------*/
96 GEN_HOOK_SET_FUNCTION(form,init)
98 /*---------------------------------------------------------------------------
100 | Function : Form_Hook form_init(const FORM *form)
102 | Description : Retrieve form initialization routine address.
104 | Return Values : The address or NULL if no hook defined.
105 +--------------------------------------------------------------------------*/
106 GEN_HOOK_GET_FUNCTION(form,init)
108 /*---------------------------------------------------------------------------
109 | Facility : libnform
110 | Function : int set_form_term(FORM *form, Form_Hook f)
112 | Description : Assigns an application defined finalization function
113 | to be called when the form is unposted and just before
116 | Return Values : E_OK - success
117 +--------------------------------------------------------------------------*/
118 GEN_HOOK_SET_FUNCTION(form,term)
120 /*---------------------------------------------------------------------------
121 | Facility : libnform
122 | Function : Form_Hook form_term(const FORM *form)
124 | Description : Retrieve form finalization routine address.
126 | Return Values : The address or NULL if no hook defined.
127 +--------------------------------------------------------------------------*/
128 GEN_HOOK_GET_FUNCTION(form,term)
130 /* frm_hook.c ends here */