-/*
- ** tuiSource.c
- ** This module contains functions for displaying source in the source window
- */
+/* TUI display source window.
+ Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Contributed by Hewlett-Packard Company.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include "defs.h"
#include <ctype.h>
#include "frame.h"
#include "breakpoint.h"
#include "source.h"
+#include "symtab.h"
#include "tui.h"
#include "tuiData.h"
** Function to display source in the source window.
*/
TuiStatus
-#ifdef __STDC__
-tuiSetSourceContent (
- struct symtab *s,
- int lineNo,
- int noerror)
-#else
-tuiSetSourceContent (s, lineNo, noerror)
- struct symtab *s;
- int lineNo;
- int noerror;
-#endif
+tuiSetSourceContent (struct symtab *s, int lineNo, int noerror)
{
TuiStatus ret = TUI_FAILURE;
element->whichElement.source.hasBreak =
(bp != (struct breakpoint *) NULL &&
(!element->whichElement.source.isExecPoint ||
- (bp->disposition != del || bp->hit_count <= 0)));
+ (bp->disposition != disp_del || bp->hit_count <= 0)));
if (c != EOF)
{
i = strlen (srcLine) - 1;
cannot be accessed */
void
-#ifdef __STDC__
-tuiSetSourceContentNil (
- TuiWinInfoPtr winInfo,
- char *warning_string)
-#else
-tuiSetSourceContentNil (winInfo, warning_string)
- TuiWinInfoPtr winInfo;
- char *warning_string;
-#endif
+tuiSetSourceContentNil (TuiWinInfoPtr winInfo, char *warning_string)
{
int lineWidth;
int nLines;
** initializes the horizontal scroll to 0.
*/
void
-#ifdef __STDC__
-tuiShowSource (
- struct symtab *s,
- Opaque line,
- int noerror)
-#else
-tuiShowSource (s, line, noerror)
- struct symtab *s;
- Opaque line;
- int noerror;
-#endif
+tuiShowSource (struct symtab *s, TuiLineOrAddress line, int noerror)
{
srcWin->detail.sourceInfo.horizontalOffset = 0;
- m_tuiShowSourceAsIs (s, line, noerror);
+ tuiUpdateSourceWindowAsIs(srcWin, s, line, noerror);
return;
} /* tuiShowSource */
** Answer whether the source is currently displayed in the source window.
*/
int
-#ifdef __STDC__
-tuiSourceIsDisplayed (
- char *fname)
-#else
-tuiSourceIsDisplayed (fname)
- char *fname;
-#endif
+tuiSourceIsDisplayed (char *fname)
{
return (srcWin->generic.contentInUse &&
(strcmp (((TuiWinElementPtr) (locatorWinInfoPtr ())->
** Scroll the source forward or backward vertically
*/
void
-#ifdef __STDC__
-tuiVerticalSourceScroll (
- TuiScrollDirection scrollDirection,
- int numToScroll)
-#else
-tuiVerticalSourceScroll (scrollDirection, numToScroll)
- TuiScrollDirection scrollDirection;
- int numToScroll;
-#endif
+tuiVerticalSourceScroll (TuiScrollDirection scrollDirection,
+ int numToScroll)
{
if (srcWin->generic.content != (OpaquePtr) NULL)
{
- int line;
- Opaque addr;
+ TuiLineOrAddress l;
struct symtab *s;
TuiWinContent content = (TuiWinContent) srcWin->generic.content;
if (scrollDirection == FORWARD_SCROLL)
{
- line = content[0]->whichElement.source.lineOrAddr.lineNo +
+ l.lineNo = content[0]->whichElement.source.lineOrAddr.lineNo +
numToScroll;
- if (line > s->nlines)
+ if (l.lineNo > s->nlines)
/*line = s->nlines - winInfo->generic.contentSize + 1; */
/*elz: fix for dts 23398 */
- line = content[0]->whichElement.source.lineOrAddr.lineNo;
+ l.lineNo = content[0]->whichElement.source.lineOrAddr.lineNo;
}
else
{
- line = content[0]->whichElement.source.lineOrAddr.lineNo -
+ l.lineNo = content[0]->whichElement.source.lineOrAddr.lineNo -
numToScroll;
- if (line <= 0)
- line = 1;
+ if (l.lineNo <= 0)
+ l.lineNo = 1;
}
- tuiUpdateSourceWindowAsIs (srcWin, s, (Opaque) line, FALSE);
+ if (identify_source_line (s, l.lineNo, 0, -1) == 1)
+ tuiUpdateSourceWindowAsIs (srcWin, s, l, FALSE);
}
return;
** the source file indicated
*/
static struct breakpoint *
-#ifdef __STDC__
-_hasBreak (
- char *sourceFileName,
- int lineNo)
-#else
-_hasBreak (sourceFileName, lineNo)
- char *sourceFileName;
- int lineNo;
-#endif
+_hasBreak (char *sourceFileName, int lineNo)
{
struct breakpoint *bpWithBreak = (struct breakpoint *) NULL;
struct breakpoint *bp;
(bp != (struct breakpoint *) NULL &&
bpWithBreak == (struct breakpoint *) NULL);
bp = bp->next)
- if ((strcmp (sourceFileName, bp->source_file) == 0) &&
- (lineNo == bp->line_number))
+ if (bp->source_file
+ && (strcmp (sourceFileName, bp->source_file) == 0)
+ && (lineNo == bp->line_number))
bpWithBreak = bp;
return bpWithBreak;