* tuiSourceWin.h (tui_update_all_breakpoint_info): Declare.
[deliverable/binutils-gdb.git] / gdb / tui / tuiData.h
1 /* TUI data manipulation routines.
2 Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
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
22 #ifndef TUI_DATA_H
23 #define TUI_DATA_H
24
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 */
45 char* title; /* Window title to display. */
46 }
47 TuiGenWinInfo, *TuiGenWinInfoPtr;
48
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 */
89 typedef enum
90 {
91 FORWARD_SCROLL,
92 BACKWARD_SCROLL,
93 LEFT_SCROLL,
94 RIGHT_SCROLL
95 }
96 TuiScrollDirection, *TuiScrollDirectionPtr;
97
98
99 /* General list struct */
100 typedef struct _TuiList
101 {
102 OpaqueList list;
103 int count;
104 }
105 TuiList, *TuiListPtr;
106
107
108 /* The kinds of layouts available */
109 typedef enum
110 {
111 SRC_COMMAND,
112 DISASSEM_COMMAND,
113 SRC_DISASSEM_COMMAND,
114 SRC_DATA_COMMAND,
115 DISASSEM_DATA_COMMAND,
116 UNDEFINED_LAYOUT
117 }
118 TuiLayoutType, *TuiLayoutTypePtr;
119
120 /* Basic data types that can be displayed in the data window. */
121 typedef enum _TuiDataType
122 {
123 TUI_REGISTER,
124 TUI_SCALAR,
125 TUI_COMPLEX,
126 TUI_STRUCT
127 }
128 TuiDataType, TuiDataTypePtr;
129
130 /* Types of register displays */
131 typedef enum _TuiRegisterDisplayType
132 {
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
139 }
140 TuiRegisterDisplayType, *TuiRegisterDisplayTypePtr;
141
142 /* Structure describing source line or line address */
143 typedef union _TuiLineOrAddress
144 {
145 int lineNo;
146 CORE_ADDR addr;
147 }
148 TuiLineOrAddress, *TuiLineOrAddressPtr;
149
150 /* Current Layout definition */
151 typedef struct _TuiLayoutDef
152 {
153 TuiWinType displayMode;
154 int split;
155 TuiRegisterDisplayType regsDisplayType;
156 TuiRegisterDisplayType floatRegsDisplayType;
157 }
158 TuiLayoutDef, *TuiLayoutDefPtr;
159
160 /* Elements in the Source/Disassembly Window */
161 typedef struct _TuiSourceElement
162 {
163 char *line;
164 TuiLineOrAddress lineOrAddr;
165 int isExecPoint;
166 int hasBreak;
167 }
168 TuiSourceElement, *TuiSourceElementPtr;
169
170
171 /* Elements in the data display window content */
172 typedef struct _TuiDataElement
173 {
174 const char *name;
175 int itemNo; /* the register number, or data display number */
176 TuiDataType type;
177 Opaque value;
178 int highlight;
179 }
180 TuiDataElement, *TuiDataElementPtr;
181
182
183 /* Elements in the command window content */
184 typedef struct _TuiCommandElement
185 {
186 char *line;
187 }
188 TuiCommandElement, *TuiCommandElementPtr;
189
190
191 #define MAX_LOCATOR_ELEMENT_LEN 100
192
193 /* Elements in the locator window content */
194 typedef struct _TuiLocatorElement
195 {
196 char fileName[MAX_LOCATOR_ELEMENT_LEN];
197 char procName[MAX_LOCATOR_ELEMENT_LEN];
198 int lineNo;
199 CORE_ADDR addr;
200 }
201 TuiLocatorElement, *TuiLocatorElementPtr;
202
203 /* Flags to tell what kind of breakpoint is at current line. */
204 #define TUI_BP_ENABLED 0x01
205 #define TUI_BP_DISABLED 0x02
206 #define TUI_BP_HIT 0x04
207 #define TUI_BP_CONDITIONAL 0x08
208 #define TUI_BP_HARDWARE 0x10
209
210 /* Position of breakpoint markers in the exec info string. */
211 #define TUI_BP_HIT_POS 0
212 #define TUI_BP_BREAK_POS 1
213 #define TUI_EXEC_POS 2
214 #define TUI_EXECINFO_SIZE 4
215
216 typedef char TuiExecInfoContent[TUI_EXECINFO_SIZE];
217
218 /* An content element in a window */
219 typedef union
220 {
221 TuiSourceElement source; /* the source elements */
222 TuiGenWinInfo dataWindow; /* data display elements */
223 TuiDataElement data; /* elements of dataWindow */
224 TuiCommandElement command; /* command elements */
225 TuiLocatorElement locator; /* locator elements */
226 TuiExecInfoContent simpleString; /* simple char based elements */
227 }
228 TuiWhichElement, *TuiWhichElementPtr;
229
230 typedef struct _TuiWinElement
231 {
232 int highlight;
233 TuiWhichElement whichElement;
234 }
235 TuiWinElement, *TuiWinElementPtr;
236
237
238 /* This describes the content of the window. */
239 typedef TuiWinElementPtr *TuiWinContent;
240
241
242 /* This struct defines the specific information about a data display window */
243 typedef struct _TuiDataInfo
244 {
245 TuiWinContent dataContent; /* start of data display content */
246 int dataContentCount;
247 TuiWinContent regsContent; /* start of regs display content */
248 int regsContentCount;
249 TuiRegisterDisplayType regsDisplayType;
250 int regsColumnCount;
251 int displayRegs; /* Should regs be displayed at all? */
252 }
253 TuiDataInfo, *TuiDataInfoPtr;
254
255
256 typedef struct _TuiSourceInfo
257 {
258 int hasLocator; /* Does locator belongs to this window? */
259 TuiGenWinInfoPtr executionInfo; /* execution information window */
260 int horizontalOffset; /* used for horizontal scroll */
261 TuiLineOrAddress startLineOrAddr;
262 char* filename;
263 }
264 TuiSourceInfo, *TuiSourceInfoPtr;
265
266
267 typedef struct _TuiCommandInfo
268 {
269 int curLine; /* The current line position */
270 int curch; /* The current cursor position */
271 int start_line;
272 }
273 TuiCommandInfo, *TuiCommandInfoPtr;
274
275
276 /* This defines information about each logical window */
277 typedef struct _TuiWinInfo
278 {
279 TuiGenWinInfo generic; /* general window information */
280 union
281 {
282 TuiSourceInfo sourceInfo;
283 TuiDataInfo dataDisplayInfo;
284 TuiCommandInfo commandInfo;
285 Opaque opaque;
286 }
287 detail;
288 int canHighlight; /* Can this window ever be highlighted? */
289 int isHighlighted; /* Is this window highlighted? */
290 }
291 TuiWinInfo, *TuiWinInfoPtr;
292
293 /* MACROS (prefixed with m_) */
294
295 /* Testing macros */
296 #define m_genWinPtrIsNull(winInfo) \
297 ((winInfo) == (TuiGenWinInfoPtr)NULL)
298 #define m_genWinPtrNotNull(winInfo) \
299 ((winInfo) != (TuiGenWinInfoPtr)NULL)
300 #define m_winPtrIsNull(winInfo) \
301 ((winInfo) == (TuiWinInfoPtr)NULL)
302 #define m_winPtrNotNull(winInfo) \
303 ((winInfo) != (TuiWinInfoPtr)NULL)
304
305 #define m_winIsSourceType(type) \
306 (type == SRC_WIN || type == DISASSEM_WIN)
307 #define m_winIsAuxillary(winType) \
308 (winType > MAX_MAJOR_WINDOWS)
309 #define m_hasLocator(winInfo) \
310 ( ((winInfo) != (TuiWinInfoPtr)NULL) ? \
311 (winInfo->detail.sourceInfo.hasLocator) : \
312 FALSE )
313
314 #define m_setWinHighlightOn(winInfo) \
315 if ((winInfo) != (TuiWinInfoPtr)NULL) \
316 (winInfo)->isHighlighted = TRUE
317 #define m_setWinHighlightOff(winInfo) \
318 if ((winInfo) != (TuiWinInfoPtr)NULL) \
319 (winInfo)->isHighlighted = FALSE
320
321
322 /* Global Data */
323 extern TuiWinInfoPtr winList[MAX_MAJOR_WINDOWS];
324 extern int tui_version;
325
326 /* Macros */
327 #define srcWin winList[SRC_WIN]
328 #define disassemWin winList[DISASSEM_WIN]
329 #define dataWin winList[DATA_WIN]
330 #define cmdWin winList[CMD_WIN]
331
332 /* Data Manipulation Functions */
333 extern void initializeStaticData (void);
334 extern TuiGenWinInfoPtr allocGenericWinInfo (void);
335 extern TuiWinInfoPtr allocWinInfo (TuiWinType);
336 extern void initGenericPart (TuiGenWinInfoPtr);
337 extern void initWinInfo (TuiWinInfoPtr);
338 extern TuiWinContent allocContent (int, TuiWinType);
339 extern int addContentElements (TuiGenWinInfoPtr, int);
340 extern void initContentElement (TuiWinElementPtr, TuiWinType);
341 extern void freeWindow (TuiWinInfoPtr);
342 extern void freeAllWindows (void);
343 extern void freeWinContent (TuiGenWinInfoPtr);
344 extern void freeDataContent (TuiWinContent, int);
345 extern void freeAllSourceWinsContent (void);
346 extern void tuiDelWindow (TuiWinInfoPtr);
347 extern void tuiDelDataWindows (TuiWinContent, int);
348 extern TuiWinInfoPtr winByName (char *);
349 extern TuiWinInfoPtr partialWinByName (char *);
350 extern char *winName (TuiGenWinInfoPtr);
351 extern char *displayableWinContentOf (TuiGenWinInfoPtr, TuiWinElementPtr);
352 extern char *displayableWinContentAt (TuiGenWinInfoPtr, int);
353 extern int winElementHeight (TuiGenWinInfoPtr, TuiWinElementPtr);
354 extern TuiLayoutType currentLayout (void);
355 extern void setCurrentLayoutTo (TuiLayoutType);
356 extern int termHeight (void);
357 extern void setTermHeightTo (int);
358 extern int termWidth (void);
359 extern void setTermWidthTo (int);
360 extern int historyLimit (void);
361 extern void setHistoryLimit (int);
362 extern void setGenWinOrigin (TuiGenWinInfoPtr, int, int);
363 extern TuiGenWinInfoPtr locatorWinInfoPtr (void);
364 extern TuiGenWinInfoPtr sourceExecInfoWinPtr (void);
365 extern TuiGenWinInfoPtr disassemExecInfoWinPtr (void);
366 extern char *nullStr (void);
367 extern char *blankStr (void);
368 extern char *locationStr (void);
369 extern char *breakStr (void);
370 extern char *breakLocationStr (void);
371 extern TuiListPtr sourceWindows (void);
372 extern void clearSourceWindows (void);
373 extern void clearSourceWindowsDetail (void);
374 extern void clearWinDetail (TuiWinInfoPtr winInfo);
375 extern void tuiAddToSourceWindows (TuiWinInfoPtr);
376 extern int tuiDefaultTabLen (void);
377 extern void tuiSetDefaultTabLen (int);
378 extern TuiWinInfoPtr tuiWinWithFocus (void);
379 extern void tuiSetWinWithFocus (TuiWinInfoPtr);
380 extern TuiLayoutDefPtr tuiLayoutDef (void);
381 extern int tuiWinResized (void);
382 extern void tuiSetWinResizedTo (int);
383
384 extern TuiWinInfoPtr tuiNextWin (TuiWinInfoPtr);
385 extern TuiWinInfoPtr tuiPrevWin (TuiWinInfoPtr);
386
387 extern void addToSourceWindows (TuiWinInfoPtr winInfo);
388
389 #endif /* TUI_DATA_H */
This page took 0.03857 seconds and 4 git commands to generate.