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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [tui/] [tui-windata.c] - Blame information for rev 853

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
/* Data/register window display.
2
 
3
   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007, 2008, 2009,
4
   2010 Free Software Foundation, Inc.
5
 
6
   Contributed by Hewlett-Packard Company.
7
 
8
   This file is part of GDB.
9
 
10
   This program is free software; you can redistribute it and/or modify
11
   it under the terms of the GNU General Public License as published by
12
   the Free Software Foundation; either version 3 of the License, or
13
   (at your option) any later version.
14
 
15
   This program is distributed in the hope that it will be useful,
16
   but WITHOUT ANY WARRANTY; without even the implied warranty of
17
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
   GNU General Public License for more details.
19
 
20
   You should have received a copy of the GNU General Public License
21
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
22
 
23
#include "defs.h"
24
#include "tui/tui.h"
25
#include "tui/tui-data.h"
26
#include "tui/tui-wingeneral.h"
27
#include "tui/tui-regs.h"
28
#include "tui/tui-windata.h"
29
 
30
#include "gdb_string.h"
31
#include "gdb_curses.h"
32
 
33
 
34
/*****************************************
35
** STATIC LOCAL FUNCTIONS FORWARD DECLS    **
36
******************************************/
37
 
38
 
39
 
40
/*****************************************
41
** PUBLIC FUNCTIONS                        **
42
******************************************/
43
 
44
 
45
/* Answer the index first element displayed.  If none are displayed,
46
   then return (-1).  */
47
int
48
tui_first_data_item_displayed (void)
49
{
50
  int element_no = (-1);
51
  int i;
52
 
53
  for (i = 0;
54
       i < TUI_DATA_WIN->generic.content_size && element_no < 0;
55
       i++)
56
    {
57
      struct tui_gen_win_info *data_item_win;
58
 
59
      data_item_win = &((tui_win_content)
60
                        TUI_DATA_WIN->generic.content)[i]->which_element.data_window;
61
      if (data_item_win->handle != (WINDOW *) NULL
62
          && data_item_win->is_visible)
63
        element_no = i;
64
    }
65
 
66
  return element_no;
67
}
68
 
69
 
70
/* Answer the index of the first element in line_no.  If line_no is
71
   past the data area (-1) is returned.  */
72
int
73
tui_first_data_element_no_in_line (int line_no)
74
{
75
  int first_element_no = (-1);
76
 
77
  /* First see if there is a register on line_no, and if so, set the
78
     first element number.  */
79
  if ((first_element_no = tui_first_reg_element_no_inline (line_no)) == -1)
80
    { /* Looking at the general data, the 1st element on line_no.  */
81
    }
82
 
83
  return first_element_no;
84
}
85
 
86
 
87
/* Function to delete all the item windows in the data window.  This
88
   is usually done when the data window is scrolled.  */
89
void
90
tui_delete_data_content_windows (void)
91
{
92
  int i;
93
  struct tui_gen_win_info *data_item_win_ptr;
94
 
95
  for (i = 0; (i < TUI_DATA_WIN->generic.content_size); i++)
96
    {
97
      data_item_win_ptr = &((tui_win_content)
98
                            TUI_DATA_WIN->generic.content)[i]->which_element.data_window;
99
      tui_delete_win (data_item_win_ptr->handle);
100
      data_item_win_ptr->handle = (WINDOW *) NULL;
101
      data_item_win_ptr->is_visible = FALSE;
102
    }
103
}
104
 
105
 
106
void
107
tui_erase_data_content (char *prompt)
108
{
109
  werase (TUI_DATA_WIN->generic.handle);
110
  tui_check_and_display_highlight_if_needed (TUI_DATA_WIN);
111
  if (prompt != (char *) NULL)
112
    {
113
      int half_width = (TUI_DATA_WIN->generic.width - 2) / 2;
114
      int x_pos;
115
 
116
      if (strlen (prompt) >= half_width)
117
        x_pos = 1;
118
      else
119
        x_pos = half_width - strlen (prompt);
120
      mvwaddstr (TUI_DATA_WIN->generic.handle,
121
                 (TUI_DATA_WIN->generic.height / 2),
122
                 x_pos,
123
                 prompt);
124
    }
125
  wrefresh (TUI_DATA_WIN->generic.handle);
126
}
127
 
128
 
129
/* This function displays the data that is in the data window's
130
   content.  It does not set the content.  */
131
void
132
tui_display_all_data (void)
133
{
134
  if (TUI_DATA_WIN->generic.content_size <= 0)
135
    tui_erase_data_content (NO_DATA_STRING);
136
  else
137
    {
138
      tui_erase_data_content ((char *) NULL);
139
      tui_delete_data_content_windows ();
140
      tui_check_and_display_highlight_if_needed (TUI_DATA_WIN);
141
      tui_display_registers_from (0);
142
 
143
      /* Then display the other data.  */
144
      if (TUI_DATA_WIN->detail.data_display_info.data_content !=
145
          (tui_win_content) NULL
146
          && TUI_DATA_WIN->detail.data_display_info.data_content_count > 0)
147
        {
148
        }
149
    }
150
}
151
 
