OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [gdb/] [tui/] [tuiData.c] - Diff between revs 578 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 578 Rev 1765
/*
/*
   ** tuiData.c
   ** tuiData.c
   **    This module contains functions for manipulating the data
   **    This module contains functions for manipulating the data
   **    structures used by the TUI
   **    structures used by the TUI
 */
 */
 
 
#include "defs.h"
#include "defs.h"
#include "tui.h"
#include "tui.h"
#include "tuiData.h"
#include "tuiData.h"
 
 
/****************************
/****************************
** GLOBAL DECLARATIONS
** GLOBAL DECLARATIONS
****************************/
****************************/
TuiWinInfoPtr winList[MAX_MAJOR_WINDOWS];
TuiWinInfoPtr winList[MAX_MAJOR_WINDOWS];
 
 
/***************************
/***************************
** Private Definitions
** Private Definitions
****************************/
****************************/
#define FILE_WIDTH   30
#define FILE_WIDTH   30
#define PROC_WIDTH   40
#define PROC_WIDTH   40
#define LINE_WIDTH   4
#define LINE_WIDTH   4
#define PC_WIDTH     8
#define PC_WIDTH     8
 
 
/***************************
/***************************
** Private data
** Private data
****************************/
****************************/
static char *_tuiNullStr = TUI_NULL_STR;
static char *_tuiNullStr = TUI_NULL_STR;
static char *_tuiBlankStr = "   ";
static char *_tuiBlankStr = "   ";
static char *_tuiLocationStr = "  >";
static char *_tuiLocationStr = "  >";
static char *_tuiBreakStr = " * ";
static char *_tuiBreakStr = " * ";
static char *_tuiBreakLocationStr = " *>";
static char *_tuiBreakLocationStr = " *>";
static TuiLayoutType _currentLayout = UNDEFINED_LAYOUT;
static TuiLayoutType _currentLayout = UNDEFINED_LAYOUT;
static int _termHeight, _termWidth;
static int _termHeight, _termWidth;
static int _historyLimit = DEFAULT_HISTORY_COUNT;
static int _historyLimit = DEFAULT_HISTORY_COUNT;
static TuiGenWinInfo _locator;
static TuiGenWinInfo _locator;
static TuiGenWinInfo _execInfo[2];
static TuiGenWinInfo _execInfo[2];
static TuiWinInfoPtr _srcWinList[2];
static TuiWinInfoPtr _srcWinList[2];
static TuiList _sourceWindows =
static TuiList _sourceWindows =
{(OpaqueList) _srcWinList, 0};
{(OpaqueList) _srcWinList, 0};
static int _defaultTabLen = DEFAULT_TAB_LEN;
static int _defaultTabLen = DEFAULT_TAB_LEN;
static TuiWinInfoPtr _winWithFocus = (TuiWinInfoPtr) NULL;
static TuiWinInfoPtr _winWithFocus = (TuiWinInfoPtr) NULL;
static TuiLayoutDef _layoutDef =
static TuiLayoutDef _layoutDef =
{SRC_WIN,                       /* displayMode */
{SRC_WIN,                       /* displayMode */
 FALSE,                         /* split */
 FALSE,                         /* split */
 TUI_UNDEFINED_REGS,            /* regsDisplayType */
 TUI_UNDEFINED_REGS,            /* regsDisplayType */
 TUI_SFLOAT_REGS};              /* floatRegsDisplayType */
 TUI_SFLOAT_REGS};              /* floatRegsDisplayType */
static int _winResized = FALSE;
static int _winResized = FALSE;
 
 
 
 
/*********************************
/*********************************
** Static function forward decls
** Static function forward decls
**********************************/
**********************************/
static void freeContent (TuiWinContent, int, TuiWinType);
static void freeContent (TuiWinContent, int, TuiWinType);
static void freeContentElements (TuiWinContent, int, TuiWinType);
static void freeContentElements (TuiWinContent, int, TuiWinType);
 
 
 
 
 
 
/*********************************
/*********************************
** PUBLIC FUNCTIONS
** PUBLIC FUNCTIONS
**********************************/
**********************************/
 
 
/******************************************
/******************************************
** ACCESSORS & MUTATORS FOR PRIVATE DATA
** ACCESSORS & MUTATORS FOR PRIVATE DATA
******************************************/
******************************************/
 
 
/*
/*
   ** tuiWinResized().
   ** tuiWinResized().
   **        Answer a whether the terminal window has been resized or not
   **        Answer a whether the terminal window has been resized or not
 */
 */
int
int
#ifdef __STDC__
#ifdef __STDC__
tuiWinResized (void)
tuiWinResized (void)
#else
#else
tuiWinResized ()
tuiWinResized ()
#endif
#endif
{
{
  return _winResized;
  return _winResized;
}                               /* tuiWinResized */
}                               /* tuiWinResized */
 
 
 
 
/*
/*
   ** tuiSetWinResized().
   ** tuiSetWinResized().
   **        Set a whether the terminal window has been resized or not
   **        Set a whether the terminal window has been resized or not
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
tuiSetWinResizedTo (
tuiSetWinResizedTo (
                     int resized)
                     int resized)
#else
#else
tuiSetWinResizedTo (resized)
tuiSetWinResizedTo (resized)
     int resized;
     int resized;
#endif
#endif
{
{
  _winResized = resized;
  _winResized = resized;
 
 
  return;
  return;
}                               /* tuiSetWinResizedTo */
}                               /* tuiSetWinResizedTo */
 
 
 
 
/*
/*
   ** tuiLayoutDef().
   ** tuiLayoutDef().
   **        Answer a pointer to the current layout definition
   **        Answer a pointer to the current layout definition
 */
 */
TuiLayoutDefPtr
TuiLayoutDefPtr
#ifdef __STDC__
#ifdef __STDC__
tuiLayoutDef (void)
tuiLayoutDef (void)
#else
#else
tuiLayoutDef ()
tuiLayoutDef ()
#endif
#endif
{
{
  return &_layoutDef;
  return &_layoutDef;
}                               /* tuiLayoutDef */
}                               /* tuiLayoutDef */
 
 
 
 
/*
/*
   ** tuiWinWithFocus().
   ** tuiWinWithFocus().
   **        Answer the window with the logical focus
   **        Answer the window with the logical focus
 */
 */
TuiWinInfoPtr
TuiWinInfoPtr
#ifdef __STDC__
#ifdef __STDC__
tuiWinWithFocus (void)
tuiWinWithFocus (void)
#else
#else
tuiWinWithFocus ()
tuiWinWithFocus ()
#endif
#endif
{
{
  return _winWithFocus;
  return _winWithFocus;
}                               /* tuiWinWithFocus */
}                               /* tuiWinWithFocus */
 
 
 
 
/*
/*
   ** tuiSetWinWithFocus().
   ** tuiSetWinWithFocus().
   **        Set the window that has the logical focus
   **        Set the window that has the logical focus
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
tuiSetWinWithFocus (
tuiSetWinWithFocus (
                     TuiWinInfoPtr winInfo)
                     TuiWinInfoPtr winInfo)
#else
#else
tuiSetWinWithFocus (winInfo)
tuiSetWinWithFocus (winInfo)
     TuiWinInfoPtr winInfo;
     TuiWinInfoPtr winInfo;
#endif
#endif
{
{
  _winWithFocus = winInfo;
  _winWithFocus = winInfo;
 
 
  return;
  return;
}                               /* tuiSetWinWithFocus */
}                               /* tuiSetWinWithFocus */
 
 
 
 
/*
/*
   ** tuiDefaultTabLen().
   ** tuiDefaultTabLen().
   **        Answer the length in chars, of tabs
   **        Answer the length in chars, of tabs
 */
 */
int
int
#ifdef __STDC__
#ifdef __STDC__
tuiDefaultTabLen (void)
tuiDefaultTabLen (void)
#else
#else
tuiDefaultTabLen ()
tuiDefaultTabLen ()
#endif
#endif
{
{
  return _defaultTabLen;
  return _defaultTabLen;
}                               /* tuiDefaultTabLen */
}                               /* tuiDefaultTabLen */
 
 
 
 
/*
/*
   ** tuiSetDefaultTabLen().
   ** tuiSetDefaultTabLen().
   **        Set the length in chars, of tabs
   **        Set the length in chars, of tabs
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
tuiSetDefaultTabLen (
tuiSetDefaultTabLen (
                      int len)
                      int len)
#else
#else
tuiSetDefaultTabLen (len)
tuiSetDefaultTabLen (len)
     int len;
     int len;
#endif
#endif
{
{
  _defaultTabLen = len;
  _defaultTabLen = len;
 
 
  return;
  return;
}                               /* tuiSetDefaultTabLen */
}                               /* tuiSetDefaultTabLen */
 
 
 
 
/*
/*
   ** currentSourceWin()
   ** currentSourceWin()
   **        Accessor for the current source window.  Usually there is only
   **        Accessor for the current source window.  Usually there is only
   **        one source window (either source or disassembly), but both can
   **        one source window (either source or disassembly), but both can
   **        be displayed at the same time.
   **        be displayed at the same time.
 */
 */
