Google
 

Trailing-Edge - PDP-10 Archives - bb-r775d-bm_tops20_ks_upd_4 - sources/wfreabck.bli
There are 10 other files named wfreabck.bli in the archive. Click here to see a list.
 %TITLE 'WFREABCK - read previous line'
MODULE WFREABCK (				! Read previous line
		IDENT = '3-001'			! File: WFREABCK.BLI Edit: GB3001
		) =
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:
!
!	Read the previous line from the work file system.
!
! 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 EDT$$RD_PRVLN  from module EDTWF.
! 1-002	- regularize headers.  JBS 19-Mar-1981
! 1-003 - Change index for line numbers from 10 to 15.  SMB 18-Jan-1982
! 1-004	- Remove EDT$$SET_WKLN.  JBS 14-Sep-1982
! 3-001 - Use word addressing for Tops 10/20. GB 17-Feb-1983
!--

%SBTTL 'Declarations'
!
! TABLE OF CONTENTS:
!

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$RD_PRVLN;

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$RD_PRVLN  - read previous line'

GLOBAL ROUTINE EDT$$RD_PRVLN 			! Read previous line
    =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Read a line backwards.  The line preceding the current line becomes the
!	current line.  If we are already at the top, return a 0 otherwise return
!	a 1.
!
! FORMAL PARAMETERS:
!
!	NONE
!
! IMPLICIT INPUTS:
!
!	CUR_BUF
!	WK_BUK
!	WK_CURBUK
!	LNO0
!	WK_LN
!
! IMPLICIT OUTPUTS:
!
!	CUR_BUF
!
! ROUTINE VALUE:
!
!	1 = previous line read successfully
!	0 = there is no previous line
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$WF_MAKECUR : NOVALUE;

    EXTERNAL
	CUR_BUF : REF TBCB_BLOCK,	! Current text buffer control block
	WK_BUK : 			! Pointer to current bucket
	    REF BLOCK [WF_BUKT_SIZE] FIELD (WFB_FIELDS),
	WK_CURBUK,			! Number of the current bucket
	LNO0 : LNOVECTOR [14],
	WK_LN : REF LIN_BLOCK;		! Pointer to work line

    CUR_BUF [TBCB_CHAR_POS] = 0;
!+
! See if we are at the beginning of a bucket.
!-

    IF (.CUR_BUF [TBCB_LINE_ADDR] EQL WFB_FIXED_SIZE)
    THEN

	IF (.WK_BUK [WFB_PREV_BUKT] EQL 0)
	THEN
	    RETURN (0)				! cannot read backward at beginning of buffer.
	ELSE
	    BEGIN
!+
! Read the previous bucket and position to it's end.
!-
	    EDT$$WF_MAKECUR (.WK_BUK [WFB_PREV_BUKT]);
	    CUR_BUF [TBCB_LINE_ADDR] = .WK_BUK [WFB_END];
	    CUR_BUF [TBCB_CUR_BUKT] = .WK_CURBUK;
	    END;

!+
! Now, move back a line.
!-
    CUR_BUF [TBCB_LINE_ADDR] = .CUR_BUF [TBCB_LINE_ADDR] - .(.WK_BUK + .CUR_BUF [TBCB_LINE_ADDR] - 1);
    SUBLINE (LNO0, CUR_BUF [TBCB_CUR_LIN], CUR_BUF [TBCB_CUR_LIN]);
!+
! Get the address of the current line.
!-
    WK_LN = .WK_BUK + .CUR_BUF [TBCB_LINE_ADDR];
    RETURN (1);
    END;


END
ELUDOM