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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [tui/] [tuiDataWin.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
/*
2
   ** tuiDataWin.c
3
   **   This module contains functions to support the data/register window display.
4
 */
5
 
6
 
7
#include "defs.h"
8
#include "tui.h"
9
#include "tuiData.h"
10
#include "tuiRegs.h"
11
 
12
 
13
/*****************************************
14
** STATIC LOCAL FUNCTIONS FORWARD DECLS    **
15
******************************************/
16
 
17
 
18
 
19
/*****************************************
20
** PUBLIC FUNCTIONS                        **
21
******************************************/
22
 
23
 
24
/*
25
   ** tuiFirstDataItemDisplayed()
26
   **    Answer the index first element displayed.
27
   **    If none are displayed, then return (-1).
28
 */
29
int
30
#ifdef __STDC__
31
tuiFirstDataItemDisplayed (void)
32
#else
33
tuiFirstDataItemDisplayed ()
34
#endif
35
{
36
  int elementNo = (-1);
37
  int i;
38
 
39
  for (i = 0; (i < dataWin->generic.contentSize && elementNo < 0); i++)
40
    {
41
      TuiGenWinInfoPtr dataItemWin;
42
 
43
      dataItemWin = &((TuiWinContent)
44
                      dataWin->generic.content)[i]->whichElement.dataWindow;
45
      if (dataItemWin->handle != (WINDOW *) NULL && dataItemWin->isVisible)
46
        elementNo = i;
47
    }
48
 
49
  return elementNo;
50
}                               /* tuiFirstDataItemDisplayed */
51
 
52
 
53
/*
54
   ** tuiFirstDataElementNoInLine()
55
   **        Answer the index of the first element in lineNo.  If lineNo is
56
   **        past the data area (-1) is returned.
57
 */
58
int
59
#ifdef __STDC__
60
tuiFirstDataElementNoInLine (
61
                              int lineNo)
62
#else
63
tuiFirstDataElementNoInLine (lineNo)
64
     int lineNo;
65
#endif
66
{
67
  int firstElementNo = (-1);
68
 
69
  /*
70
     ** First see if there is a register on lineNo, and if so, set the
71
     ** first element number
72
   */
73
  if ((firstElementNo = tuiFirstRegElementNoInLine (lineNo)) == -1)
74
    {                           /*
75
                                   ** Looking at the general data, the 1st element on lineNo
76
                                 */
77
    }
78
 
79
  return firstElementNo;
80
}                               /* tuiFirstDataElementNoInLine */
81
 
82
 
83
/*
84
   ** tuiDeleteDataContentWindows()
85
   **        Function to delete all the item windows in the data window.
86
   **        This is usually done when the data window is scrolled.
87
 */
88
void
89
#ifdef __STDC__
90
tuiDeleteDataContentWindows (void)
91
#else
92
tuiDeleteDataContentWindows ()
93
#endif
94
{
95
  int i;
96
  TuiGenWinInfoPtr dataItemWinPtr;
97
 
98
  for (i = 0; (i < dataWin->generic.contentSize); i++)
99
    {
100
      dataItemWinPtr = &((TuiWinContent)
101
                      dataWin->generic.content)[i]->whichElement.dataWindow;
102
      tuiDelwin (dataItemWinPtr->handle);
103
      dataItemWinPtr->handle = (WINDOW *) NULL;
104
      dataItemWinPtr->isVisible = FALSE;
105
    }
106
 
107
  return;
108
}                               /* tuiDeleteDataContentWindows */
109
 
110
 
111
void
112
#ifdef __STDC__
113
tuiEraseDataContent (
114
                      char *prompt)
115
#else
116
tuiEraseDataContent (prompt)
117
     char *prompt;
118
#endif
119
{
120
  werase (dataWin->generic.handle);
121
  checkAndDisplayHighlightIfNeeded (dataWin);
122
  if (prompt != (char *) NULL)
123
    {
124
      int halfWidth = (dataWin->generic.width - 2) / 2;
125
      int xPos;
126
 
127
      if (strlen (prompt) >= halfWidth)
128
        xPos = 1;
129
      else
130
        xPos = halfWidth - strlen (prompt);
131
      mvwaddstr (dataWin->generic.handle,
132
                 (dataWin->generic.height / 2),
133
                 xPos,
134
                 prompt);
135
    }
136
  wrefresh (dataWin->generic.handle);
137
 
138
  return;
139
}                               /* tuiEraseDataContent */
140
 
141
 
142
/*
143
   ** tuiDisplayAllData().
144
   **        This function displays the data that is in the data window's
145
   **        content.  It does not set the content.
146
 */
147
void
148
#ifdef __STDC__
149
tuiDisplayAllData (void)
150
#else
151
tuiDisplayAllData ()
152
#endif
153
{
154
  if (dataWin->generic.contentSize <= 0)
155
    tuiEraseDataContent (NO_DATA_STRING);
156
  else
157
    {
158
      tuiEraseDataContent ((char *) NULL);
159
      tuiDeleteDataContentWindows ();
160
      checkAndDisplayHighlightIfNeeded (dataWin);
161
      tuiDisplayRegistersFrom (0);
162
      /*
163
         ** Then display the other data
164
       */
165
      if (dataWin->detail.dataDisplayInfo.dataContent !=
166
          (TuiWinContent) NULL &&
167
          dataWin->detail.dataDisplayInfo.dataContentCount > 0)
168
        {
169
        }
170
    }
171
  return;
172
}                               /* tuiDisplayAllData */
173
 
174
 
175
/*
176
   ** tuiDisplayDataFromLine()
177
   **        Function to display the data starting at line, lineNo, in the
178
   **        data window.
179
 */
180
void
181
#ifdef __STDC__
182
tuiDisplayDataFromLine (
183
                         int lineNo)
184
#else
185
tuiDisplayDataFromLine (lineNo)
186
     int lineNo;
187
#endif
188
{
189
  int _lineNo = lineNo;
190
 
191
  if (lineNo < 0)
192
    _lineNo = 0;
193
 
194
  checkAndDisplayHighlightIfNeeded (dataWin);
195
 
196
  /* there is no general data, force regs to display (if there are any) */
197
  if (dataWin->detail.dataDisplayInfo.dataContentCount <= 0)
198
    tuiDisplayRegistersFromLine (_lineNo, TRUE);
199
  else
200
    {
201
      int elementNo, startLineNo;
202
      int regsLastLine = tuiLastRegsLineNo ();
203
 
204
 
205
      /* display regs if we can */
206
      if (tuiDisplayRegistersFromLine (_lineNo, FALSE) < 0)
207
        {                       /*
208
                                   ** _lineNo is past the regs display, so calc where the
209
                                   ** start data element is
210
                                 */
211
          if (regsLastLine < _lineNo)
212
            {                   /* figure out how many lines each element is to obtain
213
                                   the start elementNo */
214
            }
215
        }
216
      else
217
        {                       /*
218
                                   ** calculate the starting element of the data display, given
219
                                   ** regsLastLine and how many lines each element is, up to
220
                                   ** _lineNo
221
                                 */
222
        }
223
      /* Now display the data , starting at elementNo */
224
    }
225
 
226
  return;
227
}                               /* tuiDisplayDataFromLine */
228
 
229
 
230
/*
231
   ** tuiDisplayDataFrom()
232
   **        Display data starting at element elementNo
233
 */
234
void
235
#ifdef __STDC__
236
tuiDisplayDataFrom (
237
                     int elementNo,
238
                     int reuseWindows)
239
#else
240
tuiDisplayDataFrom (elementNo, reuseWindows)
241
     int elementNo;
242
     int reuseWindows;
243
#endif
244
{
245
  int firstLine = (-1);
246
 
247
  if (elementNo < dataWin->detail.dataDisplayInfo.regsContentCount)
248
    firstLine = tuiLineFromRegElementNo (elementNo);
249
  else
250
    {                           /* calculate the firstLine from the element number */
251
    }
252
 
253
  if (firstLine >= 0)
254
    {
255
      tuiEraseDataContent ((char *) NULL);
256
      if (!reuseWindows)
257
        tuiDeleteDataContentWindows ();
258
      tuiDisplayDataFromLine (firstLine);
259
    }
260
 
261
  return;
262
}                               /* tuiDisplayDataFrom */
263
 
264
 
265
/*
266
   ** tuiRefreshDataWin()
267
   **        Function to redisplay the contents of the data window.
268
 */
269
void
270
#ifdef __STDC__
271
tuiRefreshDataWin (void)
272
#else
273
tuiRefreshDataWin ()
274
#endif
275
{
276
  tuiEraseDataContent ((char *) NULL);
277
  if (dataWin->generic.contentSize > 0)
278
    {
279
      int firstElement = tuiFirstDataItemDisplayed ();
280
 
281
      if (firstElement >= 0)     /* re-use existing windows */
282
        tuiDisplayDataFrom (firstElement, TRUE);
283
    }
284
 
285
  return;
286
}                               /* tuiRefreshDataWin */
287
 
288
 
289
/*
290
   ** tuiCheckDataValues().
291
   **        Function to check the data values and hilite any that have changed
292
 */
293
void
294
#ifdef __STDC__
295
tuiCheckDataValues (
296
                     struct frame_info *frame)
297
#else
298
tuiCheckDataValues (frame)
299
     struct frame_info *frame;
300
#endif
301
{
302
  tuiCheckRegisterValues (frame);
303
 
304
  /* Now check any other data values that there are */
305
  if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible)
306
    {
307
      int i;
308
 
309
      for (i = 0; dataWin->detail.dataDisplayInfo.dataContentCount; i++)
310
        {
311
#ifdef LATER
312
          TuiDataElementPtr dataElementPtr;
313
          TuiGenWinInfoPtr dataItemWinPtr;
314
          Opaque newValue;
315
 
316
          dataItemPtr = &dataWin->detail.dataDisplayInfo.
317
            dataContent[i]->whichElement.dataWindow;
318
          dataElementPtr = &((TuiWinContent)
319
                             dataItemWinPtr->content)[0]->whichElement.data;
320
          if value
321
            has changed (dataElementPtr, frame, &newValue)
322
            {
323
              dataElementPtr->value = newValue;
324
              update the display with the new value, hiliting it.
325
            }
326
#endif
327
        }
328
    }
329
}                               /* tuiCheckDataValues */
330
 
