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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [tui/] [tui-windata.c] - Blame information for rev 280

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

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

powered by: WebSVN 2.1.0

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