Google
 

Trailing-Edge - PDP-10 Archives - BB-R775C-BM - sources/chmgbuf.bli
There are 11 other files named chmgbuf.bli in the archive. Click here to see a list.
 %TITLE 'CHMGBUF - look for a buffer name'
MODULE CHMGBUF (				! Look for a buffer name
		IDENT = '3-003'			! File: CHMGBUF.BLI Edit: GB3003
		) =
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:
!
!	This module scans the command buffer for a buffer name.
!
! ENVIRONMENT:	Runs at any access mode - AST reentrant
!
! AUTHOR: Bob Kushlis, CREATION DATE: Unknown
!
! MODIFIED BY:
!
! 1-001	- Original.  DJS 04-Feb-1981.  This module was created by
!	extracting the routine EDT$$GET_BUF  from the module CHANGE.BLI.
! 1-002	- Regularize headers.  JBS 02-Mar-1981
! 1-003	- Use new message codes.  JBS 04-Aug-1981
! 1-004 - Check first to see if there are more characters on command line. 
!	    STS 21-Jun-1982
! 1-005	- Change alphabetic test.  JBS 19-Jul-1982
! 1-006	- Add conditional for VT220 support.  JBS 11-Feb-1983
! 3-001 - Change lots of occurences of CMD_BUF to CMD_PTR.  GB 07-Apr-1983
! 3-002 - Add updates from V3 source kit.  GB 27-Apr-1983
! 3-003 - Remove VT220 conditional to speed up code. CJG 25-Nov-1983
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$GET_BUF : NOVALUE;	! Look for a buffer specification for the cut, paste, and append commands

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

LIBRARY 'EDTSRC:TRANSLATE';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$GET_BUF  - look for a buffer name'

GLOBAL ROUTINE EDT$$GET_BUF 			! Look for a buffer name
    : NOVALUE =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine looks for a buffer spec for use by cut paste and append.
!	If an '=' is seen, an explicit buffer spec is there, otherwise, use
!	the paste buffer.  The routine places the address of the buffer in
!	ALT_BUF , with a zero indicating failure.
!
! FORMAL PARAMETERS:
!
!	NONE
!
! IMPLICIT INPUTS:
!
!	CMD_END
!	CMD_PTR
!	PST_BUF
!	CUR_BUF
!
! IMPLICIT OUTPUTS:
!
!	ALT_BUF
!	CMD_PTR
!
! ROUTINE VALUE:
!
!	1 = buffer spec seen, 0 = no buffer spec seen
!
! SIDE EFFECTS:
!
!	Uses EDT$$FND_BUF  to create the buffer if necessary.  If it fails,
!	gives an error message.
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$MSG_BELL : NOVALUE,		! Output a message to the terminal with a warning bell
	EDT$$CNV_UPC,				! Convert string to upper case
	EDT$$FND_BUF,				! Search for a text buffer
	EDT$$RD_CURLN;				! Get the current line

    EXTERNAL
	CMD_END,				! End of command pointer
	CMD_PTR,				! Command string pointer
	ALT_BUF : REF TBCB_BLOCK,		! Alternate buffer used for cut/paste.
	PST_BUF : REF TBCB_BLOCK,		! The paste buffer tbcb
	CUR_BUF : REF TBCB_BLOCK,		! The current buffer tbcb
	CHAR_INFO : BLOCKVECTOR [256, 1];	! Information about characters

    MESSAGES ((INVBUFNAM, INSMEM));

    LOCAL
	SAVE_TBCB,
	NEW,
	NAME_LEN,
	NAME_START,
	CHAR;

    NAME_LEN = 0;
    CHAR = CH$RCHAR (.CMD_PTR);

    IF (.CHAR EQL %C'=') AND CH$PTR_LSS (.CMD_PTR, .CMD_END)
    THEN
	BEGIN
	CMD_PTR = CH$PLUS (.CMD_PTR, 1);
	NAME_START = .CMD_PTR;

	WHILE CH$PTR_LSS (.CMD_PTR, .CMD_END) DO
	    BEGIN

	    CHAR = CH$RCHAR (.CMD_PTR);

	    IF (NOT .CHAR_INFO [.CHAR, CI_LET]		! Not alphabetic
		AND NOT .CHAR_INFO [.CHAR, CI_DIG]	! Not numeric
		AND (.CHAR NEQ %C'_'))			! Not an underscore
	    THEN
		EXITLOOP;

	    NAME_LEN = .NAME_LEN + 1;
	    CMD_PTR = CH$PLUS (.CMD_PTR, 1);
	    END;

	CHAR = CH$RCHAR (.NAME_START);

	IF ((.NAME_LEN EQL 0) OR NOT .CHAR_INFO [.CHAR, CI_LET])
	THEN
		BEGIN
		EDT$$MSG_BELL (EDT$_INVBUFNAM);
		RETURN;
		END;

	EDT$$CNV_UPC (.NAME_START, .NAME_LEN);
	SAVE_TBCB = .CUR_BUF;

	IF EDT$$FND_BUF (.NAME_START, .NAME_LEN)
	THEN
	    ALT_BUF = .CUR_BUF
	ELSE
	    EDT$$MSG_BELL (EDT$_INSMEM);

	CUR_BUF = .SAVE_TBCB;
	EDT$$RD_CURLN ();
	END
    ELSE
	ALT_BUF = .PST_BUF;

    END;					! of routine EDT$$GET_BUF

END						! of module EDT$CHMGBUF
ELUDOM