home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
SOURCE
/
CSSRC
/
MENUDEST.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-12-19
|
2KB
|
96 lines
/*
menudest.c
% menu_Destroy
Menu destruction routine.
C-scape 3.2
Copyright (c) 1986, 1987, by Oakland Group, Inc.
ALL RIGHTS RESERVED.
Revision History:
-----------------
6/24/88 jmd converted to new xarray/iarray calls
8/16/88 jmd added calls to omalloc
8/20/88 jmd add list of screen objects
9/19/88 jmd added field name support
10/05/88 jmd added sedptr
11/05/88 jmd renamed to menu_Destroy
4/29/89 jdc added and fixed ofree(CSA_VARBLOCK, menu->varblock)
5/29/89 jdc added varnamea for LNF
3/28/90 jmd ansi-fied
12/18/90 jdc fixed realloced menu->fa->array == NULL bug
12/19/90 jdc fixed realloced menu->token_buf == NULL free
*/
#include "menu.h"
void menu_Destroy(menu_type menu)
/*
DESCRIPTION
This function closes a menu and frees the memory taken up by it.
You must not use the menu after it has been closed.
RETURNS
There is no return value.
*/
{
int i;
field_type field;
cs_Assert(menu_Ok(menu), CS_M_C_MENU, 0);
menu_Flush(menu);
for (i = 0; i < menu->fieldcount; i++) {
if ((field = menu_GetField(menu, i)) != NULL) {
field_Close(field);
}
}
tb_Close(menu->textbuf);
/* Insurance against closed menus. */
menu->rowcount = menu->colcount = -555;
menu->fieldcount = -555;
ia_Close(menu->fgrid);
xa_Close(menu->fa);
if (menu->boba != NULL) {
ia_Close(menu->boba);
}
if (menu->namelist != NULL) {
oslist_Close(menu->namelist);
}
if (menu->dptrlist != NULL) {
oslist_Close(menu->dptrlist);
}
if (menu->funcnamea != NULL) {
ia_Close(menu->funcnamea);
}
if (menu->functypea != NULL) {
ia_Close(menu->functypea);
}
if (menu->varnamea != NULL) {
ia_Close(menu->varnamea);
}
if (menu->varblock != NULL) {
ofree(CSA_VARBLOCK, (VOID *) menu->varblock);
}
if (menu->token_buf != NULL) {
ofree(CSA_TOKBUF, (VOID *) menu->token_buf);
}
ofree(CSA_MENU, (VOID *) menu);
}