Google
 

Trailing-Edge - PDP-10 Archives - tops20-v7-ft-dist1-clock - 7-sources/chmundel.bli
There are 11 other files named chmundel.bli in the archive. Click here to see a list.
 %TITLE 'CHMUNDEL - undelete'
MODULE CHMUNDEL (				! Undelete
		IDENT = '3-001'			! File: CHMUNDEL.BLI Edit: GB3001
		) =
BEGIN
!COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1981, 1988.  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 THAT IS NOT SUPPLIED BY DIGITAL.
!
!
!++
! FACILITY:	EDT -- The DEC Standard Editor
!
! ABSTRACT:
!
!	This module performs the undeletion of text associated
!	with the change mode commands UNDC, UNDW, and UNDL.
!
! 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 UNDELETE from the module CHANGE.BLI.
! 1-002	- Regularize headers.  JBS 04-Mar-1981
! 1-003 - Replace call to edt$$tst_eob. STS 22-Sep-1982
! 1-004	- Don't turn an undelete of an empty line into a noop at EOB.  JBS 01-Dec-1982
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$UNDL;					! Insert the contents of an undelete buffer

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$UNDL  - undelete'

GLOBAL ROUTINE EDT$$UNDL (			! Undelete
	BUF, 					! Address of the appropriate undelete buffer
	LEN					! Length of that buffer
    ) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Insert the contents of an undelete buffer and move to whichever end.
!
! FORMAL PARAMETERS:
!
!  BUF 			the address of the undelete buffer.  Its first character is
!     			the direction indicator.
!
!  LEN 			the length of the buffer.
!
! IMPLICIT INPUTS:
!
!	NONE
!
! IMPLICIT OUTPUTS:
!
!	NONE
!
! ROUTINE VALUE:
!
!	1 is returned if successful, 0 otherwise.
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$INS_CHS,			! Insert a string of characters which may include carriage returns
	EDT$$CS_LEFT;				! Move left a character

    EXTERNAL
	WK_LN : REF LIN_BLOCK,
	EOB_LN;

    LOCAL
	DIR,
	RLEN,
	BUF_POINT;

    RLEN = .LEN;
!+
! Check for special case of entering an unnecessary carriage return
! at the end of the buffer.
!-

    IF ((.WK_LN EQLA EOB_LN) AND 	!
	(.RLEN GTR 1) AND 			!
	(CH$RCHAR (CH$PTR (.BUF, .RLEN, BYTE_SIZE)) EQL ASC_K_CR))
    THEN
	RLEN = .RLEN - 1;

    BUF_POINT = CH$PTR (.BUF,, BYTE_SIZE);
!+
! Get the direction indicator.
!-
    DIR = CH$RCHAR_A (BUF_POINT);

    IF (EDT$$INS_CHS (.BUF_POINT, .RLEN) EQL 0) THEN RETURN (0);

!+
! If the delete was a forward one, position to the beginning of the
! string we just inserted.
!-

    IF (.DIR NEQ DIR_BACKWARD)
    THEN

	DECR I FROM .RLEN - 1 TO 0 DO
	    EDT$$CS_LEFT ();

    RETURN (1);
    END;


END
ELUDOM