152
 
153
/* Function to display the data starting at line, line_no, in the data
154
   window.  */
155
void
156
tui_display_data_from_line (int line_no)
157
{
158
  int _line_no = line_no;
159
 
160
  if (line_no < 0)
161
    _line_no = 0;
162
 
163
  tui_check_and_display_highlight_if_needed (TUI_DATA_WIN);
164
 
165
  /* There is no general data, force regs to display (if there are
166
     any).  */
167
  if (TUI_DATA_WIN->detail.data_display_info.data_content_count <= 0)
168
    tui_display_registers_from_line (_line_no, TRUE);
169
  else
170
    {
171
      int element_no, start_line_no;
172
      int regs_last_line = tui_last_regs_line_no ();
173
 
174
 
175
      /* Display regs if we can.  */
176
      if (tui_display_registers_from_line (_line_no, FALSE) < 0)
177
        { /* _line_no is past the regs display, so calc where the
178
             start data element is.  */
179
          if (regs_last_line < _line_no)
180
            { /* Figure out how many lines each element is to obtain
181
                 the start element_no.  */
182
            }
183
        }
184
      else
185
        { /* Calculate the starting element of the data display, given
186
             regs_last_line and how many lines each element is, up to
187
             _line_no.  */
188
        }
189
      /* Now display the data , starting at element_no.  */
190
    }
191
}
192
 
193
 
194
/* Display data starting at element element_no.  */
195
void
196
tui_display_data_from (int element_no, int reuse_windows)
197
{
198
  int first_line = (-1);
199
 
200
  if (element_no < TUI_DATA_WIN->detail.data_display_info.regs_content_count)
201
    first_line = tui_line_from_reg_element_no (element_no);
202
  else
203
    { /* Calculate the first_line from the element number.  */
204
    }
205
 
206
  if (first_line >= 0)
207
    {
208
      tui_erase_data_content ((char *) NULL);
209
      if (!reuse_windows)
210
        tui_delete_data_content_windows ();
211
      tui_display_data_from_line (first_line);
212
    }
213
}
214
 
215
 
216
/* Function to redisplay the contents of the data window.  */
217
void
218
tui_refresh_data_win (void)
219
{
220
  tui_erase_data_content ((char *) NULL);
221
  if (TUI_DATA_WIN->generic.content_size > 0)
222
    {
223
      int first_element = tui_first_data_item_displayed ();
224
 
225
      if (first_element >= 0)    /* Re-use existing windows.  */
226
        tui_display_data_from (first_element, TRUE);
227
    }
228
}
229
 
230
 
231
/* Function to check the data values and hilite any that have
232
   changed.  */
233
void
234
tui_check_data_values (struct frame_info *frame)
235
{
236
  tui_check_register_values (frame);
237
 
238
  /* Now check any other data values that there are.  */
239
  if (TUI_DATA_WIN != NULL && TUI_DATA_WIN->generic.is_visible)
240
    {
241
      int i;
242
 
243
      for (i = 0;
244
           TUI_DATA_WIN->detail.data_display_info.data_content_count;
245
           i++)
246
        {
247
#ifdef LATER
248
          tui_data_element_ptr data_element_ptr;
249
          struct tui_gen_win_info *data_item_win_ptr;
250
          Opaque new_value;
251
 
252
          data_item_ptr = &TUI_DATA_WIN->detail.data_display_info.
253
            data_content[i]->which_element.data_window;
254
          data_element_ptr = &((tui_win_content)
255
                             data_item_win_ptr->content)[0]->which_element.data;
256
          if value
257
            has changed (data_element_ptr, frame, &new_value)
258
            {
259
              data_element_ptr->value = new_value;
260
              update the display with the new value, hiliting it.
261
            }
262
#endif
263
        }
264
    }
265
}
266
 
267
 
268
/* Scroll the data window vertically forward or backward.  */
269
void
270
tui_vertical_data_scroll (enum tui_scroll_direction scroll_direction,
271
                          int num_to_scroll)
272
{
273
  int first_element_no;
274
  int first_line = (-1);
275
 
276
  first_element_no = tui_first_data_item_displayed ();
277
  if (first_element_no < TUI_DATA_WIN->detail.data_display_info.regs_content_count)
278
    first_line = tui_line_from_reg_element_no (first_element_no);
279
  else
280
    { /* Calculate the first line from the element number which is in
281
        the general data content.  */
282
    }
283
 
284
  if (first_line >= 0)
285
    {
286
      int last_element_no, last_line;
287
 
288
      if (scroll_direction == FORWARD_SCROLL)
289
        first_line += num_to_scroll;
290
      else
291
        first_line -= num_to_scroll;
292
      tui_erase_data_content ((char *) NULL);
293
      tui_delete_data_content_windows ();
294
      tui_display_data_from_line (first_line);
295
    }
296
}
297
 
298
 
299
/*****************************************
300
** STATIC LOCAL FUNCTIONS               **
301
******************************************/

powered by: WebSVN 2.1.0

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