* tuiWin.c, tuiWin.h, tui.c, tui.h, tuiCommand.c: Add FSF copyright.
tuiCommand.h, tuiIO.c, tuiIO.h, tuiData.h, tuiData.c: Likewise.
tuiDataWin.c, tuiDataWin.h, tuiDisassem.c, tuiDisassem.h: Likewise.
tuiGeneralWin.c, tuiGeneralWin.h, tuiLayout.c, tuiLayout.h: Likewise.
tuiRegs.c, tuiRegs.h, tuiSource.c, tuiSource.h: Likewise.
tuiSouceWin.c, tuiSourceWin.h, tuiStack.c, tuiStack.h: Likewise.
2001-07-14 19:01:25 +00:00
|
|
|
/* TUI data manipulation routines.
|
2002-03-01 06:19:28 +00:00
|
|
|
|
2003-06-22 15:21:39 +00:00
|
|
|
Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
|
2002-03-01 06:19:28 +00:00
|
|
|
Inc.
|
|
|
|
|
* tuiWin.c, tuiWin.h, tui.c, tui.h, tuiCommand.c: Add FSF copyright.
tuiCommand.h, tuiIO.c, tuiIO.h, tuiData.h, tuiData.c: Likewise.
tuiDataWin.c, tuiDataWin.h, tuiDisassem.c, tuiDisassem.h: Likewise.
tuiGeneralWin.c, tuiGeneralWin.h, tuiLayout.c, tuiLayout.h: Likewise.
tuiRegs.c, tuiRegs.h, tuiSource.c, tuiSource.h: Likewise.
tuiSouceWin.c, tuiSourceWin.h, tuiStack.c, tuiStack.h: Likewise.
2001-07-14 19:01:25 +00:00
|
|
|
Contributed by Hewlett-Packard Company.
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2003-06-22 15:21:39 +00:00
|
|
|
#include "defs.h"
|
|
|
|
#include "symtab.h"
|
2004-01-19 04:31:53 +00:00
|
|
|
#include "tui/tui.h"
|
|
|
|
#include "tui/tui-data.h"
|
|
|
|
#include "tui/tui-wingeneral.h"
|
2002-03-01 06:19:28 +00:00
|
|
|
|
2002-02-08 15:54:32 +00:00
|
|
|
#ifdef HAVE_NCURSES_H
|
|
|
|
#include <ncurses.h>
|
|
|
|
#else
|
|
|
|
#ifdef HAVE_CURSES_H
|
|
|
|
#include <curses.h>
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
/****************************
|
|
|
|
** GLOBAL DECLARATIONS
|
|
|
|
****************************/
|
|
|
|
TuiWinInfoPtr winList[MAX_MAJOR_WINDOWS];
|
|
|
|
|
|
|
|
/***************************
|
|
|
|
** Private data
|
|
|
|
****************************/
|
|
|
|
static TuiLayoutType _currentLayout = UNDEFINED_LAYOUT;
|
|
|
|
static int _termHeight, _termWidth;
|
|
|
|
static TuiGenWinInfo _locator;
|
|
|
|
static TuiGenWinInfo _execInfo[2];
|
|
|
|
static TuiWinInfoPtr _srcWinList[2];
|
|
|
|
static TuiList _sourceWindows =
|
|
|
|
{(OpaqueList) _srcWinList, 0};
|
|
|
|
static int _defaultTabLen = DEFAULT_TAB_LEN;
|
|
|
|
static TuiWinInfoPtr _winWithFocus = (TuiWinInfoPtr) NULL;
|
|
|
|
static TuiLayoutDef _layoutDef =
|
|
|
|
{SRC_WIN, /* displayMode */
|
|
|
|
FALSE, /* split */
|
|
|
|
TUI_UNDEFINED_REGS, /* regsDisplayType */
|
|
|
|
TUI_SFLOAT_REGS}; /* floatRegsDisplayType */
|
|
|
|
static int _winResized = FALSE;
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************
|
|
|
|
** Static function forward decls
|
|
|
|
**********************************/
|
2000-05-28 01:12:42 +00:00
|
|
|
static void freeContent (TuiWinContent, int, TuiWinType);
|
|
|
|
static void freeContentElements (TuiWinContent, int, TuiWinType);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************
|
|
|
|
** PUBLIC FUNCTIONS
|
|
|
|
**********************************/
|
|
|
|
|
|
|
|
/******************************************
|
|
|
|
** ACCESSORS & MUTATORS FOR PRIVATE DATA
|
|
|
|
******************************************/
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** tuiWinResized().
|
|
|
|
** Answer a whether the terminal window has been resized or not
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
int
|
|
|
|
tuiWinResized (void)
|
|
|
|
{
|
|
|
|
return _winResized;
|
|
|
|
} /* tuiWinResized */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** tuiSetWinResized().
|
|
|
|
** Set a whether the terminal window has been resized or not
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
2001-07-14 19:31:09 +00:00
|
|
|
tuiSetWinResizedTo (int resized)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
_winResized = resized;
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* tuiSetWinResizedTo */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** tuiLayoutDef().
|
|
|
|
** Answer a pointer to the current layout definition
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
TuiLayoutDefPtr
|
|
|
|
tuiLayoutDef (void)
|
|
|
|
{
|
|
|
|
return &_layoutDef;
|
|
|
|
} /* tuiLayoutDef */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** tuiWinWithFocus().
|
|
|
|
** Answer the window with the logical focus
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
TuiWinInfoPtr
|
|
|
|
tuiWinWithFocus (void)
|
|
|
|
{
|
|
|
|
return _winWithFocus;
|
|
|
|
} /* tuiWinWithFocus */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** tuiSetWinWithFocus().
|
|
|
|
** Set the window that has the logical focus
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
2001-07-14 19:31:09 +00:00
|
|
|
tuiSetWinWithFocus (TuiWinInfoPtr winInfo)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
_winWithFocus = winInfo;
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* tuiSetWinWithFocus */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** tuiDefaultTabLen().
|
|
|
|
** Answer the length in chars, of tabs
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
int
|
|
|
|
tuiDefaultTabLen (void)
|
|
|
|
{
|
|
|
|
return _defaultTabLen;
|
|
|
|
} /* tuiDefaultTabLen */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** tuiSetDefaultTabLen().
|
|
|
|
** Set the length in chars, of tabs
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
2001-07-14 19:31:09 +00:00
|
|
|
tuiSetDefaultTabLen (int len)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
_defaultTabLen = len;
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* tuiSetDefaultTabLen */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** currentSourceWin()
|
|
|
|
** Accessor for the current source window. Usually there is only
|
|
|
|
** one source window (either source or disassembly), but both can
|
|
|
|
** be displayed at the same time.
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
TuiListPtr
|
|
|
|
sourceWindows (void)
|
|
|
|
{
|
|
|
|
return &_sourceWindows;
|
|
|
|
} /* currentSourceWindows */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** clearSourceWindows()
|
|
|
|
** Clear the list of source windows. Usually there is only one
|
|
|
|
** source window (either source or disassembly), but both can be
|
|
|
|
** displayed at the same time.
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
|
|
|
clearSourceWindows (void)
|
|
|
|
{
|
|
|
|
_sourceWindows.list[0] = (Opaque) NULL;
|
|
|
|
_sourceWindows.list[1] = (Opaque) NULL;
|
|
|
|
_sourceWindows.count = 0;
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* currentSourceWindows */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** clearSourceWindowsDetail()
|
|
|
|
** Clear the pertinant detail in the source windows.
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
|
|
|
clearSourceWindowsDetail (void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < (sourceWindows ())->count; i++)
|
|
|
|
clearWinDetail ((TuiWinInfoPtr) (sourceWindows ())->list[i]);
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* currentSourceWindows */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** addSourceWindowToList().
|
|
|
|
** Add a window to the list of source windows. Usually there is
|
|
|
|
** only one source window (either source or disassembly), but
|
|
|
|
** both can be displayed at the same time.
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
2001-07-14 19:31:09 +00:00
|
|
|
addToSourceWindows (TuiWinInfoPtr winInfo)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
if (_sourceWindows.count < 2)
|
|
|
|
_sourceWindows.list[_sourceWindows.count++] = (Opaque) winInfo;
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* addToSourceWindows */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** clearWinDetail()
|
|
|
|
** Clear the pertinant detail in the windows.
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
2001-07-14 19:31:09 +00:00
|
|
|
clearWinDetail (TuiWinInfoPtr winInfo)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
if (m_winPtrNotNull (winInfo))
|
|
|
|
{
|
|
|
|
switch (winInfo->generic.type)
|
|
|
|
{
|
|
|
|
case SRC_WIN:
|
|
|
|
case DISASSEM_WIN:
|
2001-07-20 23:06:48 +00:00
|
|
|
winInfo->detail.sourceInfo.startLineOrAddr.addr = 0;
|
1999-04-16 01:35:26 +00:00
|
|
|
winInfo->detail.sourceInfo.horizontalOffset = 0;
|
|
|
|
break;
|
|
|
|
case CMD_WIN:
|
|
|
|
winInfo->detail.commandInfo.curLine =
|
|
|
|
winInfo->detail.commandInfo.curch = 0;
|
|
|
|
break;
|
|
|
|
case DATA_WIN:
|
|
|
|
winInfo->detail.dataDisplayInfo.dataContent =
|
|
|
|
(TuiWinContent) NULL;
|
|
|
|
winInfo->detail.dataDisplayInfo.dataContentCount = 0;
|
|
|
|
winInfo->detail.dataDisplayInfo.regsContent =
|
|
|
|
(TuiWinContent) NULL;
|
|
|
|
winInfo->detail.dataDisplayInfo.regsContentCount = 0;
|
|
|
|
winInfo->detail.dataDisplayInfo.regsDisplayType =
|
|
|
|
TUI_UNDEFINED_REGS;
|
|
|
|
winInfo->detail.dataDisplayInfo.regsColumnCount = 1;
|
|
|
|
winInfo->detail.dataDisplayInfo.displayRegs = FALSE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* clearWinDetail */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** sourceExecInfoPtr().
|
|
|
|
** Accessor for the source execution info ptr.
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
TuiGenWinInfoPtr
|
|
|
|
sourceExecInfoWinPtr (void)
|
|
|
|
{
|
|
|
|
return &_execInfo[0];
|
|
|
|
} /* sourceExecInfoWinPtr */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** disassemExecInfoPtr().
|
|
|
|
** Accessor for the disassem execution info ptr.
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
TuiGenWinInfoPtr
|
|
|
|
disassemExecInfoWinPtr (void)
|
|
|
|
{
|
|
|
|
return &_execInfo[1];
|
|
|
|
} /* disassemExecInfoWinPtr */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** locatorWinInfoPtr().
|
|
|
|
** Accessor for the locator win info. Answers a pointer to the
|
|
|
|
** static locator win info struct.
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
TuiGenWinInfoPtr
|
|
|
|
locatorWinInfoPtr (void)
|
|
|
|
{
|
|
|
|
return &_locator;
|
|
|
|
} /* locatorWinInfoPtr */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** termHeight().
|
|
|
|
** Accessor for the termHeight
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
int
|
|
|
|
termHeight (void)
|
|
|
|
{
|
|
|
|
return _termHeight;
|
|
|
|
} /* termHeight */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** setTermHeightTo().
|
|
|
|
** Mutator for the term height
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
2001-07-14 19:31:09 +00:00
|
|
|
setTermHeightTo (int h)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
_termHeight = h;
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* setTermHeightTo */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** termWidth().
|
|
|
|
** Accessor for the termWidth
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
int
|
|
|
|
termWidth (void)
|
|
|
|
{
|
|
|
|
return _termWidth;
|
|
|
|
} /* termWidth */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** setTermWidth().
|
|
|
|
** Mutator for the termWidth
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
2001-07-14 19:31:09 +00:00
|
|
|
setTermWidthTo (int w)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
_termWidth = w;
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* setTermWidthTo */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** currentLayout().
|
|
|
|
** Accessor for the current layout
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
TuiLayoutType
|
|
|
|
currentLayout (void)
|
|
|
|
{
|
|
|
|
return _currentLayout;
|
|
|
|
} /* currentLayout */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** setCurrentLayoutTo().
|
|
|
|
** Mutator for the current layout
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
2001-07-14 19:31:09 +00:00
|
|
|
setCurrentLayoutTo (TuiLayoutType newLayout)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
_currentLayout = newLayout;
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* setCurrentLayoutTo */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** setGenWinOrigin().
|
|
|
|
** Set the origin of the window
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
2001-07-14 19:31:09 +00:00
|
|
|
setGenWinOrigin (TuiGenWinInfoPtr winInfo, int x, int y)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
winInfo->origin.x = x;
|
|
|
|
winInfo->origin.y = y;
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* setGenWinOrigin */
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************
|
|
|
|
** OTHER PUBLIC FUNCTIONS
|
|
|
|
*****************************/
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** tuiNextWin().
|
|
|
|
** Answer the next window in the list, cycling back to the top
|
|
|
|
** if necessary
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
TuiWinInfoPtr
|
2001-07-14 19:31:09 +00:00
|
|
|
tuiNextWin (TuiWinInfoPtr curWin)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
TuiWinType type = curWin->generic.type;
|
|
|
|
TuiWinInfoPtr nextWin = (TuiWinInfoPtr) NULL;
|
|
|
|
|
|
|
|
if (curWin->generic.type == CMD_WIN)
|
|
|
|
type = SRC_WIN;
|
|
|
|
else
|
|
|
|
type = curWin->generic.type + 1;
|
|
|
|
while (type != curWin->generic.type && m_winPtrIsNull (nextWin))
|
|
|
|
{
|
2001-07-20 23:06:48 +00:00
|
|
|
if (winList[type] && winList[type]->generic.isVisible)
|
1999-04-16 01:35:26 +00:00
|
|
|
nextWin = winList[type];
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (type == CMD_WIN)
|
|
|
|
type = SRC_WIN;
|
|
|
|
else
|
|
|
|
type++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nextWin;
|
|
|
|
} /* tuiNextWin */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** tuiPrevWin().
|
|
|
|
** Answer the prev window in the list, cycling back to the bottom
|
|
|
|
** if necessary
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
TuiWinInfoPtr
|
2001-07-14 19:31:09 +00:00
|
|
|
tuiPrevWin (TuiWinInfoPtr curWin)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
TuiWinType type = curWin->generic.type;
|
|
|
|
TuiWinInfoPtr prev = (TuiWinInfoPtr) NULL;
|
|
|
|
|
|
|
|
if (curWin->generic.type == SRC_WIN)
|
|
|
|
type = CMD_WIN;
|
|
|
|
else
|
|
|
|
type = curWin->generic.type - 1;
|
|
|
|
while (type != curWin->generic.type && m_winPtrIsNull (prev))
|
|
|
|
{
|
|
|
|
if (winList[type]->generic.isVisible)
|
|
|
|
prev = winList[type];
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (type == SRC_WIN)
|
|
|
|
type = CMD_WIN;
|
|
|
|
else
|
|
|
|
type--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return prev;
|
* tuiData.h (FILE_PREFIX): Don't define.
(blankStr, locationStr, breakStr): Don't declare.
(breakLocationStr, nullStr, historyLimit, setHistoryLimitTo): Likewise.
(displayableWinContentOf, displayableWinContentAt): Likewise.
(winElementHeight, winByName, freeAllWindows): Likewise.
* tuiData.c (blankStr, locationStr, breakStr): Remove.
(breakLocationStr, nullStr, historyLimit, setHistoryLimitTo): Remove.
(displayableWinContentOf, displayableWinContentAt): Remove.
(winElementHeight, winByName, freeAllWindows): Remove.
2002-09-01 10:49:00 +00:00
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** partialWinByName().
|
|
|
|
** Answer the window represented by name
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
TuiWinInfoPtr
|
2001-07-14 19:31:09 +00:00
|
|
|
partialWinByName (char *name)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
TuiWinInfoPtr winInfo = (TuiWinInfoPtr) NULL;
|
|
|
|
|
|
|
|
if (name != (char *) NULL)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
while (i < MAX_MAJOR_WINDOWS && m_winPtrIsNull (winInfo))
|
|
|
|
{
|
2001-07-20 23:06:48 +00:00
|
|
|
if (winList[i] != 0)
|
|
|
|
{
|
|
|
|
char *curName = winName (&winList[i]->generic);
|
|
|
|
if (strlen (name) <= strlen (curName) &&
|
|
|
|
strncmp (name, curName, strlen (name)) == 0)
|
|
|
|
winInfo = winList[i];
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return winInfo;
|
|
|
|
} /* partialWinByName */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** winName().
|
|
|
|
** Answer the name of the window
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
char *
|
2001-07-14 19:31:09 +00:00
|
|
|
winName (TuiGenWinInfoPtr winInfo)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
char *name = (char *) NULL;
|
|
|
|
|
|
|
|
switch (winInfo->type)
|
|
|
|
{
|
|
|
|
case SRC_WIN:
|
|
|
|
name = SRC_NAME;
|
|
|
|
break;
|
|
|
|
case CMD_WIN:
|
|
|
|
name = CMD_NAME;
|
|
|
|
break;
|
|
|
|
case DISASSEM_WIN:
|
|
|
|
name = DISASSEM_NAME;
|
|
|
|
break;
|
|
|
|
case DATA_WIN:
|
|
|
|
name = DATA_NAME;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
name = "";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return name;
|
|
|
|
} /* winName */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** initializeStaticData
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
|
|
|
initializeStaticData (void)
|
|
|
|
{
|
|
|
|
initGenericPart (sourceExecInfoWinPtr ());
|
|
|
|
initGenericPart (disassemExecInfoWinPtr ());
|
|
|
|
initGenericPart (locatorWinInfoPtr ());
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* initializeStaticData */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** allocGenericWinInfo().
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
TuiGenWinInfoPtr
|
|
|
|
allocGenericWinInfo (void)
|
|
|
|
{
|
|
|
|
TuiGenWinInfoPtr win;
|
|
|
|
|
|
|
|
if ((win = (TuiGenWinInfoPtr) xmalloc (
|
|
|
|
sizeof (TuiGenWinInfoPtr))) != (TuiGenWinInfoPtr) NULL)
|
|
|
|
initGenericPart (win);
|
|
|
|
|
|
|
|
return win;
|
|
|
|
} /* allocGenericWinInfo */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** initGenericPart().
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
2001-07-14 19:31:09 +00:00
|
|
|
initGenericPart (TuiGenWinInfoPtr win)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
win->width =
|
|
|
|
win->height =
|
|
|
|
win->origin.x =
|
|
|
|
win->origin.y =
|
|
|
|
win->viewportHeight =
|
|
|
|
win->contentSize =
|
|
|
|
win->lastVisibleLine = 0;
|
|
|
|
win->handle = (WINDOW *) NULL;
|
|
|
|
win->content = (OpaquePtr) NULL;
|
|
|
|
win->contentInUse =
|
|
|
|
win->isVisible = FALSE;
|
2002-08-25 11:00:46 +00:00
|
|
|
win->title = 0;
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** initContentElement().
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
2001-07-14 19:31:09 +00:00
|
|
|
initContentElement (TuiWinElementPtr element, TuiWinType type)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
element->highlight = FALSE;
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case SRC_WIN:
|
|
|
|
case DISASSEM_WIN:
|
|
|
|
element->whichElement.source.line = (char *) NULL;
|
|
|
|
element->whichElement.source.lineOrAddr.lineNo = 0;
|
|
|
|
element->whichElement.source.isExecPoint = FALSE;
|
|
|
|
element->whichElement.source.hasBreak = FALSE;
|
|
|
|
break;
|
|
|
|
case DATA_WIN:
|
|
|
|
initGenericPart (&element->whichElement.dataWindow);
|
|
|
|
element->whichElement.dataWindow.type = DATA_ITEM_WIN;
|
|
|
|
((TuiGenWinInfoPtr) & element->whichElement.dataWindow)->content =
|
|
|
|
(OpaquePtr) allocContent (1, DATA_ITEM_WIN);
|
|
|
|
((TuiGenWinInfoPtr)
|
|
|
|
& element->whichElement.dataWindow)->contentSize = 1;
|
|
|
|
break;
|
|
|
|
case CMD_WIN:
|
|
|
|
element->whichElement.command.line = (char *) NULL;
|
|
|
|
break;
|
|
|
|
case DATA_ITEM_WIN:
|
|
|
|
element->whichElement.data.name = (char *) NULL;
|
|
|
|
element->whichElement.data.type = TUI_REGISTER;
|
|
|
|
element->whichElement.data.itemNo = UNDEFINED_ITEM;
|
|
|
|
element->whichElement.data.value = (Opaque) NULL;
|
|
|
|
element->whichElement.data.highlight = FALSE;
|
|
|
|
break;
|
|
|
|
case LOCATOR_WIN:
|
|
|
|
element->whichElement.locator.fileName[0] =
|
|
|
|
element->whichElement.locator.procName[0] = (char) 0;
|
|
|
|
element->whichElement.locator.lineNo = 0;
|
|
|
|
element->whichElement.locator.addr = 0;
|
|
|
|
break;
|
|
|
|
case EXEC_INFO_WIN:
|
2002-08-30 20:07:05 +00:00
|
|
|
memset(element->whichElement.simpleString, ' ',
|
|
|
|
sizeof(element->whichElement.simpleString));
|
1999-04-16 01:35:26 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
} /* initContentElement */
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** initWinInfo().
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
2001-07-14 19:31:09 +00:00
|
|
|
initWinInfo (TuiWinInfoPtr winInfo)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
initGenericPart (&winInfo->generic);
|
|
|
|
winInfo->canHighlight =
|
|
|
|
winInfo->isHighlighted = FALSE;
|
|
|
|
switch (winInfo->generic.type)
|
|
|
|
{
|
|
|
|
case SRC_WIN:
|
|
|
|
case DISASSEM_WIN:
|
|
|
|
winInfo->detail.sourceInfo.executionInfo = (TuiGenWinInfoPtr) NULL;
|
|
|
|
winInfo->detail.sourceInfo.hasLocator = FALSE;
|
|
|
|
winInfo->detail.sourceInfo.horizontalOffset = 0;
|
2001-07-20 23:06:48 +00:00
|
|
|
winInfo->detail.sourceInfo.startLineOrAddr.addr = 0;
|
2002-08-25 11:00:46 +00:00
|
|
|
winInfo->detail.sourceInfo.filename = 0;
|
1999-04-16 01:35:26 +00:00
|
|
|
break;
|
|
|
|
case DATA_WIN:
|
|
|
|
winInfo->detail.dataDisplayInfo.dataContent = (TuiWinContent) NULL;
|
|
|
|
winInfo->detail.dataDisplayInfo.dataContentCount = 0;
|
|
|
|
winInfo->detail.dataDisplayInfo.regsContent = (TuiWinContent) NULL;
|
|
|
|
winInfo->detail.dataDisplayInfo.regsContentCount = 0;
|
|
|
|
winInfo->detail.dataDisplayInfo.regsDisplayType =
|
|
|
|
TUI_UNDEFINED_REGS;
|
|
|
|
winInfo->detail.dataDisplayInfo.regsColumnCount = 1;
|
|
|
|
winInfo->detail.dataDisplayInfo.displayRegs = FALSE;
|
|
|
|
break;
|
|
|
|
case CMD_WIN:
|
|
|
|
winInfo->detail.commandInfo.curLine = 0;
|
|
|
|
winInfo->detail.commandInfo.curch = 0;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
winInfo->detail.opaque = (Opaque) NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* initWinInfo */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** allocWinInfo().
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
TuiWinInfoPtr
|
2001-07-14 19:31:09 +00:00
|
|
|
allocWinInfo (TuiWinType type)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
TuiWinInfoPtr winInfo = (TuiWinInfoPtr) NULL;
|
|
|
|
|
|
|
|
winInfo = (TuiWinInfoPtr) xmalloc (sizeof (TuiWinInfo));
|
|
|
|
if (m_winPtrNotNull (winInfo))
|
|
|
|
{
|
|
|
|
winInfo->generic.type = type;
|
|
|
|
initWinInfo (winInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
return winInfo;
|
|
|
|
} /* allocWinInfo */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** allocContent().
|
|
|
|
** Allocates the content and elements in a block.
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
TuiWinContent
|
2001-07-14 19:31:09 +00:00
|
|
|
allocContent (int numElements, TuiWinType type)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
TuiWinContent content = (TuiWinContent) NULL;
|
|
|
|
char *elementBlockPtr = (char *) NULL;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if ((content = (TuiWinContent)
|
|
|
|
xmalloc (sizeof (TuiWinElementPtr) * numElements)) != (TuiWinContent) NULL)
|
|
|
|
{ /*
|
1999-07-07 20:19:36 +00:00
|
|
|
** All windows, except the data window, can allocate the elements
|
|
|
|
** in a chunk. The data window cannot because items can be
|
|
|
|
** added/removed from the data display by the user at any time.
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
if (type != DATA_WIN)
|
|
|
|
{
|
|
|
|
if ((elementBlockPtr = (char *)
|
|
|
|
xmalloc (sizeof (TuiWinElement) * numElements)) != (char *) NULL)
|
|
|
|
{
|
|
|
|
for (i = 0; i < numElements; i++)
|
|
|
|
{
|
|
|
|
content[i] = (TuiWinElementPtr) elementBlockPtr;
|
|
|
|
initContentElement (content[i], type);
|
|
|
|
elementBlockPtr += sizeof (TuiWinElement);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tuiFree ((char *) content);
|
|
|
|
content = (TuiWinContent) NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return content;
|
|
|
|
} /* allocContent */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** addContentElements().
|
|
|
|
** Adds the input number of elements to the windows's content. If
|
|
|
|
** no content has been allocated yet, allocContent() is called to
|
|
|
|
** do this. The index of the first element added is returned,
|
|
|
|
** unless there is a memory allocation error, in which case, (-1)
|
|
|
|
** is returned.
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
int
|
2001-07-14 19:31:09 +00:00
|
|
|
addContentElements (TuiGenWinInfoPtr winInfo, int numElements)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
TuiWinElementPtr elementPtr;
|
|
|
|
int i, indexStart;
|
|
|
|
|
|
|
|
if (winInfo->content == (OpaquePtr) NULL)
|
|
|
|
{
|
|
|
|
winInfo->content = (OpaquePtr) allocContent (numElements, winInfo->type);
|
|
|
|
indexStart = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
indexStart = winInfo->contentSize;
|
|
|
|
if (winInfo->content != (OpaquePtr) NULL)
|
|
|
|
{
|
|
|
|
for (i = indexStart; (i < numElements + indexStart); i++)
|
|
|
|
{
|
|
|
|
if ((elementPtr = (TuiWinElementPtr)
|
|
|
|
xmalloc (sizeof (TuiWinElement))) != (TuiWinElementPtr) NULL)
|
|
|
|
{
|
|
|
|
winInfo->content[i] = (Opaque) elementPtr;
|
|
|
|
initContentElement (elementPtr, winInfo->type);
|
|
|
|
winInfo->contentSize++;
|
|
|
|
}
|
1999-07-07 20:19:36 +00:00
|
|
|
else /* things must be really hosed now! We ran out of memory!? */
|
1999-04-16 01:35:26 +00:00
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return indexStart;
|
|
|
|
} /* addContentElements */
|
|
|
|
|
|
|
|
|
2002-08-25 11:00:46 +00:00
|
|
|
/* Delete all curses windows associated with winInfo, leaving everything
|
|
|
|
else intact. */
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
2001-07-14 19:31:09 +00:00
|
|
|
tuiDelWindow (TuiWinInfoPtr winInfo)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
TuiGenWinInfoPtr genericWin;
|
|
|
|
|
|
|
|
switch (winInfo->generic.type)
|
|
|
|
{
|
|
|
|
case SRC_WIN:
|
|
|
|
case DISASSEM_WIN:
|
|
|
|
genericWin = locatorWinInfoPtr ();
|
|
|
|
if (genericWin != (TuiGenWinInfoPtr) NULL)
|
|
|
|
{
|
|
|
|
tuiDelwin (genericWin->handle);
|
|
|
|
genericWin->handle = (WINDOW *) NULL;
|
|
|
|
genericWin->isVisible = FALSE;
|
|
|
|
}
|
2002-08-25 11:00:46 +00:00
|
|
|
if (winInfo->detail.sourceInfo.filename)
|
|
|
|
{
|
|
|
|
xfree (winInfo->detail.sourceInfo.filename);
|
|
|
|
winInfo->detail.sourceInfo.filename = 0;
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
genericWin = winInfo->detail.sourceInfo.executionInfo;
|
|
|
|
if (genericWin != (TuiGenWinInfoPtr) NULL)
|
|
|
|
{
|
|
|
|
tuiDelwin (genericWin->handle);
|
|
|
|
genericWin->handle = (WINDOW *) NULL;
|
|
|
|
genericWin->isVisible = FALSE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DATA_WIN:
|
|
|
|
if (winInfo->generic.content != (OpaquePtr) NULL)
|
|
|
|
{
|
2002-08-25 11:00:46 +00:00
|
|
|
tuiDelDataWindows (winInfo->detail.dataDisplayInfo.regsContent,
|
|
|
|
winInfo->detail.dataDisplayInfo.regsContentCount);
|
|
|
|
tuiDelDataWindows (winInfo->detail.dataDisplayInfo.dataContent,
|
|
|
|
winInfo->detail.dataDisplayInfo.dataContentCount);
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (winInfo->generic.handle != (WINDOW *) NULL)
|
|
|
|
{
|
|
|
|
tuiDelwin (winInfo->generic.handle);
|
|
|
|
winInfo->generic.handle = (WINDOW *) NULL;
|
|
|
|
winInfo->generic.isVisible = FALSE;
|
|
|
|
}
|
2002-08-25 11:00:46 +00:00
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** freeWindow().
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
2001-07-14 19:31:09 +00:00
|
|
|
freeWindow (TuiWinInfoPtr winInfo)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
TuiGenWinInfoPtr genericWin;
|
|
|
|
|
|
|
|
switch (winInfo->generic.type)
|
|
|
|
{
|
|
|
|
case SRC_WIN:
|
|
|
|
case DISASSEM_WIN:
|
|
|
|
genericWin = locatorWinInfoPtr ();
|
|
|
|
if (genericWin != (TuiGenWinInfoPtr) NULL)
|
|
|
|
{
|
|
|
|
tuiDelwin (genericWin->handle);
|
|
|
|
genericWin->handle = (WINDOW *) NULL;
|
|
|
|
}
|
|
|
|
freeWinContent (genericWin);
|
2002-08-25 11:00:46 +00:00
|
|
|
if (winInfo->detail.sourceInfo.filename)
|
|
|
|
{
|
|
|
|
xfree (winInfo->detail.sourceInfo.filename);
|
|
|
|
winInfo->detail.sourceInfo.filename = 0;
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
genericWin = winInfo->detail.sourceInfo.executionInfo;
|
|
|
|
if (genericWin != (TuiGenWinInfoPtr) NULL)
|
|
|
|
{
|
|
|
|
tuiDelwin (genericWin->handle);
|
|
|
|
genericWin->handle = (WINDOW *) NULL;
|
|
|
|
freeWinContent (genericWin);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DATA_WIN:
|
|
|
|
if (winInfo->generic.content != (OpaquePtr) NULL)
|
|
|
|
{
|
|
|
|
freeDataContent (
|
|
|
|
winInfo->detail.dataDisplayInfo.regsContent,
|
|
|
|
winInfo->detail.dataDisplayInfo.regsContentCount);
|
|
|
|
winInfo->detail.dataDisplayInfo.regsContent =
|
|
|
|
(TuiWinContent) NULL;
|
|
|
|
winInfo->detail.dataDisplayInfo.regsContentCount = 0;
|
|
|
|
freeDataContent (
|
|
|
|
winInfo->detail.dataDisplayInfo.dataContent,
|
|
|
|
winInfo->detail.dataDisplayInfo.dataContentCount);
|
|
|
|
winInfo->detail.dataDisplayInfo.dataContent =
|
|
|
|
(TuiWinContent) NULL;
|
|
|
|
winInfo->detail.dataDisplayInfo.dataContentCount = 0;
|
|
|
|
winInfo->detail.dataDisplayInfo.regsDisplayType =
|
|
|
|
TUI_UNDEFINED_REGS;
|
|
|
|
winInfo->detail.dataDisplayInfo.regsColumnCount = 1;
|
|
|
|
winInfo->detail.dataDisplayInfo.displayRegs = FALSE;
|
|
|
|
winInfo->generic.content = (OpaquePtr) NULL;
|
|
|
|
winInfo->generic.contentSize = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (winInfo->generic.handle != (WINDOW *) NULL)
|
|
|
|
{
|
|
|
|
tuiDelwin (winInfo->generic.handle);
|
|
|
|
winInfo->generic.handle = (WINDOW *) NULL;
|
|
|
|
freeWinContent (&winInfo->generic);
|
|
|
|
}
|
2002-08-25 11:00:46 +00:00
|
|
|
if (winInfo->generic.title)
|
|
|
|
xfree (winInfo->generic.title);
|
2000-12-15 01:01:51 +00:00
|
|
|
xfree (winInfo);
|
2002-08-25 11:00:46 +00:00
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** freeAllSourceWinsContent().
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
|
|
|
freeAllSourceWinsContent (void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < (sourceWindows ())->count; i++)
|
|
|
|
{
|
|
|
|
TuiWinInfoPtr winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[i];
|
|
|
|
|
|
|
|
if (m_winPtrNotNull (winInfo))
|
|
|
|
{
|
|
|
|
freeWinContent (&(winInfo->generic));
|
|
|
|
freeWinContent (winInfo->detail.sourceInfo.executionInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* freeAllSourceWinsContent */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** freeWinContent().
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
2001-07-14 19:31:09 +00:00
|
|
|
freeWinContent (TuiGenWinInfoPtr winInfo)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
if (winInfo->content != (OpaquePtr) NULL)
|
|
|
|
{
|
|
|
|
freeContent ((TuiWinContent) winInfo->content,
|
|
|
|
winInfo->contentSize,
|
|
|
|
winInfo->type);
|
|
|
|
winInfo->content = (OpaquePtr) NULL;
|
|
|
|
}
|
|
|
|
winInfo->contentSize = 0;
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* freeWinContent */
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2001-07-14 19:31:09 +00:00
|
|
|
tuiDelDataWindows (TuiWinContent content, int contentSize)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** Remember that data window content elements are of type TuiGenWinInfoPtr,
|
|
|
|
** each of which whose single element is a data element.
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
for (i = 0; i < contentSize; i++)
|
|
|
|
{
|
|
|
|
TuiGenWinInfoPtr genericWin = &content[i]->whichElement.dataWindow;
|
|
|
|
|
|
|
|
if (genericWin != (TuiGenWinInfoPtr) NULL)
|
|
|
|
{
|
|
|
|
tuiDelwin (genericWin->handle);
|
|
|
|
genericWin->handle = (WINDOW *) NULL;
|
|
|
|
genericWin->isVisible = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* tuiDelDataWindows */
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2001-07-14 19:31:09 +00:00
|
|
|
freeDataContent (TuiWinContent content, int contentSize)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** Remember that data window content elements are of type TuiGenWinInfoPtr,
|
|
|
|
** each of which whose single element is a data element.
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
for (i = 0; i < contentSize; i++)
|
|
|
|
{
|
|
|
|
TuiGenWinInfoPtr genericWin = &content[i]->whichElement.dataWindow;
|
|
|
|
|
|
|
|
if (genericWin != (TuiGenWinInfoPtr) NULL)
|
|
|
|
{
|
|
|
|
tuiDelwin (genericWin->handle);
|
|
|
|
genericWin->handle = (WINDOW *) NULL;
|
|
|
|
freeWinContent (genericWin);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
freeContent (content,
|
|
|
|
contentSize,
|
|
|
|
DATA_WIN);
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* freeDataContent */
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************
|
|
|
|
** LOCAL STATIC FUNCTIONS **
|
|
|
|
**********************************/
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** freeContent().
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
static void
|
2001-07-14 19:31:09 +00:00
|
|
|
freeContent (TuiWinContent content, int contentSize, TuiWinType winType)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
if (content != (TuiWinContent) NULL)
|
|
|
|
{
|
|
|
|
freeContentElements (content, contentSize, winType);
|
|
|
|
tuiFree ((char *) content);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* freeContent */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** freeContentElements().
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
static void
|
2001-07-14 19:31:09 +00:00
|
|
|
freeContentElements (TuiWinContent content, int contentSize, TuiWinType type)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
if (content != (TuiWinContent) NULL)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (type == SRC_WIN || type == DISASSEM_WIN)
|
|
|
|
{
|
|
|
|
/* free whole source block */
|
|
|
|
if (content[0]->whichElement.source.line != (char *) NULL)
|
|
|
|
tuiFree (content[0]->whichElement.source.line);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (i = 0; i < contentSize; i++)
|
|
|
|
{
|
|
|
|
TuiWinElementPtr element;
|
|
|
|
|
|
|
|
element = content[i];
|
|
|
|
if (element != (TuiWinElementPtr) NULL)
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case DATA_WIN:
|
|
|
|
tuiFree ((char *) element);
|
|
|
|
break;
|
|
|
|
case DATA_ITEM_WIN:
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** Note that data elements are not allocated
|
|
|
|
** in a single block, but individually, as needed.
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
if (element->whichElement.data.type != TUI_REGISTER)
|
|
|
|
tuiFree ((char *)
|
|
|
|
element->whichElement.data.name);
|
|
|
|
tuiFree ((char *) element->whichElement.data.value);
|
|
|
|
tuiFree ((char *) element);
|
|
|
|
break;
|
|
|
|
case CMD_WIN:
|
|
|
|
tuiFree ((char *) element->whichElement.command.line);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (type != DATA_WIN && type != DATA_ITEM_WIN)
|
|
|
|
tuiFree ((char *) content[0]); /* free the element block */
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* freeContentElements */
|