Google
 

Trailing-Edge - PDP-10 Archives - BB-H138E-BM - 6-1-sources/wfappbkt.bli
There are 10 other files named wfappbkt.bli in the archive. Click here to see a list.
 %TITLE 'WFAPPBKT - append a new bucket'
MODULE WFAPPBKT (				! Append a new bucket to a text buffer
		IDENT = '3-003'			! File: WFAPPBKT.BLI Edit: CJG3003
		) =
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:
!
!	Append a new bucket to a text buffer.
!
! 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 APPEND_BUKT from module EDTWF.
! 1-002	- Regularize headers.  JBS 16-Mar-1981
! 1-003 - Modify to use edt$workio. STS 15-Feb-1982
! 1-004 - Add literals for callable parameters. STS 08-Mar-1982
! 1-005 - Put wf_nxt_buk in line. STS 11-Oct-1982
! 3-001 - Make WK_LN an address not a string ptr.  GB 18-Feb-1983
! 3-002 - Add updates from V3 sources.  GB 16-May-1983
! 3-003 - Remove call to EDT$$CALLWIO. CJG 13-Jun-1983
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$WF_NEWBUK : NOVALUE;

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

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

GLOBAL ROUTINE EDT$$WF_NEWBUK (			! Append a new bucket to a text buffer
	NEXT, 					! Next bucket, or 0
	PREV					! Previous bucket, or 0
    ) : NOVALUE =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine appends a new bucket to a text buffer.  The bucket is
!	linked into the chain.
!
! FORMAL PARAMETERS:
!
!  NEXT 		the bucket which will follow the new bucket or 0 if it is at the end.
!
!  PREV 		the bucket which will precede the new bucket or 0 if it is the first.
!
! IMPLICIT INPUTS:
!
!	CUR_BUF
!	WK_BUK
!	WK_CURBUK
!	WK_LN
!	WF_DESC
!	WK_MODFD
!
! IMPLICIT OUTPUTS:
!
!	CUR_BUF
!	WK_MODFD
!	WK_CURBUK
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$WF_WR : NOVALUE,
	EDT$$WF_ALOBUF : NOVALUE,
	EDT$$WF_MAKECUR : NOVALUE;

    EXTERNAL
	WF_DESC : BLOCK[8],		! workfile record descriptor
	CUR_BUF : REF TBCB_BLOCK,	! Current text buffer control block
 	WK_AVAIL,
    	WK_GRTSTBUK,
	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
	WK_MODFD;			! Flag indicating bucket was modified

!+
! Is this the last bucket in the buffer?
!-

    IF (.NEXT EQL 0)
    THEN
!+
! Yes, update the last bucket field of CUR_BUF
!-
    	IF (.WK_AVAIL NEQ 0)
    	THEN
    	    CUR_BUF[TBCB_LAST_BUKT] = .WK_AVAIL
    	ELSE
    	    CUR_BUF[TBCB_LAST_BUKT] = .WK_GRTSTBUK
    ELSE
!+
! No, link the next bucket back to the one we are adding.
!-
	BEGIN
	EDT$$WF_MAKECUR (.NEXT);
    	IF (.WK_AVAIL NEQ 0)
    	THEN
    	    WK_BUK[WFB_PREV_BUKT] = .WK_AVAIL
    	ELSE
    	    WK_BUK[WFB_PREV_BUKT] = .WK_GRTSTBUK;

	WK_MODFD = 1;
	END;

!+
! Write out the current bucket if it has been modified.
!-

    IF .WK_MODFD THEN EDT$$WF_WR (.WK_CURBUK, WF_DESC);

    WK_MODFD = 0;
!+
! Get a new bukt.
!-
    EDT$$WF_ALOBUF ();
!+
! Update the current bucket and next bucket info
!-
    CUR_BUF [TBCB_CUR_BUKT] = .WK_CURBUK;
!+
! Fill in the bucket info for the new bucket
!-
    WK_BUK [WFB_NEXT_BUKT] = .NEXT;
    WK_BUK [WFB_PREV_BUKT] = .PREV;
    WK_BUK [WFB_END] = WFB_FIXED_SIZE;
!+
! Update CUR_BUF  to point to first record in this new bucket
!-
    CUR_BUF [TBCB_LINE_ADDR] = WFB_FIXED_SIZE;
    WK_LN = .WK_BUK + WFB_FIXED_SIZE;
!+
! Mark the new bucket as modified.
!-
    WK_MODFD = 1;
    END;


END
ELUDOM