TuiListPtr
TuiListPtr
#ifdef __STDC__
#ifdef __STDC__
sourceWindows (void)
sourceWindows (void)
#else
#else
sourceWindows ()
sourceWindows ()
#endif
#endif
{
{
  return &_sourceWindows;
  return &_sourceWindows;
}                               /* currentSourceWindows */
}                               /* currentSourceWindows */
 
 
 
 
/*
/*
   ** clearSourceWindows()
   ** clearSourceWindows()
   **        Clear the list of source windows.  Usually there is only one
   **        Clear the list of source windows.  Usually there is only one
   **        source window (either source or disassembly), but both can be
   **        source window (either source or disassembly), but both can be
   **        displayed at the same time.
   **        displayed at the same time.
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
clearSourceWindows (void)
clearSourceWindows (void)
#else
#else
clearSourceWindows ()
clearSourceWindows ()
#endif
#endif
{
{
  _sourceWindows.list[0] = (Opaque) NULL;
  _sourceWindows.list[0] = (Opaque) NULL;
  _sourceWindows.list[1] = (Opaque) NULL;
  _sourceWindows.list[1] = (Opaque) NULL;
  _sourceWindows.count = 0;
  _sourceWindows.count = 0;
 
 
  return;
  return;
}                               /* currentSourceWindows */
}                               /* currentSourceWindows */
 
 
 
 
/*
/*
   ** clearSourceWindowsDetail()
   ** clearSourceWindowsDetail()
   **        Clear the pertinant detail in the source windows.
   **        Clear the pertinant detail in the source windows.
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
clearSourceWindowsDetail (void)
clearSourceWindowsDetail (void)
#else
#else
clearSourceWindowsDetail ()
clearSourceWindowsDetail ()
#endif
#endif
{
{
  int i;
  int i;
 
 
  for (i = 0; i < (sourceWindows ())->count; i++)
  for (i = 0; i < (sourceWindows ())->count; i++)
    clearWinDetail ((TuiWinInfoPtr) (sourceWindows ())->list[i]);
    clearWinDetail ((TuiWinInfoPtr) (sourceWindows ())->list[i]);
 
 
  return;
  return;
}                               /* currentSourceWindows */
}                               /* currentSourceWindows */
 
 
 
 
/*
/*
   ** addSourceWindowToList().
   ** addSourceWindowToList().
   **       Add a window to the list of source windows.  Usually there is
   **       Add a window to the list of source windows.  Usually there is
   **       only one source window (either source or disassembly), but
   **       only one source window (either source or disassembly), but
   **       both can be displayed at the same time.
   **       both can be displayed at the same time.
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
addToSourceWindows (
addToSourceWindows (
                     TuiWinInfoPtr winInfo)
                     TuiWinInfoPtr winInfo)
#else
#else
addToSourceWindows (winInfo)
addToSourceWindows (winInfo)
     TuiWinInfoPtr winInfo;
     TuiWinInfoPtr winInfo;
#endif
#endif
{
{
  if (_sourceWindows.count < 2)
  if (_sourceWindows.count < 2)
    _sourceWindows.list[_sourceWindows.count++] = (Opaque) winInfo;
    _sourceWindows.list[_sourceWindows.count++] = (Opaque) winInfo;
 
 
  return;
  return;
}                               /* addToSourceWindows */
}                               /* addToSourceWindows */
 
 
 
 
/*
/*
   ** clearWinDetail()
   ** clearWinDetail()
   **        Clear the pertinant detail in the windows.
   **        Clear the pertinant detail in the windows.
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
clearWinDetail (
clearWinDetail (
                 TuiWinInfoPtr winInfo)
                 TuiWinInfoPtr winInfo)
#else
#else
clearWinDetail (winInfo)
clearWinDetail (winInfo)
     TuiWinInfoPtr winInfo;
     TuiWinInfoPtr winInfo;
#endif
#endif
{
{
  if (m_winPtrNotNull (winInfo))
  if (m_winPtrNotNull (winInfo))
    {
    {
      switch (winInfo->generic.type)
      switch (winInfo->generic.type)
        {
        {
        case SRC_WIN:
        case SRC_WIN:
        case DISASSEM_WIN:
        case DISASSEM_WIN:
          winInfo->detail.sourceInfo.startLineOrAddr.addr = (Opaque) NULL;
          winInfo->detail.sourceInfo.startLineOrAddr.addr = (Opaque) NULL;
          winInfo->detail.sourceInfo.horizontalOffset = 0;
          winInfo->detail.sourceInfo.horizontalOffset = 0;
          break;
          break;
        case CMD_WIN:
        case CMD_WIN:
          winInfo->detail.commandInfo.curLine =
          winInfo->detail.commandInfo.curLine =
            winInfo->detail.commandInfo.curch = 0;
            winInfo->detail.commandInfo.curch = 0;
          break;
          break;
        case DATA_WIN:
        case DATA_WIN:
          winInfo->detail.dataDisplayInfo.dataContent =
          winInfo->detail.dataDisplayInfo.dataContent =
            (TuiWinContent) NULL;
            (TuiWinContent) NULL;
          winInfo->detail.dataDisplayInfo.dataContentCount = 0;
          winInfo->detail.dataDisplayInfo.dataContentCount = 0;
          winInfo->detail.dataDisplayInfo.regsContent =
          winInfo->detail.dataDisplayInfo.regsContent =
            (TuiWinContent) NULL;
            (TuiWinContent) NULL;
          winInfo->detail.dataDisplayInfo.regsContentCount = 0;
          winInfo->detail.dataDisplayInfo.regsContentCount = 0;
          winInfo->detail.dataDisplayInfo.regsDisplayType =
          winInfo->detail.dataDisplayInfo.regsDisplayType =
            TUI_UNDEFINED_REGS;
            TUI_UNDEFINED_REGS;
          winInfo->detail.dataDisplayInfo.regsColumnCount = 1;
          winInfo->detail.dataDisplayInfo.regsColumnCount = 1;
          winInfo->detail.dataDisplayInfo.displayRegs = FALSE;
          winInfo->detail.dataDisplayInfo.displayRegs = FALSE;
          break;
          break;
        default:
        default:
          break;
          break;
        }
        }
    }
    }
 
 
  return;
  return;
}                               /* clearWinDetail */
}                               /* clearWinDetail */
 
 
 
 
/*
/*
   ** blankStr()
   ** blankStr()
   **        Accessor for the blank string.
   **        Accessor for the blank string.
 */
 */
char *
char *
#ifdef __STDC__
#ifdef __STDC__
blankStr (void)
blankStr (void)
#else
#else
blankStr ()
blankStr ()
#endif
#endif
{
{
  return _tuiBlankStr;
  return _tuiBlankStr;
}                               /* blankStr */
}                               /* blankStr */
 
 
 
 
/*
/*
   ** locationStr()
   ** locationStr()
   **        Accessor for the location string.
   **        Accessor for the location string.
 */
 */
char *
char *
#ifdef __STDC__
#ifdef __STDC__
locationStr (void)
locationStr (void)
#else
#else
locationStr ()
locationStr ()
#endif
#endif
{
{
  return _tuiLocationStr;
  return _tuiLocationStr;
}                               /* locationStr */
}                               /* locationStr */
 
 
 
 
/*
/*
   ** breakStr()
   ** breakStr()
   **        Accessor for the break string.
   **        Accessor for the break string.
 */
 */
char *
char *
#ifdef __STDC__
#ifdef __STDC__
breakStr (void)
breakStr (void)
#else
#else
breakStr ()
breakStr ()
#endif
#endif
{
{
  return _tuiBreakStr;
  return _tuiBreakStr;
}                               /* breakStr */
}                               /* breakStr */
 
 
 
 
/*
/*
   ** breakLocationStr()
   ** breakLocationStr()
   **        Accessor for the breakLocation string.
   **        Accessor for the breakLocation string.
 */
 */
char *
char *
#ifdef __STDC__
#ifdef __STDC__
breakLocationStr (void)
breakLocationStr (void)
#else
#else
breakLocationStr ()
breakLocationStr ()
#endif
#endif
{
{
  return _tuiBreakLocationStr;
  return _tuiBreakLocationStr;
}                               /* breakLocationStr */
}                               /* breakLocationStr */
 
 
 
 
/*
/*
   ** nullStr()
   ** nullStr()
   **        Accessor for the null string.
   **        Accessor for the null string.
 */
 */
char *
char *
#ifdef __STDC__
#ifdef __STDC__
nullStr (void)
nullStr (void)
#else
#else
nullStr ()
nullStr ()
#endif
#endif
{
{
  return _tuiNullStr;
  return _tuiNullStr;
}                               /* nullStr */
}                               /* nullStr */
 
 
 
 
/*
/*
   ** sourceExecInfoPtr().
   ** sourceExecInfoPtr().
   **        Accessor for the source execution info ptr.
   **        Accessor for the source execution info ptr.
 */
 */
TuiGenWinInfoPtr
TuiGenWinInfoPtr
#ifdef __STDC__
#ifdef __STDC__
sourceExecInfoWinPtr (void)
sourceExecInfoWinPtr (void)
#else
#else
sourceExecInfoWinPtr ()
sourceExecInfoWinPtr ()
#endif
#endif
{
{
  return &_execInfo[0];
  return &_execInfo[0];
}                               /* sourceExecInfoWinPtr */
}                               /* sourceExecInfoWinPtr */
 
 
 
 
/*
/*
   ** disassemExecInfoPtr().
   ** disassemExecInfoPtr().
   **        Accessor for the disassem execution info ptr.
   **        Accessor for the disassem execution info ptr.
 */
 */
TuiGenWinInfoPtr
TuiGenWinInfoPtr
#ifdef __STDC__
#ifdef __STDC__
disassemExecInfoWinPtr (void)
disassemExecInfoWinPtr (void)
#else
#else
disassemExecInfoWinPtr ()
disassemExecInfoWinPtr ()
#endif
#endif
{
{
  return &_execInfo[1];
  return &_execInfo[1];
}                               /* disassemExecInfoWinPtr */
}                               /* disassemExecInfoWinPtr */
 
 
 
 
/*
/*
   ** locatorWinInfoPtr().
   ** locatorWinInfoPtr().
   **        Accessor for the locator win info.  Answers a pointer to the
   **        Accessor for the locator win info.  Answers a pointer to the
   **        static locator win info struct.
   **        static locator win info struct.
 */
 */
TuiGenWinInfoPtr
TuiGenWinInfoPtr
#ifdef __STDC__
#ifdef __STDC__
locatorWinInfoPtr (void)
locatorWinInfoPtr (void)
#else
#else
locatorWinInfoPtr ()
locatorWinInfoPtr ()
#endif
#endif
{
{
  return &_locator;
  return &_locator;
}                               /* locatorWinInfoPtr */
}                               /* locatorWinInfoPtr */
 
 
 
 
/*
/*
   ** historyLimit().
   ** historyLimit().
   **        Accessor for the history limit
   **        Accessor for the history limit
 */
 */
