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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [tui/] [tuiDataWin.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
/*
/*
   ** tuiDataWin.c
   ** tuiDataWin.c
   **   This module contains functions to support the data/register window display.
   **   This module contains functions to support the data/register window display.
 */
 */
 
 
 
 
#include "defs.h"
#include "defs.h"
#include "tui.h"
#include "tui.h"
#include "tuiData.h"
#include "tuiData.h"
#include "tuiRegs.h"
#include "tuiRegs.h"
 
 
 
 
/*****************************************
/*****************************************
** STATIC LOCAL FUNCTIONS FORWARD DECLS    **
** STATIC LOCAL FUNCTIONS FORWARD DECLS    **
******************************************/
******************************************/
 
 
 
 
 
 
/*****************************************
/*****************************************
** PUBLIC FUNCTIONS                        **
** PUBLIC FUNCTIONS                        **
******************************************/
******************************************/
 
 
 
 
/*
/*
   ** tuiFirstDataItemDisplayed()
   ** tuiFirstDataItemDisplayed()
   **    Answer the index first element displayed.
   **    Answer the index first element displayed.
   **    If none are displayed, then return (-1).
   **    If none are displayed, then return (-1).
 */
 */
int
int
#ifdef __STDC__
#ifdef __STDC__
tuiFirstDataItemDisplayed (void)
tuiFirstDataItemDisplayed (void)
#else
#else
tuiFirstDataItemDisplayed ()
tuiFirstDataItemDisplayed ()
#endif
#endif
{
{
  int elementNo = (-1);
  int elementNo = (-1);
  int i;
  int i;
 
 
  for (i = 0; (i < dataWin->generic.contentSize && elementNo < 0); i++)
  for (i = 0; (i < dataWin->generic.contentSize && elementNo < 0); i++)
    {
    {
      TuiGenWinInfoPtr dataItemWin;
      TuiGenWinInfoPtr dataItemWin;
 
 
      dataItemWin = &((TuiWinContent)
      dataItemWin = &((TuiWinContent)
                      dataWin->generic.content)[i]->whichElement.dataWindow;
                      dataWin->generic.content)[i]->whichElement.dataWindow;
      if (dataItemWin->handle != (WINDOW *) NULL && dataItemWin->isVisible)
      if (dataItemWin->handle != (WINDOW *) NULL && dataItemWin->isVisible)
        elementNo = i;
        elementNo = i;
    }
    }
 
 
  return elementNo;
  return elementNo;
}                               /* tuiFirstDataItemDisplayed */
}                               /* tuiFirstDataItemDisplayed */
 
 
 
 
/*
/*
   ** tuiFirstDataElementNoInLine()
   ** tuiFirstDataElementNoInLine()
   **        Answer the index of the first element in lineNo.  If lineNo is
   **        Answer the index of the first element in lineNo.  If lineNo is
   **        past the data area (-1) is returned.
   **        past the data area (-1) is returned.
 */
 */
int
int
#ifdef __STDC__
#ifdef __STDC__
tuiFirstDataElementNoInLine (
tuiFirstDataElementNoInLine (
                              int lineNo)
                              int lineNo)
#else
#else
tuiFirstDataElementNoInLine (lineNo)
tuiFirstDataElementNoInLine (lineNo)
     int lineNo;
     int lineNo;
#endif
#endif
{
{
  int firstElementNo = (-1);
  int firstElementNo = (-1);
 
 
  /*
  /*
     ** First see if there is a register on lineNo, and if so, set the
     ** First see if there is a register on lineNo, and if so, set the
     ** first element number
     ** first element number
   */
   */
  if ((firstElementNo = tuiFirstRegElementNoInLine (lineNo)) == -1)
  if ((firstElementNo = tuiFirstRegElementNoInLine (lineNo)) == -1)
    {                           /*
    {                           /*
                                   ** Looking at the general data, the 1st element on lineNo
                                   ** Looking at the general data, the 1st element on lineNo
                                 */
                                 */
    }
    }
 
 
  return firstElementNo;
  return firstElementNo;
}                               /* tuiFirstDataElementNoInLine */
}                               /* tuiFirstDataElementNoInLine */
 
 
 
 
/*
/*
   ** tuiDeleteDataContentWindows()
   ** tuiDeleteDataContentWindows()
   **        Function to delete all the item windows in the data window.
   **        Function to delete all the item windows in the data window.
   **        This is usually done when the data window is scrolled.
   **        This is usually done when the data window is scrolled.
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
tuiDeleteDataContentWindows (void)
tuiDeleteDataContentWindows (void)
#else
#else
tuiDeleteDataContentWindows ()
tuiDeleteDataContentWindows ()
#endif
#endif
{
{
  int i;
  int i;
  TuiGenWinInfoPtr dataItemWinPtr;
  TuiGenWinInfoPtr dataItemWinPtr;
 
 
  for (i = 0; (i < dataWin->generic.contentSize); i++)
  for (i = 0; (i < dataWin->generic.contentSize); i++)
    {
    {
      dataItemWinPtr = &((TuiWinContent)
      dataItemWinPtr = &((TuiWinContent)
                      dataWin->generic.content)[i]->whichElement.dataWindow;
                      dataWin->generic.content)[i]->whichElement.dataWindow;
      tuiDelwin (dataItemWinPtr->handle);
      tuiDelwin (dataItemWinPtr->handle);
      dataItemWinPtr->handle = (WINDOW *) NULL;
      dataItemWinPtr->handle = (WINDOW *) NULL;
      dataItemWinPtr->isVisible = FALSE;
      dataItemWinPtr->isVisible = FALSE;
    }
    }
 
 
  return;
  return;
}                               /* tuiDeleteDataContentWindows */
}                               /* tuiDeleteDataContentWindows */
 
 
 
 
void
void
#ifdef __STDC__
#ifdef __STDC__
tuiEraseDataContent (
tuiEraseDataContent (
                      char *prompt)
                      char *prompt)
