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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [tui/] [tuiLayout.c] - Diff between revs 107 and 1765

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

Rev 107 Rev 1765
/*
/*
   ** tuiLayout.c
   ** tuiLayout.c
   ** This module contains procedures for handling the layout of the windows.
   ** This module contains procedures for handling the layout of the windows.
 */
 */
 
 
 
 
#include "defs.h"
#include "defs.h"
#include "command.h"
#include "command.h"
#include "symtab.h"
#include "symtab.h"
#include "frame.h"
#include "frame.h"
 
 
#include "tui.h"
#include "tui.h"
#include "tuiData.h"
#include "tuiData.h"
#include "tuiGeneralWin.h"
#include "tuiGeneralWin.h"
#include "tuiStack.h"
#include "tuiStack.h"
#include "tuiRegs.h"
#include "tuiRegs.h"
#include "tuiDisassem.h"
#include "tuiDisassem.h"
 
 
/*******************************
/*******************************
** Static Local Decls
** Static Local Decls
********************************/
********************************/
 
 
static void _initGenWinInfo PARAMS
static void _initGenWinInfo PARAMS
  ((TuiGenWinInfoPtr, TuiWinType, int, int, int, int));
  ((TuiGenWinInfoPtr, TuiWinType, int, int, int, int));
static void _initAndMakeWin PARAMS
static void _initAndMakeWin PARAMS
  ((Opaque *, TuiWinType, int, int, int, int, int));
  ((Opaque *, TuiWinType, int, int, int, int, int));
static void _showSourceOrDisassemAndCommand PARAMS
static void _showSourceOrDisassemAndCommand PARAMS
  ((TuiLayoutType));
  ((TuiLayoutType));
static void _makeSourceOrDisassemWindow PARAMS
static void _makeSourceOrDisassemWindow PARAMS
  ((TuiWinInfoPtr *, TuiWinType, int, int));
  ((TuiWinInfoPtr *, TuiWinType, int, int));
static void _makeCommandWindow PARAMS ((TuiWinInfoPtr *, int, int));
static void _makeCommandWindow PARAMS ((TuiWinInfoPtr *, int, int));
static void _makeSourceWindow PARAMS ((TuiWinInfoPtr *, int, int));
static void _makeSourceWindow PARAMS ((TuiWinInfoPtr *, int, int));
static void _makeDisassemWindow PARAMS
static void _makeDisassemWindow PARAMS
  ((TuiWinInfoPtr *, int, int));
  ((TuiWinInfoPtr *, int, int));
static void _makeDataWindow PARAMS ((TuiWinInfoPtr *, int, int));
static void _makeDataWindow PARAMS ((TuiWinInfoPtr *, int, int));
static void _showSourceCommand PARAMS ((void));
static void _showSourceCommand PARAMS ((void));
static void _showDisassemCommand PARAMS ((void));
static void _showDisassemCommand PARAMS ((void));
static void _showSourceDisassemCommand PARAMS ((void));
static void _showSourceDisassemCommand PARAMS ((void));
static void _showData PARAMS ((TuiLayoutType));
static void _showData PARAMS ((TuiLayoutType));
static TuiLayoutType _nextLayout PARAMS ((void));
static TuiLayoutType _nextLayout PARAMS ((void));
static TuiLayoutType _prevLayout PARAMS ((void));
static TuiLayoutType _prevLayout PARAMS ((void));
static void _tuiLayout_command PARAMS ((char *, int));
static void _tuiLayout_command PARAMS ((char *, int));
static void _tuiToggleLayout_command PARAMS ((char *, int));
static void _tuiToggleLayout_command PARAMS ((char *, int));
static void _tui_vToggleLayout_command PARAMS ((va_list));
static void _tui_vToggleLayout_command PARAMS ((va_list));
static void _tuiToggleSplitLayout_command PARAMS ((char *, int));
static void _tuiToggleSplitLayout_command PARAMS ((char *, int));
static void _tui_vToggleSplitLayout_command PARAMS ((va_list));
static void _tui_vToggleSplitLayout_command PARAMS ((va_list));
static Opaque _extractDisplayStartAddr PARAMS ((void));
static Opaque _extractDisplayStartAddr PARAMS ((void));
static void _tuiHandleXDBLayout PARAMS ((TuiLayoutDefPtr));
static void _tuiHandleXDBLayout PARAMS ((TuiLayoutDefPtr));
static TuiStatus _tuiSetLayoutTo PARAMS ((char *));
static TuiStatus _tuiSetLayoutTo PARAMS ((char *));
 
 
 
 
/***************************************
/***************************************
** DEFINITIONS
** DEFINITIONS
***************************************/
***************************************/
 
 
#define LAYOUT_USAGE     "Usage: layout prev | next | <layout_name> \n"
#define LAYOUT_USAGE     "Usage: layout prev | next | <layout_name> \n"
 
 
/***************************************
/***************************************
** Static Local Data
** Static Local Data
***************************************/
***************************************/
static TuiLayoutType lastLayout = UNDEFINED_LAYOUT;
static TuiLayoutType lastLayout = UNDEFINED_LAYOUT;
 
 
/***************************************
/***************************************
** PUBLIC FUNCTIONS
** PUBLIC FUNCTIONS
***************************************/
***************************************/
 
 
/*
/*
   ** showLayout().
   ** showLayout().
   **        Show the screen layout defined
   **        Show the screen layout defined
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
showLayout (
showLayout (
             TuiLayoutType layout)
             TuiLayoutType layout)
#else
#else
showLayout (layout)
showLayout (layout)
     TuiLayoutType layout;
     TuiLayoutType layout;
#endif
#endif
{
{
  TuiLayoutType curLayout = currentLayout ();
  TuiLayoutType curLayout = currentLayout ();
 
 
  if (layout != curLayout)
  if (layout != curLayout)
    {
    {
      /*
      /*
         ** Since the new layout may cause changes in window size, we
         ** Since the new layout may cause changes in window size, we
         ** should free the content and reallocate on next display of
         ** should free the content and reallocate on next display of
         ** source/asm
         ** source/asm
       */
       */
      tuiClearAllSourceWinsContent (NO_EMPTY_SOURCE_PROMPT);
      tuiClearAllSourceWinsContent (NO_EMPTY_SOURCE_PROMPT);
      freeAllSourceWinsContent ();
      freeAllSourceWinsContent ();
      clearSourceWindows ();
      clearSourceWindows ();
      if (layout == SRC_DATA_COMMAND || layout == DISASSEM_DATA_COMMAND)
      if (layout == SRC_DATA_COMMAND || layout == DISASSEM_DATA_COMMAND)
        {
        {
          _showData (layout);
          _showData (layout);
          refreshAll (winList);
          refreshAll (winList);
        }
        }
      else
      else
        {
        {
          /* First make the current layout be invisible */
          /* First make the current layout be invisible */
          m_allBeInvisible ();
          m_allBeInvisible ();
          m_beInvisible (locatorWinInfoPtr ());
          m_beInvisible (locatorWinInfoPtr ());
 
 
          switch (layout)
          switch (layout)
            {
            {
              /* Now show the new layout */
              /* Now show the new layout */
            case SRC_COMMAND:
            case SRC_COMMAND:
              _showSourceCommand ();
              _showSourceCommand ();
              addToSourceWindows (srcWin);
              addToSourceWindows (srcWin);
              break;
              break;
            case DISASSEM_COMMAND:
            case DISASSEM_COMMAND:
              _showDisassemCommand ();
              _showDisassemCommand ();
              addToSourceWindows (disassemWin);
              addToSourceWindows (disassemWin);
              break;
              break;
            case SRC_DISASSEM_COMMAND:
            case SRC_DISASSEM_COMMAND:
              _showSourceDisassemCommand ();
              _showSourceDisassemCommand ();
              addToSourceWindows (srcWin);
              addToSourceWindows (srcWin);
              addToSourceWindows (disassemWin);
              addToSourceWindows (disassemWin);
              break;
              break;
            default:
            default:
              break;
              break;
            }
            }
        }
        }
    }
    }
 
 
  return;
  return;
}                               /* showLayout */
}                               /* showLayout */
 
 
 
 
/*
/*
   ** tuiSetLayout()
   ** tuiSetLayout()
   **    Function to set the layout to SRC_COMMAND, DISASSEM_COMMAND,
   **    Function to set the layout to SRC_COMMAND, DISASSEM_COMMAND,
   **    SRC_DISASSEM_COMMAND, SRC_DATA_COMMAND, or DISASSEM_DATA_COMMAND.
   **    SRC_DISASSEM_COMMAND, SRC_DATA_COMMAND, or DISASSEM_DATA_COMMAND.
   **    If the layout is SRC_DATA_COMMAND, DISASSEM_DATA_COMMAND, or
   **    If the layout is SRC_DATA_COMMAND, DISASSEM_DATA_COMMAND, or
   **    UNDEFINED_LAYOUT, then the data window is populated according
   **    UNDEFINED_LAYOUT, then the data window is populated according
   **    to regsDisplayType.
   **    to regsDisplayType.
 */
 */
TuiStatus
TuiStatus
#ifdef __STDC__
#ifdef __STDC__
tuiSetLayout (
tuiSetLayout (
               TuiLayoutType layoutType,
               TuiLayoutType layoutType,
               TuiRegisterDisplayType regsDisplayType)
               TuiRegisterDisplayType regsDisplayType)
#else
#else
tuiSetLayout (layoutType, regsDisplayType)
tuiSetLayout (layoutType, regsDisplayType)
     TuiLayoutType layoutType;
     TuiLayoutType layoutType;
     TuiRegisterDisplayType regsDisplayType;
     TuiRegisterDisplayType regsDisplayType;
