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