Google
 

Trailing-Edge - PDP-10 Archives - bb-r775c-bm_tops20_ks_upd_3 - sources/ldelete.bli
There are 10 other files named ldelete.bli in the archive. Click here to see a list.
 %TITLE 'LDELETE - delete lines'
MODULE LDELETE (				! Delete lines
		IDENT = '3-001'			! File: LDELETE.BLI Edit: CJG3001
		) =
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 executes the line mode DELETE command.
!	It also provides the delete part of the REPLACE command.
!
! ENVIRONMENT:	Runs at any access mode - AST reentrant
!
! AUTHOR: Bob Kushlis, CREATION DATE: February 3, 1978
!
! MODIFIED BY:
!
! 1-001	- Original.  DJS 30-JAN-81.  This module was created by
!	extracting the routines DELETE and DEL_COM from EXEC.BLI.
! 1-002	- Regularize headers.  JBS 19-Mar-1981
! 1-003	- Change DEL_COM to EDT$$DEL_CMD .  JBS 30-Mar-1981
! 1-004 - Change count to 48-bits.  SMB 05-Feb-1982
! 1-005 - Stop processing on bad select range.  SMB 01-Jul-1982
! 1-006	- Use EDT$$FMT_CRLF instead of EDT$$OUT_FMTBUF.  JBS 05-Jul-1982
! 1-007	- After deleting a line, make sure the character offset is 0.
!	   Bug reported in SPR 11-47685.  JBS 14-Jul-1982
! 1-008	- Suppress typing out the current line in EXT mode.  JBS 15-Jul-1982
! 1-009	- New screen update logic.  JBS 13-Sep-1982
! 1-010 - Modify to use new 48 bit arith macros. STS 01-Oct-1982
! 1-011 - Put code for ranpos in line. STS 11-Oct-1982
! 1-012 - Modify to use new compare macro. STS 20-Oct-1982
! 3-001 - Fix EDT$$FMT_STR and EDT$$FMT_STRCNT. CJG 22-Mar-1983
!--
%SBTTL 'Declarations'
!
! TABLE OF CONTENTS:
!

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$DEL_LNS,				! Delete a range of lines
    EDT$$DEL_CMD : NOVALUE;			! Process the DELETE command

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$DEL_LNS  - delete a range of lines'

GLOBAL ROUTINE EDT$$DEL_LNS 			! Delete a range of lines
    =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine is used by DELETE and REPLACE to delete a range of lines.
!	We process through the range, checking for /QUERY before deleting each
!	line.  When we are done a message indicating the number of lines
!	deleted is displayed.
!
! FORMAL PARAMETERS:
!
!	NONE
!
! IMPLICIT INPUTS:
!
!	EXE_CURCMD
!	EXE_QRYQUIT
!
! IMPLICIT OUTPUTS:
!
!	NONE
!
! ROUTINE VALUE:
!
!	1 = at least one line was deleted
!	0 = no lines were deleted
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$CMP_LNO,
	EDT$$FMT_STRCNT : NOVALUE,
	EDT$$FMT_CRLF,				! Terminate an output line
    	EDT$$RNG_REPOS,
	EDT$$FMT_STR,
	EDT$$PROC_QRYQAL,
	EDT$$NXT_LNRNG,
	EDT$$DEL_CURLN,
	EDT$$RD_NXTLN;

    EXTERNAL
	LNO_ZERO : LN_BLOCK,
	LNO0 : LN_BLOCK,
	EXE_CURCMD : REF NODE_BLOCK,	! Pointer to the current command.
    	RNG_FRSTLN,
    	RNG_ORIGPOS : POS_BLOCK,
	EXE_QRYQUIT,			! Quit flag for /QUERY operations.
	CUR_BUF : REF POS_BLOCK,		! The current editing position
	EXT_MOD;				! 1 = we are under the EXT command

    LOCAL
	NUM_DELETED : LN_BLOCK;

    NUM_DELETED [LN_LO] = .LNO_ZERO [LN_LO];
    NUM_DELETED [LN_MD] = .LNO_ZERO [LN_MD];
    NUM_DELETED [LN_HI] = .LNO_ZERO [LN_HI];
!+
! Position to the first line in the range.
!-

    RNG_FRSTLN = 1;
    EDT$$CPY_MEM(POS_SIZE, .CUR_BUF, RNG_ORIGPOS);
    IF ( NOT EDT$$RNG_REPOS (.EXE_CURCMD [RANGE1])) THEN RETURN (0);

!+
! Loop until the end of the range, or the user typed 'Q' in response to
! a /QUERY prompt.  If we delete a line, make sure the cursor position
! is at 0 on the new line, so we don't skip the text of the next line
! if we start a search.
!-

    WHILE (EDT$$NXT_LNRNG (1) AND ( NOT .EXE_QRYQUIT)) DO

	IF EDT$$PROC_QRYQAL (0, 0)
	THEN
	    BEGIN
	    ADDLINE (LNO0, NUM_DELETED, NUM_DELETED);
	    CUR_BUF [POS_CHAR_POS] = 0;
	    EDT$$DEL_CURLN ();

	    END
	ELSE
	    EDT$$RD_NXTLN ();

!+
! Display message about the count.
!-
    EDT$$FMT_STRCNT (NUM_DELETED, CH$PTR (UPLIT (' line')), 5);
    EDT$$FMT_STR (CH$PTR (UPLIT (' deleted')), 8);
    EDT$$FMT_CRLF ();
    RETURN (EDT$$CMP_LNO (NUM_DELETED, LNO_ZERO) NEQ 0);
    END;					! of routine EDT$$DEL_LNS
%SBTTL 'EDT$$DEL_CMD  - DELETE line-mode command'

GLOBAL ROUTINE EDT$$DEL_CMD 			! DELETE line-mode command
    : NOVALUE =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Command processing routine for DELETE.   All the work is done by the EDT$$DEL_LNS  routine.
!	When it is done, display the current line after the deletions.
!
! FORMAL PARAMETERS:
!
!	NONE
!
! IMPLICIT INPUTS:
!
!	INP_SRC
!
! IMPLICIT OUTPUTS:
!
!	NONE
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$TY_CURLN;

    EXTERNAL
	INP_SRC,
	EXT_MOD;

    EDT$$DEL_LNS ();

    IF ((.INP_SRC EQL INP_TERM) AND ( NOT .EXT_MOD)) THEN EDT$$TY_CURLN ();

    END;					! of routine EDT$$DEL_CMD
END						! of module EDT$LDELETE

ELUDOM