#endif
#endif
{
{
  TuiStatus status = TUI_SUCCESS;
  TuiStatus status = TUI_SUCCESS;
 
 
  if (layoutType != UNDEFINED_LAYOUT || regsDisplayType != TUI_UNDEFINED_REGS)
  if (layoutType != UNDEFINED_LAYOUT || regsDisplayType != TUI_UNDEFINED_REGS)
    {
    {
      TuiLayoutType curLayout = currentLayout (), newLayout = UNDEFINED_LAYOUT;
      TuiLayoutType curLayout = currentLayout (), newLayout = UNDEFINED_LAYOUT;
      int regsPopulate = FALSE;
      int regsPopulate = FALSE;
      Opaque addr = _extractDisplayStartAddr ();
      Opaque addr = _extractDisplayStartAddr ();
      TuiWinInfoPtr newWinWithFocus = (TuiWinInfoPtr) NULL, winWithFocus = tuiWinWithFocus ();
      TuiWinInfoPtr newWinWithFocus = (TuiWinInfoPtr) NULL, winWithFocus = tuiWinWithFocus ();
      TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
      TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
 
 
 
 
      if (layoutType == UNDEFINED_LAYOUT &&
      if (layoutType == UNDEFINED_LAYOUT &&
          regsDisplayType != TUI_UNDEFINED_REGS)
          regsDisplayType != TUI_UNDEFINED_REGS)
        {
        {
          if (curLayout == SRC_DISASSEM_COMMAND)
          if (curLayout == SRC_DISASSEM_COMMAND)
            newLayout = DISASSEM_DATA_COMMAND;
            newLayout = DISASSEM_DATA_COMMAND;
          else if (curLayout == SRC_COMMAND || curLayout == SRC_DATA_COMMAND)
          else if (curLayout == SRC_COMMAND || curLayout == SRC_DATA_COMMAND)
            newLayout = SRC_DATA_COMMAND;
            newLayout = SRC_DATA_COMMAND;
          else if (curLayout == DISASSEM_COMMAND ||
          else if (curLayout == DISASSEM_COMMAND ||
                   curLayout == DISASSEM_DATA_COMMAND)
                   curLayout == DISASSEM_DATA_COMMAND)
            newLayout = DISASSEM_DATA_COMMAND;
            newLayout = DISASSEM_DATA_COMMAND;
        }
        }
      else
      else
        newLayout = layoutType;
        newLayout = layoutType;
 
 
      regsPopulate = (newLayout == SRC_DATA_COMMAND ||
      regsPopulate = (newLayout == SRC_DATA_COMMAND ||
                      newLayout == DISASSEM_DATA_COMMAND ||
                      newLayout == DISASSEM_DATA_COMMAND ||
                      regsDisplayType != TUI_UNDEFINED_REGS);
                      regsDisplayType != TUI_UNDEFINED_REGS);
      if (newLayout != curLayout || regsDisplayType != TUI_UNDEFINED_REGS)
      if (newLayout != curLayout || regsDisplayType != TUI_UNDEFINED_REGS)
        {
        {
          if (newLayout != curLayout)
          if (newLayout != curLayout)
            {
            {
              if (winWithFocus != cmdWin)
              if (winWithFocus != cmdWin)
                tuiClearWinFocus ();
                tuiClearWinFocus ();
              showLayout (newLayout);
              showLayout (newLayout);
              /*
              /*
                 ** Now determine where focus should be
                 ** Now determine where focus should be
               */
               */
              if (winWithFocus != cmdWin)
              if (winWithFocus != cmdWin)
                {
                {
                  switch (newLayout)
                  switch (newLayout)
                    {
                    {
                    case SRC_COMMAND:
                    case SRC_COMMAND:
                      tuiSetWinFocusTo (srcWin);
                      tuiSetWinFocusTo (srcWin);
                      layoutDef->displayMode = SRC_WIN;
                      layoutDef->displayMode = SRC_WIN;
                      layoutDef->split = FALSE;
                      layoutDef->split = FALSE;
                      break;
                      break;
                    case DISASSEM_COMMAND:
                    case DISASSEM_COMMAND:
                      /* the previous layout was not showing
                      /* the previous layout was not showing
                         ** code. this can happen if there is no
                         ** code. this can happen if there is no
                         ** source available:
                         ** source available:
                         ** 1. if the source file is in another dir OR
                         ** 1. if the source file is in another dir OR
                         ** 2. if target was compiled without -g
                         ** 2. if target was compiled without -g
                         ** We still want to show the assembly though!
                         ** We still want to show the assembly though!
                       */
                       */
                      addr = vcatch_errors ((OpaqueFuncPtr)
                      addr = vcatch_errors ((OpaqueFuncPtr)
                                            tuiGetBeginAsmAddress);
                                            tuiGetBeginAsmAddress);
                      tuiSetWinFocusTo (disassemWin);
                      tuiSetWinFocusTo (disassemWin);
                      layoutDef->displayMode = DISASSEM_WIN;
                      layoutDef->displayMode = DISASSEM_WIN;
                      layoutDef->split = FALSE;
                      layoutDef->split = FALSE;
                      break;
                      break;
                    case SRC_DISASSEM_COMMAND:
                    case SRC_DISASSEM_COMMAND:
                      /* the previous layout was not showing
                      /* the previous layout was not showing
                         ** code. this can happen if there is no
                         ** code. this can happen if there is no
                         ** source available:
                         ** source available:
                         ** 1. if the source file is in another dir OR
                         ** 1. if the source file is in another dir OR
                         ** 2. if target was compiled without -g
                         ** 2. if target was compiled without -g
                         ** We still want to show the assembly though!
                         ** We still want to show the assembly though!
                       */
                       */
                      addr = vcatch_errors ((OpaqueFuncPtr)
                      addr = vcatch_errors ((OpaqueFuncPtr)
                                            tuiGetBeginAsmAddress);
                                            tuiGetBeginAsmAddress);
                      if (winWithFocus == srcWin)
                      if (winWithFocus == srcWin)
                        tuiSetWinFocusTo (srcWin);
                        tuiSetWinFocusTo (srcWin);
                      else
                      else
                        tuiSetWinFocusTo (disassemWin);
                        tuiSetWinFocusTo (disassemWin);
                      layoutDef->split = TRUE;
                      layoutDef->split = TRUE;
                      break;
                      break;
                    case SRC_DATA_COMMAND:
                    case SRC_DATA_COMMAND:
                      if (winWithFocus != dataWin)
                      if (winWithFocus != dataWin)
                        tuiSetWinFocusTo (srcWin);
                        tuiSetWinFocusTo (srcWin);
                      else
                      else
                        tuiSetWinFocusTo (dataWin);
                        tuiSetWinFocusTo (dataWin);
                      layoutDef->displayMode = SRC_WIN;
                      layoutDef->displayMode = SRC_WIN;
                      layoutDef->split = FALSE;
                      layoutDef->split = FALSE;
                      break;
                      break;
                    case DISASSEM_DATA_COMMAND:
                    case DISASSEM_DATA_COMMAND:
                      /* the previous layout was not showing
                      /* the previous layout was not showing
                         ** code. this can happen if there is no
                         ** code. this can happen if there is no
                         ** source available:
                         ** source available:
                         ** 1. if the source file is in another dir OR
                         ** 1. if the source file is in another dir OR
                         ** 2. if target was compiled without -g
                         ** 2. if target was compiled without -g
                         ** We still want to show the assembly though!
                         ** We still want to show the assembly though!
                       */
                       */
                      addr = vcatch_errors ((OpaqueFuncPtr)
                      addr = vcatch_errors ((OpaqueFuncPtr)
                                            tuiGetBeginAsmAddress);
                                            tuiGetBeginAsmAddress);
                      if (winWithFocus != dataWin)
                      if (winWithFocus != dataWin)
                        tuiSetWinFocusTo (disassemWin);
                        tuiSetWinFocusTo (disassemWin);
                      else
                      else
                        tuiSetWinFocusTo (dataWin);
                        tuiSetWinFocusTo (dataWin);
                      layoutDef->displayMode = DISASSEM_WIN;
                      layoutDef->displayMode = DISASSEM_WIN;
                      layoutDef->split = FALSE;
                      layoutDef->split = FALSE;
                      break;
                      break;
                    default:
                    default:
                      break;
                      break;
                    }
                    }
                }
                }
              if (newWinWithFocus != (TuiWinInfoPtr) NULL)
              if (newWinWithFocus != (TuiWinInfoPtr) NULL)
                tuiSetWinFocusTo (newWinWithFocus);
                tuiSetWinFocusTo (newWinWithFocus);
              /*
              /*
                 ** Now update the window content
                 ** Now update the window content
               */
               */
              if (!regsPopulate &&
              if (!regsPopulate &&
                  (newLayout == SRC_DATA_COMMAND ||
                  (newLayout == SRC_DATA_COMMAND ||
                   newLayout == DISASSEM_DATA_COMMAND))
                   newLayout == DISASSEM_DATA_COMMAND))
                tuiDisplayAllData ();
                tuiDisplayAllData ();
 
 
              tuiUpdateSourceWindowsWithAddr (addr);
              tuiUpdateSourceWindowsWithAddr (addr);
            }
            }
          if (regsPopulate)
          if (regsPopulate)
            {
            {
              layoutDef->regsDisplayType =
              layoutDef->regsDisplayType =
                (regsDisplayType == TUI_UNDEFINED_REGS ?
                (regsDisplayType == TUI_UNDEFINED_REGS ?
                 TUI_GENERAL_REGS : regsDisplayType);
                 TUI_GENERAL_REGS : regsDisplayType);
              tuiShowRegisters (layoutDef->regsDisplayType);
              tuiShowRegisters (layoutDef->regsDisplayType);
            }
            }
        }
        }
    }
    }
  else
  else
    status = TUI_FAILURE;
    status = TUI_FAILURE;
 
 
  return status;
  return status;
}                               /* tuiSetLayout */
}                               /* tuiSetLayout */
 
 
 
 
/*
/*
   ** tui_vSetLayoutTo()
   ** tui_vSetLayoutTo()
   **        Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA,
   **        Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA,
   **        REGS, $REGS, $GREGS, $FREGS, $SREGS with arguments in a va_list
   **        REGS, $REGS, $GREGS, $FREGS, $SREGS with arguments in a va_list
 */
 */
TuiStatus
TuiStatus
#ifdef __STDC__
#ifdef __STDC__
tui_vSetLayoutTo (
tui_vSetLayoutTo (
                   va_list args)
                   va_list args)
#else
#else
tui_vSetLayoutTo (args)
tui_vSetLayoutTo (args)
     va_list args;
     va_list args;