331
 
332
/*
333
   ** tui_vCheckDataValues().
334
   **        Function to check the data values and hilite any that have
335
   **        changed with args in a va_list
336
 */
337
void
338
#ifdef __STDC__
339
tui_vCheckDataValues (
340
                       va_list args)
341
#else
342
tui_vCheckDataValues (args)
343
     va_list args;
344
#endif
345
{
346
  struct frame_info *frame = va_arg (args, struct frame_info *);
347
 
348
  tuiCheckDataValues (frame);
349
 
350
  return;
351
}                               /* tui_vCheckDataValues */
352
 
353
 
354
/*
355
   ** tuiVerticalDataScroll()
356
   **        Scroll the data window vertically forward or backward.
357
 */
358
void
359
#ifdef __STDC__
360
tuiVerticalDataScroll (
361
                        TuiScrollDirection scrollDirection,
362
                        int numToScroll)
363
#else
364
tuiVerticalDataScroll (scrollDirection, numToScroll)
365
     TuiScrollDirection scrollDirection;
366
     int numToScroll;
367
#endif
368
{
369
  int firstElementNo;
370
  int firstLine = (-1);
371
 
372
  firstElementNo = tuiFirstDataItemDisplayed ();
373
  if (firstElementNo < dataWin->detail.dataDisplayInfo.regsContentCount)
374
    firstLine = tuiLineFromRegElementNo (firstElementNo);
375
  else
376
    {                           /* calculate the first line from the element number which is in
377
                                   ** the general data content
378
                                 */
379
    }
380
 
381
  if (firstLine >= 0)
382
    {
383
      int lastElementNo, lastLine;
384
 
385
      if (scrollDirection == FORWARD_SCROLL)
386
        firstLine += numToScroll;
387
      else
388
        firstLine -= numToScroll;
389
      tuiEraseDataContent ((char *) NULL);
390
      tuiDeleteDataContentWindows ();
391
      tuiDisplayDataFromLine (firstLine);
392
    }
393
 
394
  return;
395
}                               /* tuiVerticalDataScroll */
396
 
397
 
398
/*****************************************
399
** STATIC LOCAL FUNCTIONS               **
400
******************************************/

powered by: WebSVN 2.1.0

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