int
int
#ifdef __STDC__
#ifdef __STDC__
historyLimit (void)
historyLimit (void)
#else
#else
historyLimit ()
historyLimit ()
#endif
#endif
{
{
  return _historyLimit;
  return _historyLimit;
}                               /* historyLimit */
}                               /* historyLimit */
 
 
 
 
/*
/*
   ** setHistoryLimitTo().
   ** setHistoryLimitTo().
   **        Mutator for the history limit
   **        Mutator for the history limit
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
setHistoryLimitTo (
setHistoryLimitTo (
                    int h)
                    int h)
#else
#else
setHistoryLimitTo (h)
setHistoryLimitTo (h)
     int h;
     int h;
#endif
#endif
{
{
  _historyLimit = h;
  _historyLimit = h;
 
 
  return;
  return;
}                               /* setHistoryLimitTo */
}                               /* setHistoryLimitTo */
 
 
/*
/*
   ** termHeight().
   ** termHeight().
   **        Accessor for the termHeight
   **        Accessor for the termHeight
 */
 */
int
int
#ifdef __STDC__
#ifdef __STDC__
termHeight (void)
termHeight (void)
#else
#else
termHeight ()
termHeight ()
#endif
#endif
{
{
  return _termHeight;
  return _termHeight;
}                               /* termHeight */
}                               /* termHeight */
 
 
 
 
/*
/*
   ** setTermHeightTo().
   ** setTermHeightTo().
   **        Mutator for the term height
   **        Mutator for the term height
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
setTermHeightTo (
setTermHeightTo (
                  int h)
                  int h)
#else
#else
setTermHeightTo (h)
setTermHeightTo (h)
     int h;
     int h;
#endif
#endif
{
{
  _termHeight = h;
  _termHeight = h;
 
 
  return;
  return;
}                               /* setTermHeightTo */
}                               /* setTermHeightTo */
 
 
 
 
/*
/*
   ** termWidth().
   ** termWidth().
   **        Accessor for the termWidth
   **        Accessor for the termWidth
 */
 */
int
int
#ifdef __STDC__
#ifdef __STDC__
termWidth (void)
termWidth (void)
#else
#else
termWidth ()
termWidth ()
#endif
#endif
{
{
  return _termWidth;
  return _termWidth;
}                               /* termWidth */
}                               /* termWidth */
 
 
 
 
/*
/*
   ** setTermWidth().
   ** setTermWidth().
   **        Mutator for the termWidth
   **        Mutator for the termWidth
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
setTermWidthTo (
setTermWidthTo (
                 int w)
                 int w)
#else
#else
setTermWidthTo (w)
setTermWidthTo (w)
     int w;
     int w;
#endif
#endif
{
{
  _termWidth = w;
  _termWidth = w;
 
 
  return;
  return;
}                               /* setTermWidthTo */
}                               /* setTermWidthTo */
 
 
 
 
/*
/*
   ** currentLayout().
   ** currentLayout().
   **        Accessor for the current layout
   **        Accessor for the current layout
 */
 */
TuiLayoutType
TuiLayoutType
#ifdef __STDC__
#ifdef __STDC__
currentLayout (void)
currentLayout (void)
#else
#else
currentLayout ()
currentLayout ()
#endif
#endif
{
{
  return _currentLayout;
  return _currentLayout;
}                               /* currentLayout */
}                               /* currentLayout */
 
 
 
 
/*
/*
   ** setCurrentLayoutTo().
   ** setCurrentLayoutTo().
   **        Mutator for the current layout
   **        Mutator for the current layout
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
setCurrentLayoutTo (
setCurrentLayoutTo (
                     TuiLayoutType newLayout)
                     TuiLayoutType newLayout)
#else
#else
setCurrentLayoutTo (newLayout)
setCurrentLayoutTo (newLayout)
     TuiLayoutType newLayout;
     TuiLayoutType newLayout;
#endif
#endif
{
{
  _currentLayout = newLayout;
  _currentLayout = newLayout;
 
 
  return;
  return;
}                               /* setCurrentLayoutTo */
}                               /* setCurrentLayoutTo */
 
 
 
 
/*
/*
   ** setGenWinOrigin().
   ** setGenWinOrigin().
   **        Set the origin of the window
   **        Set the origin of the window
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
setGenWinOrigin (
setGenWinOrigin (
                  TuiGenWinInfoPtr winInfo,
                  TuiGenWinInfoPtr winInfo,
                  int x,
                  int x,
                  int y)
                  int y)
#else
#else
setGenWinOrigin (winInfo, x, y)
setGenWinOrigin (winInfo, x, y)
     TuiGenWinInfoPtr winInfo;
     TuiGenWinInfoPtr winInfo;
     int x;
     int x;
     int y;
     int y;
#endif
#endif
{
{
  winInfo->origin.x = x;
  winInfo->origin.x = x;
  winInfo->origin.y = y;
  winInfo->origin.y = y;
 
 
  return;
  return;
}                               /* setGenWinOrigin */
}                               /* setGenWinOrigin */
 
 
 
 
/*****************************
/*****************************
** OTHER PUBLIC FUNCTIONS
** OTHER PUBLIC FUNCTIONS
*****************************/
*****************************/
 
 
 
 
/*
/*
   ** tuiNextWin().
   ** tuiNextWin().
   **        Answer the next window in the list, cycling back to the top
   **        Answer the next window in the list, cycling back to the top
   **        if necessary
   **        if necessary
 */
 */
TuiWinInfoPtr
TuiWinInfoPtr
#ifdef __STDC__
#ifdef __STDC__
tuiNextWin (
tuiNextWin (
             TuiWinInfoPtr curWin)
             TuiWinInfoPtr curWin)
#else
#else
tuiNextWin (curWin)
tuiNextWin (curWin)
     TuiWinInfoPtr curWin;
     TuiWinInfoPtr curWin;
#endif
#endif
{
{
  TuiWinType type = curWin->generic.type;
  TuiWinType type = curWin->generic.type;
  TuiWinInfoPtr nextWin = (TuiWinInfoPtr) NULL;
  TuiWinInfoPtr nextWin = (TuiWinInfoPtr) NULL;
 
 
  if (curWin->generic.type == CMD_WIN)
  if (curWin->generic.type == CMD_WIN)
    type = SRC_WIN;
    type = SRC_WIN;
  else
  else
    type = curWin->generic.type + 1;
    type = curWin->generic.type + 1;
  while (type != curWin->generic.type && m_winPtrIsNull (nextWin))
  while (type != curWin->generic.type && m_winPtrIsNull (nextWin))
    {
    {
      if (winList[type]->generic.isVisible)
      if (winList[type]->generic.isVisible)
        nextWin = winList[type];
        nextWin = winList[type];
      else
      else
        {
        {
          if (type == CMD_WIN)
          if (type == CMD_WIN)
            type = SRC_WIN;
            type = SRC_WIN;
          else
          else
            type++;
            type++;
        }
        }
    }
    }
 
 
  return nextWin;
  return nextWin;
}                               /* tuiNextWin */
}                               /* tuiNextWin */
 
 
 
 
/*
/*
   ** tuiPrevWin().
   ** tuiPrevWin().
   **        Answer the prev window in the list, cycling back to the bottom
   **        Answer the prev window in the list, cycling back to the bottom
   **        if necessary
   **        if necessary
 */
 */
TuiWinInfoPtr
TuiWinInfoPtr
#ifdef __STDC__
#ifdef __STDC__
tuiPrevWin (
tuiPrevWin (
             TuiWinInfoPtr curWin)
             TuiWinInfoPtr curWin)
#else
#else
tuiPrevWin (curWin)
tuiPrevWin (curWin)
     TuiWinInfoPtr curWin;
     TuiWinInfoPtr curWin;
#endif
#endif
{
{
  TuiWinType type = curWin->generic.type;
  TuiWinType type = curWin->generic.type;
  TuiWinInfoPtr prev = (TuiWinInfoPtr) NULL;
  TuiWinInfoPtr prev = (TuiWinInfoPtr) NULL;
 
 
  if (curWin->generic.type == SRC_WIN)
  if (curWin->generic.type == SRC_WIN)
    type = CMD_WIN;
    type = CMD_WIN;
  else
  else
    type = curWin->generic.type - 1;
    type = curWin->generic.type - 1;
  while (type != curWin->generic.type && m_winPtrIsNull (prev))
  while (type != curWin->generic.type && m_winPtrIsNull (prev))
    {
    {
      if (winList[type]->generic.isVisible)
      if (winList[type]->generic.isVisible)
        prev = winList[type];
        prev = winList[type];
      else
      else
        {
        {
          if (type == SRC_WIN)
          if (type == SRC_WIN)
            type = CMD_WIN;
            type = CMD_WIN;
          else
          else
            type--;
            type--;
        }
        }
    }
    }
 
 
  return prev;
  return prev;
}                               /* tuiPrevWin */
}                               /* tuiPrevWin */
 
 
 
 
/*
/*
   ** displayableWinContentOf().
   ** displayableWinContentOf().
   **        Answer a the content at the location indicated by index.  Note
   **        Answer a the content at the location indicated by index.  Note
   **        that if this is a locator window, the string returned should be
   **        that if this is a locator window, the string returned should be
   **        freed after use.
   **        freed after use.
 */
 */
char *
char *
#ifdef __STDC__
#ifdef __STDC__
displayableWinContentOf (
displayableWinContentOf (
                          TuiGenWinInfoPtr winInfo,
                          TuiGenWinInfoPtr winInfo,
                          TuiWinElementPtr elementPtr)
                          TuiWinElementPtr elementPtr)
#else
#else
displayableWinContentOf (winInfo, elementPtr)
displayableWinContentOf (winInfo, elementPtr)
     TuiGenWinInfoPtr winInfo;
     TuiGenWinInfoPtr winInfo;
     TuiWinElementPtr elementPtr;
     TuiWinElementPtr elementPtr;
