GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: lib/libform/frm_hook.c Lines: 0 8 0.0 %
Date: 2017-11-13 Branches: 0 0 0.0 %

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