frm_hook.c revision 50276
1243789Sdim/****************************************************************************
2243789Sdim * Copyright (c) 1998 Free Software Foundation, Inc.                        *
3243789Sdim *                                                                          *
4243789Sdim * Permission is hereby granted, free of charge, to any person obtaining a  *
5243789Sdim * copy of this software and associated documentation files (the            *
6243789Sdim * "Software"), to deal in the Software without restriction, including      *
7243789Sdim * without limitation the rights to use, copy, modify, merge, publish,      *
8243789Sdim * distribute, distribute with modifications, sublicense, and/or sell       *
9243789Sdim * copies of the Software, and to permit persons to whom the Software is    *
10296417Sdim * furnished to do so, subject to the following conditions:                 *
11296417Sdim *                                                                          *
12296417Sdim * The above copyright notice and this permission notice shall be included  *
13296417Sdim * in all copies or substantial portions of the Software.                   *
14296417Sdim *                                                                          *
15296417Sdim * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16296417Sdim * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17296417Sdim * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18296417Sdim * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19296417Sdim * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20296417Sdim * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21296417Sdim * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22296417Sdim *                                                                          *
23296417Sdim * Except as contained in this notice, the name(s) of the above copyright   *
24276479Sdim * holders shall not be used in advertising or otherwise to promote the     *
25243789Sdim * sale, use or other dealings in this Software without prior written       *
26276479Sdim * authorization.                                                           *
27243789Sdim ****************************************************************************/
28296417Sdim
29296417Sdim/****************************************************************************
30243789Sdim *   Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997            *
31296417Sdim ****************************************************************************/
32296417Sdim
33296417Sdim#include "form.priv.h"
34296417Sdim
35243789SdimMODULE_ID("$Id: frm_hook.c,v 1.8 1999/05/16 17:21:04 juergen Exp $")
36243789Sdim
37243789Sdim/* "Template" macro to generate function to set application specific hook */
38243789Sdim#define GEN_HOOK_SET_FUNCTION( typ, name ) \
39243789Sdimint set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\
40243789Sdim{\
41243789Sdim   (Normalize_Form( form ) -> typ ## name) = func ;\
42243789Sdim   RETURN(E_OK);\
43296417Sdim}
44296417Sdim
45296417Sdim/* "Template" macro to generate function to get application specific hook */
46296417Sdim#define GEN_HOOK_GET_FUNCTION( typ, name ) \
47296417SdimForm_Hook typ ## _ ## name ( const FORM *form )\
48243789Sdim{\
49243789Sdim   return ( Normalize_Form( form ) -> typ ## name );\
50249423Sdim}
51296417Sdim
52296417Sdim/*---------------------------------------------------------------------------
53296417Sdim|   Facility      :  libnform
54243789Sdim|   Function      :  int set_field_init(FORM *form, Form_Hook f)
55243789Sdim|
56296417Sdim|   Description   :  Assigns an application defined initialization function
57296417Sdim|                    to be called when the form is posted and just after
58296417Sdim|                    the current field changes.
59296417Sdim|
60296417Sdim|   Return Values :  E_OK      - success
61243789Sdim+--------------------------------------------------------------------------*/
62243789SdimGEN_HOOK_SET_FUNCTION(field,init)
63243789Sdim
64243789Sdim/*---------------------------------------------------------------------------
65243789Sdim|   Facility      :  libnform
66243789Sdim|   Function      :  Form_Hook field_init(const FORM *form)
67243789Sdim|
68243789Sdim|   Description   :  Retrieve field initialization routine address.
69243789Sdim|
70243789Sdim|   Return Values :  The address or NULL if no hook defined.
71243789Sdim+--------------------------------------------------------------------------*/
72243789SdimGEN_HOOK_GET_FUNCTION(field,init)
73243789Sdim
74243789Sdim/*---------------------------------------------------------------------------
75243789Sdim|   Facility      :  libnform
76243789Sdim|   Function      :  int set_field_term(FORM *form, Form_Hook f)
77243789Sdim|
78243789Sdim|   Description   :  Assigns an application defined finalization function
79243789Sdim|                    to be called when the form is unposted and just before
80243789Sdim|                    the current field changes.
81243789Sdim|
82243789Sdim|   Return Values :  E_OK      - success
83243789Sdim+--------------------------------------------------------------------------*/
84243789SdimGEN_HOOK_SET_FUNCTION(field,term)
85243789Sdim
86243789Sdim/*---------------------------------------------------------------------------
87243789Sdim|   Facility      :  libnform
88243789Sdim|   Function      :  Form_Hook field_term(const FORM *form)
89243789Sdim|
90243789Sdim|   Description   :  Retrieve field finalization routine address.
91243789Sdim|
92243789Sdim|   Return Values :  The address or NULL if no hook defined.
93243789Sdim+--------------------------------------------------------------------------*/
94243789SdimGEN_HOOK_GET_FUNCTION(field,term)
95243789Sdim
96243789Sdim/*---------------------------------------------------------------------------
97243789Sdim|   Facility      :  libnform
98243789Sdim|   Function      :  int set_form_init(FORM *form, Form_Hook f)
99243789Sdim|
100243789Sdim|   Description   :  Assigns an application defined initialization function
101243789Sdim|                    to be called when the form is posted and just after
102243789Sdim|                    a page change.
103243789Sdim|
104243789Sdim|   Return Values :  E_OK       - success
105243789Sdim+--------------------------------------------------------------------------*/
106243789SdimGEN_HOOK_SET_FUNCTION(form,init)
107243789Sdim
108243789Sdim/*---------------------------------------------------------------------------
109243789Sdim|   Facility      :  libnform
110243789Sdim|   Function      :  Form_Hook form_init(const FORM *form)
111243789Sdim|
112243789Sdim|   Description   :  Retrieve form initialization routine address.
113243789Sdim|
114243789Sdim|   Return Values :  The address or NULL if no hook defined.
115243789Sdim+--------------------------------------------------------------------------*/
116243789SdimGEN_HOOK_GET_FUNCTION(form,init)
117243789Sdim
118243789Sdim/*---------------------------------------------------------------------------
119243789Sdim|   Facility      :  libnform
120243789Sdim|   Function      :  int set_form_term(FORM *form, Form_Hook f)
121243789Sdim|
122243789Sdim|   Description   :  Assigns an application defined finalization function
123243789Sdim|                    to be called when the form is unposted and just before
124243789Sdim|                    a page change.
125243789Sdim|
126243789Sdim|   Return Values :  E_OK       - success
127243789Sdim+--------------------------------------------------------------------------*/
128243789SdimGEN_HOOK_SET_FUNCTION(form,term)
129243789Sdim
130243789Sdim/*---------------------------------------------------------------------------
131243789Sdim|   Facility      :  libnform
132243789Sdim|   Function      :  Form_Hook form_term(const FORM *form)
133243789Sdim|
134243789Sdim|   Description   :  Retrieve form finalization routine address.
135243789Sdim|
136243789Sdim|   Return Values :  The address or NULL if no hook defined.
137243789Sdim+--------------------------------------------------------------------------*/
138243789SdimGEN_HOOK_GET_FUNCTION(form,term)
139243789Sdim
140243789Sdim/* frm_hook.c ends here */
141243789Sdim