Google
 

Trailing-Edge - PDP-10 Archives - bb-r775d-bm_tops20_ks_upd_4 - sources/wfdelbkt.bli
There are 10 other files named wfdelbkt.bli in the archive. Click here to see a list.
 %TITLE 'WFDELBKT - delete the current bucket'
MODULE WFDELBKT (				! Delete the current bucket
		IDENT = '3-001'			! File: WFDELBKT.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:
!
!	Delete a bucket.
!
! 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 DELETE_BUKT from module EDTWF.
! 1-002	- Regularize headers.  JBS 16-Mar-1981
! 1-003	- Remove EDT$$SET_WKLN.  JBS 14-Sep-1982
! 1-004 - Remove call to EDT$$WF_RELBUK. STS 11-Oct-1982
! 3-001 - Add updates from V3 sources.  GB 04-May-1983
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$WF_DELBUK : NOVALUE;

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$WF_DELBUK  - delete the current bucket'

GLOBAL ROUTINE EDT$$WF_DELBUK 			! Delete the current bucket
    : NOVALUE =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine is called when all the text in a bucket has been deleted.
!	If this is not the only bucket in the text buffer, then update the links
!	of the previous and next bucket to point to each other, handling the
!	special case of the first and last bucket.
!
! FORMAL PARAMETERS:
!
!	NONE
!
! IMPLICIT INPUTS:
!
!	CUR_BUF
!	WK_BUK
!	WK_CURBUK
!
! IMPLICIT OUTPUTS:
!
!	WK_MODFD
!	CUR_BUF
!	WK_CURBUK
!	WK_LN
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	Changes the current bucket.
!
!--

    BEGIN

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

    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
	WK_MODFD,			! Flag indicating bucket was modified
    	WK_AVAIL,
	WK_LN : REF LIN_BLOCK;		! Pointer to work line

    LOCAL
	NEXT,
	PREV;

!+
! Keep track of its previous and next bucket pointers.
!-
    NEXT = .WK_BUK [WFB_NEXT_BUKT];
    PREV = .WK_BUK [WFB_PREV_BUKT];
!+
! If this is the only bucket in the text buffer just update
! WK_LN  and get out.
!-

    IF ((.NEXT OR .PREV) EQL 0)
    THEN
	BEGIN
	EDT$$RD_NXTLN ();
	RETURN;
	END;

!+
! Release the bucket.
!-
    WK_BUK[WFB_NEXT_BUKT] = .WK_AVAIL;
    WK_AVAIL = .WK_CURBUK;
    WK_MODFD = 1;
!+
! Link the previous bucket to the next one.
!-

    IF (.PREV EQL 0)
    THEN
	CUR_BUF [TBCB_FIRST_BUKT] = .NEXT
    ELSE
	BEGIN
	EDT$$WF_MAKECUR (.PREV);
	WK_BUK [WFB_NEXT_BUKT] = .NEXT;
	WK_MODFD = 1;
	END;

!+
! If this was the last bucket then update CUR_BUF , otherwise
! go to the next bucket and update it's pointers.
!-

    IF (.NEXT EQL 0)
    THEN
	BEGIN
	CUR_BUF [TBCB_LAST_BUKT] = CUR_BUF [TBCB_CUR_BUKT] = .PREV;
	CUR_BUF [TBCB_LINE_ADDR] = .WK_BUK [WFB_END];
	EDT$$RD_NXTLN ();
	END
    ELSE
	BEGIN
	EDT$$WF_MAKECUR (.NEXT);
	WK_BUK [WFB_PREV_BUKT] = .PREV;
	CUR_BUF [TBCB_LINE_ADDR] = WFB_FIXED_SIZE;
	WK_LN = .WK_BUK + .CUR_BUF [TBCB_LINE_ADDR];
	WK_MODFD = 1;
	END;

!+
! Update the current bucket field.
!-
    CUR_BUF [TBCB_CUR_BUKT] = .WK_CURBUK;
    END;


END
ELUDOM