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