#endif
#endif
{
{
 
 
  char *string = nullStr ();
  char *string = nullStr ();
 
 
  if (elementPtr != (TuiWinElementPtr) NULL || winInfo->type == LOCATOR_WIN)
  if (elementPtr != (TuiWinElementPtr) NULL || winInfo->type == LOCATOR_WIN)
    {
    {
      /*
      /*
         ** Now convert the line to a displayable string
         ** Now convert the line to a displayable string
       */
       */
      switch (winInfo->type)
      switch (winInfo->type)
        {
        {
        case SRC_WIN:
        case SRC_WIN:
        case DISASSEM_WIN:
        case DISASSEM_WIN:
          string = elementPtr->whichElement.source.line;
          string = elementPtr->whichElement.source.line;
          break;
          break;
        case CMD_WIN:
        case CMD_WIN:
          string = elementPtr->whichElement.command.line;
          string = elementPtr->whichElement.command.line;
          break;
          break;
        case LOCATOR_WIN:
        case LOCATOR_WIN:
          if ((string = (char *) xmalloc (
          if ((string = (char *) xmalloc (
                      (termWidth () + 1) * sizeof (char))) == (char *) NULL)
                      (termWidth () + 1) * sizeof (char))) == (char *) NULL)
              string = nullStr ();
              string = nullStr ();
          else
          else
            {
            {
              char lineNo[50], pc[50], buf[50], *fname, *pname;
              char lineNo[50], pc[50], buf[50], *fname, *pname;
              register int strSize = termWidth (), i, procWidth, fileWidth;
              register int strSize = termWidth (), i, procWidth, fileWidth;
 
 
              /*
              /*
                 ** First determine the amount of file/proc name width
                 ** First determine the amount of file/proc name width
                 ** we have available
                 ** we have available
               */
               */
              i = strSize - (PC_WIDTH + LINE_WIDTH
              i = strSize - (PC_WIDTH + LINE_WIDTH
                             + 25       /* pc and line labels */
                             + 25       /* pc and line labels */
                             + strlen (FILE_PREFIX) + 1         /* file label */
                             + strlen (FILE_PREFIX) + 1         /* file label */
                             + 15 /* procedure label */ );
                             + 15 /* procedure label */ );
              if (i >= FILE_WIDTH + PROC_WIDTH)
              if (i >= FILE_WIDTH + PROC_WIDTH)
                {
                {
                  fileWidth = FILE_WIDTH;
                  fileWidth = FILE_WIDTH;
                  procWidth = PROC_WIDTH;
                  procWidth = PROC_WIDTH;
                }
                }
              else
              else
                {
                {
                  fileWidth = i / 2;
                  fileWidth = i / 2;
                  procWidth = i - fileWidth;
                  procWidth = i - fileWidth;
                }
                }
 
 
              /* Now convert elements to string form */
              /* Now convert elements to string form */
              if (elementPtr != (TuiWinElementPtr) NULL &&
              if (elementPtr != (TuiWinElementPtr) NULL &&
                  *elementPtr->whichElement.locator.fileName != (char) 0 &&
                  *elementPtr->whichElement.locator.fileName != (char) 0 &&
                  srcWin->generic.isVisible)
                  srcWin->generic.isVisible)
                fname = elementPtr->whichElement.locator.fileName;
                fname = elementPtr->whichElement.locator.fileName;
              else
              else
                fname = "??";
                fname = "??";
              if (elementPtr != (TuiWinElementPtr) NULL &&
              if (elementPtr != (TuiWinElementPtr) NULL &&
                  *elementPtr->whichElement.locator.procName != (char) 0)
                  *elementPtr->whichElement.locator.procName != (char) 0)
                pname = elementPtr->whichElement.locator.procName;
                pname = elementPtr->whichElement.locator.procName;
              else
              else
                pname = "??";
                pname = "??";
              if (elementPtr != (TuiWinElementPtr) NULL &&
              if (elementPtr != (TuiWinElementPtr) NULL &&
                  elementPtr->whichElement.locator.lineNo > 0)
                  elementPtr->whichElement.locator.lineNo > 0)
                sprintf (lineNo, "%d",
                sprintf (lineNo, "%d",
                         elementPtr->whichElement.locator.lineNo);
                         elementPtr->whichElement.locator.lineNo);
              else
              else
                strcpy (lineNo, "??");
                strcpy (lineNo, "??");
              if (elementPtr != (TuiWinElementPtr) NULL &&
              if (elementPtr != (TuiWinElementPtr) NULL &&
                  elementPtr->whichElement.locator.addr > (Opaque) 0)
                  elementPtr->whichElement.locator.addr > (Opaque) 0)
                sprintf (pc, "0x%x",
                sprintf (pc, "0x%x",
                         elementPtr->whichElement.locator.addr);
                         elementPtr->whichElement.locator.addr);
              else
              else
                strcpy (pc, "??");
                strcpy (pc, "??");
              /*
              /*
                 ** Now create the locator line from the string version
                 ** Now create the locator line from the string version
                 ** of the elements.  We could use sprintf() here but
                 ** of the elements.  We could use sprintf() here but
                 ** that wouldn't ensure that we don't overrun the size
                 ** that wouldn't ensure that we don't overrun the size
                 ** of the allocated buffer.  strcat_to_buf() will.
                 ** of the allocated buffer.  strcat_to_buf() will.
               */
               */
              *string = (char) 0;
              *string = (char) 0;
              /* Filename */
              /* Filename */
              strcat_to_buf (string, strSize, " ");
              strcat_to_buf (string, strSize, " ");
              strcat_to_buf (string, strSize, FILE_PREFIX);
              strcat_to_buf (string, strSize, FILE_PREFIX);
              if (strlen (fname) > fileWidth)
              if (strlen (fname) > fileWidth)
                {
                {
                  strncpy (buf, fname, fileWidth - 1);
                  strncpy (buf, fname, fileWidth - 1);
                  buf[fileWidth - 1] = '*';
                  buf[fileWidth - 1] = '*';
                  buf[fileWidth] = (char) 0;
                  buf[fileWidth] = (char) 0;
                }
                }
              else
              else
                strcpy (buf, fname);
                strcpy (buf, fname);
              strcat_to_buf (string, strSize, buf);
              strcat_to_buf (string, strSize, buf);
              /* procedure/class name */
              /* procedure/class name */
              sprintf (buf, "%15s", PROC_PREFIX);
              sprintf (buf, "%15s", PROC_PREFIX);
              strcat_to_buf (string, strSize, buf);
              strcat_to_buf (string, strSize, buf);
              if (strlen (pname) > procWidth)
              if (strlen (pname) > procWidth)
                {
                {
                  strncpy (buf, pname, procWidth - 1);
                  strncpy (buf, pname, procWidth - 1);
                  buf[procWidth - 1] = '*';
                  buf[procWidth - 1] = '*';
                  buf[procWidth] = (char) 0;
                  buf[procWidth] = (char) 0;
                }
                }
              else
              else
                strcpy (buf, pname);
                strcpy (buf, pname);
              strcat_to_buf (string, strSize, buf);
              strcat_to_buf (string, strSize, buf);
              sprintf (buf, "%10s", LINE_PREFIX);
              sprintf (buf, "%10s", LINE_PREFIX);
              strcat_to_buf (string, strSize, buf);
              strcat_to_buf (string, strSize, buf);
              strcat_to_buf (string, strSize, lineNo);
              strcat_to_buf (string, strSize, lineNo);
              sprintf (buf, "%10s", PC_PREFIX);
              sprintf (buf, "%10s", PC_PREFIX);
              strcat_to_buf (string, strSize, buf);
              strcat_to_buf (string, strSize, buf);
              strcat_to_buf (string, strSize, pc);
              strcat_to_buf (string, strSize, pc);
              for (i = strlen (string); i < strSize; i++)
              for (i = strlen (string); i < strSize; i++)
                string[i] = ' ';
                string[i] = ' ';
              string[strSize] = (char) 0;
              string[strSize] = (char) 0;
            }
            }
          break;
          break;
        case EXEC_INFO_WIN:
        case EXEC_INFO_WIN:
          string = elementPtr->whichElement.simpleString;
          string = elementPtr->whichElement.simpleString;
          break;
          break;
        default:
        default:
          break;
          break;
        }
        }
    }
    }
  return string;
  return string;
}                               /* displayableWinContentOf */
}                               /* displayableWinContentOf */
 
 
 
 
/*
/*
   **    winContentAt().
   **    winContentAt().
   **        Answer a the content at the location indicated by index
   **        Answer a the content at the location indicated by index
 */
 */
char *
char *
#ifdef __STDC__
#ifdef __STDC__
displayableWinContentAt (
displayableWinContentAt (
                          TuiGenWinInfoPtr winInfo,
                          TuiGenWinInfoPtr winInfo,
                          int index)
                          int index)
#else
#else
displayableWinContentAt (winInfo, index)
displayableWinContentAt (winInfo, index)
     TuiGenWinInfoPtr winInfo;
     TuiGenWinInfoPtr winInfo;
     int index;
     int index;
#endif
#endif
{
{
  return (displayableWinContentOf (winInfo, (TuiWinElementPtr) winInfo->content[index]));
  return (displayableWinContentOf (winInfo, (TuiWinElementPtr) winInfo->content[index]));
}                               /* winContentAt */
}                               /* winContentAt */
 
 
 
 
/*
/*
   ** winElementHeight().
   ** winElementHeight().
   **        Answer the height of the element in lines
   **        Answer the height of the element in lines
 */
 */
int
int
#ifdef __STDC__
#ifdef __STDC__
winElementHeight (
winElementHeight (
                   TuiGenWinInfoPtr winInfo,
                   TuiGenWinInfoPtr winInfo,
                   TuiWinElementPtr element)
                   TuiWinElementPtr element)
#else
#else
winElementHeight (winInfo, element)
winElementHeight (winInfo, element)
     TuiGenWinInfoPtr winInfo;
     TuiGenWinInfoPtr winInfo;
     TuiWinElementPtr element;
     TuiWinElementPtr element;
#endif
#endif
{
{
  int h;
  int h;
 
 
  if (winInfo->type == DATA_WIN)
  if (winInfo->type == DATA_WIN)
/* FOR NOW SAY IT IS ONLY ONE LINE HIGH */
/* FOR NOW SAY IT IS ONLY ONE LINE HIGH */
    h = 1;
    h = 1;
  else
  else
    h = 1;
    h = 1;
 
 
  return h;
  return h;
}                               /* winElementHeight */
}                               /* winElementHeight */
 
 
 
 
/*
/*
   **  winByName().
   **  winByName().
   **      Answer the window represented by name
   **      Answer the window represented by name
 */
 */
