3 ** This module contains functions for displaying source or assembly in the "source" window.
4 * The "source" window may be the assembly or the source windows.
11 #include "breakpoint.h"
16 #include "tuiSourceWin.h"
17 #include "tuiSource.h"
18 #include "tuiDisassem.h"
21 /*****************************************
22 ** EXTERNAL FUNCTION DECLS **
23 ******************************************/
25 /*****************************************
26 ** EXTERNAL DATA DECLS **
27 ******************************************/
28 extern int current_source_line
;
29 extern struct symtab
*current_source_symtab
;
32 /*****************************************
33 ** STATIC LOCAL FUNCTIONS FORWARD DECLS **
34 ******************************************/
36 /*****************************************
37 ** STATIC LOCAL DATA **
38 ******************************************/
41 /*****************************************
42 ** PUBLIC FUNCTIONS **
43 ******************************************/
45 /*********************************
46 ** SOURCE/DISASSEM FUNCTIONS **
47 *********************************/
50 ** tuiSrcWinIsDisplayed().
54 tuiSrcWinIsDisplayed (void)
56 tuiSrcWinIsDisplayed ()
59 return (m_winPtrNotNull (srcWin
) && srcWin
->generic
.isVisible
);
60 } /* tuiSrcWinIsDisplayed */
64 ** tuiAsmWinIsDisplayed().
68 tuiAsmWinIsDisplayed (void)
70 tuiAsmWinIsDisplayed ()
73 return (m_winPtrNotNull (disassemWin
) && disassemWin
->generic
.isVisible
);
74 } /* tuiAsmWinIsDisplayed */
78 ** tuiDisplayMainFunction().
79 ** Function to display the "main" routine"
83 tuiDisplayMainFunction (void)
85 tuiDisplayMainFunction ()
88 if ((sourceWindows ())->count
> 0)
92 addr
= parse_and_eval_address ("main");
93 if (addr
<= (CORE_ADDR
) 0)
94 addr
= parse_and_eval_address ("MAIN");
95 if (addr
> (CORE_ADDR
) 0)
97 struct symtab_and_line sal
;
99 tuiUpdateSourceWindowsWithAddr ((Opaque
) addr
);
100 sal
= find_pc_line (addr
, 0);
101 tuiSwitchFilename (sal
.symtab
->filename
);
106 } /* tuiDisplayMainFunction */
111 ** tuiUpdateSourceWindow().
112 ** Function to display source in the source window. This function
113 ** initializes the horizontal scroll to 0.
117 tuiUpdateSourceWindow (
118 TuiWinInfoPtr winInfo
,
123 tuiUpdateSourceWindow (winInfo
, s
, lineOrAddr
, noerror
)
124 TuiWinInfoPtr winInfo
;
130 winInfo
->detail
.sourceInfo
.horizontalOffset
= 0;
131 tuiUpdateSourceWindowAsIs (winInfo
, s
, lineOrAddr
, noerror
);
134 } /* tuiUpdateSourceWindow */
138 ** tuiUpdateSourceWindowAsIs().
139 ** Function to display source in the source/asm window. This
140 ** function shows the source as specified by the horizontal offset.
144 tuiUpdateSourceWindowAsIs (
145 TuiWinInfoPtr winInfo
,
150 tuiUpdateSourceWindowAsIs (winInfo
, s
, lineOrAddr
, noerror
)
151 TuiWinInfoPtr winInfo
;
159 if (winInfo
->generic
.type
== SRC_WIN
)
160 ret
= tuiSetSourceContent (s
, (int) lineOrAddr
, noerror
);
162 ret
= tuiSetDisassemContent (s
, (Opaque
) lineOrAddr
);
164 if (ret
== TUI_FAILURE
)
166 tuiClearSourceContent (winInfo
, EMPTY_SOURCE_PROMPT
);
167 tuiClearExecInfoContent (winInfo
);
171 tuiEraseSourceContent (winInfo
, NO_EMPTY_SOURCE_PROMPT
);
172 tuiShowSourceContent (winInfo
);
173 tuiUpdateExecInfo (winInfo
);
174 if (winInfo
->generic
.type
== SRC_WIN
)
176 current_source_line
= (int) lineOrAddr
+
177 (winInfo
->generic
.contentSize
- 2);
178 current_source_symtab
= s
;
180 ** If the focus was in the asm win, put it in the src
181 ** win if we don't have a split layout
183 if (tuiWinWithFocus () == disassemWin
&&
184 currentLayout () != SRC_DISASSEM_COMMAND
)
185 tuiSetWinFocusTo (srcWin
);
191 } /* tuiUpdateSourceWindowAsIs */
195 ** tuiUpdateSourceWindowsWithAddr().
196 ** Function to ensure that the source and/or disassemly windows
197 ** reflect the input address.
201 tuiUpdateSourceWindowsWithAddr (
204 tuiUpdateSourceWindowsWithAddr (addr
)
208 if (addr
> (Opaque
) NULL
)
210 struct symtab_and_line sal
;
212 switch (currentLayout ())
214 case DISASSEM_COMMAND
:
215 case DISASSEM_DATA_COMMAND
:
216 tuiShowDisassem (addr
);
218 case SRC_DISASSEM_COMMAND
:
219 tuiShowDisassemAndUpdateSource (addr
);
222 sal
= find_pc_line ((CORE_ADDR
) addr
, 0);
223 tuiShowSource (sal
.symtab
,
233 for (i
= 0; i
< (sourceWindows ())->count
; i
++)
235 TuiWinInfoPtr winInfo
= (TuiWinInfoPtr
) (sourceWindows ())->list
[i
];
237 tuiClearSourceContent (winInfo
, EMPTY_SOURCE_PROMPT
);
238 tuiClearExecInfoContent (winInfo
);
243 } /* tuiUpdateSourceWindowsWithAddr */
247 ** tui_vUpdateSourceWindowsWithAddr()
248 ** Update the source window with the address in a va_list
252 tui_vUpdateSourceWindowsWithAddr (
255 tui_vUpdateSourceWindowsWithAddr (args
)
259 Opaque addr
= va_arg (args
, Opaque
);
261 tuiUpdateSourceWindowsWithAddr (addr
);
264 } /* tui_vUpdateSourceWindowsWithAddr */
268 ** tuiUpdateSourceWindowsWithLine().
269 ** Function to ensure that the source and/or disassemly windows
270 ** reflect the input address.
274 tuiUpdateSourceWindowsWithLine (
278 tuiUpdateSourceWindowsWithLine (s
, line
)
283 switch (currentLayout ())
285 case DISASSEM_COMMAND
:
286 case DISASSEM_DATA_COMMAND
:
287 tuiUpdateSourceWindowsWithAddr ((Opaque
) find_line_pc (s
, line
));
290 tuiShowSource (s
, (Opaque
) line
, FALSE
);
291 if (currentLayout () == SRC_DISASSEM_COMMAND
)
292 tuiShowDisassem ((Opaque
) find_line_pc (s
, line
));
297 } /* tuiUpdateSourceWindowsWithLine */
301 ** tui_vUpdateSourceWindowsWithLine()
302 ** Update the source window with the line number in a va_list
306 tui_vUpdateSourceWindowsWithLine (
309 tui_vUpdateSourceWindowsWithLine (args
)
313 struct symtab
*s
= va_arg (args
, struct symtab
*);
314 int line
= va_arg (args
, int);
316 tuiUpdateSourceWindowsWithLine (s
, line
);
319 } /* tui_vUpdateSourceWindowsWithLine */
323 ** tuiClearSourceContent().
327 tuiClearSourceContent (
328 TuiWinInfoPtr winInfo
,
331 tuiClearSourceContent (winInfo
, displayPrompt
)
332 TuiWinInfoPtr winInfo
;
336 if (m_winPtrNotNull (winInfo
))
340 winInfo
->generic
.contentInUse
= FALSE
;
341 tuiEraseSourceContent (winInfo
, displayPrompt
);
342 for (i
= 0; i
< winInfo
->generic
.contentSize
; i
++)
344 TuiWinElementPtr element
=
345 (TuiWinElementPtr
) winInfo
->generic
.content
[i
];
346 element
->whichElement
.source
.hasBreak
= FALSE
;
347 element
->whichElement
.source
.isExecPoint
= FALSE
;
352 } /* tuiClearSourceContent */
356 ** tuiClearAllSourceWinsContent().
360 tuiClearAllSourceWinsContent (
363 tuiClearAllSourceWinsContent (displayPrompt
)
369 for (i
= 0; i
< (sourceWindows ())->count
; i
++)
370 tuiClearSourceContent ((TuiWinInfoPtr
) (sourceWindows ())->list
[i
],
374 } /* tuiClearAllSourceWinsContent */
378 ** tuiEraseSourceContent().
382 tuiEraseSourceContent (
383 TuiWinInfoPtr winInfo
,
386 tuiEraseSourceContent (winInfo
, displayPrompt
)
387 TuiWinInfoPtr winInfo
;
392 int halfWidth
= (winInfo
->generic
.width
- 2) / 2;
394 if (winInfo
->generic
.handle
!= (WINDOW
*) NULL
)
396 werase (winInfo
->generic
.handle
);
397 checkAndDisplayHighlightIfNeeded (winInfo
);
398 if (displayPrompt
== EMPTY_SOURCE_PROMPT
)
402 if (winInfo
->generic
.type
== SRC_WIN
)
403 noSrcStr
= NO_SRC_STRING
;
405 noSrcStr
= NO_DISASSEM_STRING
;
406 if (strlen (noSrcStr
) >= halfWidth
)
409 xPos
= halfWidth
- strlen (noSrcStr
);
410 mvwaddstr (winInfo
->generic
.handle
,
411 (winInfo
->generic
.height
/ 2),
415 /* elz: added this function call to set the real contents of
416 the window to what is on the screen, so that later calls
417 to refresh, do display
418 the correct stuff, and not the old image */
420 tuiSetSourceContentNil (winInfo
, noSrcStr
);
422 tuiRefreshWin (&winInfo
->generic
);
425 } /* tuiEraseSourceContent */
429 ** tuiEraseAllSourceContent().
433 tuiEraseAllSourceWinsContent (
436 tuiEraseAllSourceWinsContent (displayPrompt
)
442 for (i
= 0; i
< (sourceWindows ())->count
; i
++)
443 tuiEraseSourceContent ((TuiWinInfoPtr
) (sourceWindows ())->list
[i
],
447 } /* tuiEraseAllSourceWinsContent */
451 ** tuiShowSourceContent().
455 tuiShowSourceContent (
456 TuiWinInfoPtr winInfo
)
458 tuiShowSourceContent (winInfo
)
459 TuiWinInfoPtr winInfo
;
462 int curLine
, i
, curX
;
464 tuiEraseSourceContent (winInfo
, (winInfo
->generic
.contentSize
<= 0));
465 if (winInfo
->generic
.contentSize
> 0)
469 for (curLine
= 1; (curLine
<= winInfo
->generic
.contentSize
); curLine
++)
471 winInfo
->generic
.handle
,
475 winInfo
->generic
.content
[curLine
- 1])->whichElement
.source
.line
);
477 checkAndDisplayHighlightIfNeeded (winInfo
);
478 tuiRefreshWin (&winInfo
->generic
);
479 winInfo
->generic
.contentInUse
= TRUE
;
482 } /* tuiShowSourceContent */
486 ** tuiShowAllSourceWinsContent()
490 tuiShowAllSourceWinsContent (void)
492 tuiShowAllSourceWinsContent ()
497 for (i
= 0; i
< (sourceWindows ())->count
; i
++)
498 tuiShowSourceContent ((TuiWinInfoPtr
) (sourceWindows ())->list
[i
]);
501 } /* tuiShowAllSourceWinsContent */
505 ** tuiHorizontalSourceScroll().
506 ** Scroll the source forward or backward horizontally
510 tuiHorizontalSourceScroll (
511 TuiWinInfoPtr winInfo
,
512 TuiScrollDirection direction
,
515 tuiHorizontalSourceScroll (winInfo
, direction
, numToScroll
)
516 TuiWinInfoPtr winInfo
;
517 TuiScrollDirection direction
;
521 if (winInfo
->generic
.content
!= (OpaquePtr
) NULL
)
526 if (current_source_symtab
== (struct symtab
*) NULL
)
527 s
= find_pc_symtab (selected_frame
->pc
);
529 s
= current_source_symtab
;
531 if (direction
== LEFT_SCROLL
)
532 offset
= winInfo
->detail
.sourceInfo
.horizontalOffset
+ numToScroll
;
536 winInfo
->detail
.sourceInfo
.horizontalOffset
- numToScroll
) < 0)
539 winInfo
->detail
.sourceInfo
.horizontalOffset
= offset
;
540 tuiUpdateSourceWindowAsIs (
543 ((winInfo
== srcWin
) ?
544 (Opaque
) ((TuiWinElementPtr
)
545 winInfo
->generic
.content
[0])->whichElement
.source
.lineOrAddr
.lineNo
:
546 (Opaque
) ((TuiWinElementPtr
)
547 winInfo
->generic
.content
[0])->whichElement
.source
.lineOrAddr
.addr
),
552 } /* tuiHorizontalSourceScroll */
556 ** tuiSetHasExecPointAt().
557 ** Set or clear the hasBreak flag in the line whose line is lineNo.
561 tuiSetIsExecPointAt (
563 TuiWinInfoPtr winInfo
)
565 tuiSetIsExecPointAt (lineOrAddr
, winInfo
)
567 TuiWinInfoPtr winInfo
;
571 TuiWinContent content
= (TuiWinContent
) winInfo
->generic
.content
;
574 while (i
< winInfo
->generic
.contentSize
)
576 if (content
[i
]->whichElement
.source
.lineOrAddr
.addr
== lineOrAddr
)
577 content
[i
]->whichElement
.source
.isExecPoint
= TRUE
;
579 content
[i
]->whichElement
.source
.isExecPoint
= FALSE
;
584 } /* tuiSetIsExecPointAt */
588 ** tuiSetHasBreakAt().
589 ** Set or clear the hasBreak flag in the line whose line is lineNo.
594 struct breakpoint
*bp
,
595 TuiWinInfoPtr winInfo
,
598 tuiSetHasBreakAt (bp
, winInfo
, hasBreak
)
599 struct breakpoint
*bp
;
600 TuiWinInfoPtr winInfo
;
605 TuiWinContent content
= (TuiWinContent
) winInfo
->generic
.content
;
608 while (i
< winInfo
->generic
.contentSize
)
611 TuiGenWinInfoPtr locator
= locatorWinInfoPtr ();
613 if (winInfo
== srcWin
)
615 char *fileNameDisplayed
= (char *) NULL
;
617 if (((TuiWinElementPtr
)
618 locator
->content
[0])->whichElement
.locator
.fileName
!=
620 fileNameDisplayed
= ((TuiWinElementPtr
)
621 locator
->content
[0])->whichElement
.locator
.fileName
;
622 else if (current_source_symtab
!= (struct symtab
*) NULL
)
623 fileNameDisplayed
= current_source_symtab
->filename
;
625 gotIt
= (fileNameDisplayed
!= (char *) NULL
&&
626 (strcmp (bp
->source_file
, fileNameDisplayed
) == 0) &&
627 content
[i
]->whichElement
.source
.lineOrAddr
.lineNo
==
631 gotIt
= (content
[i
]->whichElement
.source
.lineOrAddr
.addr
632 == (Opaque
) bp
->address
);
635 content
[i
]->whichElement
.source
.hasBreak
= hasBreak
;
642 } /* tuiSetHasBreakAt */
646 ** tuiAllSetHasBreakAt().
647 ** Set or clear the hasBreak flag in all displayed source windows.
651 tuiAllSetHasBreakAt (
652 struct breakpoint
*bp
,
655 tuiAllSetHasBreakAt (bp
, hasBreak
)
656 struct breakpoint
*bp
;
662 for (i
= 0; i
< (sourceWindows ())->count
; i
++)
663 tuiSetHasBreakAt (bp
,
664 (TuiWinInfoPtr
) (sourceWindows ())->list
[i
], hasBreak
);
667 } /* tuiAllSetHasBreakAt */
671 ** tui_vAllSetHasBreakAt()
672 ** Set or clear the hasBreak flag in all displayed source windows,
673 ** with params in a va_list
677 tui_vAllSetHasBreakAt (
680 tui_vAllSetHasBreakAt (args
)
684 struct breakpoint
*bp
= va_arg (args
, struct breakpoint
*);
685 int hasBreak
= va_arg (args
, int);
687 tuiAllSetHasBreakAt (bp
, hasBreak
);
690 } /* tui_vAllSetHasBreakAt */
694 /*********************************
695 ** EXECUTION INFO FUNCTIONS **
696 *********************************/
699 ** tuiSetExecInfoContent().
700 ** Function to initialize the content of the execution info window,
701 ** based upon the input window which is either the source or
702 ** disassembly window.
706 tuiSetExecInfoContent (
707 TuiWinInfoPtr winInfo
)
709 tuiSetExecInfoContent (winInfo
)
710 TuiWinInfoPtr winInfo
;
713 TuiStatus ret
= TUI_SUCCESS
;
715 if (winInfo
->detail
.sourceInfo
.executionInfo
!= (TuiGenWinInfoPtr
) NULL
)
717 TuiGenWinInfoPtr execInfoPtr
= winInfo
->detail
.sourceInfo
.executionInfo
;
719 if (execInfoPtr
->content
== (OpaquePtr
) NULL
)
720 execInfoPtr
->content
=
721 (OpaquePtr
) allocContent (winInfo
->generic
.height
,
723 if (execInfoPtr
->content
!= (OpaquePtr
) NULL
)
727 for (i
= 0; i
< winInfo
->generic
.contentSize
; i
++)
729 TuiWinElementPtr element
;
730 TuiWinElementPtr srcElement
;
732 element
= (TuiWinElementPtr
) execInfoPtr
->content
[i
];
733 srcElement
= (TuiWinElementPtr
) winInfo
->generic
.content
[i
];
735 ** First check to see if we have a breakpoint that is
736 ** temporary. If so, and this is our current execution point,
737 ** then clear the break indicator.
739 if (srcElement
->whichElement
.source
.hasBreak
&&
740 srcElement
->whichElement
.source
.isExecPoint
)
742 struct breakpoint
*bp
;
744 extern struct breakpoint
*breakpoint_chain
;
746 for (bp
= breakpoint_chain
;
747 (bp
!= (struct breakpoint
*) NULL
&& !found
);
751 (winInfo
== srcWin
&&
753 srcElement
->whichElement
.source
.lineOrAddr
.lineNo
) ||
754 (winInfo
== disassemWin
&&
755 bp
->address
== (CORE_ADDR
)
756 srcElement
->whichElement
.source
.lineOrAddr
.addr
);
758 srcElement
->whichElement
.source
.hasBreak
=
759 (bp
->disposition
!= del
|| bp
->hit_count
<= 0);
762 srcElement
->whichElement
.source
.hasBreak
= FALSE
;
765 ** Now update the exec info content based upon the state
766 ** of each line as indicated by the source content.
768 if (srcElement
->whichElement
.source
.hasBreak
&&
769 srcElement
->whichElement
.source
.isExecPoint
)
770 element
->whichElement
.simpleString
= breakLocationStr ();
771 else if (srcElement
->whichElement
.source
.hasBreak
)
772 element
->whichElement
.simpleString
= breakStr ();
773 else if (srcElement
->whichElement
.source
.isExecPoint
)
774 element
->whichElement
.simpleString
= locationStr ();
776 element
->whichElement
.simpleString
= blankStr ();
778 execInfoPtr
->contentSize
= winInfo
->generic
.contentSize
;
785 } /* tuiSetExecInfoContent */
789 ** tuiShowExecInfoContent().
793 tuiShowExecInfoContent (
794 TuiWinInfoPtr winInfo
)
796 tuiShowExecInfoContent (winInfo
)
797 TuiWinInfoPtr winInfo
;
800 TuiGenWinInfoPtr execInfo
= winInfo
->detail
.sourceInfo
.executionInfo
;
803 werase (execInfo
->handle
);
804 tuiRefreshWin (execInfo
);
805 for (curLine
= 1; (curLine
<= execInfo
->contentSize
); curLine
++)
806 mvwaddstr (execInfo
->handle
,
810 execInfo
->content
[curLine
- 1])->whichElement
.simpleString
);
811 tuiRefreshWin (execInfo
);
812 execInfo
->contentInUse
= TRUE
;
815 } /* tuiShowExecInfoContent */
819 ** tuiShowAllExecInfosContent()
823 tuiShowAllExecInfosContent (void)
825 tuiShowAllExecInfosContent ()
830 for (i
= 0; i
< (sourceWindows ())->count
; i
++)
831 tuiShowExecInfoContent ((TuiWinInfoPtr
) (sourceWindows ())->list
[i
]);
834 } /* tuiShowAllExecInfosContent */
838 ** tuiEraseExecInfoContent().
842 tuiEraseExecInfoContent (
843 TuiWinInfoPtr winInfo
)
845 tuiEraseExecInfoContent (winInfo
)
846 TuiWinInfoPtr winInfo
;
849 TuiGenWinInfoPtr execInfo
= winInfo
->detail
.sourceInfo
.executionInfo
;
851 werase (execInfo
->handle
);
852 tuiRefreshWin (execInfo
);
855 } /* tuiEraseExecInfoContent */
859 ** tuiEraseAllExecInfosContent()
863 tuiEraseAllExecInfosContent (void)
865 tuiEraseAllExecInfosContent ()
870 for (i
= 0; i
< (sourceWindows ())->count
; i
++)
871 tuiEraseExecInfoContent ((TuiWinInfoPtr
) (sourceWindows ())->list
[i
]);
874 } /* tuiEraseAllExecInfosContent */
878 ** tuiClearExecInfoContent().
882 tuiClearExecInfoContent (
883 TuiWinInfoPtr winInfo
)
885 tuiClearExecInfoContent (winInfo
)
886 TuiWinInfoPtr winInfo
;
889 winInfo
->detail
.sourceInfo
.executionInfo
->contentInUse
= FALSE
;
890 tuiEraseExecInfoContent (winInfo
);
893 } /* tuiClearExecInfoContent */
897 ** tuiClearAllExecInfosContent()
901 tuiClearAllExecInfosContent (void)
903 tuiClearAllExecInfosContent ()
908 for (i
= 0; i
< (sourceWindows ())->count
; i
++)
909 tuiClearExecInfoContent ((TuiWinInfoPtr
) (sourceWindows ())->list
[i
]);
912 } /* tuiClearAllExecInfosContent */
916 ** tuiUpdateExecInfo().
917 ** Function to update the execution info window
922 TuiWinInfoPtr winInfo
)
924 tuiUpdateExecInfo (winInfo
)
925 TuiWinInfoPtr winInfo
;
928 tuiSetExecInfoContent (winInfo
);
929 tuiShowExecInfoContent (winInfo
);
930 } /* tuiUpdateExecInfo
934 ** tuiUpdateAllExecInfos()
938 tuiUpdateAllExecInfos (void)
940 tuiUpdateAllExecInfos ()
945 for (i
= 0; i
< (sourceWindows ())->count
; i
++)
946 tuiUpdateExecInfo ((TuiWinInfoPtr
) (sourceWindows ())->list
[i
]);
949 } /* tuiUpdateAllExecInfos */
954 ** elz: This function clears the execution info from the source windows
955 ** and resets the locator to display no line info, procedure info, pc
956 ** info. It is called by stack_publish_stopped_with_no_frame, which
957 ** is called then the target terminates execution
961 tuiUpdateOnEnd (void)
967 TuiGenWinInfoPtr locator
;
969 TuiWinInfoPtr winInfo
;
971 locator
= locatorWinInfoPtr ();
973 /* for all the windows (src, asm) */
974 for (i
= 0; i
< (sourceWindows ())->count
; i
++)
976 winInfo
= (TuiWinInfoPtr
) (sourceWindows ())->list
[i
];
978 tuiSetIsExecPointAt ((Opaque
) - 1, winInfo
); /* the target is'n running */
979 /* -1 should not match any line number or pc */
980 tuiSetExecInfoContent (winInfo
); /*set winInfo so that > is'n displayed */
981 tuiShowExecInfoContent (winInfo
); /* display the new contents */
984 /*now update the locator */
985 tuiClearLocatorDisplay ();
986 tuiGetLocatorFilename (locator
, &filename
);
992 &((TuiWinElementPtr
) locator
->content
[0])->whichElement
.locator
);
993 tuiShowLocatorContent ();
996 } /* tuiUpdateOnEnd */
1002 tuiAllocSourceBuffer (
1003 TuiWinInfoPtr winInfo
)
1005 tuiAllocSourceBuffer (winInfo
)
1006 TuiWinInfoPtr winInfo
;
1009 register char *srcLine
, *srcLineBuf
;
1010 register int i
, lineWidth
, c
, maxLines
;
1011 TuiStatus ret
= TUI_FAILURE
;
1013 maxLines
= winInfo
->generic
.height
; /* less the highlight box */
1014 lineWidth
= winInfo
->generic
.width
- 1;
1016 ** Allocate the buffer for the source lines. Do this only once since they
1017 ** will be re-used for all source displays. The only other time this will
1018 ** be done is when a window's size changes.
1020 if (winInfo
->generic
.content
== (OpaquePtr
) NULL
)
1022 srcLineBuf
= (char *) xmalloc ((maxLines
* lineWidth
) * sizeof (char));
1023 if (srcLineBuf
== (char *) NULL
)
1025 "Unable to Allocate Memory for Source or Disassembly Display.\n",
1029 /* allocate the content list */
1030 if ((winInfo
->generic
.content
=
1031 (OpaquePtr
) allocContent (maxLines
, SRC_WIN
)) == (OpaquePtr
) NULL
)
1033 tuiFree (srcLineBuf
);
1034 srcLineBuf
= (char *) NULL
;
1036 "Unable to Allocate Memory for Source or Disassembly Display.\n",
1040 for (i
= 0; i
< maxLines
; i
++)
1042 winInfo
->generic
.content
[i
])->whichElement
.source
.line
=
1043 srcLineBuf
+ (lineWidth
* i
);
1050 } /* tuiAllocSourceBuffer */
1054 ** tuiLineIsDisplayed().
1055 ** Answer whether the a particular line number or address is displayed
1056 ** in the current source window.
1060 tuiLineIsDisplayed (
1061 Opaque lineNoOrAddr
,
1062 TuiWinInfoPtr winInfo
,
1065 tuiLineIsDisplayed (lineNoOrAddr
, winInfo
, checkThreshold
)
1066 Opaque lineNoOrAddr
;
1067 TuiWinInfoPtr winInfo
;
1071 int isDisplayed
= FALSE
;
1075 threshold
= SCROLL_THRESHOLD
;
1079 while (i
< winInfo
->generic
.contentSize
- threshold
&& !isDisplayed
)
1081 if (winInfo
== srcWin
)
1082 isDisplayed
= (((TuiWinElementPtr
)
1083 winInfo
->generic
.content
[i
])->whichElement
.source
.lineOrAddr
.lineNo
1084 == (int) lineNoOrAddr
);
1086 isDisplayed
= (((TuiWinElementPtr
)
1087 winInfo
->generic
.content
[i
])->whichElement
.source
.lineOrAddr
.addr
1093 } /* tuiLineIsDisplayed */
1096 /*****************************************
1097 ** STATIC LOCAL FUNCTIONS **
1098 ******************************************/