3 ** This module contains procedures for handling the layout of the windows.
14 #include "tuiGeneralWin.h"
17 #include "tuiDisassem.h"
19 /*******************************
21 ********************************/
23 static void _initGenWinInfo PARAMS
24 ((TuiGenWinInfoPtr
, TuiWinType
, int, int, int, int));
25 static void _initAndMakeWin PARAMS
26 ((Opaque
*, TuiWinType
, int, int, int, int, int));
27 static void _showSourceOrDisassemAndCommand PARAMS
29 static void _makeSourceOrDisassemWindow PARAMS
30 ((TuiWinInfoPtr
*, TuiWinType
, int, int));
31 static void _makeCommandWindow
PARAMS ((TuiWinInfoPtr
*, int, int));
32 static void _makeSourceWindow
PARAMS ((TuiWinInfoPtr
*, int, int));
33 static void _makeDisassemWindow PARAMS
34 ((TuiWinInfoPtr
*, int, int));
35 static void _makeDataWindow
PARAMS ((TuiWinInfoPtr
*, int, int));
36 static void _showSourceCommand
PARAMS ((void));
37 static void _showDisassemCommand
PARAMS ((void));
38 static void _showSourceDisassemCommand
PARAMS ((void));
39 static void _showData
PARAMS ((TuiLayoutType
));
40 static TuiLayoutType _nextLayout
PARAMS ((void));
41 static TuiLayoutType _prevLayout
PARAMS ((void));
42 static void _tuiLayout_command
PARAMS ((char *, int));
43 static void _tuiToggleLayout_command
PARAMS ((char *, int));
44 static void _tui_vToggleLayout_command
PARAMS ((va_list));
45 static void _tuiToggleSplitLayout_command
PARAMS ((char *, int));
46 static void _tui_vToggleSplitLayout_command
PARAMS ((va_list));
47 static Opaque _extractDisplayStartAddr
PARAMS ((void));
48 static void _tuiHandleXDBLayout
PARAMS ((TuiLayoutDefPtr
));
49 static TuiStatus _tuiSetLayoutTo
PARAMS ((char *));
52 /***************************************
54 ***************************************/
56 #define LAYOUT_USAGE "Usage: layout prev | next | <layout_name> \n"
58 /***************************************
60 ***************************************/
61 static TuiLayoutType lastLayout
= UNDEFINED_LAYOUT
;
63 /***************************************
65 ***************************************/
69 ** Show the screen layout defined
80 TuiLayoutType curLayout
= currentLayout ();
82 if (layout
!= curLayout
)
85 ** Since the new layout may cause changes in window size, we
86 ** should free the content and reallocate on next display of
89 tuiClearAllSourceWinsContent (NO_EMPTY_SOURCE_PROMPT
);
90 freeAllSourceWinsContent ();
91 clearSourceWindows ();
92 if (layout
== SRC_DATA_COMMAND
|| layout
== DISASSEM_DATA_COMMAND
)
99 /* First make the current layout be invisible */
101 m_beInvisible (locatorWinInfoPtr ());
105 /* Now show the new layout */
107 _showSourceCommand ();
108 addToSourceWindows (srcWin
);
110 case DISASSEM_COMMAND
:
111 _showDisassemCommand ();
112 addToSourceWindows (disassemWin
);
114 case SRC_DISASSEM_COMMAND
:
115 _showSourceDisassemCommand ();
116 addToSourceWindows (srcWin
);
117 addToSourceWindows (disassemWin
);
131 ** Function to set the layout to SRC_COMMAND, DISASSEM_COMMAND,
132 ** SRC_DISASSEM_COMMAND, SRC_DATA_COMMAND, or DISASSEM_DATA_COMMAND.
133 ** If the layout is SRC_DATA_COMMAND, DISASSEM_DATA_COMMAND, or
134 ** UNDEFINED_LAYOUT, then the data window is populated according
135 ** to regsDisplayType.
140 TuiLayoutType layoutType
,
141 TuiRegisterDisplayType regsDisplayType
)
143 tuiSetLayout (layoutType
, regsDisplayType
)
144 TuiLayoutType layoutType
;
145 TuiRegisterDisplayType regsDisplayType
;
148 TuiStatus status
= TUI_SUCCESS
;
150 if (layoutType
!= UNDEFINED_LAYOUT
|| regsDisplayType
!= TUI_UNDEFINED_REGS
)
152 TuiLayoutType curLayout
= currentLayout (), newLayout
= UNDEFINED_LAYOUT
;
153 int regsPopulate
= FALSE
;
154 Opaque addr
= _extractDisplayStartAddr ();
155 TuiWinInfoPtr newWinWithFocus
= (TuiWinInfoPtr
) NULL
, winWithFocus
= tuiWinWithFocus ();
156 TuiLayoutDefPtr layoutDef
= tuiLayoutDef ();
159 if (layoutType
== UNDEFINED_LAYOUT
&&
160 regsDisplayType
!= TUI_UNDEFINED_REGS
)
162 if (curLayout
== SRC_DISASSEM_COMMAND
)
163 newLayout
= DISASSEM_DATA_COMMAND
;
164 else if (curLayout
== SRC_COMMAND
|| curLayout
== SRC_DATA_COMMAND
)
165 newLayout
= SRC_DATA_COMMAND
;
166 else if (curLayout
== DISASSEM_COMMAND
||
167 curLayout
== DISASSEM_DATA_COMMAND
)
168 newLayout
= DISASSEM_DATA_COMMAND
;
171 newLayout
= layoutType
;
173 regsPopulate
= (newLayout
== SRC_DATA_COMMAND
||
174 newLayout
== DISASSEM_DATA_COMMAND
||
175 regsDisplayType
!= TUI_UNDEFINED_REGS
);
176 if (newLayout
!= curLayout
|| regsDisplayType
!= TUI_UNDEFINED_REGS
)
178 if (newLayout
!= curLayout
)
180 if (winWithFocus
!= cmdWin
)
182 showLayout (newLayout
);
184 ** Now determine where focus should be
186 if (winWithFocus
!= cmdWin
)
191 tuiSetWinFocusTo (srcWin
);
192 layoutDef
->displayMode
= SRC_WIN
;
193 layoutDef
->split
= FALSE
;
195 case DISASSEM_COMMAND
:
196 /* the previous layout was not showing
197 ** code. this can happen if there is no
199 ** 1. if the source file is in another dir OR
200 ** 2. if target was compiled without -g
201 ** We still want to show the assembly though!
203 addr
= vcatch_errors ((OpaqueFuncPtr
)
204 tuiGetBeginAsmAddress
);
205 tuiSetWinFocusTo (disassemWin
);
206 layoutDef
->displayMode
= DISASSEM_WIN
;
207 layoutDef
->split
= FALSE
;
209 case SRC_DISASSEM_COMMAND
:
210 /* the previous layout was not showing
211 ** code. this can happen if there is no
213 ** 1. if the source file is in another dir OR
214 ** 2. if target was compiled without -g
215 ** We still want to show the assembly though!
217 addr
= vcatch_errors ((OpaqueFuncPtr
)
218 tuiGetBeginAsmAddress
);
219 if (winWithFocus
== srcWin
)
220 tuiSetWinFocusTo (srcWin
);
222 tuiSetWinFocusTo (disassemWin
);
223 layoutDef
->split
= TRUE
;
225 case SRC_DATA_COMMAND
:
226 if (winWithFocus
!= dataWin
)
227 tuiSetWinFocusTo (srcWin
);
229 tuiSetWinFocusTo (dataWin
);
230 layoutDef
->displayMode
= SRC_WIN
;
231 layoutDef
->split
= FALSE
;
233 case DISASSEM_DATA_COMMAND
:
234 /* the previous layout was not showing
235 ** code. this can happen if there is no
237 ** 1. if the source file is in another dir OR
238 ** 2. if target was compiled without -g
239 ** We still want to show the assembly though!
241 addr
= vcatch_errors ((OpaqueFuncPtr
)
242 tuiGetBeginAsmAddress
);
243 if (winWithFocus
!= dataWin
)
244 tuiSetWinFocusTo (disassemWin
);
246 tuiSetWinFocusTo (dataWin
);
247 layoutDef
->displayMode
= DISASSEM_WIN
;
248 layoutDef
->split
= FALSE
;
254 if (newWinWithFocus
!= (TuiWinInfoPtr
) NULL
)
255 tuiSetWinFocusTo (newWinWithFocus
);
257 ** Now update the window content
260 (newLayout
== SRC_DATA_COMMAND
||
261 newLayout
== DISASSEM_DATA_COMMAND
))
262 tuiDisplayAllData ();
264 tuiUpdateSourceWindowsWithAddr (addr
);
268 layoutDef
->regsDisplayType
=
269 (regsDisplayType
== TUI_UNDEFINED_REGS
?
270 TUI_GENERAL_REGS
: regsDisplayType
);
271 tuiShowRegisters (layoutDef
->regsDisplayType
);
276 status
= TUI_FAILURE
;
283 ** tui_vSetLayoutTo()
284 ** Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA,
285 ** REGS, $REGS, $GREGS, $FREGS, $SREGS with arguments in a va_list
292 tui_vSetLayoutTo (args
)
298 layoutName
= va_arg (args
, char *);
300 return (_tuiSetLayoutTo (layoutName
));
301 } /* tui_vSetLayoutTo */
305 ** tuiAddWinToLayout().
306 ** Add the specified window to the layout in a logical way.
307 ** This means setting up the most logical layout given the
308 ** window to be added.
315 tuiAddWinToLayout (type
)
319 TuiLayoutType curLayout
= currentLayout ();
324 if (curLayout
!= SRC_COMMAND
&&
325 curLayout
!= SRC_DISASSEM_COMMAND
&&
326 curLayout
!= SRC_DATA_COMMAND
)
328 clearSourceWindowsDetail ();
329 if (curLayout
== DISASSEM_DATA_COMMAND
)
330 showLayout (SRC_DATA_COMMAND
);
332 showLayout (SRC_COMMAND
);
336 if (curLayout
!= DISASSEM_COMMAND
&&
337 curLayout
!= SRC_DISASSEM_COMMAND
&&
338 curLayout
!= DISASSEM_DATA_COMMAND
)
340 clearSourceWindowsDetail ();
341 if (curLayout
== SRC_DATA_COMMAND
)
342 showLayout (DISASSEM_DATA_COMMAND
);
344 showLayout (DISASSEM_COMMAND
);
348 if (curLayout
!= SRC_DATA_COMMAND
&&
349 curLayout
!= DISASSEM_DATA_COMMAND
)
351 if (curLayout
== DISASSEM_COMMAND
)
352 showLayout (DISASSEM_DATA_COMMAND
);
354 showLayout (SRC_DATA_COMMAND
);
362 } /* tuiAddWinToLayout */
366 ** tui_vAddWinToLayout().
367 ** Add the specified window to the layout in a logical way,
368 ** with arguments in a va_list.
372 tui_vAddWinToLayout (
375 tui_vAddWinToLayout (args
)
379 TuiWinType type
= va_arg (args
, TuiWinType
);
381 tuiAddWinToLayout (type
);
384 } /* tui_vAddWinToLayout */
388 ** tuiDefaultWinHeight().
389 ** Answer the height of a window. If it hasn't been created yet,
390 ** answer what the height of a window would be based upon its
391 ** type and the layout.
395 tuiDefaultWinHeight (
397 TuiLayoutType layout
)
399 tuiDefaultWinHeight (type
, layout
)
401 TuiLayoutType layout
;
406 if (winList
[type
] != (TuiWinInfoPtr
) NULL
)
407 h
= winList
[type
]->generic
.height
;
413 case DISASSEM_COMMAND
:
414 if (m_winPtrIsNull (cmdWin
))
415 h
= termHeight () / 2;
417 h
= termHeight () - cmdWin
->generic
.height
;
419 case SRC_DISASSEM_COMMAND
:
420 case SRC_DATA_COMMAND
:
421 case DISASSEM_DATA_COMMAND
:
422 if (m_winPtrIsNull (cmdWin
))
423 h
= termHeight () / 3;
425 h
= (termHeight () - cmdWin
->generic
.height
) / 2;
434 } /* tuiDefaultWinHeight */
438 ** tuiDefaultWinViewportHeight().
439 ** Answer the height of a window. If it hasn't been created yet,
440 ** answer what the height of a window would be based upon its
441 ** type and the layout.
445 tuiDefaultWinViewportHeight (
447 TuiLayoutType layout
)
449 tuiDefaultWinViewportHeight (type
, layout
)
451 TuiLayoutType layout
;
456 h
= tuiDefaultWinHeight (type
, layout
);
458 if (winList
[type
] == cmdWin
)
464 } /* tuiDefaultWinViewportHeight */
468 ** _initialize_tuiLayout().
469 ** Function to initialize gdb commands, for tui window layout
473 _initialize_tuiLayout ()
477 add_com ("layout", class_tui
, _tuiLayout_command
,
478 "Change the layout of windows.\n\
479 Usage: layout prev | next | <layout_name> \n\
481 src : Displays source and command windows.\n\
482 asm : Displays disassembly and command windows.\n\
483 split : Displays source, disassembly and command windows.\n\
484 regs : Displays register window. If existing layout\n\
485 is source/command or assembly/command, the \n\
486 register window is displayed. If the\n\
487 source/assembly/command (split) is displayed, \n\
488 the register window is displayed with \n\
489 the window that has current logical focus.\n");
492 add_com ("td", class_tui
, _tuiToggleLayout_command
,
493 "Toggle between Source/Command and Disassembly/Command layouts.\n");
494 add_com ("ts", class_tui
, _tuiToggleSplitLayout_command
,
495 "Toggle between Source/Command or Disassembly/Command and \n\
496 Source/Disassembly/Command layouts.\n");
501 } /* _intialize_tuiLayout */
504 /*************************
505 ** STATIC LOCAL FUNCTIONS
506 **************************/
511 ** Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA, REGS,
512 ** $REGS, $GREGS, $FREGS, $SREGS.
519 _tuiSetLayoutTo (layoutName
)
523 TuiStatus status
= TUI_SUCCESS
;
525 if (layoutName
!= (char *) NULL
)
528 register char *bufPtr
;
529 TuiLayoutType newLayout
= UNDEFINED_LAYOUT
;
530 TuiRegisterDisplayType dpyType
= TUI_UNDEFINED_REGS
;
531 TuiLayoutType curLayout
= currentLayout ();
533 bufPtr
= (char *) tuiStrDup (layoutName
);
534 for (i
= 0; (i
< strlen (layoutName
)); i
++)
535 bufPtr
[i
] = toupper (bufPtr
[i
]);
537 /* First check for ambiguous input */
538 if (strlen (bufPtr
) <= 1 && (*bufPtr
== 'S' || *bufPtr
== '$'))
540 warning ("Ambiguous command input.\n");
541 status
= TUI_FAILURE
;
545 if (subsetCompare (bufPtr
, "SRC"))
546 newLayout
= SRC_COMMAND
;
547 else if (subsetCompare (bufPtr
, "ASM"))
548 newLayout
= DISASSEM_COMMAND
;
549 else if (subsetCompare (bufPtr
, "SPLIT"))
550 newLayout
= SRC_DISASSEM_COMMAND
;
551 else if (subsetCompare (bufPtr
, "REGS") ||
552 subsetCompare (bufPtr
, TUI_GENERAL_SPECIAL_REGS_NAME
) ||
553 subsetCompare (bufPtr
, TUI_GENERAL_REGS_NAME
) ||
554 subsetCompare (bufPtr
, TUI_FLOAT_REGS_NAME
) ||
555 subsetCompare (bufPtr
, TUI_SPECIAL_REGS_NAME
))
557 if (curLayout
== SRC_COMMAND
|| curLayout
== SRC_DATA_COMMAND
)
558 newLayout
= SRC_DATA_COMMAND
;
560 newLayout
= DISASSEM_DATA_COMMAND
;
562 /* could ifdef out the following code. when compile with -z, there are null
563 pointer references that cause a core dump if 'layout regs' is the first
564 layout command issued by the user. HP has asked us to hook up this code
567 if (subsetCompare (bufPtr
, TUI_FLOAT_REGS_NAME
))
569 if (dataWin
->detail
.dataDisplayInfo
.regsDisplayType
!=
571 dataWin
->detail
.dataDisplayInfo
.regsDisplayType
!=
573 dpyType
= TUI_SFLOAT_REGS
;
576 dataWin
->detail
.dataDisplayInfo
.regsDisplayType
;
578 else if (subsetCompare (bufPtr
,
579 TUI_GENERAL_SPECIAL_REGS_NAME
))
580 dpyType
= TUI_GENERAL_AND_SPECIAL_REGS
;
581 else if (subsetCompare (bufPtr
, TUI_GENERAL_REGS_NAME
))
582 dpyType
= TUI_GENERAL_REGS
;
583 else if (subsetCompare (bufPtr
, TUI_SPECIAL_REGS_NAME
))
584 dpyType
= TUI_SPECIAL_REGS
;
587 if (dataWin
->detail
.dataDisplayInfo
.regsDisplayType
!=
590 dataWin
->detail
.dataDisplayInfo
.regsDisplayType
;
592 dpyType
= TUI_GENERAL_REGS
;
595 /* end of potential ifdef
598 /* if ifdefed out code above, then assume that the user wishes to display the
599 general purpose registers
602 /* dpyType = TUI_GENERAL_REGS;
605 else if (subsetCompare (bufPtr
, "NEXT"))
606 newLayout
= _nextLayout ();
607 else if (subsetCompare (bufPtr
, "PREV"))
608 newLayout
= _prevLayout ();
610 status
= TUI_FAILURE
;
613 tuiSetLayout (newLayout
, dpyType
);
617 status
= TUI_FAILURE
;
620 } /* _tuiSetLayoutTo */
625 _extractDisplayStartAddr (void)
627 _extractDisplayStartAddr ()
630 TuiLayoutType curLayout
= currentLayout ();
636 case SRC_DATA_COMMAND
:
637 addr
= (Opaque
) find_line_pc (
638 current_source_symtab
,
639 srcWin
->detail
.sourceInfo
.startLineOrAddr
.lineNo
);
641 case DISASSEM_COMMAND
:
642 case SRC_DISASSEM_COMMAND
:
643 case DISASSEM_DATA_COMMAND
:
644 addr
= disassemWin
->detail
.sourceInfo
.startLineOrAddr
.addr
;
647 addr
= (Opaque
) NULL
;
652 } /* _extractDisplayStartAddr */
657 _tuiHandleXDBLayout (
658 TuiLayoutDefPtr layoutDef
)
660 _tuiHandleXDBLayout (layoutDef
)
661 TuiLayoutDefPtr layoutDef
;
664 if (layoutDef
->split
)
666 tuiSetLayout (SRC_DISASSEM_COMMAND
, TUI_UNDEFINED_REGS
);
667 tuiSetWinFocusTo (winList
[layoutDef
->displayMode
]);
671 if (layoutDef
->displayMode
== SRC_WIN
)
672 tuiSetLayout (SRC_COMMAND
, TUI_UNDEFINED_REGS
);
674 tuiSetLayout (DISASSEM_DATA_COMMAND
, layoutDef
->regsDisplayType
);
679 } /* _tuiHandleXDBLayout */
684 _tuiToggleLayout_command (
688 _tuiToggleLayout_command (arg
, fromTTY
)
693 tuiDo ((TuiOpaqueFuncPtr
) _tui_vToggleLayout_command
, arg
, fromTTY
);
698 _tui_vToggleLayout_command (
701 _tui_vToggleLayout_command (args
)
705 TuiLayoutDefPtr layoutDef
= tuiLayoutDef ();
707 if (layoutDef
->displayMode
== SRC_WIN
)
708 layoutDef
->displayMode
= DISASSEM_WIN
;
710 layoutDef
->displayMode
= SRC_WIN
;
712 if (!layoutDef
->split
)
713 _tuiHandleXDBLayout (layoutDef
);
716 } /* _tuiToggleLayout_command */
721 _tuiToggleSplitLayout_command (
725 _tuiToggleSplitLayout_command (arg
, fromTTY
)
730 tuiDo ((TuiOpaqueFuncPtr
) _tui_vToggleSplitLayout_command
, arg
, fromTTY
);
735 _tui_vToggleSplitLayout_command (
738 _tui_vToggleSplitLayout_command (args
)
742 TuiLayoutDefPtr layoutDef
= tuiLayoutDef ();
744 layoutDef
->split
= (!layoutDef
->split
);
745 _tuiHandleXDBLayout (layoutDef
);
748 } /* _tui_vToggleSplitLayout_command */
757 _tuiLayout_command (arg
, fromTTY
)
762 if ((TuiStatus
) tuiDo (
763 (TuiOpaqueFuncPtr
) tui_vSetLayoutTo
, arg
) != TUI_SUCCESS
)
764 warning ("Invalid layout specified.\n%s" LAYOUT_USAGE
);
767 } /* _tuiLayout_command */
771 ** Answer the previous layout to cycle to.
780 TuiLayoutType newLayout
;
782 newLayout
= currentLayout ();
783 if (newLayout
== UNDEFINED_LAYOUT
)
784 newLayout
= SRC_COMMAND
;
788 if (newLayout
== UNDEFINED_LAYOUT
)
789 newLayout
= SRC_COMMAND
;
798 ** Answer the next layout to cycle to.
807 TuiLayoutType newLayout
;
809 newLayout
= currentLayout ();
810 if (newLayout
== SRC_COMMAND
)
811 newLayout
= DISASSEM_DATA_COMMAND
;
815 if (newLayout
== UNDEFINED_LAYOUT
)
816 newLayout
= DISASSEM_DATA_COMMAND
;
825 ** _makeCommandWindow().
830 TuiWinInfoPtr
* winInfoPtr
,
834 _makeCommandWindow (winInfoPtr
, height
, originY
)
835 TuiWinInfoPtr
*winInfoPtr
;
840 _initAndMakeWin ((Opaque
*) winInfoPtr
,
848 (*winInfoPtr
)->canHighlight
= FALSE
;
851 } /* _makeCommandWindow */
855 ** _makeSourceWindow().
860 TuiWinInfoPtr
* winInfoPtr
,
864 _makeSourceWindow (winInfoPtr
, height
, originY
)
865 TuiWinInfoPtr
*winInfoPtr
;
870 _makeSourceOrDisassemWindow (winInfoPtr
, SRC_WIN
, height
, originY
);
873 } /* _makeSourceWindow */
877 ** _makeDisassemWindow().
881 _makeDisassemWindow (
882 TuiWinInfoPtr
* winInfoPtr
,
886 _makeDisassemWindow (winInfoPtr
, height
, originY
)
887 TuiWinInfoPtr
*winInfoPtr
;
892 _makeSourceOrDisassemWindow (winInfoPtr
, DISASSEM_WIN
, height
, originY
);
895 } /* _makeDisassemWindow */
899 ** _makeDataWindow().
904 TuiWinInfoPtr
* winInfoPtr
,
908 _makeDataWindow (winInfoPtr
, height
, originY
)
909 TuiWinInfoPtr
*winInfoPtr
;
914 _initAndMakeWin ((Opaque
*) winInfoPtr
,
923 } /* _makeDataWindow */
928 ** _showSourceCommand().
929 ** Show the Source/Command layout
933 _showSourceCommand (void)
935 _showSourceCommand ()
938 _showSourceOrDisassemAndCommand (SRC_COMMAND
);
941 } /* _showSourceCommand */
945 ** _showDisassemCommand().
946 ** Show the Dissassem/Command layout
950 _showDisassemCommand (void)
952 _showDisassemCommand ()
955 _showSourceOrDisassemAndCommand (DISASSEM_COMMAND
);
958 } /* _showDisassemCommand */
962 ** _showSourceDisassemCommand().
963 ** Show the Source/Disassem/Command layout
967 _showSourceDisassemCommand (void)
969 _showSourceDisassemCommand ()
972 TuiGenWinInfoPtr locator
= locatorWinInfoPtr ();
974 if (currentLayout () != SRC_DISASSEM_COMMAND
)
976 int cmdHeight
, srcHeight
, asmHeight
;
978 if (m_winPtrNotNull (cmdWin
))
979 cmdHeight
= cmdWin
->generic
.height
;
981 cmdHeight
= termHeight () / 3;
983 srcHeight
= (termHeight () - cmdHeight
) / 2;
984 asmHeight
= termHeight () - (srcHeight
+ cmdHeight
);
986 if (m_winPtrIsNull (srcWin
))
987 _makeSourceWindow (&srcWin
, srcHeight
, 0);
990 _initGenWinInfo (&srcWin
->generic
,
991 srcWin
->generic
.type
,
993 srcWin
->generic
.width
,
994 srcWin
->detail
.sourceInfo
.executionInfo
->width
,
996 srcWin
->canHighlight
= TRUE
;
997 _initGenWinInfo (srcWin
->detail
.sourceInfo
.executionInfo
,
1003 m_beVisible (srcWin
);
1004 m_beVisible (srcWin
->detail
.sourceInfo
.executionInfo
);
1005 srcWin
->detail
.sourceInfo
.hasLocator
= FALSE
;;
1007 if (m_winPtrNotNull (srcWin
))
1009 TuiGenWinInfoPtr locator
= locatorWinInfoPtr ();
1011 tuiShowSourceContent (srcWin
);
1012 if (m_winPtrIsNull (disassemWin
))
1014 _makeDisassemWindow (&disassemWin
, asmHeight
, srcHeight
- 1);
1015 _initAndMakeWin ((Opaque
*) & locator
,
1020 (srcHeight
+ asmHeight
) - 1,
1025 _initGenWinInfo (locator
,
1030 (srcHeight
+ asmHeight
) - 1);
1031 disassemWin
->detail
.sourceInfo
.hasLocator
= TRUE
;
1033 &disassemWin
->generic
,
1034 disassemWin
->generic
.type
,
1036 disassemWin
->generic
.width
,
1037 disassemWin
->detail
.sourceInfo
.executionInfo
->width
,
1039 _initGenWinInfo (disassemWin
->detail
.sourceInfo
.executionInfo
,
1045 disassemWin
->canHighlight
= TRUE
;
1046 m_beVisible (disassemWin
);
1047 m_beVisible (disassemWin
->detail
.sourceInfo
.executionInfo
);
1049 if (m_winPtrNotNull (disassemWin
))
1051 srcWin
->detail
.sourceInfo
.hasLocator
= FALSE
;
1052 disassemWin
->detail
.sourceInfo
.hasLocator
= TRUE
;
1053 m_beVisible (locator
);
1054 tuiShowLocatorContent ();
1055 tuiShowSourceContent (disassemWin
);
1057 if (m_winPtrIsNull (cmdWin
))
1058 _makeCommandWindow (&cmdWin
,
1060 termHeight () - cmdHeight
);
1063 _initGenWinInfo (&cmdWin
->generic
,
1064 cmdWin
->generic
.type
,
1065 cmdWin
->generic
.height
,
1066 cmdWin
->generic
.width
,
1068 cmdWin
->generic
.origin
.y
);
1069 cmdWin
->canHighlight
= FALSE
;
1070 m_beVisible (cmdWin
);
1072 if (m_winPtrNotNull (cmdWin
))
1073 tuiRefreshWin (&cmdWin
->generic
);
1076 setCurrentLayoutTo (SRC_DISASSEM_COMMAND
);
1080 } /* _showSourceDisassemCommand */
1085 ** Show the Source/Data/Command or the Dissassembly/Data/Command layout
1090 TuiLayoutType newLayout
)
1092 _showData (newLayout
)
1093 TuiLayoutType newLayout
;
1096 int totalHeight
= (termHeight () - cmdWin
->generic
.height
);
1097 int srcHeight
, dataHeight
;
1099 TuiGenWinInfoPtr locator
= locatorWinInfoPtr ();
1102 dataHeight
= totalHeight
/ 2;
1103 srcHeight
= totalHeight
- dataHeight
;
1104 m_allBeInvisible ();
1105 m_beInvisible (locator
);
1106 _makeDataWindow (&dataWin
, dataHeight
, 0);
1107 dataWin
->canHighlight
= TRUE
;
1108 if (newLayout
== SRC_DATA_COMMAND
)
1111 winType
= DISASSEM_WIN
;
1112 if (m_winPtrIsNull (winList
[winType
]))
1114 if (winType
== SRC_WIN
)
1115 _makeSourceWindow (&winList
[winType
], srcHeight
, dataHeight
- 1);
1117 _makeDisassemWindow (&winList
[winType
], srcHeight
, dataHeight
- 1);
1118 _initAndMakeWin ((Opaque
*) & locator
,
1128 _initGenWinInfo (&winList
[winType
]->generic
,
1129 winList
[winType
]->generic
.type
,
1131 winList
[winType
]->generic
.width
,
1132 winList
[winType
]->detail
.sourceInfo
.executionInfo
->width
,
1134 _initGenWinInfo (winList
[winType
]->detail
.sourceInfo
.executionInfo
,
1140 m_beVisible (winList
[winType
]);
1141 m_beVisible (winList
[winType
]->detail
.sourceInfo
.executionInfo
);
1142 _initGenWinInfo (locator
,
1149 winList
[winType
]->detail
.sourceInfo
.hasLocator
= TRUE
;
1150 m_beVisible (locator
);
1151 tuiShowLocatorContent ();
1152 addToSourceWindows (winList
[winType
]);
1153 setCurrentLayoutTo (newLayout
);
1159 ** _initGenWinInfo().
1164 TuiGenWinInfoPtr winInfo
,
1171 _initGenWinInfo (winInfo
, type
, height
, width
, originX
, originY
)
1172 TuiGenWinInfoPtr winInfo
;
1182 winInfo
->type
= type
;
1183 winInfo
->width
= width
;
1184 winInfo
->height
= h
;
1187 winInfo
->viewportHeight
= h
- 1;
1188 if (winInfo
->type
!= CMD_WIN
)
1189 winInfo
->viewportHeight
--;
1192 winInfo
->viewportHeight
= 1;
1193 winInfo
->origin
.x
= originX
;
1194 winInfo
->origin
.y
= originY
;
1197 } /* _initGenWinInfo */
1200 ** _initAndMakeWin().
1205 Opaque
* winInfoPtr
,
1213 _initAndMakeWin (winInfoPtr
, winType
, height
, width
, originX
, originY
, boxIt
)
1223 Opaque opaqueWinInfo
= *winInfoPtr
;
1224 TuiGenWinInfoPtr generic
;
1226 if (opaqueWinInfo
== (Opaque
) NULL
)
1228 if (m_winIsAuxillary (winType
))
1229 opaqueWinInfo
= (Opaque
) allocGenericWinInfo ();
1231 opaqueWinInfo
= (Opaque
) allocWinInfo (winType
);
1233 if (m_winIsAuxillary (winType
))
1234 generic
= (TuiGenWinInfoPtr
) opaqueWinInfo
;
1236 generic
= &((TuiWinInfoPtr
) opaqueWinInfo
)->generic
;
1238 if (opaqueWinInfo
!= (Opaque
) NULL
)
1240 _initGenWinInfo (generic
, winType
, height
, width
, originX
, originY
);
1241 if (!m_winIsAuxillary (winType
))
1243 if (generic
->type
== CMD_WIN
)
1244 ((TuiWinInfoPtr
) opaqueWinInfo
)->canHighlight
= FALSE
;
1246 ((TuiWinInfoPtr
) opaqueWinInfo
)->canHighlight
= TRUE
;
1248 makeWindow (generic
, boxIt
);
1249 if (winType
== LOCATOR_WIN
)
1250 tuiClearLocatorDisplay ();
1253 *winInfoPtr
= opaqueWinInfo
;
1256 } /* _initAndMakeWin */
1260 ** _makeSourceOrDisassemWindow().
1264 _makeSourceOrDisassemWindow (
1265 TuiWinInfoPtr
* winInfoPtr
,
1270 _makeSourceOrDisassemWindow (winInfoPtr
, type
, height
, originY
)
1271 TuiWinInfoPtr
*winInfoPtr
;
1277 TuiGenWinInfoPtr executionInfo
= (TuiGenWinInfoPtr
) NULL
;
1280 ** Create the exeuction info window.
1282 if (type
== SRC_WIN
)
1283 executionInfo
= sourceExecInfoWinPtr ();
1285 executionInfo
= disassemExecInfoWinPtr ();
1286 _initAndMakeWin ((Opaque
*) & executionInfo
,
1294 ** Now create the source window.
1296 _initAndMakeWin ((Opaque
*) winInfoPtr
,
1299 termWidth () - executionInfo
->width
,
1300 executionInfo
->width
,
1304 (*winInfoPtr
)->detail
.sourceInfo
.executionInfo
= executionInfo
;
1307 } /* _makeSourceOrDisassemWindow */
1311 ** _showSourceOrDisassemAndCommand().
1312 ** Show the Source/Command or the Disassem layout
1316 _showSourceOrDisassemAndCommand (
1317 TuiLayoutType layoutType
)
1319 _showSourceOrDisassemAndCommand (layoutType
)
1320 TuiLayoutType layoutType
;
1323 if (currentLayout () != layoutType
)
1325 TuiWinInfoPtr
*winInfoPtr
;
1327 int srcHeight
, cmdHeight
;
1328 TuiGenWinInfoPtr locator
= locatorWinInfoPtr ();
1330 if (m_winPtrNotNull (cmdWin
))
1331 cmdHeight
= cmdWin
->generic
.height
;
1333 cmdHeight
= termHeight () / 3;
1334 srcHeight
= termHeight () - cmdHeight
;
1337 if (layoutType
== SRC_COMMAND
)
1338 winInfoPtr
= &srcWin
;
1340 winInfoPtr
= &disassemWin
;
1342 if (m_winPtrIsNull (*winInfoPtr
))
1344 if (layoutType
== SRC_COMMAND
)
1345 _makeSourceWindow (winInfoPtr
, srcHeight
- 1, 0);
1347 _makeDisassemWindow (winInfoPtr
, srcHeight
- 1, 0);
1348 _initAndMakeWin ((Opaque
*) & locator
,
1358 _initGenWinInfo (locator
,
1364 (*winInfoPtr
)->detail
.sourceInfo
.hasLocator
= TRUE
;
1366 &(*winInfoPtr
)->generic
,
1367 (*winInfoPtr
)->generic
.type
,
1369 (*winInfoPtr
)->generic
.width
,
1370 (*winInfoPtr
)->detail
.sourceInfo
.executionInfo
->width
,
1372 _initGenWinInfo ((*winInfoPtr
)->detail
.sourceInfo
.executionInfo
,
1378 (*winInfoPtr
)->canHighlight
= TRUE
;
1379 m_beVisible (*winInfoPtr
);
1380 m_beVisible ((*winInfoPtr
)->detail
.sourceInfo
.executionInfo
);
1382 if (m_winPtrNotNull (*winInfoPtr
))
1384 (*winInfoPtr
)->detail
.sourceInfo
.hasLocator
= TRUE
;
1385 m_beVisible (locator
);
1386 tuiShowLocatorContent ();
1387 tuiShowSourceContent (*winInfoPtr
);
1389 if (m_winPtrIsNull (cmdWin
))
1391 _makeCommandWindow (&cmdWin
, cmdHeight
, srcHeight
);
1392 tuiRefreshWin (&cmdWin
->generic
);
1396 _initGenWinInfo (&cmdWin
->generic
,
1397 cmdWin
->generic
.type
,
1398 cmdWin
->generic
.height
,
1399 cmdWin
->generic
.width
,
1400 cmdWin
->generic
.origin
.x
,
1401 cmdWin
->generic
.origin
.y
);
1402 cmdWin
->canHighlight
= FALSE
;
1403 m_beVisible (cmdWin
);
1406 setCurrentLayoutTo (layoutType
);
1410 } /* _showSourceOrDisassemAndCommand */