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 (TuiGenWinInfoPtr
, TuiWinType
, int, int, int, int);
24 static void _initAndMakeWin (Opaque
*, TuiWinType
, int, int, int, int, int);
25 static void _showSourceOrDisassemAndCommand (TuiLayoutType
);
26 static void _makeSourceOrDisassemWindow (TuiWinInfoPtr
*, TuiWinType
, int, int);
27 static void _makeCommandWindow (TuiWinInfoPtr
*, int, int);
28 static void _makeSourceWindow (TuiWinInfoPtr
*, int, int);
29 static void _makeDisassemWindow (TuiWinInfoPtr
*, int, int);
30 static void _makeDataWindow (TuiWinInfoPtr
*, int, int);
31 static void _showSourceCommand (void);
32 static void _showDisassemCommand (void);
33 static void _showSourceDisassemCommand (void);
34 static void _showData (TuiLayoutType
);
35 static TuiLayoutType
_nextLayout (void);
36 static TuiLayoutType
_prevLayout (void);
37 static void _tuiLayout_command (char *, int);
38 static void _tuiToggleLayout_command (char *, int);
39 static void _tui_vToggleLayout_command (va_list);
40 static void _tuiToggleSplitLayout_command (char *, int);
41 static void _tui_vToggleSplitLayout_command (va_list);
42 static Opaque
_extractDisplayStartAddr (void);
43 static void _tuiHandleXDBLayout (TuiLayoutDefPtr
);
44 static TuiStatus
_tuiSetLayoutTo (char *);
47 /***************************************
49 ***************************************/
51 #define LAYOUT_USAGE "Usage: layout prev | next | <layout_name> \n"
53 /***************************************
55 ***************************************/
56 static TuiLayoutType lastLayout
= UNDEFINED_LAYOUT
;
58 /***************************************
60 ***************************************/
64 ** Show the screen layout defined
75 TuiLayoutType curLayout
= currentLayout ();
77 if (layout
!= curLayout
)
80 ** Since the new layout may cause changes in window size, we
81 ** should free the content and reallocate on next display of
84 tuiClearAllSourceWinsContent (NO_EMPTY_SOURCE_PROMPT
);
85 freeAllSourceWinsContent ();
86 clearSourceWindows ();
87 if (layout
== SRC_DATA_COMMAND
|| layout
== DISASSEM_DATA_COMMAND
)
94 /* First make the current layout be invisible */
96 m_beInvisible (locatorWinInfoPtr ());
100 /* Now show the new layout */
102 _showSourceCommand ();
103 addToSourceWindows (srcWin
);
105 case DISASSEM_COMMAND
:
106 _showDisassemCommand ();
107 addToSourceWindows (disassemWin
);
109 case SRC_DISASSEM_COMMAND
:
110 _showSourceDisassemCommand ();
111 addToSourceWindows (srcWin
);
112 addToSourceWindows (disassemWin
);
126 ** Function to set the layout to SRC_COMMAND, DISASSEM_COMMAND,
127 ** SRC_DISASSEM_COMMAND, SRC_DATA_COMMAND, or DISASSEM_DATA_COMMAND.
128 ** If the layout is SRC_DATA_COMMAND, DISASSEM_DATA_COMMAND, or
129 ** UNDEFINED_LAYOUT, then the data window is populated according
130 ** to regsDisplayType.
135 TuiLayoutType layoutType
,
136 TuiRegisterDisplayType regsDisplayType
)
138 tuiSetLayout (layoutType
, regsDisplayType
)
139 TuiLayoutType layoutType
;
140 TuiRegisterDisplayType regsDisplayType
;
143 TuiStatus status
= TUI_SUCCESS
;
145 if (layoutType
!= UNDEFINED_LAYOUT
|| regsDisplayType
!= TUI_UNDEFINED_REGS
)
147 TuiLayoutType curLayout
= currentLayout (), newLayout
= UNDEFINED_LAYOUT
;
148 int regsPopulate
= FALSE
;
149 Opaque addr
= _extractDisplayStartAddr ();
150 TuiWinInfoPtr newWinWithFocus
= (TuiWinInfoPtr
) NULL
, winWithFocus
= tuiWinWithFocus ();
151 TuiLayoutDefPtr layoutDef
= tuiLayoutDef ();
154 if (layoutType
== UNDEFINED_LAYOUT
&&
155 regsDisplayType
!= TUI_UNDEFINED_REGS
)
157 if (curLayout
== SRC_DISASSEM_COMMAND
)
158 newLayout
= DISASSEM_DATA_COMMAND
;
159 else if (curLayout
== SRC_COMMAND
|| curLayout
== SRC_DATA_COMMAND
)
160 newLayout
= SRC_DATA_COMMAND
;
161 else if (curLayout
== DISASSEM_COMMAND
||
162 curLayout
== DISASSEM_DATA_COMMAND
)
163 newLayout
= DISASSEM_DATA_COMMAND
;
166 newLayout
= layoutType
;
168 regsPopulate
= (newLayout
== SRC_DATA_COMMAND
||
169 newLayout
== DISASSEM_DATA_COMMAND
||
170 regsDisplayType
!= TUI_UNDEFINED_REGS
);
171 if (newLayout
!= curLayout
|| regsDisplayType
!= TUI_UNDEFINED_REGS
)
173 if (newLayout
!= curLayout
)
175 if (winWithFocus
!= cmdWin
)
177 showLayout (newLayout
);
179 ** Now determine where focus should be
181 if (winWithFocus
!= cmdWin
)
186 tuiSetWinFocusTo (srcWin
);
187 layoutDef
->displayMode
= SRC_WIN
;
188 layoutDef
->split
= FALSE
;
190 case DISASSEM_COMMAND
:
191 /* the previous layout was not showing
192 ** code. this can happen if there is no
194 ** 1. if the source file is in another dir OR
195 ** 2. if target was compiled without -g
196 ** We still want to show the assembly though!
198 addr
= vcatch_errors ((OpaqueFuncPtr
)
199 tuiGetBeginAsmAddress
);
200 tuiSetWinFocusTo (disassemWin
);
201 layoutDef
->displayMode
= DISASSEM_WIN
;
202 layoutDef
->split
= FALSE
;
204 case SRC_DISASSEM_COMMAND
:
205 /* the previous layout was not showing
206 ** code. this can happen if there is no
208 ** 1. if the source file is in another dir OR
209 ** 2. if target was compiled without -g
210 ** We still want to show the assembly though!
212 addr
= vcatch_errors ((OpaqueFuncPtr
)
213 tuiGetBeginAsmAddress
);
214 if (winWithFocus
== srcWin
)
215 tuiSetWinFocusTo (srcWin
);
217 tuiSetWinFocusTo (disassemWin
);
218 layoutDef
->split
= TRUE
;
220 case SRC_DATA_COMMAND
:
221 if (winWithFocus
!= dataWin
)
222 tuiSetWinFocusTo (srcWin
);
224 tuiSetWinFocusTo (dataWin
);
225 layoutDef
->displayMode
= SRC_WIN
;
226 layoutDef
->split
= FALSE
;
228 case DISASSEM_DATA_COMMAND
:
229 /* the previous layout was not showing
230 ** code. this can happen if there is no
232 ** 1. if the source file is in another dir OR
233 ** 2. if target was compiled without -g
234 ** We still want to show the assembly though!
236 addr
= vcatch_errors ((OpaqueFuncPtr
)
237 tuiGetBeginAsmAddress
);
238 if (winWithFocus
!= dataWin
)
239 tuiSetWinFocusTo (disassemWin
);
241 tuiSetWinFocusTo (dataWin
);
242 layoutDef
->displayMode
= DISASSEM_WIN
;
243 layoutDef
->split
= FALSE
;
249 if (newWinWithFocus
!= (TuiWinInfoPtr
) NULL
)
250 tuiSetWinFocusTo (newWinWithFocus
);
252 ** Now update the window content
255 (newLayout
== SRC_DATA_COMMAND
||
256 newLayout
== DISASSEM_DATA_COMMAND
))
257 tuiDisplayAllData ();
259 tuiUpdateSourceWindowsWithAddr (addr
);
263 layoutDef
->regsDisplayType
=
264 (regsDisplayType
== TUI_UNDEFINED_REGS
?
265 TUI_GENERAL_REGS
: regsDisplayType
);
266 tuiShowRegisters (layoutDef
->regsDisplayType
);
271 status
= TUI_FAILURE
;
278 ** tui_vSetLayoutTo()
279 ** Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA,
280 ** REGS, $REGS, $GREGS, $FREGS, $SREGS with arguments in a va_list
287 tui_vSetLayoutTo (args
)
293 layoutName
= va_arg (args
, char *);
295 return (_tuiSetLayoutTo (layoutName
));
296 } /* tui_vSetLayoutTo */
300 ** tuiAddWinToLayout().
301 ** Add the specified window to the layout in a logical way.
302 ** This means setting up the most logical layout given the
303 ** window to be added.
310 tuiAddWinToLayout (type
)
314 TuiLayoutType curLayout
= currentLayout ();
319 if (curLayout
!= SRC_COMMAND
&&
320 curLayout
!= SRC_DISASSEM_COMMAND
&&
321 curLayout
!= SRC_DATA_COMMAND
)
323 clearSourceWindowsDetail ();
324 if (curLayout
== DISASSEM_DATA_COMMAND
)
325 showLayout (SRC_DATA_COMMAND
);
327 showLayout (SRC_COMMAND
);
331 if (curLayout
!= DISASSEM_COMMAND
&&
332 curLayout
!= SRC_DISASSEM_COMMAND
&&
333 curLayout
!= DISASSEM_DATA_COMMAND
)
335 clearSourceWindowsDetail ();
336 if (curLayout
== SRC_DATA_COMMAND
)
337 showLayout (DISASSEM_DATA_COMMAND
);
339 showLayout (DISASSEM_COMMAND
);
343 if (curLayout
!= SRC_DATA_COMMAND
&&
344 curLayout
!= DISASSEM_DATA_COMMAND
)
346 if (curLayout
== DISASSEM_COMMAND
)
347 showLayout (DISASSEM_DATA_COMMAND
);
349 showLayout (SRC_DATA_COMMAND
);
357 } /* tuiAddWinToLayout */
361 ** tui_vAddWinToLayout().
362 ** Add the specified window to the layout in a logical way,
363 ** with arguments in a va_list.
367 tui_vAddWinToLayout (
370 tui_vAddWinToLayout (args
)
374 TuiWinType type
= va_arg (args
, TuiWinType
);
376 tuiAddWinToLayout (type
);
379 } /* tui_vAddWinToLayout */
383 ** tuiDefaultWinHeight().
384 ** Answer the height of a window. If it hasn't been created yet,
385 ** answer what the height of a window would be based upon its
386 ** type and the layout.
390 tuiDefaultWinHeight (
392 TuiLayoutType layout
)
394 tuiDefaultWinHeight (type
, layout
)
396 TuiLayoutType layout
;
401 if (winList
[type
] != (TuiWinInfoPtr
) NULL
)
402 h
= winList
[type
]->generic
.height
;
408 case DISASSEM_COMMAND
:
409 if (m_winPtrIsNull (cmdWin
))
410 h
= termHeight () / 2;
412 h
= termHeight () - cmdWin
->generic
.height
;
414 case SRC_DISASSEM_COMMAND
:
415 case SRC_DATA_COMMAND
:
416 case DISASSEM_DATA_COMMAND
:
417 if (m_winPtrIsNull (cmdWin
))
418 h
= termHeight () / 3;
420 h
= (termHeight () - cmdWin
->generic
.height
) / 2;
429 } /* tuiDefaultWinHeight */
433 ** tuiDefaultWinViewportHeight().
434 ** Answer the height of a window. If it hasn't been created yet,
435 ** answer what the height of a window would be based upon its
436 ** type and the layout.
440 tuiDefaultWinViewportHeight (
442 TuiLayoutType layout
)
444 tuiDefaultWinViewportHeight (type
, layout
)
446 TuiLayoutType layout
;
451 h
= tuiDefaultWinHeight (type
, layout
);
453 if (winList
[type
] == cmdWin
)
459 } /* tuiDefaultWinViewportHeight */
463 ** _initialize_tuiLayout().
464 ** Function to initialize gdb commands, for tui window layout
468 _initialize_tuiLayout (void)
472 add_com ("layout", class_tui
, _tuiLayout_command
,
473 "Change the layout of windows.\n\
474 Usage: layout prev | next | <layout_name> \n\
476 src : Displays source and command windows.\n\
477 asm : Displays disassembly and command windows.\n\
478 split : Displays source, disassembly and command windows.\n\
479 regs : Displays register window. If existing layout\n\
480 is source/command or assembly/command, the \n\
481 register window is displayed. If the\n\
482 source/assembly/command (split) is displayed, \n\
483 the register window is displayed with \n\
484 the window that has current logical focus.\n");
487 add_com ("td", class_tui
, _tuiToggleLayout_command
,
488 "Toggle between Source/Command and Disassembly/Command layouts.\n");
489 add_com ("ts", class_tui
, _tuiToggleSplitLayout_command
,
490 "Toggle between Source/Command or Disassembly/Command and \n\
491 Source/Disassembly/Command layouts.\n");
496 } /* _intialize_tuiLayout */
499 /*************************
500 ** STATIC LOCAL FUNCTIONS
501 **************************/
506 ** Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA, REGS,
507 ** $REGS, $GREGS, $FREGS, $SREGS.
514 _tuiSetLayoutTo (layoutName
)
518 TuiStatus status
= TUI_SUCCESS
;
520 if (layoutName
!= (char *) NULL
)
523 register char *bufPtr
;
524 TuiLayoutType newLayout
= UNDEFINED_LAYOUT
;
525 TuiRegisterDisplayType dpyType
= TUI_UNDEFINED_REGS
;
526 TuiLayoutType curLayout
= currentLayout ();
528 bufPtr
= (char *) tuiStrDup (layoutName
);
529 for (i
= 0; (i
< strlen (layoutName
)); i
++)
530 bufPtr
[i
] = toupper (bufPtr
[i
]);
532 /* First check for ambiguous input */
533 if (strlen (bufPtr
) <= 1 && (*bufPtr
== 'S' || *bufPtr
== '$'))
535 warning ("Ambiguous command input.\n");
536 status
= TUI_FAILURE
;
540 if (subsetCompare (bufPtr
, "SRC"))
541 newLayout
= SRC_COMMAND
;
542 else if (subsetCompare (bufPtr
, "ASM"))
543 newLayout
= DISASSEM_COMMAND
;
544 else if (subsetCompare (bufPtr
, "SPLIT"))
545 newLayout
= SRC_DISASSEM_COMMAND
;
546 else if (subsetCompare (bufPtr
, "REGS") ||
547 subsetCompare (bufPtr
, TUI_GENERAL_SPECIAL_REGS_NAME
) ||
548 subsetCompare (bufPtr
, TUI_GENERAL_REGS_NAME
) ||
549 subsetCompare (bufPtr
, TUI_FLOAT_REGS_NAME
) ||
550 subsetCompare (bufPtr
, TUI_SPECIAL_REGS_NAME
))
552 if (curLayout
== SRC_COMMAND
|| curLayout
== SRC_DATA_COMMAND
)
553 newLayout
= SRC_DATA_COMMAND
;
555 newLayout
= DISASSEM_DATA_COMMAND
;
557 /* could ifdef out the following code. when compile with -z, there are null
558 pointer references that cause a core dump if 'layout regs' is the first
559 layout command issued by the user. HP has asked us to hook up this code
562 if (subsetCompare (bufPtr
, TUI_FLOAT_REGS_NAME
))
564 if (dataWin
->detail
.dataDisplayInfo
.regsDisplayType
!=
566 dataWin
->detail
.dataDisplayInfo
.regsDisplayType
!=
568 dpyType
= TUI_SFLOAT_REGS
;
571 dataWin
->detail
.dataDisplayInfo
.regsDisplayType
;
573 else if (subsetCompare (bufPtr
,
574 TUI_GENERAL_SPECIAL_REGS_NAME
))
575 dpyType
= TUI_GENERAL_AND_SPECIAL_REGS
;
576 else if (subsetCompare (bufPtr
, TUI_GENERAL_REGS_NAME
))
577 dpyType
= TUI_GENERAL_REGS
;
578 else if (subsetCompare (bufPtr
, TUI_SPECIAL_REGS_NAME
))
579 dpyType
= TUI_SPECIAL_REGS
;
582 if (dataWin
->detail
.dataDisplayInfo
.regsDisplayType
!=
585 dataWin
->detail
.dataDisplayInfo
.regsDisplayType
;
587 dpyType
= TUI_GENERAL_REGS
;
590 /* end of potential ifdef
593 /* if ifdefed out code above, then assume that the user wishes to display the
594 general purpose registers
597 /* dpyType = TUI_GENERAL_REGS;
600 else if (subsetCompare (bufPtr
, "NEXT"))
601 newLayout
= _nextLayout ();
602 else if (subsetCompare (bufPtr
, "PREV"))
603 newLayout
= _prevLayout ();
605 status
= TUI_FAILURE
;
608 tuiSetLayout (newLayout
, dpyType
);
612 status
= TUI_FAILURE
;
615 } /* _tuiSetLayoutTo */
620 _extractDisplayStartAddr (void)
622 _extractDisplayStartAddr ()
625 TuiLayoutType curLayout
= currentLayout ();
631 case SRC_DATA_COMMAND
:
632 addr
= (Opaque
) find_line_pc (
633 current_source_symtab
,
634 srcWin
->detail
.sourceInfo
.startLineOrAddr
.lineNo
);
636 case DISASSEM_COMMAND
:
637 case SRC_DISASSEM_COMMAND
:
638 case DISASSEM_DATA_COMMAND
:
639 addr
= disassemWin
->detail
.sourceInfo
.startLineOrAddr
.addr
;
642 addr
= (Opaque
) NULL
;
647 } /* _extractDisplayStartAddr */
652 _tuiHandleXDBLayout (
653 TuiLayoutDefPtr layoutDef
)
655 _tuiHandleXDBLayout (layoutDef
)
656 TuiLayoutDefPtr layoutDef
;
659 if (layoutDef
->split
)
661 tuiSetLayout (SRC_DISASSEM_COMMAND
, TUI_UNDEFINED_REGS
);
662 tuiSetWinFocusTo (winList
[layoutDef
->displayMode
]);
666 if (layoutDef
->displayMode
== SRC_WIN
)
667 tuiSetLayout (SRC_COMMAND
, TUI_UNDEFINED_REGS
);
669 tuiSetLayout (DISASSEM_DATA_COMMAND
, layoutDef
->regsDisplayType
);
674 } /* _tuiHandleXDBLayout */
679 _tuiToggleLayout_command (
683 _tuiToggleLayout_command (arg
, fromTTY
)
688 tuiDo ((TuiOpaqueFuncPtr
) _tui_vToggleLayout_command
, arg
, fromTTY
);
693 _tui_vToggleLayout_command (
696 _tui_vToggleLayout_command (args
)
700 TuiLayoutDefPtr layoutDef
= tuiLayoutDef ();
702 if (layoutDef
->displayMode
== SRC_WIN
)
703 layoutDef
->displayMode
= DISASSEM_WIN
;
705 layoutDef
->displayMode
= SRC_WIN
;
707 if (!layoutDef
->split
)
708 _tuiHandleXDBLayout (layoutDef
);
711 } /* _tuiToggleLayout_command */
716 _tuiToggleSplitLayout_command (
720 _tuiToggleSplitLayout_command (arg
, fromTTY
)
725 tuiDo ((TuiOpaqueFuncPtr
) _tui_vToggleSplitLayout_command
, arg
, fromTTY
);
730 _tui_vToggleSplitLayout_command (
733 _tui_vToggleSplitLayout_command (args
)
737 TuiLayoutDefPtr layoutDef
= tuiLayoutDef ();
739 layoutDef
->split
= (!layoutDef
->split
);
740 _tuiHandleXDBLayout (layoutDef
);
743 } /* _tui_vToggleSplitLayout_command */
752 _tuiLayout_command (arg
, fromTTY
)
757 if ((TuiStatus
) tuiDo (
758 (TuiOpaqueFuncPtr
) tui_vSetLayoutTo
, arg
) != TUI_SUCCESS
)
759 warning ("Invalid layout specified.\n%s" LAYOUT_USAGE
);
762 } /* _tuiLayout_command */
766 ** Answer the previous layout to cycle to.
775 TuiLayoutType newLayout
;
777 newLayout
= currentLayout ();
778 if (newLayout
== UNDEFINED_LAYOUT
)
779 newLayout
= SRC_COMMAND
;
783 if (newLayout
== UNDEFINED_LAYOUT
)
784 newLayout
= SRC_COMMAND
;
793 ** Answer the next layout to cycle to.
802 TuiLayoutType newLayout
;
804 newLayout
= currentLayout ();
805 if (newLayout
== SRC_COMMAND
)
806 newLayout
= DISASSEM_DATA_COMMAND
;
810 if (newLayout
== UNDEFINED_LAYOUT
)
811 newLayout
= DISASSEM_DATA_COMMAND
;
820 ** _makeCommandWindow().
825 TuiWinInfoPtr
* winInfoPtr
,
829 _makeCommandWindow (winInfoPtr
, height
, originY
)
830 TuiWinInfoPtr
*winInfoPtr
;
835 _initAndMakeWin ((Opaque
*) winInfoPtr
,
843 (*winInfoPtr
)->canHighlight
= FALSE
;
846 } /* _makeCommandWindow */
850 ** _makeSourceWindow().
855 TuiWinInfoPtr
* winInfoPtr
,
859 _makeSourceWindow (winInfoPtr
, height
, originY
)
860 TuiWinInfoPtr
*winInfoPtr
;
865 _makeSourceOrDisassemWindow (winInfoPtr
, SRC_WIN
, height
, originY
);
868 } /* _makeSourceWindow */
872 ** _makeDisassemWindow().
876 _makeDisassemWindow (
877 TuiWinInfoPtr
* winInfoPtr
,
881 _makeDisassemWindow (winInfoPtr
, height
, originY
)
882 TuiWinInfoPtr
*winInfoPtr
;
887 _makeSourceOrDisassemWindow (winInfoPtr
, DISASSEM_WIN
, height
, originY
);
890 } /* _makeDisassemWindow */
894 ** _makeDataWindow().
899 TuiWinInfoPtr
* winInfoPtr
,
903 _makeDataWindow (winInfoPtr
, height
, originY
)
904 TuiWinInfoPtr
*winInfoPtr
;
909 _initAndMakeWin ((Opaque
*) winInfoPtr
,
918 } /* _makeDataWindow */
923 ** _showSourceCommand().
924 ** Show the Source/Command layout
928 _showSourceCommand (void)
930 _showSourceCommand ()
933 _showSourceOrDisassemAndCommand (SRC_COMMAND
);
936 } /* _showSourceCommand */
940 ** _showDisassemCommand().
941 ** Show the Dissassem/Command layout
945 _showDisassemCommand (void)
947 _showDisassemCommand ()
950 _showSourceOrDisassemAndCommand (DISASSEM_COMMAND
);
953 } /* _showDisassemCommand */
957 ** _showSourceDisassemCommand().
958 ** Show the Source/Disassem/Command layout
962 _showSourceDisassemCommand (void)
964 _showSourceDisassemCommand ()
967 TuiGenWinInfoPtr locator
= locatorWinInfoPtr ();
969 if (currentLayout () != SRC_DISASSEM_COMMAND
)
971 int cmdHeight
, srcHeight
, asmHeight
;
973 if (m_winPtrNotNull (cmdWin
))
974 cmdHeight
= cmdWin
->generic
.height
;
976 cmdHeight
= termHeight () / 3;
978 srcHeight
= (termHeight () - cmdHeight
) / 2;
979 asmHeight
= termHeight () - (srcHeight
+ cmdHeight
);
981 if (m_winPtrIsNull (srcWin
))
982 _makeSourceWindow (&srcWin
, srcHeight
, 0);
985 _initGenWinInfo (&srcWin
->generic
,
986 srcWin
->generic
.type
,
988 srcWin
->generic
.width
,
989 srcWin
->detail
.sourceInfo
.executionInfo
->width
,
991 srcWin
->canHighlight
= TRUE
;
992 _initGenWinInfo (srcWin
->detail
.sourceInfo
.executionInfo
,
998 m_beVisible (srcWin
);
999 m_beVisible (srcWin
->detail
.sourceInfo
.executionInfo
);
1000 srcWin
->detail
.sourceInfo
.hasLocator
= FALSE
;;
1002 if (m_winPtrNotNull (srcWin
))
1004 TuiGenWinInfoPtr locator
= locatorWinInfoPtr ();
1006 tuiShowSourceContent (srcWin
);
1007 if (m_winPtrIsNull (disassemWin
))
1009 _makeDisassemWindow (&disassemWin
, asmHeight
, srcHeight
- 1);
1010 _initAndMakeWin ((Opaque
*) & locator
,
1015 (srcHeight
+ asmHeight
) - 1,
1020 _initGenWinInfo (locator
,
1025 (srcHeight
+ asmHeight
) - 1);
1026 disassemWin
->detail
.sourceInfo
.hasLocator
= TRUE
;
1028 &disassemWin
->generic
,
1029 disassemWin
->generic
.type
,
1031 disassemWin
->generic
.width
,
1032 disassemWin
->detail
.sourceInfo
.executionInfo
->width
,
1034 _initGenWinInfo (disassemWin
->detail
.sourceInfo
.executionInfo
,
1040 disassemWin
->canHighlight
= TRUE
;
1041 m_beVisible (disassemWin
);
1042 m_beVisible (disassemWin
->detail
.sourceInfo
.executionInfo
);
1044 if (m_winPtrNotNull (disassemWin
))
1046 srcWin
->detail
.sourceInfo
.hasLocator
= FALSE
;
1047 disassemWin
->detail
.sourceInfo
.hasLocator
= TRUE
;
1048 m_beVisible (locator
);
1049 tuiShowLocatorContent ();
1050 tuiShowSourceContent (disassemWin
);
1052 if (m_winPtrIsNull (cmdWin
))
1053 _makeCommandWindow (&cmdWin
,
1055 termHeight () - cmdHeight
);
1058 _initGenWinInfo (&cmdWin
->generic
,
1059 cmdWin
->generic
.type
,
1060 cmdWin
->generic
.height
,
1061 cmdWin
->generic
.width
,
1063 cmdWin
->generic
.origin
.y
);
1064 cmdWin
->canHighlight
= FALSE
;
1065 m_beVisible (cmdWin
);
1067 if (m_winPtrNotNull (cmdWin
))
1068 tuiRefreshWin (&cmdWin
->generic
);
1071 setCurrentLayoutTo (SRC_DISASSEM_COMMAND
);
1075 } /* _showSourceDisassemCommand */
1080 ** Show the Source/Data/Command or the Dissassembly/Data/Command layout
1085 TuiLayoutType newLayout
)
1087 _showData (newLayout
)
1088 TuiLayoutType newLayout
;
1091 int totalHeight
= (termHeight () - cmdWin
->generic
.height
);
1092 int srcHeight
, dataHeight
;
1094 TuiGenWinInfoPtr locator
= locatorWinInfoPtr ();
1097 dataHeight
= totalHeight
/ 2;
1098 srcHeight
= totalHeight
- dataHeight
;
1099 m_allBeInvisible ();
1100 m_beInvisible (locator
);
1101 _makeDataWindow (&dataWin
, dataHeight
, 0);
1102 dataWin
->canHighlight
= TRUE
;
1103 if (newLayout
== SRC_DATA_COMMAND
)
1106 winType
= DISASSEM_WIN
;
1107 if (m_winPtrIsNull (winList
[winType
]))
1109 if (winType
== SRC_WIN
)
1110 _makeSourceWindow (&winList
[winType
], srcHeight
, dataHeight
- 1);
1112 _makeDisassemWindow (&winList
[winType
], srcHeight
, dataHeight
- 1);
1113 _initAndMakeWin ((Opaque
*) & locator
,
1123 _initGenWinInfo (&winList
[winType
]->generic
,
1124 winList
[winType
]->generic
.type
,
1126 winList
[winType
]->generic
.width
,
1127 winList
[winType
]->detail
.sourceInfo
.executionInfo
->width
,
1129 _initGenWinInfo (winList
[winType
]->detail
.sourceInfo
.executionInfo
,
1135 m_beVisible (winList
[winType
]);
1136 m_beVisible (winList
[winType
]->detail
.sourceInfo
.executionInfo
);
1137 _initGenWinInfo (locator
,
1144 winList
[winType
]->detail
.sourceInfo
.hasLocator
= TRUE
;
1145 m_beVisible (locator
);
1146 tuiShowLocatorContent ();
1147 addToSourceWindows (winList
[winType
]);
1148 setCurrentLayoutTo (newLayout
);
1154 ** _initGenWinInfo().
1159 TuiGenWinInfoPtr winInfo
,
1166 _initGenWinInfo (winInfo
, type
, height
, width
, originX
, originY
)
1167 TuiGenWinInfoPtr winInfo
;
1177 winInfo
->type
= type
;
1178 winInfo
->width
= width
;
1179 winInfo
->height
= h
;
1182 winInfo
->viewportHeight
= h
- 1;
1183 if (winInfo
->type
!= CMD_WIN
)
1184 winInfo
->viewportHeight
--;
1187 winInfo
->viewportHeight
= 1;
1188 winInfo
->origin
.x
= originX
;
1189 winInfo
->origin
.y
= originY
;
1192 } /* _initGenWinInfo */
1195 ** _initAndMakeWin().
1200 Opaque
* winInfoPtr
,
1208 _initAndMakeWin (winInfoPtr
, winType
, height
, width
, originX
, originY
, boxIt
)
1218 Opaque opaqueWinInfo
= *winInfoPtr
;
1219 TuiGenWinInfoPtr generic
;
1221 if (opaqueWinInfo
== (Opaque
) NULL
)
1223 if (m_winIsAuxillary (winType
))
1224 opaqueWinInfo
= (Opaque
) allocGenericWinInfo ();
1226 opaqueWinInfo
= (Opaque
) allocWinInfo (winType
);
1228 if (m_winIsAuxillary (winType
))
1229 generic
= (TuiGenWinInfoPtr
) opaqueWinInfo
;
1231 generic
= &((TuiWinInfoPtr
) opaqueWinInfo
)->generic
;
1233 if (opaqueWinInfo
!= (Opaque
) NULL
)
1235 _initGenWinInfo (generic
, winType
, height
, width
, originX
, originY
);
1236 if (!m_winIsAuxillary (winType
))
1238 if (generic
->type
== CMD_WIN
)
1239 ((TuiWinInfoPtr
) opaqueWinInfo
)->canHighlight
= FALSE
;
1241 ((TuiWinInfoPtr
) opaqueWinInfo
)->canHighlight
= TRUE
;
1243 makeWindow (generic
, boxIt
);
1244 if (winType
== LOCATOR_WIN
)
1245 tuiClearLocatorDisplay ();
1248 *winInfoPtr
= opaqueWinInfo
;
1251 } /* _initAndMakeWin */
1255 ** _makeSourceOrDisassemWindow().
1259 _makeSourceOrDisassemWindow (
1260 TuiWinInfoPtr
* winInfoPtr
,
1265 _makeSourceOrDisassemWindow (winInfoPtr
, type
, height
, originY
)
1266 TuiWinInfoPtr
*winInfoPtr
;
1272 TuiGenWinInfoPtr executionInfo
= (TuiGenWinInfoPtr
) NULL
;
1275 ** Create the exeuction info window.
1277 if (type
== SRC_WIN
)
1278 executionInfo
= sourceExecInfoWinPtr ();
1280 executionInfo
= disassemExecInfoWinPtr ();
1281 _initAndMakeWin ((Opaque
*) & executionInfo
,
1289 ** Now create the source window.
1291 _initAndMakeWin ((Opaque
*) winInfoPtr
,
1294 termWidth () - executionInfo
->width
,
1295 executionInfo
->width
,
1299 (*winInfoPtr
)->detail
.sourceInfo
.executionInfo
= executionInfo
;
1302 } /* _makeSourceOrDisassemWindow */
1306 ** _showSourceOrDisassemAndCommand().
1307 ** Show the Source/Command or the Disassem layout
1311 _showSourceOrDisassemAndCommand (
1312 TuiLayoutType layoutType
)
1314 _showSourceOrDisassemAndCommand (layoutType
)
1315 TuiLayoutType layoutType
;
1318 if (currentLayout () != layoutType
)
1320 TuiWinInfoPtr
*winInfoPtr
;
1322 int srcHeight
, cmdHeight
;
1323 TuiGenWinInfoPtr locator
= locatorWinInfoPtr ();
1325 if (m_winPtrNotNull (cmdWin
))
1326 cmdHeight
= cmdWin
->generic
.height
;
1328 cmdHeight
= termHeight () / 3;
1329 srcHeight
= termHeight () - cmdHeight
;
1332 if (layoutType
== SRC_COMMAND
)
1333 winInfoPtr
= &srcWin
;
1335 winInfoPtr
= &disassemWin
;
1337 if (m_winPtrIsNull (*winInfoPtr
))
1339 if (layoutType
== SRC_COMMAND
)
1340 _makeSourceWindow (winInfoPtr
, srcHeight
- 1, 0);
1342 _makeDisassemWindow (winInfoPtr
, srcHeight
- 1, 0);
1343 _initAndMakeWin ((Opaque
*) & locator
,
1353 _initGenWinInfo (locator
,
1359 (*winInfoPtr
)->detail
.sourceInfo
.hasLocator
= TRUE
;
1361 &(*winInfoPtr
)->generic
,
1362 (*winInfoPtr
)->generic
.type
,
1364 (*winInfoPtr
)->generic
.width
,
1365 (*winInfoPtr
)->detail
.sourceInfo
.executionInfo
->width
,
1367 _initGenWinInfo ((*winInfoPtr
)->detail
.sourceInfo
.executionInfo
,
1373 (*winInfoPtr
)->canHighlight
= TRUE
;
1374 m_beVisible (*winInfoPtr
);
1375 m_beVisible ((*winInfoPtr
)->detail
.sourceInfo
.executionInfo
);
1377 if (m_winPtrNotNull (*winInfoPtr
))
1379 (*winInfoPtr
)->detail
.sourceInfo
.hasLocator
= TRUE
;
1380 m_beVisible (locator
);
1381 tuiShowLocatorContent ();
1382 tuiShowSourceContent (*winInfoPtr
);
1384 if (m_winPtrIsNull (cmdWin
))
1386 _makeCommandWindow (&cmdWin
, cmdHeight
, srcHeight
);
1387 tuiRefreshWin (&cmdWin
->generic
);
1391 _initGenWinInfo (&cmdWin
->generic
,
1392 cmdWin
->generic
.type
,
1393 cmdWin
->generic
.height
,
1394 cmdWin
->generic
.width
,
1395 cmdWin
->generic
.origin
.x
,
1396 cmdWin
->generic
.origin
.y
);
1397 cmdWin
->canHighlight
= FALSE
;
1398 m_beVisible (cmdWin
);
1401 setCurrentLayoutTo (layoutType
);
1405 } /* _showSourceOrDisassemAndCommand */