TuiWinInfoPtr
TuiWinInfoPtr
#ifdef __STDC__
#ifdef __STDC__
winByName (
winByName (
            char *name)
            char *name)
#else
#else
winByName (name)
winByName (name)
     char *name;
     char *name;
#endif
#endif
{
{
  TuiWinInfoPtr winInfo = (TuiWinInfoPtr) NULL;
  TuiWinInfoPtr winInfo = (TuiWinInfoPtr) NULL;
  int i = 0;
  int i = 0;
 
 
  while (i < MAX_MAJOR_WINDOWS && m_winPtrIsNull (winInfo))
  while (i < MAX_MAJOR_WINDOWS && m_winPtrIsNull (winInfo))
    {
    {
      if (strcmp (name, winName (&(winList[i]->generic))) == 0)
      if (strcmp (name, winName (&(winList[i]->generic))) == 0)
        winInfo = winList[i];
        winInfo = winList[i];
      i++;
      i++;
    }
    }
 
 
  return winInfo;
  return winInfo;
}                               /* winByName */
}                               /* winByName */
 
 
 
 
/*
/*
   **  partialWinByName().
   **  partialWinByName().
   **      Answer the window represented by name
   **      Answer the window represented by name
 */
 */
TuiWinInfoPtr
TuiWinInfoPtr
#ifdef __STDC__
#ifdef __STDC__
partialWinByName (
partialWinByName (
                   char *name)
                   char *name)
#else
#else
partialWinByName (name)
partialWinByName (name)
     char *name;
     char *name;
#endif
#endif
{
{
  TuiWinInfoPtr winInfo = (TuiWinInfoPtr) NULL;
  TuiWinInfoPtr winInfo = (TuiWinInfoPtr) NULL;
 
 
  if (name != (char *) NULL)
  if (name != (char *) NULL)
    {
    {
      int i = 0;
      int i = 0;
 
 
      while (i < MAX_MAJOR_WINDOWS && m_winPtrIsNull (winInfo))
      while (i < MAX_MAJOR_WINDOWS && m_winPtrIsNull (winInfo))
        {
        {
          char *curName = winName (&winList[i]->generic);
          char *curName = winName (&winList[i]->generic);
          if (strlen (name) <= strlen (curName) &&
          if (strlen (name) <= strlen (curName) &&
              strncmp (name, curName, strlen (name)) == 0)
              strncmp (name, curName, strlen (name)) == 0)
            winInfo = winList[i];
            winInfo = winList[i];
          i++;
          i++;
        }
        }
    }
    }
 
 
  return winInfo;
  return winInfo;
}                               /* partialWinByName */
}                               /* partialWinByName */
 
 
 
 
/*
/*
   ** winName().
   ** winName().
   **      Answer the name of the window
   **      Answer the name of the window
 */
 */
char *
char *
#ifdef __STDC__
#ifdef __STDC__
winName (
winName (
          TuiGenWinInfoPtr winInfo)
          TuiGenWinInfoPtr winInfo)
#else
#else
winName (winInfo)
winName (winInfo)
     TuiGenWinInfoPtr winInfo;
     TuiGenWinInfoPtr winInfo;
#endif
#endif
{
{
  char *name = (char *) NULL;
  char *name = (char *) NULL;
 
 
  switch (winInfo->type)
  switch (winInfo->type)
    {
    {
    case SRC_WIN:
    case SRC_WIN:
      name = SRC_NAME;
      name = SRC_NAME;
      break;
      break;
    case CMD_WIN:
    case CMD_WIN:
      name = CMD_NAME;
      name = CMD_NAME;
      break;
      break;
    case DISASSEM_WIN:
    case DISASSEM_WIN:
      name = DISASSEM_NAME;
      name = DISASSEM_NAME;
      break;
      break;
    case DATA_WIN:
    case DATA_WIN:
      name = DATA_NAME;
      name = DATA_NAME;
      break;
      break;
    default:
    default:
      name = "";
      name = "";
      break;
      break;
    }
    }
 
 
  return name;
  return name;
}                               /* winName */
}                               /* winName */
 
 
 
 
/*
/*
   ** initializeStaticData
   ** initializeStaticData
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
initializeStaticData (void)
initializeStaticData (void)
#else
#else
initializeStaticData ()
initializeStaticData ()
#endif
#endif
{
{
  initGenericPart (sourceExecInfoWinPtr ());
  initGenericPart (sourceExecInfoWinPtr ());
  initGenericPart (disassemExecInfoWinPtr ());
  initGenericPart (disassemExecInfoWinPtr ());
  initGenericPart (locatorWinInfoPtr ());
  initGenericPart (locatorWinInfoPtr ());
 
 
  return;
  return;
}                               /* initializeStaticData */
}                               /* initializeStaticData */
 
 
 
 
/*
/*
   ** allocGenericWinInfo().
   ** allocGenericWinInfo().
 */
 */
TuiGenWinInfoPtr
TuiGenWinInfoPtr
#ifdef __STDC__
#ifdef __STDC__
allocGenericWinInfo (void)
allocGenericWinInfo (void)
#else
#else
allocGenericWinInfo ()
allocGenericWinInfo ()
#endif
#endif
{
{
  TuiGenWinInfoPtr win;
  TuiGenWinInfoPtr win;
 
 
  if ((win = (TuiGenWinInfoPtr) xmalloc (
  if ((win = (TuiGenWinInfoPtr) xmalloc (
                     sizeof (TuiGenWinInfoPtr))) != (TuiGenWinInfoPtr) NULL)
                     sizeof (TuiGenWinInfoPtr))) != (TuiGenWinInfoPtr) NULL)
    initGenericPart (win);
    initGenericPart (win);
 
 
  return win;
  return win;
}                               /* allocGenericWinInfo */
}                               /* allocGenericWinInfo */
 
 
 
 
/*
/*
   ** initGenericPart().
   ** initGenericPart().
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
initGenericPart (
initGenericPart (
                  TuiGenWinInfoPtr win)
                  TuiGenWinInfoPtr win)
#else
#else
initGenericPart (win)
initGenericPart (win)
     TuiGenWinInfoPtr win;
     TuiGenWinInfoPtr win;
#endif
#endif
{
{
  win->width =
  win->width =
    win->height =
    win->height =
    win->origin.x =
    win->origin.x =
    win->origin.y =
    win->origin.y =
    win->viewportHeight =
    win->viewportHeight =
    win->contentSize =
    win->contentSize =
    win->lastVisibleLine = 0;
    win->lastVisibleLine = 0;
  win->handle = (WINDOW *) NULL;
  win->handle = (WINDOW *) NULL;
  win->content = (OpaquePtr) NULL;
  win->content = (OpaquePtr) NULL;
  win->contentInUse =
  win->contentInUse =
    win->isVisible = FALSE;
    win->isVisible = FALSE;
 
 
  return;
  return;
}                               /* initGenericPart */
}                               /* initGenericPart */
 
 
 
 
/*
/*
   ** initContentElement().
   ** initContentElement().
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
initContentElement (
initContentElement (
                     TuiWinElementPtr element,
                     TuiWinElementPtr element,
                     TuiWinType type)
                     TuiWinType type)
#else
#else
initContentElement (element, type)
initContentElement (element, type)
     TuiWinElementPtr element;
     TuiWinElementPtr element;
     TuiWinType type;
     TuiWinType type;
#endif
#endif
{
{
  element->highlight = FALSE;
  element->highlight = FALSE;
  switch (type)
  switch (type)
    {
    {
    case SRC_WIN:
    case SRC_WIN:
    case DISASSEM_WIN:
    case DISASSEM_WIN:
      element->whichElement.source.line = (char *) NULL;
      element->whichElement.source.line = (char *) NULL;
      element->whichElement.source.lineOrAddr.lineNo = 0;
      element->whichElement.source.lineOrAddr.lineNo = 0;
      element->whichElement.source.isExecPoint = FALSE;
      element->whichElement.source.isExecPoint = FALSE;
      element->whichElement.source.hasBreak = FALSE;
      element->whichElement.source.hasBreak = FALSE;
      break;
      break;
    case DATA_WIN:
    case DATA_WIN:
      initGenericPart (&element->whichElement.dataWindow);
      initGenericPart (&element->whichElement.dataWindow);
      element->whichElement.dataWindow.type = DATA_ITEM_WIN;
      element->whichElement.dataWindow.type = DATA_ITEM_WIN;
      ((TuiGenWinInfoPtr) & element->whichElement.dataWindow)->content =
      ((TuiGenWinInfoPtr) & element->whichElement.dataWindow)->content =
        (OpaquePtr) allocContent (1, DATA_ITEM_WIN);
        (OpaquePtr) allocContent (1, DATA_ITEM_WIN);
      ((TuiGenWinInfoPtr)
      ((TuiGenWinInfoPtr)
       & element->whichElement.dataWindow)->contentSize = 1;
       & element->whichElement.dataWindow)->contentSize = 1;
      break;
      break;
    case CMD_WIN:
    case CMD_WIN:
      element->whichElement.command.line = (char *) NULL;
      element->whichElement.command.line = (char *) NULL;
      break;
      break;
    case DATA_ITEM_WIN:
    case DATA_ITEM_WIN:
      element->whichElement.data.name = (char *) NULL;
      element->whichElement.data.name = (char *) NULL;
      element->whichElement.data.type = TUI_REGISTER;
      element->whichElement.data.type = TUI_REGISTER;
      element->whichElement.data.itemNo = UNDEFINED_ITEM;
      element->whichElement.data.itemNo = UNDEFINED_ITEM;
      element->whichElement.data.value = (Opaque) NULL;
      element->whichElement.data.value = (Opaque) NULL;
      element->whichElement.data.highlight = FALSE;
      element->whichElement.data.highlight = FALSE;
      break;
      break;
    case LOCATOR_WIN:
    case LOCATOR_WIN:
      element->whichElement.locator.fileName[0] =
      element->whichElement.locator.fileName[0] =
        element->whichElement.locator.procName[0] = (char) 0;
        element->whichElement.locator.procName[0] = (char) 0;
      element->whichElement.locator.lineNo = 0;
      element->whichElement.locator.lineNo = 0;
      element->whichElement.locator.addr = 0;
      element->whichElement.locator.addr = 0;
      break;
      break;
    case EXEC_INFO_WIN:
    case EXEC_INFO_WIN:
      element->whichElement.simpleString = blankStr ();
      element->whichElement.simpleString = blankStr ();
      break;
      break;
    default:
    default:
      break;
      break;
    }
    }
  return;
  return;
}                               /* initContentElement */
}                               /* initContentElement */
 
 
/*
/*
   ** initWinInfo().
   ** initWinInfo().
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
initWinInfo (
initWinInfo (
              TuiWinInfoPtr winInfo)
              TuiWinInfoPtr winInfo)
#else
#else
initWinInfo (winInfo)
initWinInfo (winInfo)
     TuiWinInfoPtr winInfo;
     TuiWinInfoPtr winInfo;
#endif
#endif
{
{
  initGenericPart (&winInfo->generic);
  initGenericPart (&winInfo->generic);
  winInfo->canHighlight =
  winInfo->canHighlight =
    winInfo->isHighlighted = FALSE;
    winInfo->isHighlighted = FALSE;
  switch (winInfo->generic.type)
  switch (winInfo->generic.type)
    {
    {
    case SRC_WIN:
    case SRC_WIN:
    case DISASSEM_WIN:
    case DISASSEM_WIN:
      winInfo->detail.sourceInfo.executionInfo = (TuiGenWinInfoPtr) NULL;
      winInfo->detail.sourceInfo.executionInfo = (TuiGenWinInfoPtr) NULL;
      winInfo->detail.sourceInfo.hasLocator = FALSE;
      winInfo->detail.sourceInfo.hasLocator = FALSE;
      winInfo->detail.sourceInfo.horizontalOffset = 0;
      winInfo->detail.sourceInfo.horizontalOffset = 0;
      winInfo->detail.sourceInfo.startLineOrAddr.addr = (Opaque) NULL;
      winInfo->detail.sourceInfo.startLineOrAddr.addr = (Opaque) NULL;
      break;
      break;
    case DATA_WIN:
    case DATA_WIN:
      winInfo->detail.dataDisplayInfo.dataContent = (TuiWinContent) NULL;
      winInfo->detail.dataDisplayInfo.dataContent = (TuiWinContent) NULL;
      winInfo->detail.dataDisplayInfo.dataContentCount = 0;
      winInfo->detail.dataDisplayInfo.dataContentCount = 0;
      winInfo->detail.dataDisplayInfo.regsContent = (TuiWinContent) NULL;
      winInfo->detail.dataDisplayInfo.regsContent = (TuiWinContent) NULL;
      winInfo->detail.dataDisplayInfo.regsContentCount = 0;
      winInfo->detail.dataDisplayInfo.regsContentCount = 0;
      winInfo->detail.dataDisplayInfo.regsDisplayType =
      winInfo->detail.dataDisplayInfo.regsDisplayType =
        TUI_UNDEFINED_REGS;
        TUI_UNDEFINED_REGS;
      winInfo->detail.dataDisplayInfo.regsColumnCount = 1;
      winInfo->detail.dataDisplayInfo.regsColumnCount = 1;
      winInfo->detail.dataDisplayInfo.displayRegs = FALSE;
      winInfo->detail.dataDisplayInfo.displayRegs = FALSE;
      break;
      break;
    case CMD_WIN:
    case CMD_WIN:
      winInfo->detail.commandInfo.curLine = 0;
      winInfo->detail.commandInfo.curLine = 0;
      winInfo->detail.commandInfo.curch = 0;
      winInfo->detail.commandInfo.curch = 0;
      break;
      break;
    default:
    default:
      winInfo->detail.opaque = (Opaque) NULL;
      winInfo->detail.opaque = (Opaque) NULL;
      break;
      break;
    }
    }
 
 
  return;
  return;
}                               /* initWinInfo */
}                               /* initWinInfo */
 
 
 
 
/*
/*
   ** allocWinInfo().
   ** allocWinInfo().
 */
 */
