11590Srgrimes/**************************************************************************** 21590Srgrimes * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * 31590Srgrimes * * 41590Srgrimes * Permission is hereby granted, free of charge, to any person obtaining a * 51590Srgrimes * copy of this software and associated documentation files (the * 61590Srgrimes * "Software"), to deal in the Software without restriction, including * 71590Srgrimes * without limitation the rights to use, copy, modify, merge, publish, * 81590Srgrimes * distribute, distribute with modifications, sublicense, and/or sell * 91590Srgrimes * copies of the Software, and to permit persons to whom the Software is * 101590Srgrimes * furnished to do so, subject to the following conditions: * 111590Srgrimes * * 121590Srgrimes * The above copyright notice and this permission notice shall be included * 131590Srgrimes * in all copies or substantial portions of the Software. * 141590Srgrimes * * 151590Srgrimes * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 161590Srgrimes * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 171590Srgrimes * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 181590Srgrimes * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 191590Srgrimes * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 201590Srgrimes * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 211590Srgrimes * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 221590Srgrimes * * 231590Srgrimes * Except as contained in this notice, the name(s) of the above copyright * 241590Srgrimes * holders shall not be used in advertising or otherwise to promote the * 251590Srgrimes * sale, use or other dealings in this Software without prior written * 261590Srgrimes * authorization. * 271590Srgrimes ****************************************************************************/ 281590Srgrimes 291590Srgrimes/**************************************************************************** 301590Srgrimes * Author: Juergen Pfeifer, 1995,1997 * 311590Srgrimes ****************************************************************************/ 3260833Sjake 3360833Sjake/*************************************************************************** 341590Srgrimes* Module m_userptr * 351590Srgrimes* Associate application data with menus * 361590Srgrimes***************************************************************************/ 3778201Sdd 381590Srgrimes#include "menu.priv.h" 391590Srgrimes 401590SrgrimesMODULE_ID("$Id: m_userptr.c,v 1.17 2010/01/23 21:20:10 tom Exp $") 411590Srgrimes 421590Srgrimes/*--------------------------------------------------------------------------- 4378201Sdd| Facility : libnmenu 441590Srgrimes| Function : int set_menu_userptr(MENU *menu, void *userptr) 451590Srgrimes| 461590Srgrimes| Description : Set the pointer that is reserved in any menu to store 471590Srgrimes| application relevant informations. 481590Srgrimes| 491590Srgrimes| Return Values : E_OK - success 501590Srgrimes+--------------------------------------------------------------------------*/ 5174588SacheNCURSES_EXPORT(int) 5216438Sacheset_menu_userptr(MENU * menu, void *userptr) 531590Srgrimes{ 541590Srgrimes T((T_CALLED("set_menu_userptr(%p,%p)"), (void *)menu, (void *)userptr)); 551590Srgrimes Normalize_Menu(menu)->userptr = userptr; 561590Srgrimes RETURN(E_OK); 571590Srgrimes} 581590Srgrimes 591590Srgrimes/*--------------------------------------------------------------------------- 601590Srgrimes| Facility : libnmenu 6111547Sdg| Function : void *menu_userptr(const MENU *menu) 621590Srgrimes| 631590Srgrimes| Description : Return the pointer that is reserved in any menu to 641590Srgrimes| store application relevant informations. 6577291Sdd| 661590Srgrimes| Return Values : Value of the pointer. If no such pointer has been set, 671590Srgrimes| NULL is returned 681590Srgrimes+--------------------------------------------------------------------------*/ 691590SrgrimesNCURSES_EXPORT(void *) 701590Srgrimesmenu_userptr(const MENU * menu) 711590Srgrimes{ 721590Srgrimes T((T_CALLED("menu_userptr(%p)"), (const void *)menu)); 731590Srgrimes returnVoidPtr(Normalize_Menu(menu)->userptr); 741590Srgrimes} 751590Srgrimes 761590Srgrimes/* m_userptr.c ends here */ 771590Srgrimes