Commit | Line | Data |
---|---|---|
f377b406 | 1 | /* TUI window generic functions. |
f33c6cbf AC |
2 | |
3 | Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, | |
4 | Inc. | |
5 | ||
f377b406 | 6 | Contributed by Hewlett-Packard Company. |
c906108c | 7 | |
f377b406 SC |
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 | ||
25 | /* This module contains procedures for handling tui window functions | |
26 | like resize, scrolling, scrolling, changing focus, etc. | |
27 | ||
28 | Author: Susan B. Macchia */ | |
c906108c | 29 | |
f33c6cbf AC |
30 | /* FIXME: cagney/2002-02-28: The GDB coding standard indicates that |
31 | "defs.h" should be included first. Unfortunatly some systems | |
32 | (currently Debian GNU/Linux) include the <stdbool.h> via <curses.h> | |
33 | and they clash with "bfd.h"'s definiton of true/false. The correct | |
34 | fix is to remove true/false from "bfd.h", however, until that | |
35 | happens, hack around it by including "config.h" and <curses.h> | |
36 | first. */ | |
37 | ||
4e8f7a8b DJ |
38 | #include "config.h" |
39 | #ifdef HAVE_NCURSES_H | |
40 | #include <ncurses.h> | |
41 | #else | |
42 | #ifdef HAVE_CURSES_H | |
43 | #include <curses.h> | |
44 | #endif | |
45 | #endif | |
46 | ||
c906108c | 47 | #include <string.h> |
84b1e7c7 | 48 | #include <ctype.h> |
c906108c SS |
49 | #include "defs.h" |
50 | #include "command.h" | |
51 | #include "symtab.h" | |
52 | #include "breakpoint.h" | |
53 | #include "frame.h" | |
41783295 | 54 | #include "cli/cli-cmds.h" |
c906108c SS |
55 | |
56 | #include "tui.h" | |
57 | #include "tuiData.h" | |
58 | #include "tuiGeneralWin.h" | |
59 | #include "tuiStack.h" | |
84b1e7c7 SC |
60 | #include "tuiRegs.h" |
61 | #include "tuiDisassem.h" | |
62 | #include "tuiSource.h" | |
c906108c SS |
63 | #include "tuiSourceWin.h" |
64 | #include "tuiDataWin.h" | |
65 | ||
66 | /******************************* | |
67 | ** External Declarations | |
68 | ********************************/ | |
69 | extern void init_page_info (); | |
70 | ||
71 | /******************************* | |
72 | ** Static Local Decls | |
73 | ********************************/ | |
a14ed312 KB |
74 | static void _makeVisibleWithNewHeight (TuiWinInfoPtr); |
75 | static void _makeInvisibleAndSetNewHeight (TuiWinInfoPtr, int); | |
76 | static TuiStatus _tuiAdjustWinHeights (TuiWinInfoPtr, int); | |
77 | static int _newHeightOk (TuiWinInfoPtr, int); | |
78 | static void _tuiSetTabWidth_command (char *, int); | |
79 | static void _tuiRefreshAll_command (char *, int); | |
80 | static void _tuiSetWinHeight_command (char *, int); | |
81 | static void _tuiXDBsetWinHeight_command (char *, int); | |
82 | static void _tuiAllWindowsInfo (char *, int); | |
83 | static void _tuiSetFocus_command (char *, int); | |
84 | static void _tuiScrollForward_command (char *, int); | |
85 | static void _tuiScrollBackward_command (char *, int); | |
86 | static void _tuiScrollLeft_command (char *, int); | |
87 | static void _tuiScrollRight_command (char *, int); | |
88 | static void _parseScrollingArgs (char *, TuiWinInfoPtr *, int *); | |
c906108c SS |
89 | |
90 | ||
91 | /*************************************** | |
92 | ** DEFINITIONS | |
93 | ***************************************/ | |
94 | #define WIN_HEIGHT_USAGE "Usage: winheight <win_name> [+ | -] <#lines>\n" | |
95 | #define XDBWIN_HEIGHT_USAGE "Usage: w <#lines>\n" | |
96 | #define FOCUS_USAGE "Usage: focus {<win> | next | prev}\n" | |
97 | ||
98 | /*************************************** | |
99 | ** PUBLIC FUNCTIONS | |
100 | ***************************************/ | |
101 | ||
af101512 SC |
102 | /* Possible values for tui-border-kind variable. */ |
103 | static const char *tui_border_kind_enums[] = { | |
104 | "space", | |
105 | "ascii", | |
106 | "acs", | |
107 | NULL | |
108 | }; | |
109 | ||
110 | /* Possible values for tui-border-mode and tui-active-border-mode. */ | |
111 | static const char *tui_border_mode_enums[] = { | |
112 | "normal", | |
113 | "standout", | |
114 | "reverse", | |
115 | "half", | |
116 | "half-standout", | |
117 | "bold", | |
118 | "bold-standout", | |
119 | NULL | |
120 | }; | |
121 | ||
122 | struct tui_translate | |
123 | { | |
124 | const char *name; | |
125 | int value; | |
126 | }; | |
127 | ||
128 | /* Translation table for border-mode variables. | |
129 | The list of values must be terminated by a NULL. | |
130 | After the NULL value, an entry defines the default. */ | |
131 | struct tui_translate tui_border_mode_translate[] = { | |
132 | { "normal", A_NORMAL }, | |
133 | { "standout", A_STANDOUT }, | |
134 | { "reverse", A_REVERSE }, | |
135 | { "half", A_DIM }, | |
136 | { "half-standout", A_DIM | A_STANDOUT }, | |
137 | { "bold", A_BOLD }, | |
138 | { "bold-standout", A_BOLD | A_STANDOUT }, | |
139 | { 0, 0 }, | |
140 | { "normal", A_NORMAL } | |
141 | }; | |
142 | ||
143 | /* Translation tables for border-kind, one for each border | |
144 | character (see wborder, border curses operations). | |
145 | -1 is used to indicate the ACS because ACS characters | |
146 | are determined at run time by curses (depends on terminal). */ | |
147 | struct tui_translate tui_border_kind_translate_vline[] = { | |
148 | { "space", ' ' }, | |
149 | { "ascii", '|' }, | |
150 | { "acs", -1 }, | |
151 | { 0, 0 }, | |
152 | { "ascii", '|' } | |
153 | }; | |
154 | ||
155 | struct tui_translate tui_border_kind_translate_hline[] = { | |
156 | { "space", ' ' }, | |
157 | { "ascii", '-' }, | |
158 | { "acs", -1 }, | |
159 | { 0, 0 }, | |
160 | { "ascii", '-' } | |
161 | }; | |
162 | ||
163 | struct tui_translate tui_border_kind_translate_ulcorner[] = { | |
164 | { "space", ' ' }, | |
165 | { "ascii", '+' }, | |
166 | { "acs", -1 }, | |
167 | { 0, 0 }, | |
168 | { "ascii", '+' } | |
169 | }; | |
170 | ||
171 | struct tui_translate tui_border_kind_translate_urcorner[] = { | |
172 | { "space", ' ' }, | |
173 | { "ascii", '+' }, | |
174 | { "acs", -1 }, | |
175 | { 0, 0 }, | |
176 | { "ascii", '+' } | |
177 | }; | |
178 | ||
179 | struct tui_translate tui_border_kind_translate_llcorner[] = { | |
180 | { "space", ' ' }, | |
181 | { "ascii", '+' }, | |
182 | { "acs", -1 }, | |
183 | { 0, 0 }, | |
184 | { "ascii", '+' } | |
185 | }; | |
186 | ||
187 | struct tui_translate tui_border_kind_translate_lrcorner[] = { | |
188 | { "space", ' ' }, | |
189 | { "ascii", '+' }, | |
190 | { "acs", -1 }, | |
191 | { 0, 0 }, | |
192 | { "ascii", '+' } | |
193 | }; | |
194 | ||
195 | ||
196 | /* Tui configuration variables controlled with set/show command. */ | |
197 | const char *tui_active_border_mode = "bold-standout"; | |
198 | const char *tui_border_mode = "normal"; | |
199 | const char *tui_border_kind = "acs"; | |
200 | ||
201 | /* Tui internal configuration variables. These variables are | |
202 | updated by tui_update_variables to reflect the tui configuration | |
203 | variables. */ | |
204 | chtype tui_border_vline; | |
205 | chtype tui_border_hline; | |
206 | chtype tui_border_ulcorner; | |
207 | chtype tui_border_urcorner; | |
208 | chtype tui_border_llcorner; | |
209 | chtype tui_border_lrcorner; | |
210 | ||
211 | int tui_border_attrs; | |
212 | int tui_active_border_attrs; | |
213 | ||
214 | /* Identify the item in the translation table. | |
215 | When the item is not recognized, use the default entry. */ | |
216 | static struct tui_translate * | |
217 | translate (const char *name, struct tui_translate *table) | |
218 | { | |
219 | while (table->name) | |
220 | { | |
221 | if (name && strcmp (table->name, name) == 0) | |
222 | return table; | |
223 | table++; | |
224 | } | |
225 | ||
226 | /* Not found, return default entry. */ | |
227 | table++; | |
228 | return table; | |
229 | } | |
230 | ||
231 | /* Update the tui internal configuration according to gdb settings. | |
232 | Returns 1 if the configuration has changed and the screen should | |
233 | be redrawn. */ | |
234 | int | |
235 | tui_update_variables () | |
236 | { | |
237 | int need_redraw = 0; | |
238 | struct tui_translate *entry; | |
239 | ||
240 | entry = translate (tui_border_mode, tui_border_mode_translate); | |
241 | if (tui_border_attrs != entry->value) | |
242 | { | |
243 | tui_border_attrs = entry->value; | |
244 | need_redraw = 1; | |
245 | } | |
246 | entry = translate (tui_active_border_mode, tui_border_mode_translate); | |
247 | if (tui_active_border_attrs != entry->value) | |
248 | { | |
249 | tui_active_border_attrs = entry->value; | |
250 | need_redraw = 1; | |
251 | } | |
252 | ||
253 | /* If one corner changes, all characters are changed. | |
254 | Only check the first one. The ACS characters are determined at | |
255 | run time by curses terminal management. */ | |
256 | entry = translate (tui_border_kind, tui_border_kind_translate_lrcorner); | |
257 | if (tui_border_lrcorner != (chtype) entry->value) | |
258 | { | |
259 | tui_border_lrcorner = (entry->value < 0) ? ACS_LRCORNER : entry->value; | |
260 | need_redraw = 1; | |
261 | } | |
262 | entry = translate (tui_border_kind, tui_border_kind_translate_llcorner); | |
263 | tui_border_llcorner = (entry->value < 0) ? ACS_LLCORNER : entry->value; | |
264 | ||
265 | entry = translate (tui_border_kind, tui_border_kind_translate_ulcorner); | |
266 | tui_border_ulcorner = (entry->value < 0) ? ACS_ULCORNER : entry->value; | |
267 | ||
268 | entry = translate (tui_border_kind, tui_border_kind_translate_urcorner); | |
269 | tui_border_urcorner = (entry->value < 0) ? ACS_URCORNER : entry->value; | |
270 | ||
271 | entry = translate (tui_border_kind, tui_border_kind_translate_hline); | |
272 | tui_border_hline = (entry->value < 0) ? ACS_HLINE : entry->value; | |
273 | ||
274 | entry = translate (tui_border_kind, tui_border_kind_translate_vline); | |
275 | tui_border_vline = (entry->value < 0) ? ACS_VLINE : entry->value; | |
276 | ||
277 | return need_redraw; | |
278 | } | |
279 | ||
c9684879 SC |
280 | static void |
281 | set_tui_cmd (char *args, int from_tty) | |
282 | { | |
283 | } | |
284 | ||
285 | static void | |
286 | show_tui_cmd (char *args, int from_tty) | |
287 | { | |
288 | } | |
af101512 | 289 | |
c906108c | 290 | /* |
c5aa993b JM |
291 | ** _initialize_tuiWin(). |
292 | ** Function to initialize gdb commands, for tui window manipulation. | |
293 | */ | |
c906108c | 294 | void |
fba45db2 | 295 | _initialize_tuiWin (void) |
c906108c | 296 | { |
af101512 | 297 | struct cmd_list_element *c; |
c9684879 SC |
298 | static struct cmd_list_element *tui_setlist; |
299 | static struct cmd_list_element *tui_showlist; | |
af101512 | 300 | |
41783295 SC |
301 | /* Define the classes of commands. |
302 | They will appear in the help list in the reverse of this order. */ | |
e00d1dc8 | 303 | add_cmd ("tui", class_tui, NULL, |
41783295 SC |
304 | "Text User Interface commands.", |
305 | &cmdlist); | |
306 | ||
c9684879 SC |
307 | add_prefix_cmd ("tui", class_tui, set_tui_cmd, |
308 | "TUI configuration variables", | |
309 | &tui_setlist, "set tui ", | |
310 | 0/*allow-unknown*/, &setlist); | |
311 | add_prefix_cmd ("tui", class_tui, show_tui_cmd, | |
312 | "TUI configuration variables", | |
313 | &tui_showlist, "show tui ", | |
314 | 0/*allow-unknown*/, &showlist); | |
315 | ||
41783295 SC |
316 | add_com ("refresh", class_tui, _tuiRefreshAll_command, |
317 | "Refresh the terminal display.\n"); | |
318 | if (xdb_commands) | |
319 | add_com_alias ("U", "refresh", class_tui, 0); | |
320 | add_com ("tabset", class_tui, _tuiSetTabWidth_command, | |
321 | "Set the width (in characters) of tab stops.\n\ | |
c906108c | 322 | Usage: tabset <n>\n"); |
41783295 SC |
323 | add_com ("winheight", class_tui, _tuiSetWinHeight_command, |
324 | "Set the height of a specified window.\n\ | |
c906108c SS |
325 | Usage: winheight <win_name> [+ | -] <#lines>\n\ |
326 | Window names are:\n\ | |
327 | src : the source window\n\ | |
328 | cmd : the command window\n\ | |
329 | asm : the disassembly window\n\ | |
330 | regs : the register display\n"); | |
41783295 SC |
331 | add_com_alias ("wh", "winheight", class_tui, 0); |
332 | add_info ("win", _tuiAllWindowsInfo, | |
333 | "List of all displayed windows.\n"); | |
334 | add_com ("focus", class_tui, _tuiSetFocus_command, | |
335 | "Set focus to named window or next/prev window.\n\ | |
c906108c SS |
336 | Usage: focus {<win> | next | prev}\n\ |
337 | Valid Window names are:\n\ | |
338 | src : the source window\n\ | |
339 | asm : the disassembly window\n\ | |
340 | regs : the register display\n\ | |
341 | cmd : the command window\n"); | |
41783295 SC |
342 | add_com_alias ("fs", "focus", class_tui, 0); |
343 | add_com ("+", class_tui, _tuiScrollForward_command, | |
344 | "Scroll window forward.\nUsage: + [win] [n]\n"); | |
345 | add_com ("-", class_tui, _tuiScrollBackward_command, | |
346 | "Scroll window backward.\nUsage: - [win] [n]\n"); | |
347 | add_com ("<", class_tui, _tuiScrollLeft_command, | |
348 | "Scroll window forward.\nUsage: < [win] [n]\n"); | |
349 | add_com (">", class_tui, _tuiScrollRight_command, | |
350 | "Scroll window backward.\nUsage: > [win] [n]\n"); | |
351 | if (xdb_commands) | |
352 | add_com ("w", class_xdb, _tuiXDBsetWinHeight_command, | |
353 | "XDB compatibility command for setting the height of a command window.\n\ | |
c906108c | 354 | Usage: w <#lines>\n"); |
af101512 SC |
355 | |
356 | /* Define the tui control variables. */ | |
357 | c = add_set_enum_cmd | |
c9684879 | 358 | ("border-kind", no_class, |
c6f60bcd | 359 | tui_border_kind_enums, &tui_border_kind, |
af101512 SC |
360 | "Set the kind of border for TUI windows.\n" |
361 | "This variable controls the border of TUI windows:\n" | |
362 | "space use a white space\n" | |
363 | "ascii use ascii characters + - | for the border\n" | |
364 | "acs use the Alternate Character Set\n", | |
c9684879 SC |
365 | &tui_setlist); |
366 | add_show_from_set (c, &tui_showlist); | |
af101512 SC |
367 | |
368 | c = add_set_enum_cmd | |
c9684879 | 369 | ("border-mode", no_class, |
c6f60bcd | 370 | tui_border_mode_enums, &tui_border_mode, |
af101512 SC |
371 | "Set the attribute mode to use for the TUI window borders.\n" |
372 | "This variable controls the attributes to use for the window borders:\n" | |
373 | "normal normal display\n" | |
374 | "standout use highlight mode of terminal\n" | |
375 | "reverse use reverse video mode\n" | |
376 | "half use half bright\n" | |
377 | "half-standout use half bright and standout mode\n" | |
378 | "bold use extra bright or bold\n" | |
379 | "bold-standout use extra bright or bold with standout mode\n", | |
c9684879 SC |
380 | &tui_setlist); |
381 | add_show_from_set (c, &tui_showlist); | |
af101512 SC |
382 | |
383 | c = add_set_enum_cmd | |
c9684879 | 384 | ("active-border-mode", no_class, |
c6f60bcd | 385 | tui_border_mode_enums, &tui_active_border_mode, |
af101512 SC |
386 | "Set the attribute mode to use for the active TUI window border.\n" |
387 | "This variable controls the attributes to use for the active window border:\n" | |
388 | "normal normal display\n" | |
389 | "standout use highlight mode of terminal\n" | |
390 | "reverse use reverse video mode\n" | |
391 | "half use half bright\n" | |
392 | "half-standout use half bright and standout mode\n" | |
393 | "bold use extra bright or bold\n" | |
394 | "bold-standout use extra bright or bold with standout mode\n", | |
c9684879 SC |
395 | &tui_setlist); |
396 | add_show_from_set (c, &tui_showlist); | |
41783295 | 397 | } |
c906108c SS |
398 | |
399 | ||
400 | /* | |
c5aa993b JM |
401 | ** tuiClearWinFocusFrom |
402 | ** Clear the logical focus from winInfo | |
403 | */ | |
c906108c | 404 | void |
eca6576c | 405 | tuiClearWinFocusFrom (TuiWinInfoPtr winInfo) |
c906108c SS |
406 | { |
407 | if (m_winPtrNotNull (winInfo)) | |
408 | { | |
409 | if (winInfo->generic.type != CMD_WIN) | |
410 | unhighlightWin (winInfo); | |
411 | tuiSetWinWithFocus ((TuiWinInfoPtr) NULL); | |
412 | } | |
413 | ||
414 | return; | |
415 | } /* tuiClearWinFocusFrom */ | |
416 | ||
417 | ||
418 | /* | |
c5aa993b JM |
419 | ** tuiClearWinFocus(). |
420 | ** Clear the window that has focus. | |
421 | */ | |
c906108c | 422 | void |
c906108c | 423 | tuiClearWinFocus (void) |
c906108c SS |
424 | { |
425 | tuiClearWinFocusFrom (tuiWinWithFocus ()); | |
426 | ||
427 | return; | |
428 | } /* tuiClearWinFocus */ | |
429 | ||
430 | ||
431 | /* | |
c5aa993b JM |
432 | ** tuiSetWinFocusTo |
433 | ** Set the logical focus to winInfo | |
434 | */ | |
c906108c | 435 | void |
eca6576c | 436 | tuiSetWinFocusTo (TuiWinInfoPtr winInfo) |
c906108c SS |
437 | { |
438 | if (m_winPtrNotNull (winInfo)) | |
439 | { | |
440 | TuiWinInfoPtr winWithFocus = tuiWinWithFocus (); | |
441 | ||
442 | if (m_winPtrNotNull (winWithFocus) && | |
443 | winWithFocus->generic.type != CMD_WIN) | |
444 | unhighlightWin (winWithFocus); | |
445 | tuiSetWinWithFocus (winInfo); | |
446 | if (winInfo->generic.type != CMD_WIN) | |
447 | highlightWin (winInfo); | |
448 | } | |
449 | ||
450 | return; | |
451 | } /* tuiSetWinFocusTo */ | |
452 | ||
453 | ||
c906108c | 454 | /* |
c5aa993b JM |
455 | ** tuiScrollForward(). |
456 | */ | |
c906108c | 457 | void |
eca6576c | 458 | tuiScrollForward (TuiWinInfoPtr winToScroll, int numToScroll) |
c906108c SS |
459 | { |
460 | if (winToScroll != cmdWin) | |
461 | { | |
462 | int _numToScroll = numToScroll; | |
463 | ||
464 | if (numToScroll == 0) | |
465 | _numToScroll = winToScroll->generic.height - 3; | |
466 | /* | |
c5aa993b JM |
467 | ** If we are scrolling the source or disassembly window, do a |
468 | ** "psuedo" scroll since not all of the source is in memory, | |
469 | ** only what is in the viewport. If winToScroll is the | |
470 | ** command window do nothing since the term should handle it. | |
471 | */ | |
c906108c SS |
472 | if (winToScroll == srcWin) |
473 | tuiVerticalSourceScroll (FORWARD_SCROLL, _numToScroll); | |
474 | else if (winToScroll == disassemWin) | |
475 | tuiVerticalDisassemScroll (FORWARD_SCROLL, _numToScroll); | |
476 | else if (winToScroll == dataWin) | |
477 | tuiVerticalDataScroll (FORWARD_SCROLL, _numToScroll); | |
478 | } | |
479 | ||
480 | return; | |
481 | } /* tuiScrollForward */ | |
482 | ||
483 | ||
484 | /* | |
c5aa993b JM |
485 | ** tuiScrollBackward(). |
486 | */ | |
c906108c | 487 | void |
eca6576c | 488 | tuiScrollBackward (TuiWinInfoPtr winToScroll, int numToScroll) |
c906108c SS |
489 | { |
490 | if (winToScroll != cmdWin) | |
491 | { | |
492 | int _numToScroll = numToScroll; | |
493 | ||
494 | if (numToScroll == 0) | |
495 | _numToScroll = winToScroll->generic.height - 3; | |
496 | /* | |
c5aa993b JM |
497 | ** If we are scrolling the source or disassembly window, do a |
498 | ** "psuedo" scroll since not all of the source is in memory, | |
499 | ** only what is in the viewport. If winToScroll is the | |
500 | ** command window do nothing since the term should handle it. | |
501 | */ | |
c906108c SS |
502 | if (winToScroll == srcWin) |
503 | tuiVerticalSourceScroll (BACKWARD_SCROLL, _numToScroll); | |
504 | else if (winToScroll == disassemWin) | |
505 | tuiVerticalDisassemScroll (BACKWARD_SCROLL, _numToScroll); | |
506 | else if (winToScroll == dataWin) | |
507 | tuiVerticalDataScroll (BACKWARD_SCROLL, _numToScroll); | |
508 | } | |
509 | return; | |
510 | } /* tuiScrollBackward */ | |
511 | ||
512 | ||
513 | /* | |
c5aa993b JM |
514 | ** tuiScrollLeft(). |
515 | */ | |
c906108c | 516 | void |
eca6576c | 517 | tuiScrollLeft (TuiWinInfoPtr winToScroll, int numToScroll) |
c906108c SS |
518 | { |
519 | if (winToScroll != cmdWin) | |
520 | { | |
521 | int _numToScroll = numToScroll; | |
522 | ||
523 | if (_numToScroll == 0) | |
524 | _numToScroll = 1; | |
525 | /* | |
c5aa993b JM |
526 | ** If we are scrolling the source or disassembly window, do a |
527 | ** "psuedo" scroll since not all of the source is in memory, | |
528 | ** only what is in the viewport. If winToScroll is the | |
529 | ** command window do nothing since the term should handle it. | |
530 | */ | |
c906108c SS |
531 | if (winToScroll == srcWin || winToScroll == disassemWin) |
532 | tuiHorizontalSourceScroll (winToScroll, LEFT_SCROLL, _numToScroll); | |
533 | } | |
534 | return; | |
535 | } /* tuiScrollLeft */ | |
536 | ||
537 | ||
538 | /* | |
c5aa993b JM |
539 | ** tuiScrollRight(). |
540 | */ | |
c906108c | 541 | void |
eca6576c | 542 | tuiScrollRight (TuiWinInfoPtr winToScroll, int numToScroll) |
c906108c SS |
543 | { |
544 | if (winToScroll != cmdWin) | |
545 | { | |
546 | int _numToScroll = numToScroll; | |
547 | ||
548 | if (_numToScroll == 0) | |
549 | _numToScroll = 1; | |
550 | /* | |
c5aa993b JM |
551 | ** If we are scrolling the source or disassembly window, do a |
552 | ** "psuedo" scroll since not all of the source is in memory, | |
553 | ** only what is in the viewport. If winToScroll is the | |
554 | ** command window do nothing since the term should handle it. | |
555 | */ | |
c906108c SS |
556 | if (winToScroll == srcWin || winToScroll == disassemWin) |
557 | tuiHorizontalSourceScroll (winToScroll, RIGHT_SCROLL, _numToScroll); | |
558 | } | |
559 | return; | |
560 | } /* tuiScrollRight */ | |
561 | ||
562 | ||
563 | /* | |
e8b915dc | 564 | ** tui_scroll(). |
c5aa993b JM |
565 | ** Scroll a window. Arguments are passed through a va_list. |
566 | */ | |
c906108c | 567 | void |
e8b915dc SC |
568 | tui_scroll (TuiScrollDirection direction, |
569 | TuiWinInfoPtr winToScroll, | |
570 | int numToScroll) | |
c906108c | 571 | { |
c906108c SS |
572 | switch (direction) |
573 | { | |
574 | case FORWARD_SCROLL: | |
575 | tuiScrollForward (winToScroll, numToScroll); | |
576 | break; | |
577 | case BACKWARD_SCROLL: | |
578 | tuiScrollBackward (winToScroll, numToScroll); | |
579 | break; | |
580 | case LEFT_SCROLL: | |
581 | tuiScrollLeft (winToScroll, numToScroll); | |
582 | break; | |
583 | case RIGHT_SCROLL: | |
584 | tuiScrollRight (winToScroll, numToScroll); | |
585 | break; | |
586 | default: | |
587 | break; | |
588 | } | |
e8b915dc | 589 | } |
c906108c SS |
590 | |
591 | ||
592 | /* | |
c5aa993b JM |
593 | ** tuiRefreshAll(). |
594 | */ | |
c906108c | 595 | void |
c906108c | 596 | tuiRefreshAll (void) |
c906108c SS |
597 | { |
598 | TuiWinType type; | |
599 | ||
3e266828 | 600 | clearok (curscr, TRUE); |
c906108c SS |
601 | refreshAll (winList); |
602 | for (type = SRC_WIN; type < MAX_MAJOR_WINDOWS; type++) | |
603 | { | |
75fd9bc1 | 604 | if (winList[type] && winList[type]->generic.isVisible) |
c906108c SS |
605 | { |
606 | switch (type) | |
607 | { | |
608 | case SRC_WIN: | |
609 | case DISASSEM_WIN: | |
610 | tuiClearWin (&winList[type]->generic); | |
611 | if (winList[type]->detail.sourceInfo.hasLocator) | |
612 | tuiClearLocatorDisplay (); | |
613 | tuiShowSourceContent (winList[type]); | |
614 | checkAndDisplayHighlightIfNeeded (winList[type]); | |
615 | tuiEraseExecInfoContent (winList[type]); | |
616 | tuiUpdateExecInfo (winList[type]); | |
617 | break; | |
618 | case DATA_WIN: | |
619 | tuiRefreshDataWin (); | |
620 | break; | |
621 | default: | |
622 | break; | |
623 | } | |
624 | } | |
625 | } | |
626 | tuiClearLocatorDisplay (); | |
627 | tuiShowLocatorContent (); | |
628 | ||
629 | return; | |
630 | } /* tuiRefreshAll */ | |
631 | ||
632 | ||
633 | /* | |
c5aa993b JM |
634 | ** tuiResizeAll(). |
635 | ** Resize all the windows based on the the terminal size. This | |
636 | ** function gets called from within the readline sinwinch handler. | |
637 | */ | |
c906108c | 638 | void |
c906108c | 639 | tuiResizeAll (void) |
c906108c SS |
640 | { |
641 | int heightDiff, widthDiff; | |
c5aa993b | 642 | extern int screenheight, screenwidth; /* in readline */ |
c906108c SS |
643 | |
644 | widthDiff = screenwidth - termWidth (); | |
645 | heightDiff = screenheight - termHeight (); | |
646 | if (heightDiff || widthDiff) | |
647 | { | |
648 | TuiLayoutType curLayout = currentLayout (); | |
649 | TuiWinInfoPtr winWithFocus = tuiWinWithFocus (); | |
650 | TuiWinInfoPtr firstWin, secondWin; | |
651 | TuiGenWinInfoPtr locator = locatorWinInfoPtr (); | |
652 | TuiWinType winType; | |
653 | int i, newHeight, splitDiff, cmdSplitDiff, numWinsDisplayed = 2; | |
654 | ||
655 | /* turn keypad off while we resize */ | |
656 | if (winWithFocus != cmdWin) | |
657 | keypad (cmdWin->generic.handle, FALSE); | |
658 | init_page_info (); | |
659 | setTermHeightTo (screenheight); | |
660 | setTermWidthTo (screenwidth); | |
661 | if (curLayout == SRC_DISASSEM_COMMAND || | |
662 | curLayout == SRC_DATA_COMMAND || curLayout == DISASSEM_DATA_COMMAND) | |
663 | numWinsDisplayed++; | |
664 | splitDiff = heightDiff / numWinsDisplayed; | |
665 | cmdSplitDiff = splitDiff; | |
666 | if (heightDiff % numWinsDisplayed) | |
667 | { | |
668 | if (heightDiff < 0) | |
669 | cmdSplitDiff--; | |
670 | else | |
671 | cmdSplitDiff++; | |
672 | } | |
673 | /* now adjust each window */ | |
674 | clear (); | |
675 | refresh (); | |
676 | switch (curLayout) | |
677 | { | |
678 | case SRC_COMMAND: | |
679 | case DISASSEM_COMMAND: | |
680 | firstWin = (TuiWinInfoPtr) (sourceWindows ())->list[0]; | |
681 | firstWin->generic.width += widthDiff; | |
682 | locator->width += widthDiff; | |
683 | /* check for invalid heights */ | |
684 | if (heightDiff == 0) | |
685 | newHeight = firstWin->generic.height; | |
686 | else if ((firstWin->generic.height + splitDiff) >= | |
687 | (screenheight - MIN_CMD_WIN_HEIGHT - 1)) | |
688 | newHeight = screenheight - MIN_CMD_WIN_HEIGHT - 1; | |
689 | else if ((firstWin->generic.height + splitDiff) <= 0) | |
690 | newHeight = MIN_WIN_HEIGHT; | |
691 | else | |
692 | newHeight = firstWin->generic.height + splitDiff; | |
693 | ||
694 | _makeInvisibleAndSetNewHeight (firstWin, newHeight); | |
695 | cmdWin->generic.origin.y = locator->origin.y + 1; | |
696 | cmdWin->generic.width += widthDiff; | |
697 | newHeight = screenheight - cmdWin->generic.origin.y; | |
698 | _makeInvisibleAndSetNewHeight (cmdWin, newHeight); | |
699 | _makeVisibleWithNewHeight (firstWin); | |
700 | _makeVisibleWithNewHeight (cmdWin); | |
701 | if (firstWin->generic.contentSize <= 0) | |
702 | tuiEraseSourceContent (firstWin, EMPTY_SOURCE_PROMPT); | |
703 | break; | |
704 | default: | |
705 | if (curLayout == SRC_DISASSEM_COMMAND) | |
706 | { | |
707 | firstWin = srcWin; | |
708 | firstWin->generic.width += widthDiff; | |
709 | secondWin = disassemWin; | |
710 | secondWin->generic.width += widthDiff; | |
711 | } | |
712 | else | |
713 | { | |
714 | firstWin = dataWin; | |
715 | firstWin->generic.width += widthDiff; | |
716 | secondWin = (TuiWinInfoPtr) (sourceWindows ())->list[0]; | |
717 | secondWin->generic.width += widthDiff; | |
718 | } | |
719 | /* Change the first window's height/width */ | |
720 | /* check for invalid heights */ | |
721 | if (heightDiff == 0) | |
722 | newHeight = firstWin->generic.height; | |
723 | else if ((firstWin->generic.height + | |
724 | secondWin->generic.height + (splitDiff * 2)) >= | |
725 | (screenheight - MIN_CMD_WIN_HEIGHT - 1)) | |
726 | newHeight = (screenheight - MIN_CMD_WIN_HEIGHT - 1) / 2; | |
727 | else if ((firstWin->generic.height + splitDiff) <= 0) | |
728 | newHeight = MIN_WIN_HEIGHT; | |
729 | else | |
730 | newHeight = firstWin->generic.height + splitDiff; | |
731 | _makeInvisibleAndSetNewHeight (firstWin, newHeight); | |
732 | ||
733 | if (firstWin == dataWin && widthDiff != 0) | |
734 | firstWin->detail.dataDisplayInfo.regsColumnCount = | |
735 | tuiCalculateRegsColumnCount ( | |
736 | firstWin->detail.dataDisplayInfo.regsDisplayType); | |
737 | locator->width += widthDiff; | |
738 | ||
739 | /* Change the second window's height/width */ | |
740 | /* check for invalid heights */ | |
741 | if (heightDiff == 0) | |
742 | newHeight = secondWin->generic.height; | |
743 | else if ((firstWin->generic.height + | |
744 | secondWin->generic.height + (splitDiff * 2)) >= | |
745 | (screenheight - MIN_CMD_WIN_HEIGHT - 1)) | |
746 | { | |
747 | newHeight = screenheight - MIN_CMD_WIN_HEIGHT - 1; | |
748 | if (newHeight % 2) | |
749 | newHeight = (newHeight / 2) + 1; | |
750 | else | |
751 | newHeight /= 2; | |
752 | } | |
753 | else if ((secondWin->generic.height + splitDiff) <= 0) | |
754 | newHeight = MIN_WIN_HEIGHT; | |
755 | else | |
756 | newHeight = secondWin->generic.height + splitDiff; | |
757 | secondWin->generic.origin.y = firstWin->generic.height - 1; | |
758 | _makeInvisibleAndSetNewHeight (secondWin, newHeight); | |
759 | ||
760 | /* Change the command window's height/width */ | |
761 | cmdWin->generic.origin.y = locator->origin.y + 1; | |
762 | _makeInvisibleAndSetNewHeight ( | |
763 | cmdWin, cmdWin->generic.height + cmdSplitDiff); | |
764 | _makeVisibleWithNewHeight (firstWin); | |
765 | _makeVisibleWithNewHeight (secondWin); | |
766 | _makeVisibleWithNewHeight (cmdWin); | |
767 | if (firstWin->generic.contentSize <= 0) | |
768 | tuiEraseSourceContent (firstWin, EMPTY_SOURCE_PROMPT); | |
769 | if (secondWin->generic.contentSize <= 0) | |
770 | tuiEraseSourceContent (secondWin, EMPTY_SOURCE_PROMPT); | |
771 | break; | |
772 | } | |
773 | /* | |
c5aa993b JM |
774 | ** Now remove all invisible windows, and their content so that they get |
775 | ** created again when called for with the new size | |
776 | */ | |
c906108c SS |
777 | for (winType = SRC_WIN; (winType < MAX_MAJOR_WINDOWS); winType++) |
778 | { | |
779 | if (winType != CMD_WIN && m_winPtrNotNull (winList[winType]) && | |
780 | !winList[winType]->generic.isVisible) | |
781 | { | |
782 | freeWindow (winList[winType]); | |
783 | winList[winType] = (TuiWinInfoPtr) NULL; | |
784 | } | |
785 | } | |
786 | tuiSetWinResizedTo (TRUE); | |
787 | /* turn keypad back on, unless focus is in the command window */ | |
788 | if (winWithFocus != cmdWin) | |
789 | keypad (cmdWin->generic.handle, TRUE); | |
790 | } | |
791 | return; | |
792 | } /* tuiResizeAll */ | |
793 | ||
794 | ||
795 | /* | |
c5aa993b JM |
796 | ** tuiSigwinchHandler() |
797 | ** SIGWINCH signal handler for the tui. This signal handler is | |
798 | ** always called, even when the readline package clears signals | |
799 | ** because it is set as the old_sigwinch() (TUI only) | |
800 | */ | |
c906108c | 801 | void |
eca6576c | 802 | tuiSigwinchHandler (int signal) |
c906108c SS |
803 | { |
804 | /* | |
c5aa993b JM |
805 | ** Say that a resize was done so that the readline can do it |
806 | ** later when appropriate. | |
807 | */ | |
c906108c SS |
808 | tuiSetWinResizedTo (TRUE); |
809 | ||
810 | return; | |
811 | } /* tuiSigwinchHandler */ | |
812 | ||
813 | ||
814 | ||
815 | /************************* | |
816 | ** STATIC LOCAL FUNCTIONS | |
817 | **************************/ | |
818 | ||
819 | ||
820 | /* | |
c5aa993b JM |
821 | ** _tuiScrollForward_command(). |
822 | */ | |
c906108c | 823 | static void |
eca6576c | 824 | _tuiScrollForward_command (char *arg, int fromTTY) |
c906108c SS |
825 | { |
826 | int numToScroll = 1; | |
827 | TuiWinInfoPtr winToScroll; | |
828 | ||
1854bb21 SC |
829 | /* Make sure the curses mode is enabled. */ |
830 | tui_enable (); | |
c906108c SS |
831 | if (arg == (char *) NULL) |
832 | _parseScrollingArgs (arg, &winToScroll, (int *) NULL); | |
833 | else | |
834 | _parseScrollingArgs (arg, &winToScroll, &numToScroll); | |
e8b915dc SC |
835 | tui_scroll (FORWARD_SCROLL, winToScroll, numToScroll); |
836 | } | |
c906108c SS |
837 | |
838 | ||
839 | /* | |
c5aa993b JM |
840 | ** _tuiScrollBackward_command(). |
841 | */ | |
c906108c | 842 | static void |
eca6576c | 843 | _tuiScrollBackward_command (char *arg, int fromTTY) |
c906108c SS |
844 | { |
845 | int numToScroll = 1; | |
846 | TuiWinInfoPtr winToScroll; | |
847 | ||
1854bb21 SC |
848 | /* Make sure the curses mode is enabled. */ |
849 | tui_enable (); | |
c906108c SS |
850 | if (arg == (char *) NULL) |
851 | _parseScrollingArgs (arg, &winToScroll, (int *) NULL); | |
852 | else | |
853 | _parseScrollingArgs (arg, &winToScroll, &numToScroll); | |
e8b915dc SC |
854 | tui_scroll (BACKWARD_SCROLL, winToScroll, numToScroll); |
855 | } | |
c906108c SS |
856 | |
857 | ||
858 | /* | |
c5aa993b JM |
859 | ** _tuiScrollLeft_command(). |
860 | */ | |
c906108c | 861 | static void |
eca6576c | 862 | _tuiScrollLeft_command (char *arg, int fromTTY) |
c906108c SS |
863 | { |
864 | int numToScroll; | |
865 | TuiWinInfoPtr winToScroll; | |
866 | ||
1854bb21 SC |
867 | /* Make sure the curses mode is enabled. */ |
868 | tui_enable (); | |
c906108c | 869 | _parseScrollingArgs (arg, &winToScroll, &numToScroll); |
e8b915dc SC |
870 | tui_scroll (LEFT_SCROLL, winToScroll, numToScroll); |
871 | } | |
c906108c SS |
872 | |
873 | ||
874 | /* | |
c5aa993b JM |
875 | ** _tuiScrollRight_command(). |
876 | */ | |
c906108c | 877 | static void |
eca6576c | 878 | _tuiScrollRight_command (char *arg, int fromTTY) |
c906108c SS |
879 | { |
880 | int numToScroll; | |
881 | TuiWinInfoPtr winToScroll; | |
882 | ||
1854bb21 SC |
883 | /* Make sure the curses mode is enabled. */ |
884 | tui_enable (); | |
c906108c | 885 | _parseScrollingArgs (arg, &winToScroll, &numToScroll); |
e8b915dc SC |
886 | tui_scroll (RIGHT_SCROLL, winToScroll, numToScroll); |
887 | } | |
c906108c SS |
888 | |
889 | ||
890 | /* | |
c5aa993b JM |
891 | ** _tuiSetFocus(). |
892 | ** Set focus to the window named by 'arg' | |
893 | */ | |
c906108c | 894 | static void |
eca6576c | 895 | _tuiSetFocus (char *arg, int fromTTY) |
c906108c SS |
896 | { |
897 | if (arg != (char *) NULL) | |
898 | { | |
1854bb21 | 899 | char *bufPtr = (char *) xstrdup (arg); |
c906108c SS |
900 | int i; |
901 | TuiWinInfoPtr winInfo = (TuiWinInfoPtr) NULL; | |
902 | ||
903 | for (i = 0; (i < strlen (bufPtr)); i++) | |
904 | bufPtr[i] = toupper (arg[i]); | |
905 | ||
0963fc96 | 906 | if (subset_compare (bufPtr, "NEXT")) |
c906108c | 907 | winInfo = tuiNextWin (tuiWinWithFocus ()); |
0963fc96 | 908 | else if (subset_compare (bufPtr, "PREV")) |
c906108c SS |
909 | winInfo = tuiPrevWin (tuiWinWithFocus ()); |
910 | else | |
911 | winInfo = partialWinByName (bufPtr); | |
912 | ||
913 | if (winInfo == (TuiWinInfoPtr) NULL || !winInfo->generic.isVisible) | |
914 | warning ("Invalid window specified. \n\ | |
915 | The window name specified must be valid and visible.\n"); | |
916 | else | |
917 | { | |
918 | tuiSetWinFocusTo (winInfo); | |
919 | keypad (cmdWin->generic.handle, (winInfo != cmdWin)); | |
920 | } | |
921 | ||
75fd9bc1 | 922 | if (dataWin && dataWin->generic.isVisible) |
c906108c SS |
923 | tuiRefreshDataWin (); |
924 | tuiFree (bufPtr); | |
925 | printf_filtered ("Focus set to %s window.\n", | |
926 | winName ((TuiGenWinInfoPtr) tuiWinWithFocus ())); | |
927 | } | |
928 | else | |
929 | warning ("Incorrect Number of Arguments.\n%s", FOCUS_USAGE); | |
930 | ||
931 | return; | |
932 | } /* _tuiSetFocus */ | |
933 | ||
c906108c | 934 | /* |
c5aa993b JM |
935 | ** _tuiSetFocus_command() |
936 | */ | |
c906108c | 937 | static void |
eca6576c | 938 | _tuiSetFocus_command (char *arg, int fromTTY) |
c906108c | 939 | { |
1854bb21 SC |
940 | /* Make sure the curses mode is enabled. */ |
941 | tui_enable (); | |
e8b915dc SC |
942 | _tuiSetFocus (arg, fromTTY); |
943 | } | |
c906108c SS |
944 | |
945 | ||
946 | /* | |
c5aa993b JM |
947 | ** _tuiAllWindowsInfo(). |
948 | */ | |
c906108c | 949 | static void |
eca6576c | 950 | _tuiAllWindowsInfo (char *arg, int fromTTY) |
c906108c SS |
951 | { |
952 | TuiWinType type; | |
953 | TuiWinInfoPtr winWithFocus = tuiWinWithFocus (); | |
954 | ||
955 | for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++) | |
956 | if (winList[type]->generic.isVisible) | |
957 | { | |
958 | if (winWithFocus == winList[type]) | |
959 | printf_filtered (" %s\t(%d lines) <has focus>\n", | |
960 | winName (&winList[type]->generic), | |
961 | winList[type]->generic.height); | |
962 | else | |
963 | printf_filtered (" %s\t(%d lines)\n", | |
964 | winName (&winList[type]->generic), | |
965 | winList[type]->generic.height); | |
966 | } | |
967 | ||
968 | return; | |
969 | } /* _tuiAllWindowsInfo */ | |
970 | ||
971 | ||
972 | /* | |
c5aa993b JM |
973 | ** _tuiRefreshAll_command(). |
974 | */ | |
c906108c | 975 | static void |
eca6576c | 976 | _tuiRefreshAll_command (char *arg, int fromTTY) |
c906108c | 977 | { |
1854bb21 SC |
978 | /* Make sure the curses mode is enabled. */ |
979 | tui_enable (); | |
980 | ||
e8b915dc | 981 | tuiRefreshAll (); |
c906108c SS |
982 | } |
983 | ||
984 | ||
985 | /* | |
c5aa993b JM |
986 | ** _tuiSetWinTabWidth_command(). |
987 | ** Set the height of the specified window. | |
988 | */ | |
c906108c | 989 | static void |
eca6576c | 990 | _tuiSetTabWidth_command (char *arg, int fromTTY) |
c906108c | 991 | { |
1854bb21 SC |
992 | /* Make sure the curses mode is enabled. */ |
993 | tui_enable (); | |
c906108c SS |
994 | if (arg != (char *) NULL) |
995 | { | |
996 | int ts; | |
997 | ||
998 | ts = atoi (arg); | |
999 | if (ts > 0) | |
1000 | tuiSetDefaultTabLen (ts); | |
1001 | else | |
1002 | warning ("Tab widths greater than 0 must be specified.\n"); | |
1003 | } | |
1004 | ||
1005 | return; | |
1006 | } /* _tuiSetTabWidth_command */ | |
1007 | ||
1008 | ||
1009 | /* | |
c5aa993b JM |
1010 | ** _tuiSetWinHeight(). |
1011 | ** Set the height of the specified window. | |
1012 | */ | |
c906108c | 1013 | static void |
eca6576c | 1014 | _tuiSetWinHeight (char *arg, int fromTTY) |
c906108c | 1015 | { |
1854bb21 SC |
1016 | /* Make sure the curses mode is enabled. */ |
1017 | tui_enable (); | |
c906108c SS |
1018 | if (arg != (char *) NULL) |
1019 | { | |
1854bb21 | 1020 | char *buf = xstrdup (arg); |
c906108c SS |
1021 | char *bufPtr = buf; |
1022 | char *wname = (char *) NULL; | |
1023 | int newHeight, i; | |
1024 | TuiWinInfoPtr winInfo; | |
1025 | ||
1026 | wname = bufPtr; | |
1027 | bufPtr = strchr (bufPtr, ' '); | |
1028 | if (bufPtr != (char *) NULL) | |
1029 | { | |
1030 | *bufPtr = (char) 0; | |
1031 | ||
1032 | /* | |
c5aa993b JM |
1033 | ** Validate the window name |
1034 | */ | |
c906108c SS |
1035 | for (i = 0; i < strlen (wname); i++) |
1036 | wname[i] = toupper (wname[i]); | |
1037 | winInfo = partialWinByName (wname); | |
1038 | ||
1039 | if (winInfo == (TuiWinInfoPtr) NULL || !winInfo->generic.isVisible) | |
1040 | warning ("Invalid window specified. \n\ | |
1041 | The window name specified must be valid and visible.\n"); | |
1042 | else | |
1043 | { | |
1044 | /* Process the size */ | |
1045 | while (*(++bufPtr) == ' ') | |
1046 | ; | |
1047 | ||
1048 | if (*bufPtr != (char) 0) | |
1049 | { | |
1050 | int negate = FALSE; | |
1051 | int fixedSize = TRUE; | |
1052 | int inputNo;; | |
1053 | ||
1054 | if (*bufPtr == '+' || *bufPtr == '-') | |
1055 | { | |
1056 | if (*bufPtr == '-') | |
1057 | negate = TRUE; | |
1058 | fixedSize = FALSE; | |
1059 | bufPtr++; | |
1060 | } | |
1061 | inputNo = atoi (bufPtr); | |
1062 | if (inputNo > 0) | |
1063 | { | |
1064 | if (negate) | |
1065 | inputNo *= (-1); | |
1066 | if (fixedSize) | |
1067 | newHeight = inputNo; | |
1068 | else | |
1069 | newHeight = winInfo->generic.height + inputNo; | |
1070 | /* | |
c5aa993b JM |
1071 | ** Now change the window's height, and adjust all |
1072 | ** other windows around it | |
1073 | */ | |
c906108c SS |
1074 | if (_tuiAdjustWinHeights (winInfo, |
1075 | newHeight) == TUI_FAILURE) | |
1076 | warning ("Invalid window height specified.\n%s", | |
1077 | WIN_HEIGHT_USAGE); | |
1078 | else | |
1079 | init_page_info (); | |
1080 | } | |
1081 | else | |
1082 | warning ("Invalid window height specified.\n%s", | |
1083 | WIN_HEIGHT_USAGE); | |
1084 | } | |
1085 | } | |
1086 | } | |
1087 | else | |
1088 | printf_filtered (WIN_HEIGHT_USAGE); | |
1089 | ||
1090 | if (buf != (char *) NULL) | |
1091 | tuiFree (buf); | |
1092 | } | |
1093 | else | |
1094 | printf_filtered (WIN_HEIGHT_USAGE); | |
1095 | ||
1096 | return; | |
1097 | } /* _tuiSetWinHeight */ | |
1098 | ||
c906108c | 1099 | /* |
c5aa993b JM |
1100 | ** _tuiSetWinHeight_command(). |
1101 | ** Set the height of the specified window, with va_list. | |
1102 | */ | |
c906108c | 1103 | static void |
eca6576c | 1104 | _tuiSetWinHeight_command (char *arg, int fromTTY) |
c906108c | 1105 | { |
1854bb21 SC |
1106 | /* Make sure the curses mode is enabled. */ |
1107 | tui_enable (); | |
e8b915dc SC |
1108 | _tuiSetWinHeight (arg, fromTTY); |
1109 | } | |
c906108c SS |
1110 | |
1111 | ||
1112 | /* | |
c5aa993b JM |
1113 | ** _tuiXDBsetWinHeight(). |
1114 | ** XDB Compatibility command for setting the window height. This will | |
1115 | ** increase or decrease the command window by the specified amount. | |
1116 | */ | |
c906108c | 1117 | static void |
eca6576c | 1118 | _tuiXDBsetWinHeight (char *arg, int fromTTY) |
c906108c | 1119 | { |
1854bb21 SC |
1120 | /* Make sure the curses mode is enabled. */ |
1121 | tui_enable (); | |
c906108c SS |
1122 | if (arg != (char *) NULL) |
1123 | { | |
1124 | int inputNo = atoi (arg); | |
1125 | ||
1126 | if (inputNo > 0) | |
1127 | { /* Add 1 for the locator */ | |
1128 | int newHeight = termHeight () - (inputNo + 1); | |
1129 | ||
1130 | if (!_newHeightOk (winList[CMD_WIN], newHeight) || | |
1131 | _tuiAdjustWinHeights (winList[CMD_WIN], | |
1132 | newHeight) == TUI_FAILURE) | |
1133 | warning ("Invalid window height specified.\n%s", | |
1134 | XDBWIN_HEIGHT_USAGE); | |
1135 | } | |
1136 | else | |
1137 | warning ("Invalid window height specified.\n%s", | |
1138 | XDBWIN_HEIGHT_USAGE); | |
1139 | } | |
1140 | else | |
1141 | warning ("Invalid window height specified.\n%s", XDBWIN_HEIGHT_USAGE); | |
1142 | ||
1143 | return; | |
1144 | } /* _tuiXDBsetWinHeight */ | |
1145 | ||
c906108c | 1146 | /* |
c5aa993b JM |
1147 | ** _tuiSetWinHeight_command(). |
1148 | ** Set the height of the specified window, with va_list. | |
1149 | */ | |
c906108c | 1150 | static void |
eca6576c | 1151 | _tuiXDBsetWinHeight_command (char *arg, int fromTTY) |
c906108c | 1152 | { |
e8b915dc SC |
1153 | _tuiXDBsetWinHeight (arg, fromTTY); |
1154 | } | |
c906108c SS |
1155 | |
1156 | ||
1157 | /* | |
c5aa993b JM |
1158 | ** _tuiAdjustWinHeights(). |
1159 | ** Function to adjust all window heights around the primary | |
1160 | */ | |
c906108c | 1161 | static TuiStatus |
eca6576c | 1162 | _tuiAdjustWinHeights (TuiWinInfoPtr primaryWinInfo, int newHeight) |
c906108c SS |
1163 | { |
1164 | TuiStatus status = TUI_FAILURE; | |
1165 | ||
1166 | if (_newHeightOk (primaryWinInfo, newHeight)) | |
1167 | { | |
1168 | status = TUI_SUCCESS; | |
1169 | if (newHeight != primaryWinInfo->generic.height) | |
1170 | { | |
1171 | int i, diff; | |
1172 | TuiWinInfoPtr winInfo; | |
1173 | TuiGenWinInfoPtr locator = locatorWinInfoPtr (); | |
1174 | TuiLayoutType curLayout = currentLayout (); | |
1175 | ||
1176 | diff = (newHeight - primaryWinInfo->generic.height) * (-1); | |
1177 | if (curLayout == SRC_COMMAND || curLayout == DISASSEM_COMMAND) | |
1178 | { | |
1179 | TuiWinInfoPtr srcWinInfo; | |
1180 | ||
1181 | _makeInvisibleAndSetNewHeight (primaryWinInfo, newHeight); | |
1182 | if (primaryWinInfo->generic.type == CMD_WIN) | |
1183 | { | |
1184 | winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[0]; | |
1185 | srcWinInfo = winInfo; | |
1186 | } | |
1187 | else | |
1188 | { | |
1189 | winInfo = winList[CMD_WIN]; | |
1190 | srcWinInfo = primaryWinInfo; | |
1191 | } | |
1192 | _makeInvisibleAndSetNewHeight (winInfo, | |
1193 | winInfo->generic.height + diff); | |
1194 | cmdWin->generic.origin.y = locator->origin.y + 1; | |
1195 | _makeVisibleWithNewHeight (winInfo); | |
1196 | _makeVisibleWithNewHeight (primaryWinInfo); | |
1197 | if (srcWinInfo->generic.contentSize <= 0) | |
1198 | tuiEraseSourceContent (srcWinInfo, EMPTY_SOURCE_PROMPT); | |
1199 | } | |
1200 | else | |
1201 | { | |
1202 | TuiWinInfoPtr firstWin, secondWin; | |
1203 | ||
1204 | if (curLayout == SRC_DISASSEM_COMMAND) | |
1205 | { | |
1206 | firstWin = srcWin; | |
1207 | secondWin = disassemWin; | |
1208 | } | |
1209 | else | |
1210 | { | |
1211 | firstWin = dataWin; | |
1212 | secondWin = (TuiWinInfoPtr) (sourceWindows ())->list[0]; | |
1213 | } | |
1214 | if (primaryWinInfo == cmdWin) | |
1215 | { /* | |
c5aa993b JM |
1216 | ** Split the change in height accross the 1st & 2nd windows |
1217 | ** adjusting them as well. | |
1218 | */ | |
c906108c SS |
1219 | int firstSplitDiff = diff / 2; /* subtract the locator */ |
1220 | int secondSplitDiff = firstSplitDiff; | |
1221 | ||
1222 | if (diff % 2) | |
1223 | { | |
1224 | if (firstWin->generic.height > | |
1225 | secondWin->generic.height) | |
1226 | if (diff < 0) | |
1227 | firstSplitDiff--; | |
1228 | else | |
1229 | firstSplitDiff++; | |
1230 | else | |
1231 | { | |
1232 | if (diff < 0) | |
1233 | secondSplitDiff--; | |
1234 | else | |
1235 | secondSplitDiff++; | |
1236 | } | |
1237 | } | |
1238 | /* make sure that the minimum hieghts are honored */ | |
1239 | while ((firstWin->generic.height + firstSplitDiff) < 3) | |
1240 | { | |
1241 | firstSplitDiff++; | |
1242 | secondSplitDiff--; | |
1243 | } | |
1244 | while ((secondWin->generic.height + secondSplitDiff) < 3) | |
1245 | { | |
1246 | secondSplitDiff++; | |
1247 | firstSplitDiff--; | |
1248 | } | |
1249 | _makeInvisibleAndSetNewHeight ( | |
1250 | firstWin, | |
1251 | firstWin->generic.height + firstSplitDiff); | |
1252 | secondWin->generic.origin.y = firstWin->generic.height - 1; | |
1253 | _makeInvisibleAndSetNewHeight ( | |
1254 | secondWin, secondWin->generic.height + secondSplitDiff); | |
1255 | cmdWin->generic.origin.y = locator->origin.y + 1; | |
1256 | _makeInvisibleAndSetNewHeight (cmdWin, newHeight); | |
1257 | } | |
1258 | else | |
1259 | { | |
1260 | if ((cmdWin->generic.height + diff) < 1) | |
1261 | { /* | |
c5aa993b JM |
1262 | ** If there is no way to increase the command window |
1263 | ** take real estate from the 1st or 2nd window. | |
1264 | */ | |
c906108c SS |
1265 | if ((cmdWin->generic.height + diff) < 1) |
1266 | { | |
1267 | int i; | |
1268 | for (i = cmdWin->generic.height + diff; | |
1269 | (i < 1); i++) | |
1270 | if (primaryWinInfo == firstWin) | |
1271 | secondWin->generic.height--; | |
1272 | else | |
1273 | firstWin->generic.height--; | |
1274 | } | |
1275 | } | |
1276 | if (primaryWinInfo == firstWin) | |
1277 | _makeInvisibleAndSetNewHeight (firstWin, newHeight); | |
1278 | else | |
1279 | _makeInvisibleAndSetNewHeight ( | |
1280 | firstWin, | |
1281 | firstWin->generic.height); | |
1282 | secondWin->generic.origin.y = firstWin->generic.height - 1; | |
1283 | if (primaryWinInfo == secondWin) | |
1284 | _makeInvisibleAndSetNewHeight (secondWin, newHeight); | |
1285 | else | |
1286 | _makeInvisibleAndSetNewHeight ( | |
1287 | secondWin, secondWin->generic.height); | |
1288 | cmdWin->generic.origin.y = locator->origin.y + 1; | |
1289 | if ((cmdWin->generic.height + diff) < 1) | |
1290 | _makeInvisibleAndSetNewHeight (cmdWin, 1); | |
1291 | else | |
1292 | _makeInvisibleAndSetNewHeight ( | |
1293 | cmdWin, cmdWin->generic.height + diff); | |
1294 | } | |
1295 | _makeVisibleWithNewHeight (cmdWin); | |
1296 | _makeVisibleWithNewHeight (secondWin); | |
1297 | _makeVisibleWithNewHeight (firstWin); | |
1298 | if (firstWin->generic.contentSize <= 0) | |
1299 | tuiEraseSourceContent (firstWin, EMPTY_SOURCE_PROMPT); | |
1300 | if (secondWin->generic.contentSize <= 0) | |
1301 | tuiEraseSourceContent (secondWin, EMPTY_SOURCE_PROMPT); | |
1302 | } | |
1303 | } | |
1304 | } | |
1305 | ||
1306 | return status; | |
1307 | } /* _tuiAdjustWinHeights */ | |
1308 | ||
1309 | ||
1310 | /* | |
c5aa993b JM |
1311 | ** _makeInvisibleAndSetNewHeight(). |
1312 | ** Function make the target window (and auxillary windows associated | |
1313 | ** with the targer) invisible, and set the new height and location. | |
1314 | */ | |
c906108c | 1315 | static void |
eca6576c | 1316 | _makeInvisibleAndSetNewHeight (TuiWinInfoPtr winInfo, int height) |
c906108c SS |
1317 | { |
1318 | int i; | |
1319 | struct symtab *s; | |
1320 | TuiGenWinInfoPtr genWinInfo; | |
1321 | ||
1322 | ||
1323 | m_beInvisible (&winInfo->generic); | |
1324 | winInfo->generic.height = height; | |
1325 | if (height > 1) | |
1326 | winInfo->generic.viewportHeight = height - 1; | |
1327 | else | |
1328 | winInfo->generic.viewportHeight = height; | |
1329 | if (winInfo != cmdWin) | |
1330 | winInfo->generic.viewportHeight--; | |
1331 | ||
1332 | /* Now deal with the auxillary windows associated with winInfo */ | |
1333 | switch (winInfo->generic.type) | |
1334 | { | |
1335 | case SRC_WIN: | |
1336 | case DISASSEM_WIN: | |
1337 | genWinInfo = winInfo->detail.sourceInfo.executionInfo; | |
1338 | m_beInvisible (genWinInfo); | |
1339 | genWinInfo->height = height; | |
1340 | genWinInfo->origin.y = winInfo->generic.origin.y; | |
1341 | if (height > 1) | |
1342 | genWinInfo->viewportHeight = height - 1; | |
1343 | else | |
1344 | genWinInfo->viewportHeight = height; | |
1345 | if (winInfo != cmdWin) | |
1346 | genWinInfo->viewportHeight--; | |
1347 | ||
1348 | if (m_hasLocator (winInfo)) | |
1349 | { | |
1350 | genWinInfo = locatorWinInfoPtr (); | |
1351 | m_beInvisible (genWinInfo); | |
1352 | genWinInfo->origin.y = winInfo->generic.origin.y + height; | |
1353 | } | |
1354 | break; | |
1355 | case DATA_WIN: | |
1356 | /* delete all data item windows */ | |
1357 | for (i = 0; i < winInfo->generic.contentSize; i++) | |
1358 | { | |
1359 | genWinInfo = (TuiGenWinInfoPtr) & ((TuiWinElementPtr) | |
1360 | winInfo->generic.content[i])->whichElement.dataWindow; | |
1361 | tuiDelwin (genWinInfo->handle); | |
1362 | genWinInfo->handle = (WINDOW *) NULL; | |
1363 | } | |
1364 | break; | |
1365 | default: | |
1366 | break; | |
1367 | } | |
1368 | ||
1369 | return; | |
1370 | } /* _makeInvisibleAndSetNewHeight */ | |
1371 | ||
1372 | ||
1373 | /* | |
c5aa993b JM |
1374 | ** _makeVisibleWithNewHeight(). |
1375 | ** Function to make the windows with new heights visible. | |
1376 | ** This means re-creating the windows' content since the window | |
1377 | ** had to be destroyed to be made invisible. | |
1378 | */ | |
c906108c | 1379 | static void |
eca6576c | 1380 | _makeVisibleWithNewHeight (TuiWinInfoPtr winInfo) |
c906108c SS |
1381 | { |
1382 | int i; | |
1383 | struct symtab *s; | |
1384 | ||
1385 | m_beVisible (&winInfo->generic); | |
1386 | checkAndDisplayHighlightIfNeeded (winInfo); | |
1387 | switch (winInfo->generic.type) | |
1388 | { | |
1389 | case SRC_WIN: | |
1390 | case DISASSEM_WIN: | |
1391 | freeWinContent (winInfo->detail.sourceInfo.executionInfo); | |
1392 | m_beVisible (winInfo->detail.sourceInfo.executionInfo); | |
1393 | if (winInfo->generic.content != (OpaquePtr) NULL) | |
1394 | { | |
1395 | TuiLineOrAddress lineOrAddr; | |
1396 | ||
1397 | if (winInfo->generic.type == SRC_WIN) | |
1398 | lineOrAddr.lineNo = | |
1399 | winInfo->detail.sourceInfo.startLineOrAddr.lineNo; | |
1400 | else | |
1401 | lineOrAddr.addr = | |
1402 | winInfo->detail.sourceInfo.startLineOrAddr.addr; | |
1403 | freeWinContent (&winInfo->generic); | |
1404 | tuiUpdateSourceWindow (winInfo, | |
a4b99e53 | 1405 | current_source_symtab, lineOrAddr, TRUE); |
c906108c SS |
1406 | } |
1407 | else if (selected_frame != (struct frame_info *) NULL) | |
1408 | { | |
a4b99e53 | 1409 | TuiLineOrAddress line; |
c906108c SS |
1410 | extern int current_source_line; |
1411 | ||
1412 | s = find_pc_symtab (selected_frame->pc); | |
1413 | if (winInfo->generic.type == SRC_WIN) | |
a4b99e53 | 1414 | line.lineNo = current_source_line; |
c906108c | 1415 | else |
84b1e7c7 | 1416 | { |
a4b99e53 | 1417 | find_line_pc (s, current_source_line, &line.addr); |
84b1e7c7 | 1418 | } |
c906108c SS |
1419 | tuiUpdateSourceWindow (winInfo, s, line, TRUE); |
1420 | } | |
1421 | if (m_hasLocator (winInfo)) | |
1422 | { | |
1423 | m_beVisible (locatorWinInfoPtr ()); | |
1424 | tuiClearLocatorDisplay (); | |
1425 | tuiShowLocatorContent (); | |
1426 | } | |
1427 | break; | |
1428 | case DATA_WIN: | |
1429 | tuiDisplayAllData (); | |
1430 | break; | |
1431 | case CMD_WIN: | |
1432 | winInfo->detail.commandInfo.curLine = 0; | |
1433 | winInfo->detail.commandInfo.curch = 0; | |
1434 | wmove (winInfo->generic.handle, | |
1435 | winInfo->detail.commandInfo.curLine, | |
1436 | winInfo->detail.commandInfo.curch); | |
1437 | break; | |
1438 | default: | |
1439 | break; | |
1440 | } | |
1441 | ||
1442 | return; | |
1443 | } /* _makeVisibleWithNewHeight */ | |
1444 | ||
1445 | ||
1446 | static int | |
eca6576c | 1447 | _newHeightOk (TuiWinInfoPtr primaryWinInfo, int newHeight) |
c906108c SS |
1448 | { |
1449 | int ok = (newHeight < termHeight ()); | |
1450 | ||
1451 | if (ok) | |
1452 | { | |
1453 | int diff, curHeight; | |
1454 | TuiLayoutType curLayout = currentLayout (); | |
1455 | ||
1456 | diff = (newHeight - primaryWinInfo->generic.height) * (-1); | |
1457 | if (curLayout == SRC_COMMAND || curLayout == DISASSEM_COMMAND) | |
1458 | { | |
1459 | ok = ((primaryWinInfo->generic.type == CMD_WIN && | |
1460 | newHeight <= (termHeight () - 4) && | |
1461 | newHeight >= MIN_CMD_WIN_HEIGHT) || | |
1462 | (primaryWinInfo->generic.type != CMD_WIN && | |
1463 | newHeight <= (termHeight () - 2) && | |
1464 | newHeight >= MIN_WIN_HEIGHT)); | |
1465 | if (ok) | |
1466 | { /* check the total height */ | |
1467 | TuiWinInfoPtr winInfo; | |
1468 | ||
1469 | if (primaryWinInfo == cmdWin) | |
1470 | winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[0]; | |
1471 | else | |
1472 | winInfo = cmdWin; | |
1473 | ok = ((newHeight + | |
1474 | (winInfo->generic.height + diff)) <= termHeight ()); | |
1475 | } | |
1476 | } | |
1477 | else | |
1478 | { | |
1479 | int curTotalHeight, totalHeight, minHeight; | |
1480 | TuiWinInfoPtr firstWin, secondWin; | |
1481 | ||
1482 | if (curLayout == SRC_DISASSEM_COMMAND) | |
1483 | { | |
1484 | firstWin = srcWin; | |
1485 | secondWin = disassemWin; | |
1486 | } | |
1487 | else | |
1488 | { | |
1489 | firstWin = dataWin; | |
1490 | secondWin = (TuiWinInfoPtr) (sourceWindows ())->list[0]; | |
1491 | } | |
1492 | /* | |
c5aa993b JM |
1493 | ** We could simply add all the heights to obtain the same result |
1494 | ** but below is more explicit since we subtract 1 for the | |
1495 | ** line that the first and second windows share, and add one | |
1496 | ** for the locator. | |
1497 | */ | |
c906108c SS |
1498 | curTotalHeight = |
1499 | (firstWin->generic.height + secondWin->generic.height - 1) | |
c5aa993b | 1500 | + cmdWin->generic.height + 1 /*locator */ ; |
c906108c SS |
1501 | if (primaryWinInfo == cmdWin) |
1502 | { | |
1503 | /* locator included since first & second win share a line */ | |
1504 | ok = ((firstWin->generic.height + | |
1505 | secondWin->generic.height + diff) >= | |
1506 | (MIN_WIN_HEIGHT * 2) && | |
1507 | newHeight >= MIN_CMD_WIN_HEIGHT); | |
1508 | if (ok) | |
1509 | { | |
1510 | totalHeight = newHeight + (firstWin->generic.height + | |
1511 | secondWin->generic.height + diff); | |
1512 | minHeight = MIN_CMD_WIN_HEIGHT; | |
1513 | } | |
1514 | } | |
1515 | else | |
1516 | { | |
1517 | minHeight = MIN_WIN_HEIGHT; | |
1518 | /* | |
c5aa993b JM |
1519 | ** First see if we can increase/decrease the command |
1520 | ** window. And make sure that the command window is | |
1521 | ** at least 1 line | |
1522 | */ | |
c906108c SS |
1523 | ok = ((cmdWin->generic.height + diff) > 0); |
1524 | if (!ok) | |
1525 | { /* | |
c5aa993b JM |
1526 | ** Looks like we have to increase/decrease one of |
1527 | ** the other windows | |
1528 | */ | |
c906108c SS |
1529 | if (primaryWinInfo == firstWin) |
1530 | ok = (secondWin->generic.height + diff) >= minHeight; | |
1531 | else | |
1532 | ok = (firstWin->generic.height + diff) >= minHeight; | |
1533 | } | |
1534 | if (ok) | |
1535 | { | |
1536 | if (primaryWinInfo == firstWin) | |
1537 | totalHeight = newHeight + | |
1538 | secondWin->generic.height + | |
1539 | cmdWin->generic.height + diff; | |
1540 | else | |
1541 | totalHeight = newHeight + | |
1542 | firstWin->generic.height + | |
1543 | cmdWin->generic.height + diff; | |
1544 | } | |
1545 | } | |
1546 | /* | |
c5aa993b JM |
1547 | ** Now make sure that the proposed total height doesn't exceed |
1548 | ** the old total height. | |
1549 | */ | |
c906108c SS |
1550 | if (ok) |
1551 | ok = (newHeight >= minHeight && totalHeight <= curTotalHeight); | |
1552 | } | |
1553 | } | |
1554 | ||
1555 | return ok; | |
1556 | } /* _newHeightOk */ | |
1557 | ||
1558 | ||
1559 | /* | |
c5aa993b JM |
1560 | ** _parseScrollingArgs(). |
1561 | */ | |
c906108c | 1562 | static void |
eca6576c | 1563 | _parseScrollingArgs (char *arg, TuiWinInfoPtr * winToScroll, int *numToScroll) |
c906108c SS |
1564 | { |
1565 | if (numToScroll) | |
1566 | *numToScroll = 0; | |
1567 | *winToScroll = tuiWinWithFocus (); | |
1568 | ||
1569 | /* | |
c5aa993b JM |
1570 | ** First set up the default window to scroll, in case there is no |
1571 | ** window name arg | |
1572 | */ | |
c906108c SS |
1573 | if (arg != (char *) NULL) |
1574 | { | |
1575 | char *buf, *bufPtr; | |
1576 | ||
1577 | /* process the number of lines to scroll */ | |
1854bb21 | 1578 | buf = bufPtr = xstrdup (arg); |
c906108c SS |
1579 | if (isdigit (*bufPtr)) |
1580 | { | |
1581 | char *numStr; | |
1582 | ||
1583 | numStr = bufPtr; | |
1584 | bufPtr = strchr (bufPtr, ' '); | |
1585 | if (bufPtr != (char *) NULL) | |
1586 | { | |
1587 | *bufPtr = (char) 0; | |
1588 | if (numToScroll) | |
1589 | *numToScroll = atoi (numStr); | |
1590 | bufPtr++; | |
1591 | } | |
1592 | else if (numToScroll) | |
1593 | *numToScroll = atoi (numStr); | |
1594 | } | |
1595 | ||
1596 | /* process the window name if one is specified */ | |
1597 | if (bufPtr != (char *) NULL) | |
1598 | { | |
1599 | char *wname; | |
1600 | int i; | |
1601 | ||
1602 | if (*bufPtr == ' ') | |
1603 | while (*(++bufPtr) == ' ') | |
1604 | ; | |
1605 | ||
1606 | if (*bufPtr != (char) 0) | |
1607 | wname = bufPtr; | |
a4b99e53 SC |
1608 | else |
1609 | wname = "?"; | |
1610 | ||
c906108c SS |
1611 | /* Validate the window name */ |
1612 | for (i = 0; i < strlen (wname); i++) | |
1613 | wname[i] = toupper (wname[i]); | |
1614 | *winToScroll = partialWinByName (wname); | |
1615 | ||
1616 | if (*winToScroll == (TuiWinInfoPtr) NULL || | |
1617 | !(*winToScroll)->generic.isVisible) | |
1618 | warning ("Invalid window specified. \n\ | |
1619 | The window name specified must be valid and visible.\n"); | |
1620 | else if (*winToScroll == cmdWin) | |
1621 | *winToScroll = (TuiWinInfoPtr) (sourceWindows ())->list[0]; | |
1622 | } | |
1623 | tuiFree (buf); | |
1624 | } | |
1625 | ||
1626 | return; | |
1627 | } /* _parseScrollingArgs */ |