Google
 

Trailing-Edge - PDP-10 Archives - BB-H138F-BM_1988 - 7-sources/chmpaste.bli
There are 11 other files named chmpaste.bli in the archive. Click here to see a list.
 %TITLE 'CHMPASTE - change mode PASTE command'
MODULE CHMPASTE (				! Change mode PASTE command
		IDENT = '3-001'			! File: CHMPASTE.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 executes the change mode PASTE command.
!
! 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$$PST_CMD  from the module CHANGE.BLI.
! 1-002	- Regularize headers.  JBS 03-Mar-1981
! 1-003	- Change SPLIT_LINE to EDT$$SPLT_LNINS .  JBS 30-Mar-1981
! 1-004 - Use new message codes.  JBS 06-Aug-1981 (this note added 24-May-1982)
! 1-005	- Set a flag if control C actually aborts something.  JBS 24-May-1982
! 1-006	- New screen update logic.  JBS 13-Sep-1982
! 1-007	- Remove EDT$$G_LN_NO for new screen update logic.  JBS 29-Sep-1982
! 1-008 - Convert to new line number compare macro. STS 20-Oct-1982
! 1-009 - Add a parameter to the split line routines.  SMB 16-Nov-1982
! 1-010	- Remove parameter from EDT$$SPLT_LN.  JBS 17-Nov-1982
! 1-011	- Add a parameter to EDT$$COMB_LN.  JBS 28-Dec-1982
! 3-001 - Add updates from V3 kit.  GB 13-May-1983
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$PST_CMD;				! Execute the paste command

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$PST_CMD  - change mode PASTE command'

GLOBAL ROUTINE EDT$$PST_CMD 			! Change mode PASTE command
    =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine executes the paste command.  The variable ALT_BUF  has
!	the address of the TBCB for the buffer to be pasted.
!
! FORMAL PARAMETERS:
!
!	NONE
!
! IMPLICIT INPUTS:
!
!	ALT_BUF
!	CUR_BUF
!	LNO0
!	LNO1
!	WK_LN
!
! IMPLICIT OUTPUTS:
!
!	PST_CNT
!	CC_DONE
!
! ROUTINE VALUE
!
!	A value of 0 is returned if the paste failed.
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$INS_STR,				! Insert a string of characters at the current position
	EDT$$MSG_BELL : NOVALUE,		! Output a message to the terminal with a warning bell
	EDT$$CHK_CC,				! Check to see if a CTRL/C has been typed
	EDT$$COMB_LN : NOVALUE,			! Combine the current line with the one immediately above it
	EDT$$CS_DWN,				! Move down a line
	EDT$$CS_LEFT,				! Move left a character
	EDT$$SPLT_LN : NOVALUE,			! Split a line of text at the current cursor position
	EDT$$SPLT_LNINS : NOVALUE,		! Split a line of text at the current cursor position
	EDT$$CMP_LNO,				! Compare line numbers
	EDT$$END_INS,				! End an insert sequence
	EDT$$RD_CURLN,				! Get the current line
	EDT$$RD_NXTLN,				! Move forward a line
	EDT$$START_INS,				! Start an insert sequence
	EDT$$TOP_BUF;				! Go to top of buffer

    EXTERNAL
	PST_CNT,				! No. of characters pasted.
	ALT_BUF : REF TBCB_BLOCK,	! Alternate buffer used for cut/paste.
	CUR_BUF : REF TBCB_BLOCK,	! The current buffer tbcb
	LNO0,				! Line number 10**0 (1)
	LNO1,				! Line number 10**1 (10)
	WK_LN : REF LIN_BLOCK,		! Current line pointer
	CC_DONE;				! Set to 1 if control C actually aborts something

    MESSAGES ((ATTPASCUR));

    LOCAL
	SAVE_TBCB;

    IF (.ALT_BUF EQL 0) THEN RETURN (0);

!+
! Check for paste of the current buffer.
!-

    IF (.ALT_BUF EQL .CUR_BUF)
    THEN
	BEGIN
	EDT$$MSG_BELL (EDT$_ATTPASCUR);
	RETURN (0);
	END;

!+
! Save the address of the current text buffer.
!-
    SAVE_TBCB = .CUR_BUF;
    PST_CNT = 0;
!+
! Check for empty buffer.
!-

    IF (EDT$$CMP_LNO (LNO0, ALT_BUF [TBCB_LINE_COUNT]) EQL 1) THEN RETURN (1);


!+
! Split the current line.
!-
    EDT$$SPLT_LNINS (0);
    EDT$$CS_LEFT ();
    EDT$$START_INS ();				! Perform initialization for text insertion
!+
! Position to the front of the paste buffer.
!-
    CUR_BUF = .ALT_BUF;
    EDT$$TOP_BUF ();

    WHILE 1 DO 					! Loop through all of the paste buffer.
	BEGIN
!+
! Handle the next line.
!-
	EDT$$INS_STR (CH$PTR (WK_LN [LIN_TEXT], 0, BYTE_SIZE), .WK_LN [LIN_LENGTH]);
	PST_CNT = .PST_CNT + .WK_LN [LIN_LENGTH] + 1;

	IF ( NOT EDT$$RD_NXTLN ()) THEN EXITLOOP;

!+
! Check for CTRL/C.
!-

	IF EDT$$CHK_CC ()
	THEN
	    BEGIN
	    CC_DONE = 1;
	    EXITLOOP;
	    END;

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

    CUR_BUF = .SAVE_TBCB;
    EDT$$RD_CURLN ();
    EDT$$CS_DWN ();
    EDT$$COMB_LN (0);
    EDT$$END_INS ();				! End the text insertion sequence
    PST_CNT = .PST_CNT - 1;
    RETURN (1)
    END;


END
ELUDOM