Trailing-Edge
-
PDP-10 Archives
-
BB-R775E-BM
-
sources/edt/wfloclin.bli
There are 10 other files named wfloclin.bli in the archive. Click here to see a list.
%TITLE 'WFLOCLIN - find a specified line by number'
MODULE WFLOCLIN ( ! Find a specified line by number
IDENT = '3-001' ! File: WFLOCLIN.BLI Edit: CJG3001
) =
BEGIN
!
! COPYRIGHT (c) 1981, 1985 BY
! DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
! ALL RIGHTS RESERVED.
!
! THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
! ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE
! INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER
! COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
! OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY
! TRANSFERRED.
!
! THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE
! AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT
! CORPORATION.
!
! DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS
! SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
!
!++
! FACILITY: EDT -- The DEC Standard Editor
!
! ABSTRACT:
!
! Find a specified line, given its number.
!
! ENVIRONMENT: Runs at any access mode - AST reentrant
!
! AUTHOR: Bob Kushlis, CREATION DATE: October 16, 1978
!
! MODIFIED BY:
!
! 1-001 - Original. DJS 23-Feb-1981. This module was created by
! extracting routine WFLOCLIN from module EDTWF.
! 1-002 - Regularize headers. JBS 19-Mar-1981
! 1-003 - Use the ASSERT macro. JBS 01-Jun-1981
! 3-001 - Modify ASSERT macro to include error code. CJG 30-Jan-1984
!--
%SBTTL 'Declarations'
!
! TABLE OF CONTENTS:
!
REQUIRE 'EDTSRC:TRAROUNAM';
FORWARD ROUTINE
EDT$$LOC_LN;
!
! INCLUDE FILES:
!
REQUIRE 'EDTSRC:EDTREQ';
!
! MACROS:
!
! NONE
!
! EQUATED SYMBOLS:
!
! NONE
!
! OWN STORAGE:
!
! NONE
!
! EXTERNAL REFERENCES:
!
! In the routine
%SBTTL 'EDT$$LOC_LN - find a specified line by number'
GLOBAL ROUTINE EDT$$LOC_LN ( ! Find a specified line, given its number
LINE_NUM ! Number of line to find
) =
!++
! FUNCTIONAL DESCRIPTION:
!
! This procedure searches for a specified line number. If the line number
! is found, the buffer is left postioned there, if not, the buffer is positioned
! to the first line with a number larger than the line to be located. The value
! returned is 1 if the actual line was located and 0 otherwise.
!
! FORMAL PARAMETERS:
!
! LINE_NUM the address of the line number to be located.
!
! IMPLICIT INPUTS:
!
! WK_LN
!
! IMPLICIT OUTPUTS:
!
! WK_LN
!
! ROUTINE VALUE
!
! 1 = the line was found
! 0 = the line was not found, positioned right after where it should have been
!
! SIDE EFFECTS:
!
! NONE
!
!--
BEGIN
EXTERNAL ROUTINE
EDT$$CMP_LNO,
EDT$$RD_PRVLN,
EDT$$RD_NXTLN;
EXTERNAL
WK_LN : REF LIN_BLOCK; ! Pointer to current line
MAP
LINE_NUM : REF LN_BLOCK;
LOCAL
RELAT1,
RELAT2;
RELAT1 = 2; ! make sure no match first time
DO
BEGIN
RELAT2 = EDT$$CMP_LNO (WK_LN [LIN_NUM], .LINE_NUM);
!+
! If the relationship between the current line and the target line has gone from
! -1 to 1, or vice versa, without touching 0 in between, then the target line is
! not in the buffer.
!-
IF (.RELAT1 EQL .RELAT2) THEN EXITLOOP;
SELECTONE .RELAT2 OF
SET
[-1] : ! Move forward to find the line
IF ( NOT EDT$$RD_NXTLN ()) THEN RETURN (0); ! Return if at end of buffer
[0] : ! We are on the line, return success
RETURN (1);
[1] : ! Move backward to find the line
IF ( NOT EDT$$RD_PRVLN ()) THEN RETURN (0); ! Return if at beginning of buffer
[OTHERWISE] :
ASSERT (12, 0);
TES;
RELAT1 = -.RELAT2; ! Remember previous relation
END
UNTIL 0;
!+
! Make sure we are positioned on the line just larger than the (missing) target line.
!-
IF (.RELAT2 EQL -1) THEN EDT$$RD_NXTLN ();
RETURN (0);
END;
END
ELUDOM