#else
#else
tuiEraseDataContent (prompt)
tuiEraseDataContent (prompt)
     char *prompt;
     char *prompt;
#endif
#endif
{
{
  werase (dataWin->generic.handle);
  werase (dataWin->generic.handle);
  checkAndDisplayHighlightIfNeeded (dataWin);
  checkAndDisplayHighlightIfNeeded (dataWin);
  if (prompt != (char *) NULL)
  if (prompt != (char *) NULL)
    {
    {
      int halfWidth = (dataWin->generic.width - 2) / 2;
      int halfWidth = (dataWin->generic.width - 2) / 2;
      int xPos;
      int xPos;
 
 
      if (strlen (prompt) >= halfWidth)
      if (strlen (prompt) >= halfWidth)
        xPos = 1;
        xPos = 1;
      else
      else
        xPos = halfWidth - strlen (prompt);
        xPos = halfWidth - strlen (prompt);
      mvwaddstr (dataWin->generic.handle,
      mvwaddstr (dataWin->generic.handle,
                 (dataWin->generic.height / 2),
                 (dataWin->generic.height / 2),
                 xPos,
                 xPos,
                 prompt);
                 prompt);
    }
    }
  wrefresh (dataWin->generic.handle);
  wrefresh (dataWin->generic.handle);
 
 
  return;
  return;
}                               /* tuiEraseDataContent */
}                               /* tuiEraseDataContent */
 
 
 
 
/*
/*
   ** tuiDisplayAllData().
   ** tuiDisplayAllData().
   **        This function displays the data that is in the data window's
   **        This function displays the data that is in the data window's
   **        content.  It does not set the content.
   **        content.  It does not set the content.
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
tuiDisplayAllData (void)
tuiDisplayAllData (void)
#else
#else
tuiDisplayAllData ()
tuiDisplayAllData ()
#endif
#endif
{
{
  if (dataWin->generic.contentSize <= 0)
  if (dataWin->generic.contentSize <= 0)
    tuiEraseDataContent (NO_DATA_STRING);
    tuiEraseDataContent (NO_DATA_STRING);
  else
  else
    {
    {
      tuiEraseDataContent ((char *) NULL);
      tuiEraseDataContent ((char *) NULL);
      tuiDeleteDataContentWindows ();
      tuiDeleteDataContentWindows ();
      checkAndDisplayHighlightIfNeeded (dataWin);
      checkAndDisplayHighlightIfNeeded (dataWin);
      tuiDisplayRegistersFrom (0);
      tuiDisplayRegistersFrom (0);
      /*
      /*
         ** Then display the other data
         ** Then display the other data
       */
       */
      if (dataWin->detail.dataDisplayInfo.dataContent !=
      if (dataWin->detail.dataDisplayInfo.dataContent !=
          (TuiWinContent) NULL &&
          (TuiWinContent) NULL &&
          dataWin->detail.dataDisplayInfo.dataContentCount > 0)
          dataWin->detail.dataDisplayInfo.dataContentCount > 0)
        {
        {
        }
        }
    }
    }
  return;
  return;
}                               /* tuiDisplayAllData */
}                               /* tuiDisplayAllData */
 
 
 
 
/*
/*
   ** tuiDisplayDataFromLine()
   ** tuiDisplayDataFromLine()
   **        Function to display the data starting at line, lineNo, in the
   **        Function to display the data starting at line, lineNo, in the
   **        data window.
   **        data window.
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
tuiDisplayDataFromLine (
tuiDisplayDataFromLine (
                         int lineNo)
                         int lineNo)
#else
#else
tuiDisplayDataFromLine (lineNo)
tuiDisplayDataFromLine (lineNo)
     int lineNo;
     int lineNo;
#endif
#endif
{
{
  int _lineNo = lineNo;
  int _lineNo = lineNo;
 
 
  if (lineNo < 0)
  if (lineNo < 0)
    _lineNo = 0;
    _lineNo = 0;
 
 
  checkAndDisplayHighlightIfNeeded (dataWin);
  checkAndDisplayHighlightIfNeeded (dataWin);
 
 
  /* there is no general data, force regs to display (if there are any) */
  /* there is no general data, force regs to display (if there are any) */
  if (dataWin->detail.dataDisplayInfo.dataContentCount <= 0)
  if (dataWin->detail.dataDisplayInfo.dataContentCount <= 0)
    tuiDisplayRegistersFromLine (_lineNo, TRUE);
    tuiDisplayRegistersFromLine (_lineNo, TRUE);
  else
  else
    {
    {
      int elementNo, startLineNo;
      int elementNo, startLineNo;
      int regsLastLine = tuiLastRegsLineNo ();
      int regsLastLine = tuiLastRegsLineNo ();
 
 
 
 
      /* display regs if we can */
      /* display regs if we can */
      if (tuiDisplayRegistersFromLine (_lineNo, FALSE) < 0)
      if (tuiDisplayRegistersFromLine (_lineNo, FALSE) < 0)
        {                       /*
        {                       /*
                                   ** _lineNo is past the regs display, so calc where the
                                   ** _lineNo is past the regs display, so calc where the
                                   ** start data element is
                                   ** start data element is
                                 */
                                 */
          if (regsLastLine < _lineNo)
          if (regsLastLine < _lineNo)
            {                   /* figure out how many lines each element is to obtain
            {                   /* figure out how many lines each element is to obtain
                                   the start elementNo */
                                   the start elementNo */
            }
            }
        }
        }
      else
      else
        {                       /*
        {                       /*
                                   ** calculate the starting element of the data display, given
                                   ** calculate the starting element of the data display, given
                                   ** regsLastLine and how many lines each element is, up to
                                   ** regsLastLine and how many lines each element is, up to
                                   ** _lineNo
                                   ** _lineNo
                                 */
                                 */
        }
        }
      /* Now display the data , starting at elementNo */
      /* Now display the data , starting at elementNo */
    }
    }
 
 
  return;
  return;
}                               /* tuiDisplayDataFromLine */
}                               /* tuiDisplayDataFromLine */
 
 
 
 
/*
/*
   ** tuiDisplayDataFrom()
   ** tuiDisplayDataFrom()
   **        Display data starting at element elementNo
   **        Display data starting at element elementNo
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
tuiDisplayDataFrom (
tuiDisplayDataFrom (
                     int elementNo,
                     int elementNo,
                     int reuseWindows)
                     int reuseWindows)
#else
#else
tuiDisplayDataFrom (elementNo, reuseWindows)
tuiDisplayDataFrom (elementNo, reuseWindows)
     int elementNo;
     int elementNo;
     int reuseWindows;
     int reuseWindows;
#endif
#endif
{
{
  int firstLine = (-1);
  int firstLine = (-1);
 
 
  if (elementNo < dataWin->detail.dataDisplayInfo.regsContentCount)
  if (elementNo < dataWin->detail.dataDisplayInfo.regsContentCount)
    firstLine = tuiLineFromRegElementNo (elementNo);
    firstLine = tuiLineFromRegElementNo (elementNo);
  else
  else
    {                           /* calculate the firstLine from the element number */
    {                           /* calculate the firstLine from the element number */
    }
    }
 
 
  if (firstLine >= 0)
  if (firstLine >= 0)
    {
    {
      tuiEraseDataContent ((char *) NULL);
      tuiEraseDataContent ((char *) NULL);
      if (!reuseWindows)
      if (!reuseWindows)
        tuiDeleteDataContentWindows ();
        tuiDeleteDataContentWindows ();
      tuiDisplayDataFromLine (firstLine);
      tuiDisplayDataFromLine (firstLine);
    }
    }
 
 
  return;
  return;
}                               /* tuiDisplayDataFrom */
}                               /* tuiDisplayDataFrom */
 
 
 
 
/*
/*
   ** tuiRefreshDataWin()
   ** tuiRefreshDataWin()
   **        Function to redisplay the contents of the data window.
   **        Function to redisplay the contents of the data window.
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
tuiRefreshDataWin (void)
tuiRefreshDataWin (void)
#else
#else
tuiRefreshDataWin ()
tuiRefreshDataWin ()
#endif
#endif
{
{
  tuiEraseDataContent ((char *) NULL);
  tuiEraseDataContent ((char *) NULL);
  if (dataWin->generic.contentSize > 0)
  if (dataWin->generic.contentSize > 0)
    {
    {
      int firstElement = tuiFirstDataItemDisplayed ();
      int firstElement = tuiFirstDataItemDisplayed ();
 
 
      if (firstElement >= 0)     /* re-use existing windows */
      if (firstElement >= 0)     /* re-use existing windows */
        tuiDisplayDataFrom (firstElement, TRUE);
        tuiDisplayDataFrom (firstElement, TRUE);
    }
    }
 
 
  return;
  return;
}                               /* tuiRefreshDataWin */
}                               /* tuiRefreshDataWin */
 
 
 
 
/*
/*
   ** tuiCheckDataValues().
   ** tuiCheckDataValues().
   **        Function to check the data values and hilite any that have changed
   **        Function to check the data values and hilite any that have changed
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
tuiCheckDataValues (
tuiCheckDataValues (
                     struct frame_info *frame)
                     struct frame_info *frame)
#else
#else
tuiCheckDataValues (frame)
tuiCheckDataValues (frame)
     struct frame_info *frame;
     struct frame_info *frame;
#endif
#endif
{
{
  tuiCheckRegisterValues (frame);
  tuiCheckRegisterValues (frame);
 
 
  /* Now check any other data values that there are */
  /* Now check any other data values that there are */
  if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible)
  if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible)
    {
    {
      int i;
      int i;
 
 
      for (i = 0; dataWin->detail.dataDisplayInfo.dataContentCount; i++)
      for (i = 0; dataWin->detail.dataDisplayInfo.dataContentCount; i++)
        {
        {
#ifdef LATER
#ifdef LATER
          TuiDataElementPtr dataElementPtr;
          TuiDataElementPtr dataElementPtr;
          TuiGenWinInfoPtr dataItemWinPtr;
          TuiGenWinInfoPtr dataItemWinPtr;
          Opaque newValue;
          Opaque newValue;
 
 
          dataItemPtr = &dataWin->detail.dataDisplayInfo.
          dataItemPtr = &dataWin->detail.dataDisplayInfo.
            dataContent[i]->whichElement.dataWindow;
            dataContent[i]->whichElement.dataWindow;
          dataElementPtr = &((TuiWinContent)
          dataElementPtr = &((TuiWinContent)
                             dataItemWinPtr->content)[0]->whichElement.data;
                             dataItemWinPtr->content)[0]->whichElement.data;
          if value
          if value
            has changed (dataElementPtr, frame, &newValue)
            has changed (dataElementPtr, frame, &newValue)
            {
            {
              dataElementPtr->value = newValue;
              dataElementPtr->value = newValue;
              update the display with the new value, hiliting it.
              update the display with the new value, hiliting it.
            }
            }
#endif
#endif
        }
        }
    }
    }
}                               /* tuiCheckDataValues */
}                               /* tuiCheckDataValues */
 
 
 
 
/*
/*
   ** tui_vCheckDataValues().
   ** tui_vCheckDataValues().
   **        Function to check the data values and hilite any that have
   **        Function to check the data values and hilite any that have
   **        changed with args in a va_list
   **        changed with args in a va_list
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
tui_vCheckDataValues (
tui_vCheckDataValues (
                       va_list args)
                       va_list args)
#else
#else
tui_vCheckDataValues (args)
tui_vCheckDataValues (args)
     va_list args;
     va_list args;
#endif
#endif
{
{
  struct frame_info *frame = va_arg (args, struct frame_info *);
  struct frame_info *frame = va_arg (args, struct frame_info *);
 
 
  tuiCheckDataValues (frame);
  tuiCheckDataValues (frame);
 
 
  return;
  return;
}                               /* tui_vCheckDataValues */
}                               /* tui_vCheckDataValues */
 
 
 
 
/*
/*
   ** tuiVerticalDataScroll()
   ** tuiVerticalDataScroll()
   **        Scroll the data window vertically forward or backward.
   **        Scroll the data window vertically forward or backward.
 */
 */
