Google
 

Trailing-Edge - PDP-10 Archives - BB-AE97C-BM - sources/ufbuffer.bli
There are 10 other files named ufbuffer.bli in the archive. Click here to see a list.
 %TITLE 'UFBUFFER - find a buffer'
MODULE UFBUFFER (				! Find a buffer
		IDENT = '1-004'			! File: UFBUFFER.BLI Edit: STS1004
		) =
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:
!
!	Find a buffer, given its name.  A buffer is created if necessary.
!
! ENVIRONMENT:	Runs at any access mode - AST reentrant
!
! AUTHOR: Bob Kushlis, CREATION DATE: February 7, 1978
!
! MODIFIED BY:
!
! 1-001	- Original.  DJS 19-FEB-1981.  This module was created by
!	extracting routine EDT$$FND_BUF  from module UTIL.
! 1-002	- Regularized headers.  JBS 25-Feb-1981
! 1-003	- Fix module name.  JBS 11-Mar-1981
! 1-004 - Initialize more of the tbcb. STS 10-Mar-1982
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$FND_BUF;

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$FND_BUF  - find a buffer'

GLOBAL ROUTINE EDT$$FND_BUF (			! Find a buffer
	NAME, 					! pointer to the buffer name
	LEN					! length of that name
    ) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine searches for a buffer with a specified name and positions
!	into it.  If  a buffer by that name does not exist, then it is created.
!	The global variable PRV_BUF  is set to point to the TBCB
!	of the buffer we were originally positioned in.
!
! FORMAL PARAMETERS:
!
!  NAME			Pointer to a string containing the name of the buffer.
!
!  LEN			Length of the name string.
!
! IMPLICIT INPUTS:
!
!	CUR_BUF
!
! IMPLICIT OUTPUTS:
!
!	CUR_BUF
!	PRV_BUF
!
! ROUTINE VALUE
!
!	Returns 1 if the buffer was found or created, 0 if an attempt to create a
!	new buffer failed.
!
! SIDE EFFECTS:
!
!	May create a new buffer.
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$GET_BUFPTR,
	EDT$$NEW_BUF;

    EXTERNAL
	LNO_ZERO : LN_BLOCK,
	CUR_BUF : REF TBCB_BLOCK,	! Pointer to current buffer TBCB
	PRV_BUF : REF TBCB_BLOCK;	! Pointer to previous buffer TBCB

    LOCAL
	BUF_ADDR : REF TBCB_BLOCK,
	NEW;

!+
! Look for the buffer.
!-

    IF EDT$$GET_BUFPTR (.NAME, .LEN, BUF_ADDR, NEW)
    THEN
	BEGIN
!+
! Position to the new buffer.
!-
	PRV_BUF = .CUR_BUF;
	CUR_BUF = .BUF_ADDR;
!+
! If the buffer was new, then open it up.
!-

	IF (.NEW NEQ 0) THEN 
	    BEGIN
	    BUF_ADDR[TBCB_INPUT_RAB] = 0;
	    BUF_ADDR [TBCB_LINE_COUNT] = .LNO_ZERO [LN_LO];
	    BUF_ADDR [TBCB_LC_M] = .LNO_ZERO [LN_MD];
	    BUF_ADDR [TBCB_LC_H] = .LNO_ZERO [LN_HI];
	    EDT$$NEW_BUF ();
	    END;	    

	RETURN (1);
	END
    ELSE
	RETURN (0);

    END;


END
ELUDOM