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