1 |
106 |
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 PARAMS ((void));
|
273 |
|
|
extern TuiGenWinInfoPtr allocGenericWinInfo PARAMS ((void));
|
274 |
|
|
extern TuiWinInfoPtr allocWinInfo PARAMS ((TuiWinType));
|
275 |
|
|
extern void initGenericPart PARAMS ((TuiGenWinInfoPtr));
|
276 |
|
|
extern void initWinInfo PARAMS ((TuiWinInfoPtr));
|
277 |
|
|
extern TuiWinContent allocContent PARAMS ((int, TuiWinType));
|
278 |
|
|
extern int addContentElements
|
279 |
|
|
PARAMS ((TuiGenWinInfoPtr, int));
|
280 |
|
|
extern void initContentElement
|
281 |
|
|
PARAMS ((TuiWinElementPtr, TuiWinType));
|
282 |
|
|
extern void freeWindow PARAMS ((TuiWinInfoPtr));
|
283 |
|
|
extern void freeAllWindows PARAMS ((void));
|
284 |
|
|
extern void freeWinContent PARAMS ((TuiGenWinInfoPtr));
|
285 |
|
|
extern void freeDataContent PARAMS ((TuiWinContent, int));
|
286 |
|
|
extern void freeAllSourceWinsContent PARAMS ((void));
|
287 |
|
|
extern void tuiDelWindow PARAMS ((TuiWinInfoPtr));
|
288 |
|
|
extern void tuiDelDataWindows PARAMS ((TuiWinContent, int));
|
289 |
|
|
extern TuiWinInfoPtr winByName PARAMS ((char *));
|
290 |
|
|
extern TuiWinInfoPtr partialWinByName PARAMS ((char *));
|
291 |
|
|
extern char *winName PARAMS ((TuiGenWinInfoPtr));
|
292 |
|
|
extern char *displayableWinContentOf
|
293 |
|
|
PARAMS ((TuiGenWinInfoPtr, TuiWinElementPtr));
|
294 |
|
|
extern char *displayableWinContentAt
|
295 |
|
|
PARAMS ((TuiGenWinInfoPtr, int));
|
296 |
|
|
extern int winElementHeight
|
297 |
|
|
PARAMS ((TuiGenWinInfoPtr, TuiWinElementPtr));
|
298 |
|
|
extern TuiLayoutType currentLayout PARAMS ((void));
|
299 |
|
|
extern void setCurrentLayoutTo PARAMS ((TuiLayoutType));
|
300 |
|
|
extern int termHeight PARAMS ((void));
|
301 |
|
|
extern void setTermHeight PARAMS ((int));
|
302 |
|
|
extern int termWidth PARAMS ((void));
|
303 |
|
|
extern void setTermWidth PARAMS ((int));
|
304 |
|
|
extern int historyLimit PARAMS ((void));
|
305 |
|
|
extern void setHistoryLimit PARAMS ((int));
|
306 |
|
|
extern void setGenWinOrigin PARAMS ((TuiGenWinInfoPtr, int, int));
|
307 |
|
|
extern TuiGenWinInfoPtr locatorWinInfoPtr PARAMS ((void));
|
308 |
|
|
extern TuiGenWinInfoPtr sourceExecInfoWinPtr PARAMS ((void));
|
309 |
|
|
extern TuiGenWinInfoPtr disassemExecInfoWinPtr PARAMS ((void));
|
310 |
|
|
extern char *nullStr PARAMS ((void));
|
311 |
|
|
extern char *blankStr PARAMS ((void));
|
312 |
|
|
extern char *locationStr PARAMS ((void));
|
313 |
|
|
extern char *breakStr PARAMS ((void));
|
314 |
|
|
extern char *breakLocationStr PARAMS ((void));
|
315 |
|
|
extern TuiListPtr sourceWindows PARAMS ((void));
|
316 |
|
|
extern void clearSourceWindows PARAMS ((void));
|
317 |
|
|
extern void clearSourceWindowsDetail PARAMS ((void));
|
318 |
|
|
extern void clearWinDetail PARAMS ((TuiWinInfoPtr winInfo));
|
319 |
|
|
extern void tuiAddToSourceWindows PARAMS ((TuiWinInfoPtr));
|
320 |
|
|
extern int tuiDefaultTabLen PARAMS ((void));
|
321 |
|
|
extern void tuiSetDefaultTabLen PARAMS ((int));
|
322 |
|
|
extern TuiWinInfoPtr tuiWinWithFocus PARAMS ((void));
|
323 |
|
|
extern void tuiSetWinWithFocus PARAMS ((TuiWinInfoPtr));
|
324 |
|
|
extern TuiLayoutDefPtr tuiLayoutDef PARAMS ((void));
|
325 |
|
|
extern int tuiWinResized PARAMS ((void));
|
326 |
|
|
extern void tuiSetWinResizedTo PARAMS ((int));
|
327 |
|
|
|
328 |
|
|
extern TuiWinInfoPtr tuiNextWin PARAMS ((TuiWinInfoPtr));
|
329 |
|
|
extern TuiWinInfoPtr tuiPrevWin PARAMS ((TuiWinInfoPtr));
|
330 |
|
|
|
331 |
|
|
|
332 |
|
|
#endif /* TUI_DATA_H */
|