void
void
#ifdef __STDC__
#ifdef __STDC__
tuiVerticalDataScroll (
tuiVerticalDataScroll (
                        TuiScrollDirection scrollDirection,
                        TuiScrollDirection scrollDirection,
                        int numToScroll)
                        int numToScroll)
#else
#else
tuiVerticalDataScroll (scrollDirection, numToScroll)
tuiVerticalDataScroll (scrollDirection, numToScroll)
     TuiScrollDirection scrollDirection;
     TuiScrollDirection scrollDirection;
     int numToScroll;
     int numToScroll;
#endif
#endif
{
{
  int firstElementNo;
  int firstElementNo;
  int firstLine = (-1);
  int firstLine = (-1);
 
 
  firstElementNo = tuiFirstDataItemDisplayed ();
  firstElementNo = tuiFirstDataItemDisplayed ();
  if (firstElementNo < dataWin->detail.dataDisplayInfo.regsContentCount)
  if (firstElementNo < dataWin->detail.dataDisplayInfo.regsContentCount)
    firstLine = tuiLineFromRegElementNo (firstElementNo);
    firstLine = tuiLineFromRegElementNo (firstElementNo);
  else
  else
    {                           /* calculate the first line from the element number which is in
    {                           /* calculate the first line from the element number which is in
                                   ** the general data content
                                   ** the general data content
                                 */
                                 */
    }
    }
 
 
  if (firstLine >= 0)
  if (firstLine >= 0)
    {
    {
      int lastElementNo, lastLine;
      int lastElementNo, lastLine;
 
 
      if (scrollDirection == FORWARD_SCROLL)
      if (scrollDirection == FORWARD_SCROLL)
        firstLine += numToScroll;
        firstLine += numToScroll;
      else
      else
        firstLine -= numToScroll;
        firstLine -= numToScroll;
      tuiEraseDataContent ((char *) NULL);
      tuiEraseDataContent ((char *) NULL);
      tuiDeleteDataContentWindows ();
      tuiDeleteDataContentWindows ();
      tuiDisplayDataFromLine (firstLine);
      tuiDisplayDataFromLine (firstLine);
    }
    }
 
 
  return;
  return;
}                               /* tuiVerticalDataScroll */
}                               /* tuiVerticalDataScroll */
 
 
 
 
/*****************************************
/*****************************************
** STATIC LOCAL FUNCTIONS               **
** STATIC LOCAL FUNCTIONS               **
******************************************/
******************************************/
 
 

powered by: WebSVN 2.1.0

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