Google
 

Trailing-Edge - PDP-10 Archives - BB-H138F-BM_1988 - 7-sources/wfcoplin.bli
There are 10 other files named wfcoplin.bli in the archive. Click here to see a list.
 %TITLE 'WFCOPLIN - copy a line'
MODULE WFCOPLIN (				! Copy a line
		IDENT = '1-007'			! File: WFCOPLIN.BLI Edit: GB1007
		) =
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:
!
!	Copy a line, optionally deleting it.
!
! ENVIRONMENT:	Runs at any access mode - AST reentrant
!
! AUTHOR: Bob Kushlis, CREATION DATE: October 16, 1978
!
! MODIFIED BY:
!
! 1-001	- Original.  DJS 23-Feb-1981.  This module was created by
!	extracting routine EDT$$CPY_LN  from module EDTWF.
! 1-002	- Regularize headers.  JBS 16-Mar-1981
! 1-003 - Save line being copied since we don't have indirect access
!	  into the workfile anymore. STS 23-Feb-1982
! 1-004 - Make line larger.  STS 23-Feb-1982
! 1-005 - Change stack allocation to get heap storage. STS 05-Mar-1982
! 1-006	- Give an error return if the heap storage is not available.  JBS 09-Jun-1982
! 1-007 - Change call to CPY_MEM to CH$MOVE.  GB 7-Mar-83
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$CPY_LN;

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$CPY_LN  - copy a line'

GLOBAL ROUTINE EDT$$CPY_LN (			! Copy a line
    DELETE					! 1 = delete after copying
    ) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Copy a line.  The delete parameter indicates that the line
!	should be deleted after copying.
!
! FORMAL PARAMETERS:
!
!  DELETE		1 = delete after copying
!
! IMPLICIT INPUTS:
!
!	CUR_BUF
!	ALT_BUF
!	WK_LN
!
! IMPLICIT OUTPUTS:
!
!	CUR_BUF
!
! ROUTINE VALUE:
!
!	1 = OK
!	0 = failed for lack of heap storage
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$ALO_HEAP,				! Allocate heap storage
	EDT$$DEA_HEAP : NOVALUE,		! Deallocate heap storage
	EDT$$DEL_CURLN : NOVALUE,
	EDT$$INS_LN : NOVALUE,
	EDT$$RD_CURLN : NOVALUE;

    EXTERNAL
	CUR_BUF : REF TBCB_BLOCK,	! Current text buffer control block
	ALT_BUF,				! Alternate text buffer control block
	WK_LN : REF LIN_BLOCK;		! Pointer to current line

    LOCAL
	SAVE_TBCB,
	LINE,
	LINE_LEN;

!+
! since we do not have indirect access to the workfile with callable EDT
! we must copy out the line we wish to copy before we get the next bucket.
!-

    IF ( NOT EDT$$ALO_HEAP (%REF (512), LINE)) THEN RETURN (0);

    LINE_LEN = .WK_LN [LIN_LENGTH];
    CH$MOVE (.LINE_LEN, CH$PTR (WK_LN [LIN_TEXT],, BYTE_SIZE),
			CH$PTR (.LINE,, BYTE_SIZE));
    SAVE_TBCB = .CUR_BUF;
    CUR_BUF = .ALT_BUF;
    EDT$$RD_CURLN ();
    EDT$$INS_LN (CH$PTR (.LINE,, BYTE_SIZE), .LINE_LEN);
    EDT$$DEA_HEAP (%REF (512), LINE);
    CUR_BUF = .SAVE_TBCB;
    EDT$$RD_CURLN ();

    IF .DELETE THEN EDT$$DEL_CURLN ();

    RETURN (1);
    END;					! of routine EDT$$CPY_LN


END
ELUDOM