#endif
#endif
{
{
  char *layoutName;
  char *layoutName;
 
 
  layoutName = va_arg (args, char *);
  layoutName = va_arg (args, char *);
 
 
  return (_tuiSetLayoutTo (layoutName));
  return (_tuiSetLayoutTo (layoutName));
}                               /* tui_vSetLayoutTo */
}                               /* tui_vSetLayoutTo */
 
 
 
 
/*
/*
   ** tuiAddWinToLayout().
   ** tuiAddWinToLayout().
   **        Add the specified window to the layout in a logical way.
   **        Add the specified window to the layout in a logical way.
   **        This means setting up the most logical layout given the
   **        This means setting up the most logical layout given the
   **        window to be added.
   **        window to be added.
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
tuiAddWinToLayout (
tuiAddWinToLayout (
                    TuiWinType type)
                    TuiWinType type)
#else
#else
tuiAddWinToLayout (type)
tuiAddWinToLayout (type)
     TuiWinType type;
     TuiWinType type;
#endif
#endif
{
{
  TuiLayoutType curLayout = currentLayout ();
  TuiLayoutType curLayout = currentLayout ();
 
 
  switch (type)
  switch (type)
    {
    {
    case SRC_WIN:
    case SRC_WIN:
      if (curLayout != SRC_COMMAND &&
      if (curLayout != SRC_COMMAND &&
          curLayout != SRC_DISASSEM_COMMAND &&
          curLayout != SRC_DISASSEM_COMMAND &&
          curLayout != SRC_DATA_COMMAND)
          curLayout != SRC_DATA_COMMAND)
        {
        {
          clearSourceWindowsDetail ();
          clearSourceWindowsDetail ();
          if (curLayout == DISASSEM_DATA_COMMAND)
          if (curLayout == DISASSEM_DATA_COMMAND)
            showLayout (SRC_DATA_COMMAND);
            showLayout (SRC_DATA_COMMAND);
          else
          else
            showLayout (SRC_COMMAND);
            showLayout (SRC_COMMAND);
        }
        }
      break;
      break;
    case DISASSEM_WIN:
    case DISASSEM_WIN:
      if (curLayout != DISASSEM_COMMAND &&
      if (curLayout != DISASSEM_COMMAND &&
          curLayout != SRC_DISASSEM_COMMAND &&
          curLayout != SRC_DISASSEM_COMMAND &&
          curLayout != DISASSEM_DATA_COMMAND)
          curLayout != DISASSEM_DATA_COMMAND)
        {
        {
          clearSourceWindowsDetail ();
          clearSourceWindowsDetail ();
          if (curLayout == SRC_DATA_COMMAND)
          if (curLayout == SRC_DATA_COMMAND)
            showLayout (DISASSEM_DATA_COMMAND);
            showLayout (DISASSEM_DATA_COMMAND);
          else
          else
            showLayout (DISASSEM_COMMAND);
            showLayout (DISASSEM_COMMAND);
        }
        }
      break;
      break;
    case DATA_WIN:
    case DATA_WIN:
      if (curLayout != SRC_DATA_COMMAND &&
      if (curLayout != SRC_DATA_COMMAND &&
          curLayout != DISASSEM_DATA_COMMAND)
          curLayout != DISASSEM_DATA_COMMAND)
        {
        {
          if (curLayout == DISASSEM_COMMAND)
          if (curLayout == DISASSEM_COMMAND)
            showLayout (DISASSEM_DATA_COMMAND);
            showLayout (DISASSEM_DATA_COMMAND);
          else
          else
            showLayout (SRC_DATA_COMMAND);
            showLayout (SRC_DATA_COMMAND);
        }
        }
      break;
      break;
    default:
    default:
      break;
      break;
    }
    }
 
 
  return;
  return;
}                               /* tuiAddWinToLayout */
}                               /* tuiAddWinToLayout */
 
 
 
 
/*
/*
   ** tui_vAddWinToLayout().
   ** tui_vAddWinToLayout().
   **        Add the specified window to the layout in a logical way,
   **        Add the specified window to the layout in a logical way,
   **        with arguments in a va_list.
   **        with arguments in a va_list.
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
tui_vAddWinToLayout (
tui_vAddWinToLayout (
                      va_list args)
                      va_list args)
#else
#else
tui_vAddWinToLayout (args)
tui_vAddWinToLayout (args)
     va_list args;
     va_list args;
#endif
#endif
{
{
  TuiWinType type = va_arg (args, TuiWinType);
  TuiWinType type = va_arg (args, TuiWinType);
 
 
  tuiAddWinToLayout (type);
  tuiAddWinToLayout (type);
 
 
  return;
  return;
}                               /* tui_vAddWinToLayout */
}                               /* tui_vAddWinToLayout */
 
 
 
 
/*
/*
   ** tuiDefaultWinHeight().
   ** tuiDefaultWinHeight().
   **        Answer the height of a window.  If it hasn't been created yet,
   **        Answer the height of a window.  If it hasn't been created yet,
   **        answer what the height of a window would be based upon its
   **        answer what the height of a window would be based upon its
   **        type and the layout.
   **        type and the layout.
 */
 */
int
int
#ifdef __STDC__
#ifdef __STDC__
tuiDefaultWinHeight (
tuiDefaultWinHeight (
                      TuiWinType type,
                      TuiWinType type,
                      TuiLayoutType layout)
                      TuiLayoutType layout)
#else
#else
tuiDefaultWinHeight (type, layout)
tuiDefaultWinHeight (type, layout)
     TuiWinType type;
     TuiWinType type;
     TuiLayoutType layout;
     TuiLayoutType layout;
#endif
#endif
{
{
  int h;
  int h;
 
 
  if (winList[type] != (TuiWinInfoPtr) NULL)
  if (winList[type] != (TuiWinInfoPtr) NULL)
    h = winList[type]->generic.height;
    h = winList[type]->generic.height;
  else
  else
    {
    {
      switch (layout)
      switch (layout)
        {
        {
        case SRC_COMMAND:
        case SRC_COMMAND:
        case DISASSEM_COMMAND:
        case DISASSEM_COMMAND:
          if (m_winPtrIsNull (cmdWin))
          if (m_winPtrIsNull (cmdWin))
            h = termHeight () / 2;
            h = termHeight () / 2;
          else
          else
            h = termHeight () - cmdWin->generic.height;
            h = termHeight () - cmdWin->generic.height;
          break;
          break;
        case SRC_DISASSEM_COMMAND:
        case SRC_DISASSEM_COMMAND:
        case SRC_DATA_COMMAND:
        case SRC_DATA_COMMAND:
        case DISASSEM_DATA_COMMAND:
        case DISASSEM_DATA_COMMAND:
          if (m_winPtrIsNull (cmdWin))
          if (m_winPtrIsNull (cmdWin))
            h = termHeight () / 3;
            h = termHeight () / 3;
          else
          else
            h = (termHeight () - cmdWin->generic.height) / 2;
            h = (termHeight () - cmdWin->generic.height) / 2;
          break;
          break;
        default:
        default:
          h = 0;
          h = 0;
          break;
          break;
        }
        }
    }
    }
 
 
  return h;
  return h;
}                               /* tuiDefaultWinHeight */
}                               /* tuiDefaultWinHeight */
 
 
 
 
/*
/*
   ** tuiDefaultWinViewportHeight().
   ** tuiDefaultWinViewportHeight().
   **        Answer the height of a window.  If it hasn't been created yet,
   **        Answer the height of a window.  If it hasn't been created yet,
   **        answer what the height of a window would be based upon its
   **        answer what the height of a window would be based upon its
   **        type and the layout.
   **        type and the layout.
 */
 */
int
int
#ifdef __STDC__
#ifdef __STDC__
tuiDefaultWinViewportHeight (
tuiDefaultWinViewportHeight (
                              TuiWinType type,
                              TuiWinType type,
                              TuiLayoutType layout)
                              TuiLayoutType layout)
#else
#else
tuiDefaultWinViewportHeight (type, layout)
tuiDefaultWinViewportHeight (type, layout)
     TuiWinType type;
     TuiWinType type;
     TuiLayoutType layout;
     TuiLayoutType layout;
#endif
#endif
{
{
  int h;
  int h;
 
 
  h = tuiDefaultWinHeight (type, layout);
  h = tuiDefaultWinHeight (type, layout);
 
 
  if (winList[type] == cmdWin)
  if (winList[type] == cmdWin)
    h -= 1;
    h -= 1;
  else
  else
    h -= 2;
    h -= 2;
 
 
  return h;
  return h;
}                               /* tuiDefaultWinViewportHeight */
}                               /* tuiDefaultWinViewportHeight */
 
 
 
 
/*
/*
   ** _initialize_tuiLayout().
   ** _initialize_tuiLayout().
   **        Function to initialize gdb commands, for tui window layout
   **        Function to initialize gdb commands, for tui window layout
   **        manipulation.
   **        manipulation.
 */
 */