TuiWinInfoPtr
TuiWinInfoPtr
#ifdef __STDC__
#ifdef __STDC__
allocWinInfo (
allocWinInfo (
               TuiWinType type)
               TuiWinType type)
#else
#else
allocWinInfo (type)
allocWinInfo (type)
     TuiWinType type;
     TuiWinType type;
#endif
#endif
{
{
  TuiWinInfoPtr winInfo = (TuiWinInfoPtr) NULL;
  TuiWinInfoPtr winInfo = (TuiWinInfoPtr) NULL;
 
 
  winInfo = (TuiWinInfoPtr) xmalloc (sizeof (TuiWinInfo));
  winInfo = (TuiWinInfoPtr) xmalloc (sizeof (TuiWinInfo));
  if (m_winPtrNotNull (winInfo))
  if (m_winPtrNotNull (winInfo))
    {
    {
      winInfo->generic.type = type;
      winInfo->generic.type = type;
      initWinInfo (winInfo);
      initWinInfo (winInfo);
    }
    }
 
 
  return winInfo;
  return winInfo;
}                               /* allocWinInfo */
}                               /* allocWinInfo */
 
 
 
 
/*
/*
   ** allocContent().
   ** allocContent().
   **        Allocates the content and elements in a block.
   **        Allocates the content and elements in a block.
 */
 */
TuiWinContent
TuiWinContent
#ifdef __STDC__
#ifdef __STDC__
allocContent (
allocContent (
               int numElements,
               int numElements,
               TuiWinType type)
               TuiWinType type)
#else
#else
allocContent (numElements, type)
allocContent (numElements, type)
     int numElements;
     int numElements;
     TuiWinType type;
     TuiWinType type;
#endif
#endif
{
{
  TuiWinContent content = (TuiWinContent) NULL;
  TuiWinContent content = (TuiWinContent) NULL;
  char *elementBlockPtr = (char *) NULL;
  char *elementBlockPtr = (char *) NULL;
  int i;
  int i;
 
 
  if ((content = (TuiWinContent)
  if ((content = (TuiWinContent)
  xmalloc (sizeof (TuiWinElementPtr) * numElements)) != (TuiWinContent) NULL)
  xmalloc (sizeof (TuiWinElementPtr) * numElements)) != (TuiWinContent) NULL)
    {                           /*
    {                           /*
                                   ** All windows, except the data window, can allocate the elements
                                   ** All windows, except the data window, can allocate the elements
                                   ** in a chunk.  The data window cannot because items can be
                                   ** in a chunk.  The data window cannot because items can be
                                   ** added/removed from the data display by the user at any time.
                                   ** added/removed from the data display by the user at any time.
                                 */
                                 */
      if (type != DATA_WIN)
      if (type != DATA_WIN)
        {
        {
          if ((elementBlockPtr = (char *)
          if ((elementBlockPtr = (char *)
           xmalloc (sizeof (TuiWinElement) * numElements)) != (char *) NULL)
           xmalloc (sizeof (TuiWinElement) * numElements)) != (char *) NULL)
            {
            {
              for (i = 0; i < numElements; i++)
              for (i = 0; i < numElements; i++)
                {
                {
                  content[i] = (TuiWinElementPtr) elementBlockPtr;
                  content[i] = (TuiWinElementPtr) elementBlockPtr;
                  initContentElement (content[i], type);
                  initContentElement (content[i], type);
                  elementBlockPtr += sizeof (TuiWinElement);
                  elementBlockPtr += sizeof (TuiWinElement);
                }
                }
            }
            }
          else
          else
            {
            {
              tuiFree ((char *) content);
              tuiFree ((char *) content);
              content = (TuiWinContent) NULL;
              content = (TuiWinContent) NULL;
            }
            }
        }
        }
    }
    }
 
 
  return content;
  return content;
}                               /* allocContent */
}                               /* allocContent */
 
 
 
 
/*
/*
   ** addContentElements().
   ** addContentElements().
   **        Adds the input number of elements to the windows's content.  If
   **        Adds the input number of elements to the windows's content.  If
   **        no content has been allocated yet, allocContent() is called to
   **        no content has been allocated yet, allocContent() is called to
   **        do this.  The index of the first element added is returned,
   **        do this.  The index of the first element added is returned,
   **        unless there is a memory allocation error, in which case, (-1)
   **        unless there is a memory allocation error, in which case, (-1)
   **        is returned.
   **        is returned.
 */
 */
int
int
#ifdef __STDC__
#ifdef __STDC__
addContentElements (
addContentElements (
                     TuiGenWinInfoPtr winInfo,
                     TuiGenWinInfoPtr winInfo,
                     int numElements)
                     int numElements)
#else
#else
addContentElements (winInfo, numElements)
addContentElements (winInfo, numElements)
     TuiGenWinInfoPtr winInfo;
     TuiGenWinInfoPtr winInfo;
     int numElements;
     int numElements;
