* dwarf2-frame.h: Update copyright.
[deliverable/binutils-gdb.git] / gdb / tui / tui-data.h
CommitLineData
f377b406 1/* TUI data manipulation routines.
55fb0713
AC
2
3 Copyright 1998, 1999, 2000, 2001, 2002, 2004 Free Software
4 Foundation, Inc.
5
f377b406
SC
6 Contributed by Hewlett-Packard Company.
7
8 This file is part of GDB.
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */
24
c906108c
SS
25#ifndef TUI_DATA_H
26#define TUI_DATA_H
27
2a5127c4
SC
28#if defined (HAVE_NCURSES_H)
29#include <ncurses.h>
30#elif defined (HAVE_CURSES_H)
31#include <curses.h>
32#endif
33
34/* Generic window information */
ec7d9e56 35 typedef struct tui_gen_win_info
2a5127c4
SC
36 {
37 WINDOW *handle; /* window handle */
38 TuiWinType type; /* type of window */
39 int width; /* window width */
40 int height; /* window height */
41 TuiPoint origin; /* origin of window */
42 OpaquePtr content; /* content of window */
43 int contentSize; /* Size of content (# of elements) */
44 int contentInUse; /* Can it be used, or is it already used? */
45 int viewportHeight; /* viewport height */
46 int lastVisibleLine; /* index of last visible line */
47 int isVisible; /* whether the window is visible or not */
bc6b7f04 48 char* title; /* Window title to display. */
2a5127c4
SC
49 }
50TuiGenWinInfo, *TuiGenWinInfoPtr;
51
c906108c
SS
52/* Constant definitions */
53#define DEFAULT_TAB_LEN 8
54#define NO_SRC_STRING "[ No Source Available ]"
55#define NO_DISASSEM_STRING "[ No Assembly Available ]"
56#define NO_REGS_STRING "[ Register Values Unavailable ]"
57#define NO_DATA_STRING "[ No Data Values Displayed ]"
58#define MAX_CONTENT_COUNT 100
59#define SRC_NAME "SRC"
60#define CMD_NAME "CMD"
61#define DATA_NAME "REGS"
62#define DISASSEM_NAME "ASM"
63#define TUI_NULL_STR ""
64#define DEFAULT_HISTORY_COUNT 25
65#define BOX_WINDOW TRUE
66#define DONT_BOX_WINDOW FALSE
67#define HILITE TRUE
68#define NO_HILITE FALSE
69#define WITH_LOCATOR TRUE
70#define NO_LOCATOR FALSE
71#define EMPTY_SOURCE_PROMPT TRUE
72#define NO_EMPTY_SOURCE_PROMPT FALSE
73#define UNDEFINED_ITEM -1
74#define MIN_WIN_HEIGHT 3
75#define MIN_CMD_WIN_HEIGHT 3
76
50265402 77/* Strings to display in the TUI status line. */
50265402 78#define PROC_PREFIX "In: "
c906108c 79#define LINE_PREFIX "Line: "
50265402
SC
80#define PC_PREFIX "PC: "
81#define SINGLE_KEY "(SingleKey)"
82
83/* Minimum/Maximum length of some fields displayed in the TUI status line. */
84#define MIN_LINE_WIDTH 4 /* Use at least 4 digits for line numbers. */
85#define MIN_PROC_WIDTH 12
86#define MAX_TARGET_WIDTH 10
87#define MAX_PID_WIDTH 14
c906108c
SS
88
89#define TUI_FLOAT_REGS_NAME "$FREGS"
90#define TUI_FLOAT_REGS_NAME_LOWER "$fregs"
91#define TUI_GENERAL_REGS_NAME "$GREGS"
92#define TUI_GENERAL_REGS_NAME_LOWER "$gregs"
93#define TUI_SPECIAL_REGS_NAME "$SREGS"
94#define TUI_SPECIAL_REGS_NAME_LOWER "$sregs"
95#define TUI_GENERAL_SPECIAL_REGS_NAME "$REGS"
96#define TUI_GENERAL_SPECIAL_REGS_NAME_LOWER "$regs"
97
98/* Scroll direction enum */
65f05602 99typedef enum tui_scroll_direction
c5aa993b 100 {
c906108c
SS
101 FORWARD_SCROLL,
102 BACKWARD_SCROLL,
103 LEFT_SCROLL,
104 RIGHT_SCROLL
c5aa993b
JM
105 }
106TuiScrollDirection, *TuiScrollDirectionPtr;
c906108c
SS
107
108
109/* General list struct */
dd1abb8c 110typedef struct tui_list
c5aa993b
JM
111 {
112 OpaqueList list;
113 int count;
114 }
115TuiList, *TuiListPtr;
c906108c
SS
116
117
118/* The kinds of layouts available */
080ce8c0 119typedef enum tui_layout_type
c5aa993b 120 {
c906108c
SS
121 SRC_COMMAND,
122 DISASSEM_COMMAND,
123 SRC_DISASSEM_COMMAND,
124 SRC_DATA_COMMAND,
125 DISASSEM_DATA_COMMAND,
126 UNDEFINED_LAYOUT
c5aa993b
JM
127 }
128TuiLayoutType, *TuiLayoutTypePtr;
c906108c
SS
129
130/* Basic data types that can be displayed in the data window. */
dd1abb8c 131typedef enum tui_data_type
c5aa993b 132 {
c906108c
SS
133 TUI_REGISTER,
134 TUI_SCALAR,
135 TUI_COMPLEX,
136 TUI_STRUCT
c5aa993b
JM
137 }
138TuiDataType, TuiDataTypePtr;
c906108c
SS
139
140/* Types of register displays */
55fb0713 141typedef enum tui_register_display_type
c5aa993b 142 {
c906108c
SS
143 TUI_UNDEFINED_REGS,
144 TUI_GENERAL_REGS,
145 TUI_SFLOAT_REGS,
146 TUI_DFLOAT_REGS,
147 TUI_SPECIAL_REGS,
148 TUI_GENERAL_AND_SPECIAL_REGS
c5aa993b
JM
149 }
150TuiRegisterDisplayType, *TuiRegisterDisplayTypePtr;
c906108c
SS
151
152/* Structure describing source line or line address */
f80bda8e 153typedef union tui_line_or_address
c5aa993b
JM
154 {
155 int lineNo;
c774cec6 156 CORE_ADDR addr;
c5aa993b
JM
157 }
158TuiLineOrAddress, *TuiLineOrAddressPtr;
c906108c
SS
159
160/* Current Layout definition */
dd1abb8c 161typedef struct tui_layout_def
c5aa993b
JM
162 {
163 TuiWinType displayMode;
164 int split;
165 TuiRegisterDisplayType regsDisplayType;
166 TuiRegisterDisplayType floatRegsDisplayType;
167 }
168TuiLayoutDef, *TuiLayoutDefPtr;
c906108c
SS
169
170/* Elements in the Source/Disassembly Window */
dd1abb8c 171typedef struct tui_source_element
c5aa993b
JM
172 {
173 char *line;
174 TuiLineOrAddress lineOrAddr;
175 int isExecPoint;
176 int hasBreak;
177 }
178TuiSourceElement, *TuiSourceElementPtr;
c906108c
SS
179
180
181/* Elements in the data display window content */
dd1abb8c 182typedef struct tui_data_element
c5aa993b 183 {
bc77de56 184 const char *name;
c5aa993b 185 int itemNo; /* the register number, or data display number */
c906108c 186 TuiDataType type;
c5aa993b
JM
187 Opaque value;
188 int highlight;
189 }
190TuiDataElement, *TuiDataElementPtr;
c906108c
SS
191
192
193/* Elements in the command window content */
dd1abb8c 194typedef struct tui_command_element
c5aa993b
JM
195 {
196 char *line;
197 }
198TuiCommandElement, *TuiCommandElementPtr;
c906108c
SS
199
200
201#define MAX_LOCATOR_ELEMENT_LEN 100
202
203/* Elements in the locator window content */
dd1abb8c 204typedef struct tui_locator_element
c5aa993b
JM
205 {
206 char fileName[MAX_LOCATOR_ELEMENT_LEN];
207 char procName[MAX_LOCATOR_ELEMENT_LEN];
208 int lineNo;
c774cec6 209 CORE_ADDR addr;
c5aa993b
JM
210 }
211TuiLocatorElement, *TuiLocatorElementPtr;
c906108c 212
00b2bad4
SC
213/* Flags to tell what kind of breakpoint is at current line. */
214#define TUI_BP_ENABLED 0x01
215#define TUI_BP_DISABLED 0x02
216#define TUI_BP_HIT 0x04
217#define TUI_BP_CONDITIONAL 0x08
218#define TUI_BP_HARDWARE 0x10
219
220/* Position of breakpoint markers in the exec info string. */
221#define TUI_BP_HIT_POS 0
222#define TUI_BP_BREAK_POS 1
223#define TUI_EXEC_POS 2
224#define TUI_EXECINFO_SIZE 4
225
226typedef char TuiExecInfoContent[TUI_EXECINFO_SIZE];
c906108c
SS
227
228/* An content element in a window */
dd1abb8c 229typedef union tui_which_element
c5aa993b
JM
230 {
231 TuiSourceElement source; /* the source elements */
232 TuiGenWinInfo dataWindow; /* data display elements */
233 TuiDataElement data; /* elements of dataWindow */
234 TuiCommandElement command; /* command elements */
235 TuiLocatorElement locator; /* locator elements */
00b2bad4 236 TuiExecInfoContent simpleString; /* simple char based elements */
c5aa993b
JM
237 }
238TuiWhichElement, *TuiWhichElementPtr;
c906108c 239
dd1abb8c 240typedef struct tui_win_element
c5aa993b
JM
241 {
242 int highlight;
c906108c 243 TuiWhichElement whichElement;
c5aa993b
JM
244 }
245TuiWinElement, *TuiWinElementPtr;
c906108c
SS
246
247
248/* This describes the content of the window. */
c5aa993b 249typedef TuiWinElementPtr *TuiWinContent;
c906108c
SS
250
251
252/* This struct defines the specific information about a data display window */
dd1abb8c 253typedef struct tui_data_info
c5aa993b
JM
254 {
255 TuiWinContent dataContent; /* start of data display content */
256 int dataContentCount;
257 TuiWinContent regsContent; /* start of regs display content */
258 int regsContentCount;
259 TuiRegisterDisplayType regsDisplayType;
260 int regsColumnCount;
261 int displayRegs; /* Should regs be displayed at all? */
262 }
263TuiDataInfo, *TuiDataInfoPtr;
264
265
dd1abb8c 266typedef struct tui_source_info
c5aa993b
JM
267 {
268 int hasLocator; /* Does locator belongs to this window? */
269 TuiGenWinInfoPtr executionInfo; /* execution information window */
270 int horizontalOffset; /* used for horizontal scroll */
271 TuiLineOrAddress startLineOrAddr;
bc6b7f04 272 char* filename;
c5aa993b
JM
273 }
274TuiSourceInfo, *TuiSourceInfoPtr;
275
276
dd1abb8c 277typedef struct tui_command_info
c5aa993b
JM
278 {
279 int curLine; /* The current line position */
280 int curch; /* The current cursor position */
d75e970c 281 int start_line;
c5aa993b
JM
282 }
283TuiCommandInfo, *TuiCommandInfoPtr;
c906108c
SS
284
285
286/* This defines information about each logical window */
f80bda8e 287typedef struct tui_win_info
c5aa993b
JM
288 {
289 TuiGenWinInfo generic; /* general window information */
290 union
291 {
292 TuiSourceInfo sourceInfo;
293 TuiDataInfo dataDisplayInfo;
294 TuiCommandInfo commandInfo;
295 Opaque opaque;
296 }
297 detail;
298 int canHighlight; /* Can this window ever be highlighted? */
299 int isHighlighted; /* Is this window highlighted? */
300 }
301TuiWinInfo, *TuiWinInfoPtr;
c906108c
SS
302
303/* MACROS (prefixed with m_) */
304
305/* Testing macros */
306#define m_genWinPtrIsNull(winInfo) \
307 ((winInfo) == (TuiGenWinInfoPtr)NULL)
308#define m_genWinPtrNotNull(winInfo) \
309 ((winInfo) != (TuiGenWinInfoPtr)NULL)
310#define m_winPtrIsNull(winInfo) \
311 ((winInfo) == (TuiWinInfoPtr)NULL)
312#define m_winPtrNotNull(winInfo) \
313 ((winInfo) != (TuiWinInfoPtr)NULL)
314
315#define m_winIsSourceType(type) \
316 (type == SRC_WIN || type == DISASSEM_WIN)
317#define m_winIsAuxillary(winType) \
318 (winType > MAX_MAJOR_WINDOWS)
319#define m_hasLocator(winInfo) \
320 ( ((winInfo) != (TuiWinInfoPtr)NULL) ? \
321 (winInfo->detail.sourceInfo.hasLocator) : \
322 FALSE )
323
324#define m_setWinHighlightOn(winInfo) \
325 if ((winInfo) != (TuiWinInfoPtr)NULL) \
326 (winInfo)->isHighlighted = TRUE
327#define m_setWinHighlightOff(winInfo) \
328 if ((winInfo) != (TuiWinInfoPtr)NULL) \
329 (winInfo)->isHighlighted = FALSE
330
331
332/* Global Data */
c5aa993b 333extern TuiWinInfoPtr winList[MAX_MAJOR_WINDOWS];
c906108c
SS
334
335/* Macros */
336#define srcWin winList[SRC_WIN]
337#define disassemWin winList[DISASSEM_WIN]
338#define dataWin winList[DATA_WIN]
339#define cmdWin winList[CMD_WIN]
340
341/* Data Manipulation Functions */
dd1abb8c
AC
342extern void tui_initialize_static_data (void);
343extern struct tui_gen_win_info *tui_alloc_generic_win_info (void);
344extern struct tui_win_info *tui_alloc_win_info (TuiWinType);
345extern void tui_init_generic_part (struct tui_gen_win_info *);
346extern void tui_init_win_info (struct tui_win_info *);
347extern TuiWinContent tui_alloc_content (int, enum tui_win_type);
348extern int tui_add_content_elements (struct tui_gen_win_info *, int);
349extern void tui_init_content_element (struct tui_win_element *, enum tui_win_type);
350extern void tui_free_window (struct tui_win_info *);
351extern void tui_free_win_content (struct tui_gen_win_info *);
352extern void tui_free_data_content (TuiWinContent, int);
353extern void tui_free_all_source_wins_content (void);
354extern void tui_del_window (struct tui_win_info *);
355extern void tui_del_data_windows (TuiWinContent, int);
356extern struct tui_win_info *tui_partial_win_by_name (char *);
357extern char *tui_win_name (struct tui_gen_win_info *);
358extern TuiLayoutType tui_current_layout (void);
359extern void tui_set_current_layout_to (TuiLayoutType);
360extern int tui_term_height (void);
361extern void tui_set_term_height_to (int);
362extern int tui_term_width (void);
363extern void tui_set_term_width_to (int);
364extern void tui_set_gen_win_origin (struct tui_gen_win_info *, int, int);
365extern struct tui_gen_win_info *tui_locator_win_info_ptr (void);
366extern struct tui_gen_win_info *tui_source_exec_info_win_ptr (void);
367extern struct tui_gen_win_info *tui_disassem_exec_info_win_ptr (void);
368extern TuiListPtr tui_source_windows (void);
369extern void tui_clear_source_windows (void);
370extern void tui_clear_source_windows_detail (void);
371extern void tui_clear_win_detail (struct tui_win_info * winInfo);
372extern void tui_add_to_source_windows (struct tui_win_info *);
373extern int tui_default_tab_len (void);
374extern void tui_set_default_tab_len (int);
375extern struct tui_win_info *tui_win_with_focus (void);
376extern void tui_set_win_with_focus (struct tui_win_info *);
377extern TuiLayoutDefPtr tui_layout_def (void);
378extern int tui_win_resized (void);
379extern void tui_set_win_resized_to (int);
380
381extern struct tui_win_info *tui_next_win (struct tui_win_info *);
382extern struct tui_win_info *tui_prev_win (struct tui_win_info *);
383
384extern void tui_add_to_source_windows (struct tui_win_info * winInfo);
c7c228ed 385
c906108c 386#endif /* TUI_DATA_H */
This page took 0.417965 seconds and 4 git commands to generate.