mb/google/brya/var/orisa: Update Type C DisplayPort HPD Configuration
[coreboot2.git] / payloads / libpayload / curses / menu / m_hook.c
blobdf78d0af1e8e739ab25877e04bbba7dc70dac23f
1 /****************************************************************************
2 * Copyright (c) 1998-2004,2010 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 ****************************************************************************/
29 /****************************************************************************
30 * Author: Juergen Pfeifer, 1995,1997 *
31 ****************************************************************************/
33 /***************************************************************************
34 * Module m_hook *
35 * Assign application specific routines for automatic invocation by menus *
36 ***************************************************************************/
38 #include "menu.priv.h"
40 MODULE_ID("$Id: m_hook.c,v 1.15 2010/01/23 21:16:54 tom Exp $")
42 /* "Template" macro to generate function to set application specific hook */
43 #define GEN_HOOK_SET_FUNCTION( typ, name ) \
44 NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (MENU *menu, Menu_Hook func )\
46 T((T_CALLED("set_" #typ "_" #name "(%p,%p)"), menu, func));\
47 (Normalize_Menu(menu) -> typ ## name = func );\
48 RETURN(E_OK);\
51 /* "Template" macro to generate function to get application specific hook */
52 #define GEN_HOOK_GET_FUNCTION( typ, name ) \
53 NCURSES_IMPEXP Menu_Hook NCURSES_API typ ## _ ## name ( const MENU *menu )\
55 T((T_CALLED(#typ "_" #name "(%p)"), (const void *) menu));\
56 returnMenuHook(Normalize_Menu(menu) -> typ ## name);\
59 /*---------------------------------------------------------------------------
60 | Facility : libnmenu
61 | Function : int set_menu_init(MENU *menu, void (*f)(MENU *))
63 | Description : Set user-exit which is called when menu is posted
64 | or just after the top row changes.
66 | Return Values : E_OK - success
67 +--------------------------------------------------------------------------*/
68 GEN_HOOK_SET_FUNCTION(menu, init)
70 /*---------------------------------------------------------------------------
71 | Facility : libnmenu
72 | Function : void (*)(MENU *) menu_init(const MENU *menu)
74 | Description : Return address of user-exit function which is called
75 | when a menu is posted or just after the top row
76 | changes.
78 | Return Values : Menu init function address or NULL
79 +--------------------------------------------------------------------------*/
80 GEN_HOOK_GET_FUNCTION(menu, init)
82 /*---------------------------------------------------------------------------
83 | Facility : libnmenu
84 | Function : int set_menu_term (MENU *menu, void (*f)(MENU *))
86 | Description : Set user-exit which is called when menu is unposted
87 | or just before the top row changes.
89 | Return Values : E_OK - success
90 +--------------------------------------------------------------------------*/
91 GEN_HOOK_SET_FUNCTION(menu, term)
93 /*---------------------------------------------------------------------------
94 | Facility : libnmenu
95 | Function : void (*)(MENU *) menu_term(const MENU *menu)
97 | Description : Return address of user-exit function which is called
98 | when a menu is unposted or just before the top row
99 | changes.
101 | Return Values : Menu finalization function address or NULL
102 +--------------------------------------------------------------------------*/
103 GEN_HOOK_GET_FUNCTION(menu, term)
105 /*---------------------------------------------------------------------------
106 | Facility : libnmenu
107 | Function : int set_item_init (MENU *menu, void (*f)(MENU *))
109 | Description : Set user-exit which is called when menu is posted
110 | or just after the current item changes.
112 | Return Values : E_OK - success
113 +--------------------------------------------------------------------------*/
114 GEN_HOOK_SET_FUNCTION(item, init)
116 /*---------------------------------------------------------------------------
117 | Facility : libnmenu
118 | Function : void (*)(MENU *) item_init (const MENU *menu)
120 | Description : Return address of user-exit function which is called
121 | when a menu is posted or just after the current item
122 | changes.
124 | Return Values : Item init function address or NULL
125 +--------------------------------------------------------------------------*/
126 GEN_HOOK_GET_FUNCTION(item, init)
128 /*---------------------------------------------------------------------------
129 | Facility : libnmenu
130 | Function : int set_item_term (MENU *menu, void (*f)(MENU *))
132 | Description : Set user-exit which is called when menu is unposted
133 | or just before the current item changes.
135 | Return Values : E_OK - success
136 +--------------------------------------------------------------------------*/
137 GEN_HOOK_SET_FUNCTION(item, term)
139 /*---------------------------------------------------------------------------
140 | Facility : libnmenu
141 | Function : void (*)(MENU *) item_init (const MENU *menu)
143 | Description : Return address of user-exit function which is called
144 | when a menu is unposted or just before the current item
145 | changes.
147 | Return Values : Item finalization function address or NULL
148 +--------------------------------------------------------------------------*/
149 GEN_HOOK_GET_FUNCTION(item, term)
151 /* m_hook.c ends here */