#endif
#endif
{
{
  TuiWinElementPtr elementPtr;
  TuiWinElementPtr elementPtr;
  int i, indexStart;
  int i, indexStart;
 
 
  if (winInfo->content == (OpaquePtr) NULL)
  if (winInfo->content == (OpaquePtr) NULL)
    {
    {
      winInfo->content = (OpaquePtr) allocContent (numElements, winInfo->type);
      winInfo->content = (OpaquePtr) allocContent (numElements, winInfo->type);
      indexStart = 0;
      indexStart = 0;
    }
    }
  else
  else
    indexStart = winInfo->contentSize;
    indexStart = winInfo->contentSize;
  if (winInfo->content != (OpaquePtr) NULL)
  if (winInfo->content != (OpaquePtr) NULL)
    {
    {
      for (i = indexStart; (i < numElements + indexStart); i++)
      for (i = indexStart; (i < numElements + indexStart); i++)
        {
        {
          if ((elementPtr = (TuiWinElementPtr)
          if ((elementPtr = (TuiWinElementPtr)
               xmalloc (sizeof (TuiWinElement))) != (TuiWinElementPtr) NULL)
               xmalloc (sizeof (TuiWinElement))) != (TuiWinElementPtr) NULL)
            {
            {
              winInfo->content[i] = (Opaque) elementPtr;
              winInfo->content[i] = (Opaque) elementPtr;
              initContentElement (elementPtr, winInfo->type);
              initContentElement (elementPtr, winInfo->type);
              winInfo->contentSize++;
              winInfo->contentSize++;
            }
            }
          else                  /* things must be really hosed now! We ran out of memory!? */
          else                  /* things must be really hosed now! We ran out of memory!? */
            return (-1);
            return (-1);
        }
        }
    }
    }
 
 
  return indexStart;
  return indexStart;
}                               /* addContentElements */
}                               /* addContentElements */
 
 
 
 
/*
/*
   **  tuiDelWindow().
   **  tuiDelWindow().
   **     Delete all curses windows associated with winInfo, leaving everything
   **     Delete all curses windows associated with winInfo, leaving everything
   **     else in tact.
   **     else in tact.
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
tuiDelWindow (
tuiDelWindow (
               TuiWinInfoPtr winInfo)
               TuiWinInfoPtr winInfo)
#else
#else
tuiDelWindow (winInfo)
tuiDelWindow (winInfo)
     TuiWinInfoPtr winInfo;
     TuiWinInfoPtr winInfo;
#endif
#endif
{
{
  Opaque detail;
  Opaque detail;
  int i;
  int i;
  TuiGenWinInfoPtr genericWin;
  TuiGenWinInfoPtr genericWin;
 
 
 
 
  switch (winInfo->generic.type)
  switch (winInfo->generic.type)
    {
    {
    case SRC_WIN:
    case SRC_WIN:
    case DISASSEM_WIN:
    case DISASSEM_WIN:
      genericWin = locatorWinInfoPtr ();
      genericWin = locatorWinInfoPtr ();
      if (genericWin != (TuiGenWinInfoPtr) NULL)
      if (genericWin != (TuiGenWinInfoPtr) NULL)
        {
        {
          tuiDelwin (genericWin->handle);
          tuiDelwin (genericWin->handle);
          genericWin->handle = (WINDOW *) NULL;
          genericWin->handle = (WINDOW *) NULL;
          genericWin->isVisible = FALSE;
          genericWin->isVisible = FALSE;
        }
        }
      genericWin = winInfo->detail.sourceInfo.executionInfo;
      genericWin = winInfo->detail.sourceInfo.executionInfo;
      if (genericWin != (TuiGenWinInfoPtr) NULL)
      if (genericWin != (TuiGenWinInfoPtr) NULL)
        {
        {
          tuiDelwin (genericWin->handle);
          tuiDelwin (genericWin->handle);
          genericWin->handle = (WINDOW *) NULL;
          genericWin->handle = (WINDOW *) NULL;
          genericWin->isVisible = FALSE;
          genericWin->isVisible = FALSE;
        }
        }
      break;
      break;
    case DATA_WIN:
    case DATA_WIN:
      if (winInfo->generic.content != (OpaquePtr) NULL)
      if (winInfo->generic.content != (OpaquePtr) NULL)
        {
        {
          int i;
          int i;
 
 
          tuiDelDataWindows (
          tuiDelDataWindows (
                              winInfo->detail.dataDisplayInfo.regsContent,
                              winInfo->detail.dataDisplayInfo.regsContent,
                          winInfo->detail.dataDisplayInfo.regsContentCount);
                          winInfo->detail.dataDisplayInfo.regsContentCount);
          tuiDelDataWindows (
          tuiDelDataWindows (
                              winInfo->detail.dataDisplayInfo.dataContent,
                              winInfo->detail.dataDisplayInfo.dataContent,
                          winInfo->detail.dataDisplayInfo.dataContentCount);
                          winInfo->detail.dataDisplayInfo.dataContentCount);
        }
        }
      break;
      break;
    default:
    default:
      break;
      break;
    }
    }
  if (winInfo->generic.handle != (WINDOW *) NULL)
  if (winInfo->generic.handle != (WINDOW *) NULL)
    {
    {
      tuiDelwin (winInfo->generic.handle);
      tuiDelwin (winInfo->generic.handle);
      winInfo->generic.handle = (WINDOW *) NULL;
      winInfo->generic.handle = (WINDOW *) NULL;
      winInfo->generic.isVisible = FALSE;
      winInfo->generic.isVisible = FALSE;
    }
    }
 
 
  return;
  return;
}                               /* tuiDelWindow */
}                               /* tuiDelWindow */
 
 
 
 
/*
/*
   **  freeWindow().
   **  freeWindow().
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
freeWindow (
freeWindow (
             TuiWinInfoPtr winInfo)
             TuiWinInfoPtr winInfo)
#else
#else
freeWindow (winInfo)
freeWindow (winInfo)
     TuiWinInfoPtr winInfo;
     TuiWinInfoPtr winInfo;
#endif
#endif
{
{
  Opaque detail;
  Opaque detail;
  int i;
  int i;
  TuiGenWinInfoPtr genericWin;
  TuiGenWinInfoPtr genericWin;
 
 
 
 
  switch (winInfo->generic.type)
  switch (winInfo->generic.type)
    {
    {
    case SRC_WIN:
    case SRC_WIN:
    case DISASSEM_WIN:
    case DISASSEM_WIN:
      genericWin = locatorWinInfoPtr ();
      genericWin = locatorWinInfoPtr ();
      if (genericWin != (TuiGenWinInfoPtr) NULL)
      if (genericWin != (TuiGenWinInfoPtr) NULL)
        {
        {
          tuiDelwin (genericWin->handle);
          tuiDelwin (genericWin->handle);
          genericWin->handle = (WINDOW *) NULL;
          genericWin->handle = (WINDOW *) NULL;
        }
        }
      freeWinContent (genericWin);
      freeWinContent (genericWin);
      genericWin = winInfo->detail.sourceInfo.executionInfo;
      genericWin = winInfo->detail.sourceInfo.executionInfo;
      if (genericWin != (TuiGenWinInfoPtr) NULL)
      if (genericWin != (TuiGenWinInfoPtr) NULL)
        {
        {
          tuiDelwin (genericWin->handle);
          tuiDelwin (genericWin->handle);
          genericWin->handle = (WINDOW *) NULL;
          genericWin->handle = (WINDOW *) NULL;
          freeWinContent (genericWin);
          freeWinContent (genericWin);
        }
        }
      break;
      break;
    case DATA_WIN:
    case DATA_WIN:
      if (winInfo->generic.content != (OpaquePtr) NULL)
      if (winInfo->generic.content != (OpaquePtr) NULL)
        {
        {
          freeDataContent (
          freeDataContent (
                            winInfo->detail.dataDisplayInfo.regsContent,
                            winInfo->detail.dataDisplayInfo.regsContent,
                          winInfo->detail.dataDisplayInfo.regsContentCount);
                          winInfo->detail.dataDisplayInfo.regsContentCount);
          winInfo->detail.dataDisplayInfo.regsContent =
          winInfo->detail.dataDisplayInfo.regsContent =
            (TuiWinContent) NULL;
            (TuiWinContent) NULL;
          winInfo->detail.dataDisplayInfo.regsContentCount = 0;
          winInfo->detail.dataDisplayInfo.regsContentCount = 0;
          freeDataContent (
          freeDataContent (
                            winInfo->detail.dataDisplayInfo.dataContent,
                            winInfo->detail.dataDisplayInfo.dataContent,
                          winInfo->detail.dataDisplayInfo.dataContentCount);
                          winInfo->detail.dataDisplayInfo.dataContentCount);
          winInfo->detail.dataDisplayInfo.dataContent =
          winInfo->detail.dataDisplayInfo.dataContent =
            (TuiWinContent) NULL;
            (TuiWinContent) NULL;
          winInfo->detail.dataDisplayInfo.dataContentCount = 0;
          winInfo->detail.dataDisplayInfo.dataContentCount = 0;
          winInfo->detail.dataDisplayInfo.regsDisplayType =
          winInfo->detail.dataDisplayInfo.regsDisplayType =
            TUI_UNDEFINED_REGS;
            TUI_UNDEFINED_REGS;
          winInfo->detail.dataDisplayInfo.regsColumnCount = 1;
          winInfo->detail.dataDisplayInfo.regsColumnCount = 1;
          winInfo->detail.dataDisplayInfo.displayRegs = FALSE;
          winInfo->detail.dataDisplayInfo.displayRegs = FALSE;
          winInfo->generic.content = (OpaquePtr) NULL;
          winInfo->generic.content = (OpaquePtr) NULL;
          winInfo->generic.contentSize = 0;
          winInfo->generic.contentSize = 0;
        }
        }
      break;
      break;
    default:
    default:
      break;
      break;
    }
    }
  if (winInfo->generic.handle != (WINDOW *) NULL)
  if (winInfo->generic.handle != (WINDOW *) NULL)
    {
    {
      tuiDelwin (winInfo->generic.handle);
      tuiDelwin (winInfo->generic.handle);
      winInfo->generic.handle = (WINDOW *) NULL;
      winInfo->generic.handle = (WINDOW *) NULL;
      freeWinContent (&winInfo->generic);
      freeWinContent (&winInfo->generic);
    }
    }
  xfree (winInfo);
  xfree (winInfo);
 
 
  return;
  return;
}                               /* freeWindow */
}                               /* freeWindow */
 
 
 
 
/*
/*
   ** freeAllSourceWinsContent().
   ** freeAllSourceWinsContent().
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
freeAllSourceWinsContent (void)
freeAllSourceWinsContent (void)
#else
#else
freeAllSourceWinsContent ()
freeAllSourceWinsContent ()
#endif
#endif
{
{
  int i;
  int i;
 
 
  for (i = 0; i < (sourceWindows ())->count; i++)
  for (i = 0; i < (sourceWindows ())->count; i++)
    {
    {
      TuiWinInfoPtr winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[i];
      TuiWinInfoPtr winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[i];
 
 
      if (m_winPtrNotNull (winInfo))
      if (m_winPtrNotNull (winInfo))
        {
        {
          freeWinContent (&(winInfo->generic));
          freeWinContent (&(winInfo->generic));
          freeWinContent (winInfo->detail.sourceInfo.executionInfo);
          freeWinContent (winInfo->detail.sourceInfo.executionInfo);
        }
        }
    }
    }
 
 
  return;
  return;
}                               /* freeAllSourceWinsContent */
}                               /* freeAllSourceWinsContent */
 
 
 
 
/*
/*
   ** freeWinContent().
   ** freeWinContent().
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
freeWinContent (
freeWinContent (
                 TuiGenWinInfoPtr winInfo)
                 TuiGenWinInfoPtr winInfo)
#else
#else
freeWinContent (winInfo)
freeWinContent (winInfo)
     TuiGenWinInfoPtr winInfo;
     TuiGenWinInfoPtr winInfo;
#endif
#endif
{
{
  if (winInfo->content != (OpaquePtr) NULL)
  if (winInfo->content != (OpaquePtr) NULL)
    {
    {
      freeContent ((TuiWinContent) winInfo->content,
      freeContent ((TuiWinContent) winInfo->content,
                   winInfo->contentSize,
                   winInfo->contentSize,
                   winInfo->type);
                   winInfo->type);
      winInfo->content = (OpaquePtr) NULL;
      winInfo->content = (OpaquePtr) NULL;
    }
    }
  winInfo->contentSize = 0;
  winInfo->contentSize = 0;
 
 
  return;
  return;
}                               /* freeWinContent */
}                               /* freeWinContent */
 
 
 
 
/*
/*
   ** freeAllWindows().
   ** freeAllWindows().
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
freeAllWindows (void)
freeAllWindows (void)
#else
#else
freeAllWindows ()
freeAllWindows ()
#endif
#endif
{
{
  TuiWinType type = SRC_WIN;
  TuiWinType type = SRC_WIN;
 
 
  for (; type < MAX_MAJOR_WINDOWS; type++)
  for (; type < MAX_MAJOR_WINDOWS; type++)
    if (m_winPtrNotNull (winList[type]) &&
    if (m_winPtrNotNull (winList[type]) &&
        winList[type]->generic.type != UNDEFINED_WIN)
        winList[type]->generic.type != UNDEFINED_WIN)
      freeWindow (winList[type]);
      freeWindow (winList[type]);
  return;
  return;
}                               /* freeAllWindows */
}                               /* freeAllWindows */
 
 
 
 
void
void
#ifdef __STDC__
#ifdef __STDC__
tuiDelDataWindows (
tuiDelDataWindows (
                    TuiWinContent content,
                    TuiWinContent content,
                    int contentSize)
                    int contentSize)
