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