void
void
_initialize_tuiLayout ()
_initialize_tuiLayout ()
{
{
  if (tui_version)
  if (tui_version)
    {
    {
      add_com ("layout", class_tui, _tuiLayout_command,
      add_com ("layout", class_tui, _tuiLayout_command,
               "Change the layout of windows.\n\
               "Change the layout of windows.\n\
Usage: layout prev | next | <layout_name> \n\
Usage: layout prev | next | <layout_name> \n\
Layout names are:\n\
Layout names are:\n\
   src   : Displays source and command windows.\n\
   src   : Displays source and command windows.\n\
   asm   : Displays disassembly and command windows.\n\
   asm   : Displays disassembly and command windows.\n\
   split : Displays source, disassembly and command windows.\n\
   split : Displays source, disassembly and command windows.\n\
   regs  : Displays register window. If existing layout\n\
   regs  : Displays register window. If existing layout\n\
           is source/command or assembly/command, the \n\
           is source/command or assembly/command, the \n\
           register window is displayed. If the\n\
           register window is displayed. If the\n\
           source/assembly/command (split) is displayed, \n\
           source/assembly/command (split) is displayed, \n\
           the register window is displayed with \n\
           the register window is displayed with \n\
           the window that has current logical focus.\n");
           the window that has current logical focus.\n");
      if (xdb_commands)
      if (xdb_commands)
        {
        {
          add_com ("td", class_tui, _tuiToggleLayout_command,
          add_com ("td", class_tui, _tuiToggleLayout_command,
                   "Toggle between Source/Command and Disassembly/Command layouts.\n");
                   "Toggle between Source/Command and Disassembly/Command layouts.\n");
          add_com ("ts", class_tui, _tuiToggleSplitLayout_command,
          add_com ("ts", class_tui, _tuiToggleSplitLayout_command,
                   "Toggle between Source/Command or Disassembly/Command and \n\
                   "Toggle between Source/Command or Disassembly/Command and \n\
Source/Disassembly/Command layouts.\n");
Source/Disassembly/Command layouts.\n");
        }
        }
    }
    }
 
 
  return;
  return;
}                               /* _intialize_tuiLayout */
}                               /* _intialize_tuiLayout */
 
 
 
 
/*************************
/*************************
** STATIC LOCAL FUNCTIONS
** STATIC LOCAL FUNCTIONS
**************************/
**************************/
 
 
 
 
/*
/*
   ** _tuiSetLayoutTo()
   ** _tuiSetLayoutTo()
   **    Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA, REGS,
   **    Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA, REGS,
   **        $REGS, $GREGS, $FREGS, $SREGS.
   **        $REGS, $GREGS, $FREGS, $SREGS.
 */
 */
static TuiStatus
static TuiStatus
#ifdef __STDC__
#ifdef __STDC__
_tuiSetLayoutTo (
_tuiSetLayoutTo (
                  char *layoutName)
                  char *layoutName)
#else
#else
_tuiSetLayoutTo (layoutName)
_tuiSetLayoutTo (layoutName)
     char *layoutName;
     char *layoutName;
#endif
#endif
{
{
  TuiStatus status = TUI_SUCCESS;
  TuiStatus status = TUI_SUCCESS;
 
 
  if (layoutName != (char *) NULL)
  if (layoutName != (char *) NULL)
    {
    {
      register int i;
      register int i;
      register char *bufPtr;
      register char *bufPtr;
      TuiLayoutType newLayout = UNDEFINED_LAYOUT;
      TuiLayoutType newLayout = UNDEFINED_LAYOUT;
      TuiRegisterDisplayType dpyType = TUI_UNDEFINED_REGS;
      TuiRegisterDisplayType dpyType = TUI_UNDEFINED_REGS;
      TuiLayoutType curLayout = currentLayout ();
      TuiLayoutType curLayout = currentLayout ();
 
 
      bufPtr = (char *) tuiStrDup (layoutName);
      bufPtr = (char *) tuiStrDup (layoutName);
      for (i = 0; (i < strlen (layoutName)); i++)
      for (i = 0; (i < strlen (layoutName)); i++)
        bufPtr[i] = toupper (bufPtr[i]);
        bufPtr[i] = toupper (bufPtr[i]);
 
 
      /* First check for ambiguous input */
      /* First check for ambiguous input */
      if (strlen (bufPtr) <= 1 && (*bufPtr == 'S' || *bufPtr == '$'))
      if (strlen (bufPtr) <= 1 && (*bufPtr == 'S' || *bufPtr == '$'))
        {
        {
          warning ("Ambiguous command input.\n");
          warning ("Ambiguous command input.\n");
          status = TUI_FAILURE;
          status = TUI_FAILURE;
        }
        }
      else
      else
        {
        {
          if (subsetCompare (bufPtr, "SRC"))
          if (subsetCompare (bufPtr, "SRC"))
            newLayout = SRC_COMMAND;
            newLayout = SRC_COMMAND;
          else if (subsetCompare (bufPtr, "ASM"))
          else if (subsetCompare (bufPtr, "ASM"))
            newLayout = DISASSEM_COMMAND;
            newLayout = DISASSEM_COMMAND;
          else if (subsetCompare (bufPtr, "SPLIT"))
          else if (subsetCompare (bufPtr, "SPLIT"))
            newLayout = SRC_DISASSEM_COMMAND;
            newLayout = SRC_DISASSEM_COMMAND;
          else if (subsetCompare (bufPtr, "REGS") ||
          else if (subsetCompare (bufPtr, "REGS") ||
                   subsetCompare (bufPtr, TUI_GENERAL_SPECIAL_REGS_NAME) ||
                   subsetCompare (bufPtr, TUI_GENERAL_SPECIAL_REGS_NAME) ||
                   subsetCompare (bufPtr, TUI_GENERAL_REGS_NAME) ||
                   subsetCompare (bufPtr, TUI_GENERAL_REGS_NAME) ||
                   subsetCompare (bufPtr, TUI_FLOAT_REGS_NAME) ||
                   subsetCompare (bufPtr, TUI_FLOAT_REGS_NAME) ||
                   subsetCompare (bufPtr, TUI_SPECIAL_REGS_NAME))
                   subsetCompare (bufPtr, TUI_SPECIAL_REGS_NAME))
            {
            {
              if (curLayout == SRC_COMMAND || curLayout == SRC_DATA_COMMAND)
              if (curLayout == SRC_COMMAND || curLayout == SRC_DATA_COMMAND)
                newLayout = SRC_DATA_COMMAND;
                newLayout = SRC_DATA_COMMAND;
              else
              else
                newLayout = DISASSEM_DATA_COMMAND;
                newLayout = DISASSEM_DATA_COMMAND;
 
 
/* could ifdef out the following code. when compile with -z, there are null
/* could ifdef out the following code. when compile with -z, there are null
   pointer references that cause a core dump if 'layout regs' is the first
   pointer references that cause a core dump if 'layout regs' is the first
   layout command issued by the user. HP has asked us to hook up this code
   layout command issued by the user. HP has asked us to hook up this code
   - edie epstein
   - edie epstein
 */
 */
              if (subsetCompare (bufPtr, TUI_FLOAT_REGS_NAME))
              if (subsetCompare (bufPtr, TUI_FLOAT_REGS_NAME))
                {
                {
                  if (dataWin->detail.dataDisplayInfo.regsDisplayType !=
                  if (dataWin->detail.dataDisplayInfo.regsDisplayType !=
                      TUI_SFLOAT_REGS &&
                      TUI_SFLOAT_REGS &&
                      dataWin->detail.dataDisplayInfo.regsDisplayType !=
                      dataWin->detail.dataDisplayInfo.regsDisplayType !=
                      TUI_DFLOAT_REGS)
                      TUI_DFLOAT_REGS)
                    dpyType = TUI_SFLOAT_REGS;
                    dpyType = TUI_SFLOAT_REGS;
                  else
                  else
                    dpyType =
                    dpyType =
                      dataWin->detail.dataDisplayInfo.regsDisplayType;
                      dataWin->detail.dataDisplayInfo.regsDisplayType;
                }
                }
              else if (subsetCompare (bufPtr,
              else if (subsetCompare (bufPtr,
                                      TUI_GENERAL_SPECIAL_REGS_NAME))
                                      TUI_GENERAL_SPECIAL_REGS_NAME))
                dpyType = TUI_GENERAL_AND_SPECIAL_REGS;
                dpyType = TUI_GENERAL_AND_SPECIAL_REGS;
              else if (subsetCompare (bufPtr, TUI_GENERAL_REGS_NAME))
              else if (subsetCompare (bufPtr, TUI_GENERAL_REGS_NAME))
                dpyType = TUI_GENERAL_REGS;
                dpyType = TUI_GENERAL_REGS;
              else if (subsetCompare (bufPtr, TUI_SPECIAL_REGS_NAME))
              else if (subsetCompare (bufPtr, TUI_SPECIAL_REGS_NAME))
                dpyType = TUI_SPECIAL_REGS;
                dpyType = TUI_SPECIAL_REGS;
              else
              else
                {
                {
                  if (dataWin->detail.dataDisplayInfo.regsDisplayType !=
                  if (dataWin->detail.dataDisplayInfo.regsDisplayType !=
                      TUI_UNDEFINED_REGS)
                      TUI_UNDEFINED_REGS)
                    dpyType =
                    dpyType =
                      dataWin->detail.dataDisplayInfo.regsDisplayType;
                      dataWin->detail.dataDisplayInfo.regsDisplayType;
                  else
                  else
                    dpyType = TUI_GENERAL_REGS;
                    dpyType = TUI_GENERAL_REGS;
                }
                }
 
 
/* end of potential ifdef
/* end of potential ifdef
 */
 */
 
 
/* if ifdefed out code above, then assume that the user wishes to display the
/* if ifdefed out code above, then assume that the user wishes to display the
   general purpose registers
   general purpose registers
 */
 */
 
 
/*              dpyType = TUI_GENERAL_REGS;
/*              dpyType = TUI_GENERAL_REGS;
 */
 */
            }
            }
          else if (subsetCompare (bufPtr, "NEXT"))
          else if (subsetCompare (bufPtr, "NEXT"))
            newLayout = _nextLayout ();
            newLayout = _nextLayout ();
          else if (subsetCompare (bufPtr, "PREV"))
          else if (subsetCompare (bufPtr, "PREV"))
            newLayout = _prevLayout ();
            newLayout = _prevLayout ();
          else
          else
            status = TUI_FAILURE;
            status = TUI_FAILURE;
          free (bufPtr);
          free (bufPtr);
 
 
          tuiSetLayout (newLayout, dpyType);
          tuiSetLayout (newLayout, dpyType);
        }
        }
    }
    }
  else
  else
    status = TUI_FAILURE;
    status = TUI_FAILURE;
 
 
  return status;
  return status;
}                               /* _tuiSetLayoutTo */
}                               /* _tuiSetLayoutTo */
 
 
 
 
static Opaque
static Opaque
#ifdef __STDC__
#ifdef __STDC__
_extractDisplayStartAddr (void)
_extractDisplayStartAddr (void)
#else
#else
_extractDisplayStartAddr ()
_extractDisplayStartAddr ()
#endif
#endif
{
{
  TuiLayoutType curLayout = currentLayout ();
  TuiLayoutType curLayout = currentLayout ();
  Opaque addr;
  Opaque addr;
 
 
  switch (curLayout)
  switch (curLayout)
    {
    {
    case SRC_COMMAND:
    case SRC_COMMAND:
    case SRC_DATA_COMMAND:
    case SRC_DATA_COMMAND:
      addr = (Opaque) find_line_pc (
      addr = (Opaque) find_line_pc (
                                     current_source_symtab,
                                     current_source_symtab,
                          srcWin->detail.sourceInfo.startLineOrAddr.lineNo);
                          srcWin->detail.sourceInfo.startLineOrAddr.lineNo);
      break;
      break;
    case DISASSEM_COMMAND:
    case DISASSEM_COMMAND:
    case SRC_DISASSEM_COMMAND:
    case SRC_DISASSEM_COMMAND:
    case DISASSEM_DATA_COMMAND:
    case DISASSEM_DATA_COMMAND:
      addr = disassemWin->detail.sourceInfo.startLineOrAddr.addr;
      addr = disassemWin->detail.sourceInfo.startLineOrAddr.addr;
      break;
      break;
    default:
    default:
      addr = (Opaque) NULL;
      addr = (Opaque) NULL;
      break;
      break;
    }
    }
 
 
  return addr;
  return addr;
}                               /* _extractDisplayStartAddr */
}                               /* _extractDisplayStartAddr */
 
 
 
 
static void
static void
#ifdef __STDC__
#ifdef __STDC__
_tuiHandleXDBLayout (
_tuiHandleXDBLayout (
                      TuiLayoutDefPtr layoutDef)
                      TuiLayoutDefPtr layoutDef)
#else
#else
_tuiHandleXDBLayout (layoutDef)
_tuiHandleXDBLayout (layoutDef)
     TuiLayoutDefPtr layoutDef;
     TuiLayoutDefPtr layoutDef;
#endif
#endif
{
{
  if (layoutDef->split)
  if (layoutDef->split)
    {
    {
      tuiSetLayout (SRC_DISASSEM_COMMAND, TUI_UNDEFINED_REGS);
      tuiSetLayout (SRC_DISASSEM_COMMAND, TUI_UNDEFINED_REGS);
      tuiSetWinFocusTo (winList[layoutDef->displayMode]);
      tuiSetWinFocusTo (winList[layoutDef->displayMode]);
    }
    }
  else
  else
    {
    {
      if (layoutDef->displayMode == SRC_WIN)
      if (layoutDef->displayMode == SRC_WIN)
        tuiSetLayout (SRC_COMMAND, TUI_UNDEFINED_REGS);
        tuiSetLayout (SRC_COMMAND, TUI_UNDEFINED_REGS);
      else
      else
        tuiSetLayout (DISASSEM_DATA_COMMAND, layoutDef->regsDisplayType);
        tuiSetLayout (DISASSEM_DATA_COMMAND, layoutDef->regsDisplayType);
    }
    }
 
 
 
 
  return;
  return;
}                               /* _tuiHandleXDBLayout */
}                               /* _tuiHandleXDBLayout */
 
 
 
 
static void
static void
#ifdef __STDC__
#ifdef __STDC__
_tuiToggleLayout_command (
_tuiToggleLayout_command (
                           char *arg,
                           char *arg,
                           int fromTTY)
                           int fromTTY)
#else
#else
_tuiToggleLayout_command (arg, fromTTY)
_tuiToggleLayout_command (arg, fromTTY)
     char *arg;
     char *arg;
     int fromTTY;
     int fromTTY;
#endif
#endif
{
{
  tuiDo ((TuiOpaqueFuncPtr) _tui_vToggleLayout_command, arg, fromTTY);
  tuiDo ((TuiOpaqueFuncPtr) _tui_vToggleLayout_command, arg, fromTTY);
}
}
 
 
static void
static void
#ifdef __STDC__
#ifdef __STDC__
_tui_vToggleLayout_command (
_tui_vToggleLayout_command (
                             va_list args)
                             va_list args)
#else
#else
_tui_vToggleLayout_command (args)
_tui_vToggleLayout_command (args)
     va_list args;
     va_list args;
#endif
#endif
{
{
  TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
  TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
 
 
  if (layoutDef->displayMode == SRC_WIN)
  if (layoutDef->displayMode == SRC_WIN)
    layoutDef->displayMode = DISASSEM_WIN;
    layoutDef->displayMode = DISASSEM_WIN;
  else
  else
    layoutDef->displayMode = SRC_WIN;
    layoutDef->displayMode = SRC_WIN;
 
 
  if (!layoutDef->split)
  if (!layoutDef->split)
    _tuiHandleXDBLayout (layoutDef);
    _tuiHandleXDBLayout (layoutDef);
 
 
  return;
  return;
}                               /* _tuiToggleLayout_command */
}                               /* _tuiToggleLayout_command */
 
 
 
 
static void
static void
#ifdef __STDC__
#ifdef __STDC__
_tuiToggleSplitLayout_command (
_tuiToggleSplitLayout_command (
                                char *arg,
                                char *arg,
                                int fromTTY)
                                int fromTTY)
#else
#else
_tuiToggleSplitLayout_command (arg, fromTTY)
_tuiToggleSplitLayout_command (arg, fromTTY)
     char *arg;
     char *arg;
     int fromTTY;
     int fromTTY;
#endif
#endif
{
{
  tuiDo ((TuiOpaqueFuncPtr) _tui_vToggleSplitLayout_command, arg, fromTTY);
  tuiDo ((TuiOpaqueFuncPtr) _tui_vToggleSplitLayout_command, arg, fromTTY);
}
}
 
 
static void
static void
#ifdef __STDC__
#ifdef __STDC__
_tui_vToggleSplitLayout_command (
_tui_vToggleSplitLayout_command (
                                  va_list args)
                                  va_list args)
#else
#else
_tui_vToggleSplitLayout_command (args)
_tui_vToggleSplitLayout_command (args)
     va_list args;
     va_list args;
#endif
#endif
{
{
  TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
  TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
 
 
  layoutDef->split = (!layoutDef->split);
  layoutDef->split = (!layoutDef->split);
  _tuiHandleXDBLayout (layoutDef);
  _tuiHandleXDBLayout (layoutDef);
 
 
  return;
  return;
}                               /* _tui_vToggleSplitLayout_command */
}                               /* _tui_vToggleSplitLayout_command */
 
 
 
 
static void
static void
#ifdef __STDC__
#ifdef __STDC__
_tuiLayout_command (
_tuiLayout_command (
                     char *arg,
                     char *arg,
                     int fromTTY)
                     int fromTTY)
#else
#else
_tuiLayout_command (arg, fromTTY)
_tuiLayout_command (arg, fromTTY)
     char *arg;
     char *arg;
     int fromTTY;
     int fromTTY;
#endif
#endif
{
{
  if ((TuiStatus) tuiDo (
  if ((TuiStatus) tuiDo (
                   (TuiOpaqueFuncPtr) tui_vSetLayoutTo, arg) != TUI_SUCCESS)
                   (TuiOpaqueFuncPtr) tui_vSetLayoutTo, arg) != TUI_SUCCESS)
    warning ("Invalid layout specified.\n%s" LAYOUT_USAGE);
    warning ("Invalid layout specified.\n%s" LAYOUT_USAGE);
 
 
  return;
  return;
}                               /* _tuiLayout_command */
}                               /* _tuiLayout_command */
 
 
/*
/*
   ** _nextLayout().
   ** _nextLayout().
   **        Answer the previous layout to cycle to.
   **        Answer the previous layout to cycle to.
 */
 */
static TuiLayoutType
static TuiLayoutType
#ifdef __STDC__
#ifdef __STDC__
_nextLayout (void)
_nextLayout (void)
#else
#else
_nextLayout ()
_nextLayout ()
#endif
#endif
{
{
  TuiLayoutType newLayout;
  TuiLayoutType newLayout;
 
 
  newLayout = currentLayout ();
  newLayout = currentLayout ();
  if (newLayout == UNDEFINED_LAYOUT)
  if (newLayout == UNDEFINED_LAYOUT)
    newLayout = SRC_COMMAND;
    newLayout = SRC_COMMAND;
  else
  else
    {
    {
      newLayout++;
      newLayout++;
      if (newLayout == UNDEFINED_LAYOUT)
      if (newLayout == UNDEFINED_LAYOUT)
        newLayout = SRC_COMMAND;
        newLayout = SRC_COMMAND;
    }
    }
 
 
  return newLayout;
  return newLayout;
}                               /* _nextLayout */
}                               /* _nextLayout */
 
 
 
 
/*
/*
   ** _prevLayout().
   ** _prevLayout().
   **        Answer the next layout to cycle to.
   **        Answer the next layout to cycle to.
 */
 */
static TuiLayoutType
static TuiLayoutType
#ifdef __STDC__
#ifdef __STDC__
_prevLayout (void)
_prevLayout (void)
#else
#else
_prevLayout ()
_prevLayout ()
#endif
#endif
{
{
  TuiLayoutType newLayout;
  TuiLayoutType newLayout;
 
 
  newLayout = currentLayout ();
  newLayout = currentLayout ();
  if (newLayout == SRC_COMMAND)
  if (newLayout == SRC_COMMAND)
    newLayout = DISASSEM_DATA_COMMAND;
    newLayout = DISASSEM_DATA_COMMAND;
  else
  else
    {
    {
      newLayout--;
      newLayout--;
      if (newLayout == UNDEFINED_LAYOUT)
      if (newLayout == UNDEFINED_LAYOUT)
        newLayout = DISASSEM_DATA_COMMAND;
        newLayout = DISASSEM_DATA_COMMAND;
    }
    }
 
 
  return newLayout;
  return newLayout;
}                               /* _prevLayout */
}                               /* _prevLayout */
 
 
 
 
 
 
/*
/*
   ** _makeCommandWindow().
   ** _makeCommandWindow().
 */
 */
static void
static void
#ifdef __STDC__
#ifdef __STDC__
_makeCommandWindow (
_makeCommandWindow (
                     TuiWinInfoPtr * winInfoPtr,
                     TuiWinInfoPtr * winInfoPtr,
                     int height,
                     int height,
                     int originY)
                     int originY)
#else
#else
_makeCommandWindow (winInfoPtr, height, originY)
_makeCommandWindow (winInfoPtr, height, originY)
     TuiWinInfoPtr *winInfoPtr;
     TuiWinInfoPtr *winInfoPtr;
     int height;
     int height;
     int originY;
     int originY;
#endif
#endif
{
{
  _initAndMakeWin ((Opaque *) winInfoPtr,
  _initAndMakeWin ((Opaque *) winInfoPtr,
                   CMD_WIN,
                   CMD_WIN,
                   height,
                   height,
                   termWidth (),
                   termWidth (),
                   0,
                   0,
                   originY,
                   originY,
                   DONT_BOX_WINDOW);
                   DONT_BOX_WINDOW);
 
 
  (*winInfoPtr)->canHighlight = FALSE;
  (*winInfoPtr)->canHighlight = FALSE;
 
 
  return;
  return;
}                               /* _makeCommandWindow */
}                               /* _makeCommandWindow */
 
 
 
 
/*
/*
   ** _makeSourceWindow().
   ** _makeSourceWindow().
 */
 */
static void
static void
#ifdef __STDC__
#ifdef __STDC__
_makeSourceWindow (
_makeSourceWindow (
                    TuiWinInfoPtr * winInfoPtr,
                    TuiWinInfoPtr * winInfoPtr,
                    int height,
                    int height,
                    int originY)
                    int originY)
#else
#else
_makeSourceWindow (winInfoPtr, height, originY)
_makeSourceWindow (winInfoPtr, height, originY)
     TuiWinInfoPtr *winInfoPtr;
     TuiWinInfoPtr *winInfoPtr;
     int height;
     int height;
     int originY;
     int originY;
#endif
#endif
{
{
  _makeSourceOrDisassemWindow (winInfoPtr, SRC_WIN, height, originY);
  _makeSourceOrDisassemWindow (winInfoPtr, SRC_WIN, height, originY);
 
 
  return;
  return;
}                               /* _makeSourceWindow */
}                               /* _makeSourceWindow */
 
 
 
 
/*
/*
   ** _makeDisassemWindow().
   ** _makeDisassemWindow().
 */
 */
static void
static void
#ifdef __STDC__
#ifdef __STDC__
_makeDisassemWindow (
_makeDisassemWindow (
                      TuiWinInfoPtr * winInfoPtr,
                      TuiWinInfoPtr * winInfoPtr,
                      int height,
                      int height,
                      int originY)
                      int originY)
#else
#else
_makeDisassemWindow (winInfoPtr, height, originY)
_makeDisassemWindow (winInfoPtr, height, originY)
     TuiWinInfoPtr *winInfoPtr;
     TuiWinInfoPtr *winInfoPtr;
     int height;
     int height;
     int originY;
     int originY;
#endif
#endif
{
{
  _makeSourceOrDisassemWindow (winInfoPtr, DISASSEM_WIN, height, originY);
  _makeSourceOrDisassemWindow (winInfoPtr, DISASSEM_WIN, height, originY);
 
 
  return;
  return;
}                               /* _makeDisassemWindow */
}                               /* _makeDisassemWindow */
 
 
 
 
/*
/*
   ** _makeDataWindow().
   ** _makeDataWindow().
 */
 */
static void
static void
#ifdef __STDC__
#ifdef __STDC__
_makeDataWindow (
_makeDataWindow (
                  TuiWinInfoPtr * winInfoPtr,
                  TuiWinInfoPtr * winInfoPtr,
                  int height,
                  int height,
                  int originY)
                  int originY)
#else
#else
_makeDataWindow (winInfoPtr, height, originY)
_makeDataWindow (winInfoPtr, height, originY)
     TuiWinInfoPtr *winInfoPtr;
     TuiWinInfoPtr *winInfoPtr;
     int height;
     int height;
     int originY;
     int originY;
#endif
#endif
{
{
  _initAndMakeWin ((Opaque *) winInfoPtr,
  _initAndMakeWin ((Opaque *) winInfoPtr,
                   DATA_WIN,
                   DATA_WIN,
                   height,
                   height,
                   termWidth (),
                   termWidth (),
                   0,
                   0,
                   originY,
                   originY,
                   BOX_WINDOW);
                   BOX_WINDOW);
 
 
  return;
  return;
}                               /* _makeDataWindow */
}                               /* _makeDataWindow */
 
 
 
 
 
 
/*
/*
   **    _showSourceCommand().
   **    _showSourceCommand().
   **        Show the Source/Command layout
   **        Show the Source/Command layout
 */
 */
static void
static void
#ifdef __STDC__
#ifdef __STDC__
_showSourceCommand (void)
_showSourceCommand (void)
#else
#else
_showSourceCommand ()
_showSourceCommand ()
#endif
#endif
{
{
  _showSourceOrDisassemAndCommand (SRC_COMMAND);
  _showSourceOrDisassemAndCommand (SRC_COMMAND);
 
 
  return;
  return;
}                               /* _showSourceCommand */
}                               /* _showSourceCommand */
 
 
 
 
/*
/*
   **    _showDisassemCommand().
   **    _showDisassemCommand().
   **        Show the Dissassem/Command layout
   **        Show the Dissassem/Command layout
 */
 */
static void
static void
#ifdef __STDC__
#ifdef __STDC__
_showDisassemCommand (void)
_showDisassemCommand (void)
#else
#else
_showDisassemCommand ()
_showDisassemCommand ()
#endif
#endif
{
{
  _showSourceOrDisassemAndCommand (DISASSEM_COMMAND);
  _showSourceOrDisassemAndCommand (DISASSEM_COMMAND);
 
 
  return;
  return;
}                               /* _showDisassemCommand */
}                               /* _showDisassemCommand */
 
 
 
 
/*
/*
   **    _showSourceDisassemCommand().
   **    _showSourceDisassemCommand().
   **        Show the Source/Disassem/Command layout
   **        Show the Source/Disassem/Command layout
 */
 */
static void
static void
#ifdef __STDC__
#ifdef __STDC__
_showSourceDisassemCommand (void)
_showSourceDisassemCommand (void)
#else
#else
_showSourceDisassemCommand ()
_showSourceDisassemCommand ()
#endif
#endif
{
{
  TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
  TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
 
 
  if (currentLayout () != SRC_DISASSEM_COMMAND)
  if (currentLayout () != SRC_DISASSEM_COMMAND)
    {
    {
      int cmdHeight, srcHeight, asmHeight;
      int cmdHeight, srcHeight, asmHeight;
 
 
      if (m_winPtrNotNull (cmdWin))
      if (m_winPtrNotNull (cmdWin))
        cmdHeight = cmdWin->generic.height;
        cmdHeight = cmdWin->generic.height;
      else
      else
        cmdHeight = termHeight () / 3;
        cmdHeight = termHeight () / 3;
 
 
      srcHeight = (termHeight () - cmdHeight) / 2;
      srcHeight = (termHeight () - cmdHeight) / 2;
      asmHeight = termHeight () - (srcHeight + cmdHeight);
      asmHeight = termHeight () - (srcHeight + cmdHeight);
 
 
      if (m_winPtrIsNull (srcWin))
      if (m_winPtrIsNull (srcWin))
        _makeSourceWindow (&srcWin, srcHeight, 0);
        _makeSourceWindow (&srcWin, srcHeight, 0);
      else
      else
        {
        {
          _initGenWinInfo (&srcWin->generic,
          _initGenWinInfo (&srcWin->generic,
                           srcWin->generic.type,
                           srcWin->generic.type,
                           srcHeight,
                           srcHeight,
                           srcWin->generic.width,
                           srcWin->generic.width,
                           srcWin->detail.sourceInfo.executionInfo->width,
                           srcWin->detail.sourceInfo.executionInfo->width,
                           0);
                           0);
          srcWin->canHighlight = TRUE;
          srcWin->canHighlight = TRUE;
          _initGenWinInfo (srcWin->detail.sourceInfo.executionInfo,
          _initGenWinInfo (srcWin->detail.sourceInfo.executionInfo,
                           EXEC_INFO_WIN,
                           EXEC_INFO_WIN,
                           srcHeight,
                           srcHeight,
                           3,
                           3,
                           0,
                           0,
                           0);
                           0);
          m_beVisible (srcWin);
          m_beVisible (srcWin);
          m_beVisible (srcWin->detail.sourceInfo.executionInfo);
          m_beVisible (srcWin->detail.sourceInfo.executionInfo);
          srcWin->detail.sourceInfo.hasLocator = FALSE;;
          srcWin->detail.sourceInfo.hasLocator = FALSE;;
        }
        }
      if (m_winPtrNotNull (srcWin))
      if (m_winPtrNotNull (srcWin))
        {
        {
          TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
          TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
 
 
          tuiShowSourceContent (srcWin);
          tuiShowSourceContent (srcWin);
          if (m_winPtrIsNull (disassemWin))
          if (m_winPtrIsNull (disassemWin))
            {
            {
              _makeDisassemWindow (&disassemWin, asmHeight, srcHeight - 1);
              _makeDisassemWindow (&disassemWin, asmHeight, srcHeight - 1);
              _initAndMakeWin ((Opaque *) & locator,
              _initAndMakeWin ((Opaque *) & locator,
                               LOCATOR_WIN,
                               LOCATOR_WIN,
                               2 /* 1 */ ,
                               2 /* 1 */ ,
                               termWidth (),
                               termWidth (),
                               0,
                               0,
                               (srcHeight + asmHeight) - 1,
                               (srcHeight + asmHeight) - 1,
                               DONT_BOX_WINDOW);
                               DONT_BOX_WINDOW);
            }
            }
          else
          else
            {
            {
              _initGenWinInfo (locator,
              _initGenWinInfo (locator,
                               LOCATOR_WIN,
                               LOCATOR_WIN,
                               2 /* 1 */ ,
                               2 /* 1 */ ,
                               termWidth (),
                               termWidth (),
                               0,
                               0,
                               (srcHeight + asmHeight) - 1);
                               (srcHeight + asmHeight) - 1);
              disassemWin->detail.sourceInfo.hasLocator = TRUE;
              disassemWin->detail.sourceInfo.hasLocator = TRUE;
              _initGenWinInfo (
              _initGenWinInfo (
                                &disassemWin->generic,
                                &disassemWin->generic,
                                disassemWin->generic.type,
                                disassemWin->generic.type,
                                asmHeight,
                                asmHeight,
                                disassemWin->generic.width,
                                disassemWin->generic.width,
                        disassemWin->detail.sourceInfo.executionInfo->width,
                        disassemWin->detail.sourceInfo.executionInfo->width,
                                srcHeight - 1);
                                srcHeight - 1);
              _initGenWinInfo (disassemWin->detail.sourceInfo.executionInfo,
              _initGenWinInfo (disassemWin->detail.sourceInfo.executionInfo,
                               EXEC_INFO_WIN,
                               EXEC_INFO_WIN,
                               asmHeight,
                               asmHeight,
                               3,
                               3,
                               0,
                               0,
                               srcHeight - 1);
                               srcHeight - 1);
              disassemWin->canHighlight = TRUE;
              disassemWin->canHighlight = TRUE;
              m_beVisible (disassemWin);
              m_beVisible (disassemWin);
              m_beVisible (disassemWin->detail.sourceInfo.executionInfo);
              m_beVisible (disassemWin->detail.sourceInfo.executionInfo);
            }
            }
          if (m_winPtrNotNull (disassemWin))
          if (m_winPtrNotNull (disassemWin))
            {
            {
              srcWin->detail.sourceInfo.hasLocator = FALSE;
              srcWin->detail.sourceInfo.hasLocator = FALSE;
              disassemWin->detail.sourceInfo.hasLocator = TRUE;
              disassemWin->detail.sourceInfo.hasLocator = TRUE;
              m_beVisible (locator);
              m_beVisible (locator);
              tuiShowLocatorContent ();
              tuiShowLocatorContent ();
              tuiShowSourceContent (disassemWin);
              tuiShowSourceContent (disassemWin);
 
 
              if (m_winPtrIsNull (cmdWin))
              if (m_winPtrIsNull (cmdWin))
                _makeCommandWindow (&cmdWin,
                _makeCommandWindow (&cmdWin,
                                    cmdHeight,
                                    cmdHeight,
                                    termHeight () - cmdHeight);
                                    termHeight () - cmdHeight);
              else
              else
                {
                {
                  _initGenWinInfo (&cmdWin->generic,
                  _initGenWinInfo (&cmdWin->generic,
                                   cmdWin->generic.type,
                                   cmdWin->generic.type,
                                   cmdWin->generic.height,
                                   cmdWin->generic.height,
                                   cmdWin->generic.width,
                                   cmdWin->generic.width,
                                   0,
                                   0,
                                   cmdWin->generic.origin.y);
                                   cmdWin->generic.origin.y);
                  cmdWin->canHighlight = FALSE;
                  cmdWin->canHighlight = FALSE;
                  m_beVisible (cmdWin);
                  m_beVisible (cmdWin);
                }
                }
              if (m_winPtrNotNull (cmdWin))
              if (m_winPtrNotNull (cmdWin))
                tuiRefreshWin (&cmdWin->generic);
                tuiRefreshWin (&cmdWin->generic);
            }
            }
        }
        }
      setCurrentLayoutTo (SRC_DISASSEM_COMMAND);
      setCurrentLayoutTo (SRC_DISASSEM_COMMAND);
    }
    }
 
 
  return;
  return;
}                               /* _showSourceDisassemCommand */
}                               /* _showSourceDisassemCommand */
 
 
 
 
/*
/*
   **    _showData().
   **    _showData().
   **        Show the Source/Data/Command or the Dissassembly/Data/Command layout
   **        Show the Source/Data/Command or the Dissassembly/Data/Command layout
 */
 */
static void
static void
#ifdef __STDC__
#ifdef __STDC__
_showData (
_showData (
            TuiLayoutType newLayout)
            TuiLayoutType newLayout)
#else
#else
_showData (newLayout)
_showData (newLayout)
     TuiLayoutType newLayout;
     TuiLayoutType newLayout;
#endif
#endif
{
{
  int totalHeight = (termHeight () - cmdWin->generic.height);
  int totalHeight = (termHeight () - cmdWin->generic.height);
  int srcHeight, dataHeight;
  int srcHeight, dataHeight;
  TuiWinType winType;
  TuiWinType winType;
  TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
  TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
 
 
 
 
  dataHeight = totalHeight / 2;
  dataHeight = totalHeight / 2;
  srcHeight = totalHeight - dataHeight;
  srcHeight = totalHeight - dataHeight;
  m_allBeInvisible ();
  m_allBeInvisible ();
  m_beInvisible (locator);
  m_beInvisible (locator);
  _makeDataWindow (&dataWin, dataHeight, 0);
  _makeDataWindow (&dataWin, dataHeight, 0);
  dataWin->canHighlight = TRUE;
  dataWin->canHighlight = TRUE;
  if (newLayout == SRC_DATA_COMMAND)
  if (newLayout == SRC_DATA_COMMAND)
    winType = SRC_WIN;
    winType = SRC_WIN;
  else
  else
    winType = DISASSEM_WIN;
    winType = DISASSEM_WIN;
  if (m_winPtrIsNull (winList[winType]))
  if (m_winPtrIsNull (winList[winType]))
    {
    {
      if (winType == SRC_WIN)
      if (winType == SRC_WIN)
        _makeSourceWindow (&winList[winType], srcHeight, dataHeight - 1);
        _makeSourceWindow (&winList[winType], srcHeight, dataHeight - 1);
      else
      else
        _makeDisassemWindow (&winList[winType], srcHeight, dataHeight - 1);
        _makeDisassemWindow (&winList[winType], srcHeight, dataHeight - 1);
      _initAndMakeWin ((Opaque *) & locator,
      _initAndMakeWin ((Opaque *) & locator,
                       LOCATOR_WIN,
                       LOCATOR_WIN,
                       2 /* 1 */ ,
                       2 /* 1 */ ,
                       termWidth (),
                       termWidth (),
                       0,
                       0,
                       totalHeight - 1,
                       totalHeight - 1,
                       DONT_BOX_WINDOW);
                       DONT_BOX_WINDOW);
    }
    }
  else
  else
    {
    {
      _initGenWinInfo (&winList[winType]->generic,
      _initGenWinInfo (&winList[winType]->generic,
                       winList[winType]->generic.type,
                       winList[winType]->generic.type,
                       srcHeight,
                       srcHeight,
                       winList[winType]->generic.width,
                       winList[winType]->generic.width,
                   winList[winType]->detail.sourceInfo.executionInfo->width,
                   winList[winType]->detail.sourceInfo.executionInfo->width,
                       dataHeight - 1);
                       dataHeight - 1);
      _initGenWinInfo (winList[winType]->detail.sourceInfo.executionInfo,
      _initGenWinInfo (winList[winType]->detail.sourceInfo.executionInfo,
                       EXEC_INFO_WIN,
                       EXEC_INFO_WIN,
                       srcHeight,
                       srcHeight,
                       3,
                       3,
                       0,
                       0,
                       dataHeight - 1);
                       dataHeight - 1);
      m_beVisible (winList[winType]);
      m_beVisible (winList[winType]);
      m_beVisible (winList[winType]->detail.sourceInfo.executionInfo);
      m_beVisible (winList[winType]->detail.sourceInfo.executionInfo);
      _initGenWinInfo (locator,
      _initGenWinInfo (locator,
                       LOCATOR_WIN,
                       LOCATOR_WIN,
                       2 /* 1 */ ,
                       2 /* 1 */ ,
                       termWidth (),
                       termWidth (),
                       0,
                       0,
                       totalHeight - 1);
                       totalHeight - 1);
    }
    }
  winList[winType]->detail.sourceInfo.hasLocator = TRUE;
  winList[winType]->detail.sourceInfo.hasLocator = TRUE;
  m_beVisible (locator);
  m_beVisible (locator);
  tuiShowLocatorContent ();
  tuiShowLocatorContent ();
  addToSourceWindows (winList[winType]);
  addToSourceWindows (winList[winType]);
  setCurrentLayoutTo (newLayout);
  setCurrentLayoutTo (newLayout);
 
 
  return;
  return;
}                               /* _showData */
}                               /* _showData */
 
 
/*
/*
   ** _initGenWinInfo().
   ** _initGenWinInfo().
 */
 */
static void
static void
#ifdef __STDC__
#ifdef __STDC__
_initGenWinInfo (
_initGenWinInfo (
                  TuiGenWinInfoPtr winInfo,
                  TuiGenWinInfoPtr winInfo,
                  TuiWinType type,
                  TuiWinType type,
                  int height,
                  int height,
                  int width,
                  int width,
                  int originX,
                  int originX,
                  int originY)
                  int originY)
#else
#else
_initGenWinInfo (winInfo, type, height, width, originX, originY)
_initGenWinInfo (winInfo, type, height, width, originX, originY)
     TuiGenWinInfoPtr winInfo;
     TuiGenWinInfoPtr winInfo;
     TuiWinType type;
     TuiWinType type;
     int height;
     int height;
     int width;
     int width;
     int originX;
     int originX;
     int originY;
     int originY;
#endif
#endif
{
{
  int h = height;
  int h = height;
 
 
  winInfo->type = type;
  winInfo->type = type;
  winInfo->width = width;
  winInfo->width = width;
  winInfo->height = h;
  winInfo->height = h;
  if (h > 1)
  if (h > 1)
    {
    {
      winInfo->viewportHeight = h - 1;
      winInfo->viewportHeight = h - 1;
      if (winInfo->type != CMD_WIN)
      if (winInfo->type != CMD_WIN)
        winInfo->viewportHeight--;
        winInfo->viewportHeight--;
    }
    }
  else
  else
    winInfo->viewportHeight = 1;
    winInfo->viewportHeight = 1;
  winInfo->origin.x = originX;
  winInfo->origin.x = originX;
  winInfo->origin.y = originY;
  winInfo->origin.y = originY;
 
 
  return;
  return;
}                               /* _initGenWinInfo */
}                               /* _initGenWinInfo */
 
 
/*
/*
   ** _initAndMakeWin().
   ** _initAndMakeWin().
 */
 */
static void
static void
#ifdef __STDC__
#ifdef __STDC__
_initAndMakeWin (
_initAndMakeWin (
                  Opaque * winInfoPtr,
                  Opaque * winInfoPtr,
                  TuiWinType winType,
                  TuiWinType winType,
                  int height,
                  int height,
                  int width,
                  int width,
                  int originX,
                  int originX,
                  int originY,
                  int originY,
                  int boxIt)
                  int boxIt)
#else
#else
_initAndMakeWin (winInfoPtr, winType, height, width, originX, originY, boxIt)
_initAndMakeWin (winInfoPtr, winType, height, width, originX, originY, boxIt)
     Opaque *winInfoPtr;
     Opaque *winInfoPtr;
     TuiWinType winType;
     TuiWinType winType;
     int height;
     int height;
     int width;
     int width;
     int originX;
     int originX;
     int originY;
     int originY;
     int boxIt;
     int boxIt;
#endif
#endif
{
{
  Opaque opaqueWinInfo = *winInfoPtr;
  Opaque opaqueWinInfo = *winInfoPtr;
  TuiGenWinInfoPtr generic;
  TuiGenWinInfoPtr generic;
 
 
  if (opaqueWinInfo == (Opaque) NULL)
  if (opaqueWinInfo == (Opaque) NULL)
    {
    {
      if (m_winIsAuxillary (winType))
      if (m_winIsAuxillary (winType))
        opaqueWinInfo = (Opaque) allocGenericWinInfo ();
        opaqueWinInfo = (Opaque) allocGenericWinInfo ();
      else
      else
        opaqueWinInfo = (Opaque) allocWinInfo (winType);
        opaqueWinInfo = (Opaque) allocWinInfo (winType);
    }
    }
  if (m_winIsAuxillary (winType))
  if (m_winIsAuxillary (winType))
    generic = (TuiGenWinInfoPtr) opaqueWinInfo;
    generic = (TuiGenWinInfoPtr) opaqueWinInfo;
  else
  else
    generic = &((TuiWinInfoPtr) opaqueWinInfo)->generic;
    generic = &((TuiWinInfoPtr) opaqueWinInfo)->generic;
 
 
  if (opaqueWinInfo != (Opaque) NULL)
  if (opaqueWinInfo != (Opaque) NULL)
    {
    {
      _initGenWinInfo (generic, winType, height, width, originX, originY);
      _initGenWinInfo (generic, winType, height, width, originX, originY);
      if (!m_winIsAuxillary (winType))
      if (!m_winIsAuxillary (winType))
        {
        {
          if (generic->type == CMD_WIN)
          if (generic->type == CMD_WIN)
            ((TuiWinInfoPtr) opaqueWinInfo)->canHighlight = FALSE;
            ((TuiWinInfoPtr) opaqueWinInfo)->canHighlight = FALSE;
          else
          else
            ((TuiWinInfoPtr) opaqueWinInfo)->canHighlight = TRUE;
            ((TuiWinInfoPtr) opaqueWinInfo)->canHighlight = TRUE;
        }
        }
      makeWindow (generic, boxIt);
      makeWindow (generic, boxIt);
      if (winType == LOCATOR_WIN)
      if (winType == LOCATOR_WIN)
        tuiClearLocatorDisplay ();
        tuiClearLocatorDisplay ();
      echo ();
      echo ();
    }
    }
  *winInfoPtr = opaqueWinInfo;
  *winInfoPtr = opaqueWinInfo;
 
 
  return;
  return;
}                               /* _initAndMakeWin */
}                               /* _initAndMakeWin */
 
 
 
 
/*
/*
   ** _makeSourceOrDisassemWindow().
   ** _makeSourceOrDisassemWindow().
 */
 */
static void
static void
#ifdef __STDC__
#ifdef __STDC__
_makeSourceOrDisassemWindow (
_makeSourceOrDisassemWindow (
                              TuiWinInfoPtr * winInfoPtr,
                              TuiWinInfoPtr * winInfoPtr,
                              TuiWinType type,
                              TuiWinType type,
                              int height,
                              int height,
                              int originY)
                              int originY)
#else
#else
_makeSourceOrDisassemWindow (winInfoPtr, type, height, originY)
_makeSourceOrDisassemWindow (winInfoPtr, type, height, originY)
     TuiWinInfoPtr *winInfoPtr;
     TuiWinInfoPtr *winInfoPtr;
     TuiWinType type;
     TuiWinType type;
     int height;
     int height;
     int originY;
     int originY;
#endif
#endif
{
{
  TuiGenWinInfoPtr executionInfo = (TuiGenWinInfoPtr) NULL;
  TuiGenWinInfoPtr executionInfo = (TuiGenWinInfoPtr) NULL;
 
 
  /*
  /*
     ** Create the exeuction info window.
     ** Create the exeuction info window.
   */
   */
  if (type == SRC_WIN)
  if (type == SRC_WIN)
    executionInfo = sourceExecInfoWinPtr ();
    executionInfo = sourceExecInfoWinPtr ();
  else
  else
    executionInfo = disassemExecInfoWinPtr ();
    executionInfo = disassemExecInfoWinPtr ();
  _initAndMakeWin ((Opaque *) & executionInfo,
  _initAndMakeWin ((Opaque *) & executionInfo,
                   EXEC_INFO_WIN,
                   EXEC_INFO_WIN,
                   height,
                   height,
                   3,
                   3,
                   0,
                   0,
                   originY,
                   originY,
                   DONT_BOX_WINDOW);
                   DONT_BOX_WINDOW);
  /*
  /*
     ** Now create the source window.
     ** Now create the source window.
   */
   */
  _initAndMakeWin ((Opaque *) winInfoPtr,
  _initAndMakeWin ((Opaque *) winInfoPtr,
                   type,
                   type,
                   height,
                   height,
                   termWidth () - executionInfo->width,
                   termWidth () - executionInfo->width,
                   executionInfo->width,
                   executionInfo->width,
                   originY,
                   originY,
                   BOX_WINDOW);
                   BOX_WINDOW);
 
 
  (*winInfoPtr)->detail.sourceInfo.executionInfo = executionInfo;
  (*winInfoPtr)->detail.sourceInfo.executionInfo = executionInfo;
 
 
  return;
  return;
}                               /* _makeSourceOrDisassemWindow */
}                               /* _makeSourceOrDisassemWindow */
 
 
 
 
/*
/*
   **    _showSourceOrDisassemAndCommand().
   **    _showSourceOrDisassemAndCommand().
   **        Show the Source/Command or the Disassem layout
   **        Show the Source/Command or the Disassem layout
 */
 */
static void
static void
#ifdef __STDC__
#ifdef __STDC__
_showSourceOrDisassemAndCommand (
_showSourceOrDisassemAndCommand (
                                  TuiLayoutType layoutType)
                                  TuiLayoutType layoutType)
#else
#else
_showSourceOrDisassemAndCommand (layoutType)
_showSourceOrDisassemAndCommand (layoutType)
     TuiLayoutType layoutType;
     TuiLayoutType layoutType;
#endif
#endif
{
{
  if (currentLayout () != layoutType)
  if (currentLayout () != layoutType)
    {
    {
      TuiWinInfoPtr *winInfoPtr;
      TuiWinInfoPtr *winInfoPtr;
      int areaLeft;
      int areaLeft;
      int srcHeight, cmdHeight;
      int srcHeight, cmdHeight;
      TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
      TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
 
 
      if (m_winPtrNotNull (cmdWin))
      if (m_winPtrNotNull (cmdWin))
        cmdHeight = cmdWin->generic.height;
        cmdHeight = cmdWin->generic.height;
      else
      else
        cmdHeight = termHeight () / 3;
        cmdHeight = termHeight () / 3;
      srcHeight = termHeight () - cmdHeight;
      srcHeight = termHeight () - cmdHeight;
 
 
 
 
      if (layoutType == SRC_COMMAND)
      if (layoutType == SRC_COMMAND)
        winInfoPtr = &srcWin;
        winInfoPtr = &srcWin;
      else
      else
        winInfoPtr = &disassemWin;
        winInfoPtr = &disassemWin;
 
 
      if (m_winPtrIsNull (*winInfoPtr))
      if (m_winPtrIsNull (*winInfoPtr))
        {
        {
          if (layoutType == SRC_COMMAND)
          if (layoutType == SRC_COMMAND)
            _makeSourceWindow (winInfoPtr, srcHeight - 1, 0);
            _makeSourceWindow (winInfoPtr, srcHeight - 1, 0);
          else
          else
            _makeDisassemWindow (winInfoPtr, srcHeight - 1, 0);
            _makeDisassemWindow (winInfoPtr, srcHeight - 1, 0);
          _initAndMakeWin ((Opaque *) & locator,
          _initAndMakeWin ((Opaque *) & locator,
                           LOCATOR_WIN,
                           LOCATOR_WIN,
                           2 /* 1 */ ,
                           2 /* 1 */ ,
                           termWidth (),
                           termWidth (),
                           0,
                           0,
                           srcHeight - 1,
                           srcHeight - 1,
                           DONT_BOX_WINDOW);
                           DONT_BOX_WINDOW);
        }
        }
      else
      else
        {
        {
          _initGenWinInfo (locator,
          _initGenWinInfo (locator,
                           LOCATOR_WIN,
                           LOCATOR_WIN,
                           2 /* 1 */ ,
                           2 /* 1 */ ,
                           termWidth (),
                           termWidth (),
                           0,
                           0,
                           srcHeight - 1);
                           srcHeight - 1);
          (*winInfoPtr)->detail.sourceInfo.hasLocator = TRUE;
          (*winInfoPtr)->detail.sourceInfo.hasLocator = TRUE;
          _initGenWinInfo (
          _initGenWinInfo (
                            &(*winInfoPtr)->generic,
                            &(*winInfoPtr)->generic,
                            (*winInfoPtr)->generic.type,
                            (*winInfoPtr)->generic.type,
                            srcHeight - 1,
                            srcHeight - 1,
                            (*winInfoPtr)->generic.width,
                            (*winInfoPtr)->generic.width,
                      (*winInfoPtr)->detail.sourceInfo.executionInfo->width,
                      (*winInfoPtr)->detail.sourceInfo.executionInfo->width,
                            0);
                            0);
          _initGenWinInfo ((*winInfoPtr)->detail.sourceInfo.executionInfo,
          _initGenWinInfo ((*winInfoPtr)->detail.sourceInfo.executionInfo,
                           EXEC_INFO_WIN,
                           EXEC_INFO_WIN,
                           srcHeight - 1,
                           srcHeight - 1,
                           3,
                           3,
                           0,
                           0,
                           0);
                           0);
          (*winInfoPtr)->canHighlight = TRUE;
          (*winInfoPtr)->canHighlight = TRUE;
          m_beVisible (*winInfoPtr);
          m_beVisible (*winInfoPtr);
          m_beVisible ((*winInfoPtr)->detail.sourceInfo.executionInfo);
          m_beVisible ((*winInfoPtr)->detail.sourceInfo.executionInfo);
        }
        }
      if (m_winPtrNotNull (*winInfoPtr))
      if (m_winPtrNotNull (*winInfoPtr))
        {
        {
          (*winInfoPtr)->detail.sourceInfo.hasLocator = TRUE;
          (*winInfoPtr)->detail.sourceInfo.hasLocator = TRUE;
          m_beVisible (locator);
          m_beVisible (locator);
          tuiShowLocatorContent ();
          tuiShowLocatorContent ();
          tuiShowSourceContent (*winInfoPtr);
          tuiShowSourceContent (*winInfoPtr);
 
 
          if (m_winPtrIsNull (cmdWin))
          if (m_winPtrIsNull (cmdWin))
            {
            {
              _makeCommandWindow (&cmdWin, cmdHeight, srcHeight);
              _makeCommandWindow (&cmdWin, cmdHeight, srcHeight);
              tuiRefreshWin (&cmdWin->generic);
              tuiRefreshWin (&cmdWin->generic);
            }
            }
          else
          else
            {
            {
              _initGenWinInfo (&cmdWin->generic,
              _initGenWinInfo (&cmdWin->generic,
                               cmdWin->generic.type,
                               cmdWin->generic.type,
                               cmdWin->generic.height,
                               cmdWin->generic.height,
                               cmdWin->generic.width,
                               cmdWin->generic.width,
                               cmdWin->generic.origin.x,
                               cmdWin->generic.origin.x,
                               cmdWin->generic.origin.y);
                               cmdWin->generic.origin.y);
              cmdWin->canHighlight = FALSE;
              cmdWin->canHighlight = FALSE;
              m_beVisible (cmdWin);
              m_beVisible (cmdWin);
            }
            }
        }
        }
      setCurrentLayoutTo (layoutType);
      setCurrentLayoutTo (layoutType);
    }
    }
 
 
  return;
  return;
}                               /* _showSourceOrDisassemAndCommand */
}                               /* _showSourceOrDisassemAndCommand */
 
 

powered by: WebSVN 2.1.0

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