2002-08-25 Andrew Cagney <ac131313@redhat.com>
[deliverable/binutils-gdb.git] / gdb / tui / tuiData.h
CommitLineData
f377b406 1/* TUI data manipulation routines.
bc6b7f04 2 Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
f377b406
SC
3 Contributed by Hewlett-Packard Company.
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
c906108c
SS
22#ifndef TUI_DATA_H
23#define TUI_DATA_H
24
2a5127c4
SC
25#if defined (HAVE_NCURSES_H)
26#include <ncurses.h>
27#elif defined (HAVE_CURSES_H)
28#include <curses.h>
29#endif
30
31/* Generic window information */
32 typedef struct _TuiGenWinInfo
33 {
34 WINDOW *handle; /* window handle */
35 TuiWinType type; /* type of window */
36 int width; /* window width */
37 int height; /* window height */
38 TuiPoint origin; /* origin of window */
39 OpaquePtr content; /* content of window */
40 int contentSize; /* Size of content (# of elements) */
41 int contentInUse; /* Can it be used, or is it already used? */
42 int viewportHeight; /* viewport height */
43 int lastVisibleLine; /* index of last visible line */
44 int isVisible; /* whether the window is visible or not */
bc6b7f04 45 char* title; /* Window title to display. */
2a5127c4
SC
46 }
47TuiGenWinInfo, *TuiGenWinInfoPtr;
48
c906108c
SS
49/* Constant definitions */
50#define DEFAULT_TAB_LEN 8
51#define NO_SRC_STRING "[ No Source Available ]"
52#define NO_DISASSEM_STRING "[ No Assembly Available ]"
53#define NO_REGS_STRING "[ Register Values Unavailable ]"
54#define NO_DATA_STRING "[ No Data Values Displayed ]"
55#define MAX_CONTENT_COUNT 100
56#define SRC_NAME "SRC"
57#define CMD_NAME "CMD"
58#define DATA_NAME "REGS"
59#define DISASSEM_NAME "ASM"
60#define TUI_NULL_STR ""
61#define DEFAULT_HISTORY_COUNT 25
62#define BOX_WINDOW TRUE
63#define DONT_BOX_WINDOW FALSE
64#define HILITE TRUE
65#define NO_HILITE FALSE
66#define WITH_LOCATOR TRUE
67#define NO_LOCATOR FALSE
68#define EMPTY_SOURCE_PROMPT TRUE
69#define NO_EMPTY_SOURCE_PROMPT FALSE
70#define UNDEFINED_ITEM -1
71#define MIN_WIN_HEIGHT 3
72#define MIN_CMD_WIN_HEIGHT 3
73
74#define FILE_PREFIX "File: "
75#define PROC_PREFIX "Procedure: "
76#define LINE_PREFIX "Line: "
77#define PC_PREFIX "pc: "
78
79#define TUI_FLOAT_REGS_NAME "$FREGS"
80#define TUI_FLOAT_REGS_NAME_LOWER "$fregs"
81#define TUI_GENERAL_REGS_NAME "$GREGS"
82#define TUI_GENERAL_REGS_NAME_LOWER "$gregs"
83#define TUI_SPECIAL_REGS_NAME "$SREGS"
84#define TUI_SPECIAL_REGS_NAME_LOWER "$sregs"
85#define TUI_GENERAL_SPECIAL_REGS_NAME "$REGS"
86#define TUI_GENERAL_SPECIAL_REGS_NAME_LOWER "$regs"
87
88/* Scroll direction enum */
c5aa993b
JM
89typedef enum
90 {
c906108c
SS
91 FORWARD_SCROLL,
92 BACKWARD_SCROLL,
93 LEFT_SCROLL,
94 RIGHT_SCROLL
c5aa993b
JM
95 }
96TuiScrollDirection, *TuiScrollDirectionPtr;
c906108c
SS
97
98
99/* General list struct */
c5aa993b
JM
100typedef struct _TuiList
101 {
102 OpaqueList list;
103 int count;
104 }
105TuiList, *TuiListPtr;
c906108c
SS
106
107
108/* The kinds of layouts available */
c5aa993b
JM
109typedef enum
110 {
c906108c
SS
111 SRC_COMMAND,
112 DISASSEM_COMMAND,
113 SRC_DISASSEM_COMMAND,
114 SRC_DATA_COMMAND,
115 DISASSEM_DATA_COMMAND,
116 UNDEFINED_LAYOUT
c5aa993b
JM
117 }
118TuiLayoutType, *TuiLayoutTypePtr;
c906108c
SS
119
120/* Basic data types that can be displayed in the data window. */
c5aa993b
JM
121typedef enum _TuiDataType
122 {
c906108c
SS
123 TUI_REGISTER,
124 TUI_SCALAR,
125 TUI_COMPLEX,
126 TUI_STRUCT
c5aa993b
JM
127 }
128TuiDataType, TuiDataTypePtr;
c906108c
SS
129
130/* Types of register displays */
c5aa993b
JM
131typedef enum _TuiRegisterDisplayType
132 {
c906108c
SS
133 TUI_UNDEFINED_REGS,
134 TUI_GENERAL_REGS,
135 TUI_SFLOAT_REGS,
136 TUI_DFLOAT_REGS,
137 TUI_SPECIAL_REGS,
138 TUI_GENERAL_AND_SPECIAL_REGS
c5aa993b
JM
139 }
140TuiRegisterDisplayType, *TuiRegisterDisplayTypePtr;
c906108c
SS
141
142/* Structure describing source line or line address */
c5aa993b
JM
143typedef union _TuiLineOrAddress
144 {
145 int lineNo;
c774cec6 146 CORE_ADDR addr;
c5aa993b
JM
147 }
148TuiLineOrAddress, *TuiLineOrAddressPtr;
c906108c
SS
149
150/* Current Layout definition */
c5aa993b
JM
151typedef struct _TuiLayoutDef
152 {
153 TuiWinType displayMode;
154 int split;
155 TuiRegisterDisplayType regsDisplayType;
156 TuiRegisterDisplayType floatRegsDisplayType;
157 }
158TuiLayoutDef, *TuiLayoutDefPtr;
c906108c
SS
159
160/* Elements in the Source/Disassembly Window */
161typedef struct _TuiSourceElement
c5aa993b
JM
162 {
163 char *line;
164 TuiLineOrAddress lineOrAddr;
165 int isExecPoint;
166 int hasBreak;
167 }
168TuiSourceElement, *TuiSourceElementPtr;
c906108c
SS
169
170
171/* Elements in the data display window content */
172typedef struct _TuiDataElement
c5aa993b 173 {
bc77de56 174 const char *name;
c5aa993b 175 int itemNo; /* the register number, or data display number */
c906108c 176 TuiDataType type;
c5aa993b
JM
177 Opaque value;
178 int highlight;
179 }
180TuiDataElement, *TuiDataElementPtr;
c906108c
SS
181
182
183/* Elements in the command window content */
184typedef struct _TuiCommandElement
c5aa993b
JM
185 {
186 char *line;
187 }
188TuiCommandElement, *TuiCommandElementPtr;
c906108c
SS
189
190
191#define MAX_LOCATOR_ELEMENT_LEN 100
192
193/* Elements in the locator window content */
194typedef struct _TuiLocatorElement
c5aa993b
JM
195 {
196 char fileName[MAX_LOCATOR_ELEMENT_LEN];
197 char procName[MAX_LOCATOR_ELEMENT_LEN];
198 int lineNo;
c774cec6 199 CORE_ADDR addr;
c5aa993b
JM
200 }
201TuiLocatorElement, *TuiLocatorElementPtr;
c906108c
SS
202
203
204/* An content element in a window */
205typedef union
c5aa993b
JM
206 {
207 TuiSourceElement source; /* the source elements */
208 TuiGenWinInfo dataWindow; /* data display elements */
209 TuiDataElement data; /* elements of dataWindow */
210 TuiCommandElement command; /* command elements */
211 TuiLocatorElement locator; /* locator elements */
212 char *simpleString; /* simple char based elements */
213 }
214TuiWhichElement, *TuiWhichElementPtr;
c906108c
SS
215
216typedef struct _TuiWinElement
c5aa993b
JM
217 {
218 int highlight;
c906108c 219 TuiWhichElement whichElement;
c5aa993b
JM
220 }
221TuiWinElement, *TuiWinElementPtr;
c906108c
SS
222
223
224/* This describes the content of the window. */
c5aa993b 225typedef TuiWinElementPtr *TuiWinContent;
c906108c
SS
226
227
228/* This struct defines the specific information about a data display window */
c5aa993b
JM
229typedef struct _TuiDataInfo
230 {
231 TuiWinContent dataContent; /* start of data display content */
232 int dataContentCount;
233 TuiWinContent regsContent; /* start of regs display content */
234 int regsContentCount;
235 TuiRegisterDisplayType regsDisplayType;
236 int regsColumnCount;
237 int displayRegs; /* Should regs be displayed at all? */
238 }
239TuiDataInfo, *TuiDataInfoPtr;
240
241
242typedef struct _TuiSourceInfo
243 {
244 int hasLocator; /* Does locator belongs to this window? */
245 TuiGenWinInfoPtr executionInfo; /* execution information window */
246 int horizontalOffset; /* used for horizontal scroll */
247 TuiLineOrAddress startLineOrAddr;
bc6b7f04 248 char* filename;
c5aa993b
JM
249 }
250TuiSourceInfo, *TuiSourceInfoPtr;
251
252
253typedef struct _TuiCommandInfo
254 {
255 int curLine; /* The current line position */
256 int curch; /* The current cursor position */
d75e970c 257 int start_line;
c5aa993b
JM
258 }
259TuiCommandInfo, *TuiCommandInfoPtr;
c906108c
SS
260
261
262/* This defines information about each logical window */
c5aa993b
JM
263typedef struct _TuiWinInfo
264 {
265 TuiGenWinInfo generic; /* general window information */
266 union
267 {
268 TuiSourceInfo sourceInfo;
269 TuiDataInfo dataDisplayInfo;
270 TuiCommandInfo commandInfo;
271 Opaque opaque;
272 }
273 detail;
274 int canHighlight; /* Can this window ever be highlighted? */
275 int isHighlighted; /* Is this window highlighted? */
276 }
277TuiWinInfo, *TuiWinInfoPtr;
c906108c
SS
278
279/* MACROS (prefixed with m_) */
280
281/* Testing macros */
282#define m_genWinPtrIsNull(winInfo) \
283 ((winInfo) == (TuiGenWinInfoPtr)NULL)
284#define m_genWinPtrNotNull(winInfo) \
285 ((winInfo) != (TuiGenWinInfoPtr)NULL)
286#define m_winPtrIsNull(winInfo) \
287 ((winInfo) == (TuiWinInfoPtr)NULL)
288#define m_winPtrNotNull(winInfo) \
289 ((winInfo) != (TuiWinInfoPtr)NULL)
290
291#define m_winIsSourceType(type) \
292 (type == SRC_WIN || type == DISASSEM_WIN)
293#define m_winIsAuxillary(winType) \
294 (winType > MAX_MAJOR_WINDOWS)
295#define m_hasLocator(winInfo) \
296 ( ((winInfo) != (TuiWinInfoPtr)NULL) ? \
297 (winInfo->detail.sourceInfo.hasLocator) : \
298 FALSE )
299
300#define m_setWinHighlightOn(winInfo) \
301 if ((winInfo) != (TuiWinInfoPtr)NULL) \
302 (winInfo)->isHighlighted = TRUE
303#define m_setWinHighlightOff(winInfo) \
304 if ((winInfo) != (TuiWinInfoPtr)NULL) \
305 (winInfo)->isHighlighted = FALSE
306
307
308/* Global Data */
c5aa993b
JM
309extern TuiWinInfoPtr winList[MAX_MAJOR_WINDOWS];
310extern int tui_version;
c906108c
SS
311
312/* Macros */
313#define srcWin winList[SRC_WIN]
314#define disassemWin winList[DISASSEM_WIN]
315#define dataWin winList[DATA_WIN]
316#define cmdWin winList[CMD_WIN]
317
318/* Data Manipulation Functions */
a14ed312
KB
319extern void initializeStaticData (void);
320extern TuiGenWinInfoPtr allocGenericWinInfo (void);
321extern TuiWinInfoPtr allocWinInfo (TuiWinType);
322extern void initGenericPart (TuiGenWinInfoPtr);
323extern void initWinInfo (TuiWinInfoPtr);
324extern TuiWinContent allocContent (int, TuiWinType);
325extern int addContentElements (TuiGenWinInfoPtr, int);
326extern void initContentElement (TuiWinElementPtr, TuiWinType);
327extern void freeWindow (TuiWinInfoPtr);
328extern void freeAllWindows (void);
329extern void freeWinContent (TuiGenWinInfoPtr);
330extern void freeDataContent (TuiWinContent, int);
331extern void freeAllSourceWinsContent (void);
332extern void tuiDelWindow (TuiWinInfoPtr);
333extern void tuiDelDataWindows (TuiWinContent, int);
334extern TuiWinInfoPtr winByName (char *);
335extern TuiWinInfoPtr partialWinByName (char *);
336extern char *winName (TuiGenWinInfoPtr);
337extern char *displayableWinContentOf (TuiGenWinInfoPtr, TuiWinElementPtr);
338extern char *displayableWinContentAt (TuiGenWinInfoPtr, int);
339extern int winElementHeight (TuiGenWinInfoPtr, TuiWinElementPtr);
340extern TuiLayoutType currentLayout (void);
341extern void setCurrentLayoutTo (TuiLayoutType);
342extern int termHeight (void);
2a5127c4 343extern void setTermHeightTo (int);
a14ed312 344extern int termWidth (void);
2a5127c4 345extern void setTermWidthTo (int);
a14ed312
KB
346extern int historyLimit (void);
347extern void setHistoryLimit (int);
348extern void setGenWinOrigin (TuiGenWinInfoPtr, int, int);
349extern TuiGenWinInfoPtr locatorWinInfoPtr (void);
350extern TuiGenWinInfoPtr sourceExecInfoWinPtr (void);
351extern TuiGenWinInfoPtr disassemExecInfoWinPtr (void);
352extern char *nullStr (void);
353extern char *blankStr (void);
354extern char *locationStr (void);
355extern char *breakStr (void);
356extern char *breakLocationStr (void);
357extern TuiListPtr sourceWindows (void);
358extern void clearSourceWindows (void);
359extern void clearSourceWindowsDetail (void);
360extern void clearWinDetail (TuiWinInfoPtr winInfo);
361extern void tuiAddToSourceWindows (TuiWinInfoPtr);
362extern int tuiDefaultTabLen (void);
363extern void tuiSetDefaultTabLen (int);
364extern TuiWinInfoPtr tuiWinWithFocus (void);
365extern void tuiSetWinWithFocus (TuiWinInfoPtr);
366extern TuiLayoutDefPtr tuiLayoutDef (void);
367extern int tuiWinResized (void);
368extern void tuiSetWinResizedTo (int);
369
370extern TuiWinInfoPtr tuiNextWin (TuiWinInfoPtr);
371extern TuiWinInfoPtr tuiPrevWin (TuiWinInfoPtr);
c906108c 372
c7c228ed
SC
373extern void addToSourceWindows (TuiWinInfoPtr winInfo);
374
c906108c 375#endif /* TUI_DATA_H */
This page took 0.254139 seconds and 4 git commands to generate.