AcePerl
view release on metacpan or search on metacpan
acelib/menu.c view on Meta::CPAN
/* File: menu.c
* Author: Jean Thierry-Mieg (mieg@mrc-lmb.cam.ac.uk)
* Copyright (C) J Thierry-Mieg and R Durbin, 1992-1995
*-------------------------------------------------------------------
* This file is part of the ACEDB genome database package, written by
* Richard Durbin (MRC LMB, UK) rd@mrc-lmb.cam.ac.uk, and
* Jean Thierry-Mieg (CRBM du CNRS, France) mieg@kaa.cnrs-mop.fr
*
* Description:
* Exported functions: all in menu.h
* HISTORY:
* Last edited: Dec 4 11:28 1998 (fw)
* * Jan 9 22:52 1995 (rd): complete replacement for new menu package
* * Jul 23 21:53 1992 (rd): big change because of new menus
must have a separate MENUOPT* for each combination of entries
* Created: Mon Jun 15 14:43:55 1992 (mieg)
*-------------------------------------------------------------------
*/
/* $Id: menu.c,v 1.1 2002/11/14 20:00:06 lstein Exp $ */
#include "regular.h"
#include "call.h" /* for call() and callExists() */
#include "menu_.h" /* private header for menu package */
/****************** MENU manipulation *******************/
MENU menuCreate (char *title)
{
MENU menu = (MENU) messalloc (sizeof (struct MenuStruct)) ;
menu->title = title ;
menu->items = 0 ;
return menu ;
}
MENU menuCopy (MENU oldMenu)
{
MENU newMenu = (MENU) messalloc (sizeof (struct MenuStruct)) ;
MENUITEM newItem, oldItem ;
newMenu->title = oldMenu->title ;
for (oldItem = oldMenu->items ; oldItem ; oldItem = oldItem->down)
{ newItem = menuCreateItem (oldItem->label, oldItem->func) ;
*newItem = *oldItem ;
menuAddItem (newMenu, newItem, 0) ;
}
return newMenu ;
}
void menuDestroy (MENU menu)
{
#ifdef NO_WE_CACHE_MENUS_IN_ASS_BELOW__DONT_DESTROY_HERE
MENUITEM item = menu->items ;
while (item)
{ MENUITEM next = item->down ;
messfree (item) ;
item = next ;
}
messfree (menu) ;
#endif
}
MENU menuInitialise (char *title, MENUSPEC *spec)
{
MENU menu ;
MENUITEM item ;
static Associator ass = 0 ;
static MENUSPEC *localSpec ;
if (!ass)
ass = assCreate () ;
( run in 0.539 second using v1.01-cache-2.11-cpan-39bf76dae61 )