#else
#else
tuiDelDataWindows (content, contentSize)
tuiDelDataWindows (content, contentSize)
     TuiWinContent content;
     TuiWinContent content;
     int contentSize;
     int contentSize;
#endif
#endif
{
{
  int i;
  int i;
 
 
  /*
  /*
     ** Remember that data window content elements are of type TuiGenWinInfoPtr,
     ** Remember that data window content elements are of type TuiGenWinInfoPtr,
     ** each of which whose single element is a data element.
     ** each of which whose single element is a data element.
   */
   */
  for (i = 0; i < contentSize; i++)
  for (i = 0; i < contentSize; i++)
    {
    {
      TuiGenWinInfoPtr genericWin = &content[i]->whichElement.dataWindow;
      TuiGenWinInfoPtr genericWin = &content[i]->whichElement.dataWindow;
 
 
      if (genericWin != (TuiGenWinInfoPtr) NULL)
      if (genericWin != (TuiGenWinInfoPtr) NULL)
        {
        {
          tuiDelwin (genericWin->handle);
          tuiDelwin (genericWin->handle);
          genericWin->handle = (WINDOW *) NULL;
          genericWin->handle = (WINDOW *) NULL;
          genericWin->isVisible = FALSE;
          genericWin->isVisible = FALSE;
        }
        }
    }
    }
 
 
  return;
  return;
}                               /* tuiDelDataWindows */
}                               /* tuiDelDataWindows */
 
 
 
 
void
void
#ifdef __STDC__
#ifdef __STDC__
freeDataContent (
freeDataContent (
                  TuiWinContent content,
                  TuiWinContent content,
                  int contentSize)
                  int contentSize)
#else
#else
freeDataContent (content, contentSize)
freeDataContent (content, contentSize)
     TuiWinContent content;
     TuiWinContent content;
     int contentSize;
     int contentSize;
#endif
#endif
{
{
  int i;
  int i;
 
 
  /*
  /*
     ** Remember that data window content elements are of type TuiGenWinInfoPtr,
     ** Remember that data window content elements are of type TuiGenWinInfoPtr,
     ** each of which whose single element is a data element.
     ** each of which whose single element is a data element.
   */
   */
  for (i = 0; i < contentSize; i++)
  for (i = 0; i < contentSize; i++)
    {
    {
      TuiGenWinInfoPtr genericWin = &content[i]->whichElement.dataWindow;
      TuiGenWinInfoPtr genericWin = &content[i]->whichElement.dataWindow;
 
 
      if (genericWin != (TuiGenWinInfoPtr) NULL)
      if (genericWin != (TuiGenWinInfoPtr) NULL)
        {
        {
          tuiDelwin (genericWin->handle);
          tuiDelwin (genericWin->handle);
          genericWin->handle = (WINDOW *) NULL;
          genericWin->handle = (WINDOW *) NULL;
          freeWinContent (genericWin);
          freeWinContent (genericWin);
        }
        }
    }
    }
  freeContent (content,
  freeContent (content,
               contentSize,
               contentSize,
               DATA_WIN);
               DATA_WIN);
 
 
  return;
  return;
}                               /* freeDataContent */
}                               /* freeDataContent */
 
 
 
 
/**********************************
/**********************************
** LOCAL STATIC FUNCTIONS        **
** LOCAL STATIC FUNCTIONS        **
**********************************/
**********************************/
 
 
 
 
/*
/*
   ** freeContent().
   ** freeContent().
 */
 */
static void
static void
#ifdef __STDC__
#ifdef __STDC__
freeContent (
freeContent (
              TuiWinContent content,
              TuiWinContent content,
              int contentSize,
              int contentSize,
              TuiWinType winType)
              TuiWinType winType)
#else
#else
freeContent (content, contentSize, winType)
freeContent (content, contentSize, winType)
     TuiWinContent content;
     TuiWinContent content;
     int contentSize;
     int contentSize;
     TuiWinType winType;
     TuiWinType winType;
#endif
#endif
{
{
  if (content != (TuiWinContent) NULL)
  if (content != (TuiWinContent) NULL)
    {
    {
      freeContentElements (content, contentSize, winType);
      freeContentElements (content, contentSize, winType);
      tuiFree ((char *) content);
      tuiFree ((char *) content);
    }
    }
 
 
  return;
  return;
}                               /* freeContent */
}                               /* freeContent */
 
 
 
 
/*
/*
   ** freeContentElements().
   ** freeContentElements().
 */
 */
static void
static void
#ifdef __STDC__
#ifdef __STDC__
freeContentElements (
freeContentElements (
                      TuiWinContent content,
                      TuiWinContent content,
                      int contentSize,
                      int contentSize,
                      TuiWinType type)
                      TuiWinType type)
#else
#else
freeContentElements (content, contentSize, type)
freeContentElements (content, contentSize, type)
     TuiWinContent content;
     TuiWinContent content;
     int contentSize;
     int contentSize;
     TuiWinType type;
     TuiWinType type;
#endif
#endif
{
{
  if (content != (TuiWinContent) NULL)
  if (content != (TuiWinContent) NULL)
    {
    {
      int i;
      int i;
 
 
      if (type == SRC_WIN || type == DISASSEM_WIN)
      if (type == SRC_WIN || type == DISASSEM_WIN)
        {
        {
          /* free whole source block */
          /* free whole source block */
          if (content[0]->whichElement.source.line != (char *) NULL)
          if (content[0]->whichElement.source.line != (char *) NULL)
            tuiFree (content[0]->whichElement.source.line);
            tuiFree (content[0]->whichElement.source.line);
        }
        }
      else
      else
        {
        {
          for (i = 0; i < contentSize; i++)
          for (i = 0; i < contentSize; i++)
            {
            {
              TuiWinElementPtr element;
              TuiWinElementPtr element;
 
 
              element = content[i];
              element = content[i];
              if (element != (TuiWinElementPtr) NULL)
              if (element != (TuiWinElementPtr) NULL)
                {
                {
                  switch (type)
                  switch (type)
                    {
                    {
                    case DATA_WIN:
                    case DATA_WIN:
                      tuiFree ((char *) element);
                      tuiFree ((char *) element);
                      break;
                      break;
                    case DATA_ITEM_WIN:
                    case DATA_ITEM_WIN:
                      /*
                      /*
                         ** Note that data elements are not allocated
                         ** Note that data elements are not allocated
                         ** in a single block, but individually, as needed.
                         ** in a single block, but individually, as needed.
                       */
                       */
                      if (element->whichElement.data.type != TUI_REGISTER)
                      if (element->whichElement.data.type != TUI_REGISTER)
                        tuiFree ((char *)
                        tuiFree ((char *)
                                 element->whichElement.data.name);
                                 element->whichElement.data.name);
                      tuiFree ((char *) element->whichElement.data.value);
                      tuiFree ((char *) element->whichElement.data.value);
                      tuiFree ((char *) element);
                      tuiFree ((char *) element);
                      break;
                      break;
                    case CMD_WIN:
                    case CMD_WIN:
                      tuiFree ((char *) element->whichElement.command.line);
                      tuiFree ((char *) element->whichElement.command.line);
                      break;
                      break;
                    default:
                    default:
                      break;
                      break;
                    }
                    }
                }
                }
            }
            }
        }
        }
      if (type != DATA_WIN && type != DATA_ITEM_WIN)
      if (type != DATA_WIN && type != DATA_ITEM_WIN)
        tuiFree ((char *) content[0]);   /* free the element block */
        tuiFree ((char *) content[0]);   /* free the element block */
    }
    }
 
 
  return;
  return;
}                               /* freeContentElements */
}                               /* freeContentElements */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.