Google
 

Trailing-Edge - PDP-10 Archives - bb-r775c-bm_tops20_ks_upd_3 - sources/wfreafwd.bli
There are 10 other files named wfreafwd.bli in the archive. Click here to see a list.
 %TITLE 'WFREAFWD - read the next line'
MODULE WFREAFWD (				! Read the next line
		IDENT = '3-001'			! File: WFREAFWD.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 next line in the forward direction.
!
! 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_NXTLN  from module EDTWF.
! 1-002	- Regularized the headers.  JBS 25-Feb-1981
! 1-003	- Fix module name.  JBS 19-Mar-1981
! 1-004	- Change EOB_LINE to EOB_LN .  JBS 31-Mar-1981
! 1-005	- Correct a typo in a subtitle.  JBS 02-Jun-1981
! 1-006 - Change index for line numbers from 10 to 15.  SMB 18-Jan-1982
! 1-007	- Remove EDT$$SET_WKLN.  JBS 14-Sep-1982
! 3-001 - Use LIN_NEXT to get address of next line.  GB 17-Feb-1983
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$RD_NXTLN;

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

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

GLOBAL ROUTINE EDT$$RD_NXTLN 			! Read the next line
    =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Read the next line in the forward direction.  The line following the
!	current line becomes the new line.  This routine may have the effect
!	of reading a line from the input file.  If we are already at the end
!	of the buffer, then return a 0 otherwise return a 1.
!
! FORMAL PARAMETERS:
!
!	NONE
!
! IMPLICIT INPUTS:
!
!	EXITD
!	WK_BUK
!	WK_CURBUK
!	WK_LN
!	EOB_LN
!	LNO0
!
! IMPLICIT OUTPUTS:
!
!	CUR_BUF
!	WK_LN
!
! ROUTINE VALUE:
!
!	1		Not at end of buffer
!	0		At end of buffer
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$WF_MAKECUR : NOVALUE,
	EDT$$RD_ILN;

    EXTERNAL
	CUR_BUF : REF TBCB_BLOCK,	! Current text buffer control block
	EXITD,				! Exit flag (on if we are exiting)
	WK_BUK : 			! Pointer to current bucket
	    REF BLOCK [WF_BUKT_SIZE] FIELD (WFB_FIELDS),
	WK_CURBUK,			! Number of the current bucket
	WK_LN : REF LIN_BLOCK,		! Pointer to current line
	EOB_LN,
	LNO0 : LNOVECTOR [14];

    CUR_BUF [TBCB_CHAR_POS] = 0;
!+
! Point to the next line in the bucket.
!-

    IF (.CUR_BUF [TBCB_LINE_ADDR] NEQA .WK_BUK [WFB_END])
    THEN
	BEGIN
	CUR_BUF [TBCB_LINE_ADDR] = .CUR_BUF [TBCB_LINE_ADDR] + .WK_LN [LIN_NEXT];
	WK_LN = .WK_BUK + .CUR_BUF [TBCB_LINE_ADDR];
	ADDLINE (LNO0, CUR_BUF [TBCB_CUR_LIN], CUR_BUF [TBCB_CUR_LIN]);
	END;

!+
! If this is out of the scope of the bucket, then we better read the
! next bucket.
!-

    IF (.CUR_BUF [TBCB_LINE_ADDR] GEQA .WK_BUK [WFB_END])
    THEN

	IF (.WK_BUK [WFB_NEXT_BUKT] EQL 0)
	THEN
	    BEGIN

	    IF (.EXITD NEQ 0)
	    THEN
		BEGIN
!+
! Return zero so we don't read any more.
!-
		WK_LN = EOB_LN;
		RETURN (0);
		END;

!+
! End of buffer, try reading the next record.
!-
	    RETURN (EDT$$RD_ILN ());
	    END
	ELSE
	    BEGIN
	    EDT$$WF_MAKECUR (.WK_BUK [WFB_NEXT_BUKT]);
	    CUR_BUF [TBCB_LINE_ADDR] = WFB_FIXED_SIZE;
	    CUR_BUF [TBCB_CUR_BUKT] = .WK_CURBUK;
	    END;

!+
! Update the current line pointer.
!-
    WK_LN = .WK_BUK + .CUR_BUF [TBCB_LINE_ADDR];
    RETURN (1)
    END;


END
ELUDOM