Google
 

Trailing-Edge - PDP-10 Archives - bb-r775e-bm_tops20_ks_upd_5 - sources/edt/wfgetbkt.bli
There are 10 other files named wfgetbkt.bli in the archive. Click here to see a list.
 %TITLE 'WFGETBKT - allocate a bucket'
MODULE WFGETBKT (				! Allocate a bucket
		IDENT = '3-001'			! File: WFGETBKT.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:
!
!	Allocate 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 GET_NEW_BUKT from module EDTWF.
! 1-002	- Regularize headers.  JBS 16-Mar-1981
! 1-003	- Change SY_EXIT to EDT$$SYS_EXI .  JBS 31-Mar-1981
! 1-004 - Modify to use EDT$WORKIO. STS 15-Feb-1982
! 1-005 - Call WF_EXT if running on 11's. STS 26-Feb-1982
! 1-006 - Add literals for callable parameters. STS 08-Mar-1982
! 1-007	- Fix module name.  JBS 07-Apr-1982
! 1-008	- Fix work file overflow message.  JBS 05-Jul-1982
! 3-001 - Remove call to EDT$$CALLWIO. CJG 13-Jun-1983
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$WF_ALOBUF : NOVALUE;

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$WF_ALOBUF  - allocate a bucket'

GLOBAL ROUTINE EDT$$WF_ALOBUF 			! Allocate a bucket
    : NOVALUE =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine allocates a new bucket from the work-file.  If there
!	is a bucket available on the deleted bucket list, use it, otherwise
!	take the next higher numbered bucket.
!
! FORMAL PARAMETERS:
!
!	NONE
!
! IMPLICIT INPUTS:
!
!	WK_GRTSTBUK
!	WK_BUK
!
! IMPLICIT OUTPUTS:
!
!	WF_DESC
!	WK_AVAIL
!	WK_CURBUK
!	WK_GRTSTBUK
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	If the work file overflows, never returns to its caller.
!
!--

    BEGIN


    EXTERNAL ROUTINE
	EDT$$FMT_MSG,				! Put the text of a message in the format buffer
	EDT$$FMT_CRLF,				! Terminate the line being built in the format buffer
	EDT$$WF_RD : NOVALUE,			! Read from the work file
	EDT$$WF_MAKECUR : NOVALUE,
	EDT$$SYS_EXI;				! Leave EDT abruptly

    EXTERNAL
	WF_DESC : BLOCK,		! descriptor for workfile record
	WK_AVAIL,			! Pointer to next available deleted bucket
	WK_CURBUK,			! Number of the current bucket
	WK_GRTSTBUK,			! Largest bucket number in use
	WK_BUK : 			! Pointer to current bucket
	    REF BLOCK [WF_BUKT_SIZE] FIELD (WFB_FIELDS);

    MESSAGES ((WRKFILOVF));

    IF (.WK_AVAIL NEQ 0)
    THEN
	BEGIN
	EDT$$WF_MAKECUR (.WK_AVAIL);
	WK_AVAIL = .WK_BUK [WFB_NEXT_BUKT];
	END
    ELSE
	BEGIN
!+
! Check for overflow
!-

	IF ((.WK_GRTSTBUK EQL 0) OR 	!
	    (.WK_GRTSTBUK GTRU 65535))
	THEN
	    BEGIN
	    EDT$$FMT_MSG (EDT$_WRKFILOVF);
	    EDT$$FMT_CRLF ();
	    EDT$$SYS_EXI (EDT$_WRKFILOVF);
	    END;

!+
! Inform the caching routines that we are creating a new bucket.
! On the 11's we have to bring another bucket into the cache specially
!-

	EDT$$WF_RD (.WK_GRTSTBUK, WF_DESC);

	WK_BUK = .WF_DESC [DSC$A_POINTER];	!get address of record
	WK_CURBUK = .WK_GRTSTBUK;
!+
! And bump the largest bucket number.
!-
	WK_GRTSTBUK = .WK_GRTSTBUK + 1;
	END;

    END;					! End of routine EDT$$WF_ALOBUF


END
ELUDOM