Google
 

Trailing-Edge - PDP-10 Archives - BB-R775E-BM - sources/edt/chmsavtxt.bli
There are 11 other files named chmsavtxt.bli in the archive. Click here to see a list.
 %TITLE 'CHMSAVTXT - save deleted text'
MODULE CHMSAVTXT (				! Save deleted text
		IDENT = '1-002'			! File: CHMSAVTXT.BLI Edit: JBS1002
		) =
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 saves text deleted by a delete line or word
!	command in the associated undelete buffer.
!
! 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$$SAV_DELTXT  from module CHANGE.BLI.
! 1-002	- Regularize headers.  JBS 03-Mar-1981
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$SAV_DELTXT : NOVALUE;			! Save a deleted word or line in an undelete buffer

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$SAV_DELTXT  - save deleted text'

GLOBAL ROUTINE EDT$$SAV_DELTXT (		! Save deleted text
	NC, 					! Number of characters to save
	DEL_BUF, 				! Address of delete buffer
	BUF_LEN					! Place to store the length
    ) : NOVALUE =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Save the text deleted by a delete line or word command in the
!	associated undelete buffer.
!
! FORMAL PARAMETERS:
!
!  NC 			the number of characters to save
!
!  DEL_BUF 		the address of the delete buffer
!
!  DEL_LEN 		the address in which to save the length
!
! IMPLICIT INPUTS:
!
!	DIRN
!	LN_PTR
!
! IMPLICIT OUTPUTS:
!
!	NONE
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$CS_LEFT,				! Move left a character
	EDT$$CS_RIGHT;				! Move right a character

    EXTERNAL
	DIRN,				! The current direction.
	LN_PTR;				! Current character pointer

    LOCAL
	BUF_POINT;

!+
! Put the direction in the first char of the buffer.
!-
    BUF_POINT = CH$PTR (.DEL_BUF,, BYTE_SIZE);
    CH$WCHAR_A (.DIRN, BUF_POINT);
!+
! If it is a forward delete, then go back to the beginning.
!-

    IF (.DIRN NEQ DIR_BACKWARD)
    THEN

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

!+
! Save the text, ending up at the end.
!-

    INCR I FROM 1 TO .NC DO
	BEGIN

	IF (.I LEQ .BUF_LEN) THEN CH$WCHAR_A (CH$RCHAR (.LN_PTR), BUF_POINT);

	EDT$$CS_RIGHT ();
	END;

!+
! If is is a backward delete, move back to the beginning.
!-

    IF (.DIRN EQL DIR_BACKWARD)
    THEN

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

    END;


END
ELUDOM