]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - menu/m_hook.c
ncurses 6.2 - patch 20210619
[ncurses.git] / menu / m_hook.c
index f06992d6b9c5c2f29f03f3807920559ed0d33eeb..c7d9fe91af7fcee27830206e0b255c0a59ed4665 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2012,2016 Free Software Foundation, Inc.              *
+ * Copyright 2018-2020,2021 Thomas E. Dickey                                *
+ * Copyright 1998-2012,2016 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
 
 #include "menu.priv.h"
 
-MODULE_ID("$Id: m_hook.c,v 1.17 2016/01/23 21:32:00 tom Exp $")
+MODULE_ID("$Id: m_hook.c,v 1.21 2021/06/17 21:26:02 tom Exp $")
 
 /* "Template" macro to generate function to set application specific hook */
 #define GEN_HOOK_SET_FUNCTION( typ, name ) \
-NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (MENU *menu, Menu_Hook func )\
+MENU_EXPORT(int) NCURSES_API set_ ## typ ## _ ## name (MENU *menu, Menu_Hook func )\
 {\
-   T((T_CALLED("set_" #typ "_" #name "(%p,%p)"), (void *) menu, TR_FUNC(func)));\
+   TR_FUNC_BFR(1);\
+   T((T_CALLED("set_" #typ "_" #name "(%p,%s)"), (void *) menu, TR_FUNC_ARG(0, func)));\
    (Normalize_Menu(menu) -> typ ## name = func );\
    RETURN(E_OK);\
 }
 
 /* "Template" macro to generate function to get application specific hook */
 #define GEN_HOOK_GET_FUNCTION( typ, name ) \
-NCURSES_IMPEXP Menu_Hook NCURSES_API typ ## _ ## name ( const MENU *menu )\
+MENU_EXPORT(Menu_Hook) NCURSES_API typ ## _ ## name ( const MENU *menu )\
 {\
    T((T_CALLED(#typ "_" #name "(%p)"), (const void *) menu));\
    returnMenuHook(Normalize_Menu(menu) -> typ ## name);\
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnmenu  
+|   Facility      :  libnmenu
 |   Function      :  int set_menu_init(MENU *menu, void (*f)(MENU *))
-|   
+|
 |   Description   :  Set user-exit which is called when menu is posted
 |                    or just after the top row changes.
 |
@@ -68,11 +70,11 @@ NCURSES_IMPEXP Menu_Hook NCURSES_API typ ## _ ## name ( const MENU *menu )\
 GEN_HOOK_SET_FUNCTION(menu, init)
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnmenu  
+|   Facility      :  libnmenu
 |   Function      :  void (*)(MENU *) menu_init(const MENU *menu)
-|   
+|
 |   Description   :  Return address of user-exit function which is called
-|                    when a menu is posted or just after the top row 
+|                    when a menu is posted or just after the top row
 |                    changes.
 |
 |   Return Values :  Menu init function address or NULL
@@ -80,9 +82,9 @@ GEN_HOOK_SET_FUNCTION(menu, init)
 GEN_HOOK_GET_FUNCTION(menu, init)
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnmenu  
+|   Facility      :  libnmenu
 |   Function      :  int set_menu_term (MENU *menu, void (*f)(MENU *))
-|   
+|
 |   Description   :  Set user-exit which is called when menu is unposted
 |                    or just before the top row changes.
 |
@@ -91,11 +93,11 @@ GEN_HOOK_GET_FUNCTION(menu, init)
 GEN_HOOK_SET_FUNCTION(menu, term)
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnmenu  
+|   Facility      :  libnmenu
 |   Function      :  void (*)(MENU *) menu_term(const MENU *menu)
-|   
+|
 |   Description   :  Return address of user-exit function which is called
-|                    when a menu is unposted or just before the top row 
+|                    when a menu is unposted or just before the top row
 |                    changes.
 |
 |   Return Values :  Menu finalization function address or NULL
@@ -103,9 +105,9 @@ GEN_HOOK_SET_FUNCTION(menu, term)
 GEN_HOOK_GET_FUNCTION(menu, term)
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnmenu  
+|   Facility      :  libnmenu
 |   Function      :  int set_item_init (MENU *menu, void (*f)(MENU *))
-|   
+|
 |   Description   :  Set user-exit which is called when menu is posted
 |                    or just after the current item changes.
 |
@@ -114,11 +116,11 @@ GEN_HOOK_GET_FUNCTION(menu, term)
 GEN_HOOK_SET_FUNCTION(item, init)
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnmenu  
+|   Facility      :  libnmenu
 |   Function      :  void (*)(MENU *) item_init (const MENU *menu)
-|   
+|
 |   Description   :  Return address of user-exit function which is called
-|                    when a menu is posted or just after the current item 
+|                    when a menu is posted or just after the current item
 |                    changes.
 |
 |   Return Values :  Item init function address or NULL
@@ -126,9 +128,9 @@ GEN_HOOK_SET_FUNCTION(item, init)
 GEN_HOOK_GET_FUNCTION(item, init)
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnmenu  
+|   Facility      :  libnmenu
 |   Function      :  int set_item_term (MENU *menu, void (*f)(MENU *))
-|   
+|
 |   Description   :  Set user-exit which is called when menu is unposted
 |                    or just before the current item changes.
 |
@@ -137,11 +139,11 @@ GEN_HOOK_GET_FUNCTION(item, init)
 GEN_HOOK_SET_FUNCTION(item, term)
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnmenu  
+|   Facility      :  libnmenu
 |   Function      :  void (*)(MENU *) item_init (const MENU *menu)
-|   
+|
 |   Description   :  Return address of user-exit function which is called
-|                    when a menu is unposted or just before the current item 
+|                    when a menu is unposted or just before the current item
 |                    changes.
 |
 |   Return Values :  Item finalization function address or NULL