Trailing-Edge
-
PDP-10 Archives
-
BB-H138E-BM
-
6-1-sources/wfendins.bli
There are 10 other files named wfendins.bli in the archive. Click here to see a list.
%TITLE 'WFENDINS - end of a series of inserts'
MODULE WFENDINS ( ! End of a series of inserts
IDENT = '1-005' ! File: WFENDINS.BLI Edit: SMB1005
) =
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:
!
! End of a series of inserts.
!
! 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$$END_INS from module EDTWF.
! 1-002 - Regularize headers. JBS 16-Mar-1981
! 1-003 - Remove division from line number calculations. SMB 14-Jan-1982
! 1-004 - Add error check for line number too large. SMB 04-Feb-1982
! 1-005 - Pass count by address instead of by value. SMB 07-Feb-1982
!--
%SBTTL 'Declarations'
!
! TABLE OF CONTENTS:
!
REQUIRE 'EDTSRC:TRAROUNAM';
FORWARD ROUTINE
EDT$$END_INS : NOVALUE;
!
! INCLUDE FILES:
!
REQUIRE 'EDTSRC:EDTREQ';
!
! MACROS:
!
! NONE
!
! EQUATED SYMBOLS:
!
! NONE
!
! OWN STORAGE:
!
! NONE
!
! EXTERNAL REFERENCES:
!
! In the routine
%SBTTL 'EDT$$END_INS - end a series of inserts'
GLOBAL ROUTINE EDT$$END_INS ! End a series of inserts
: NOVALUE =
!++
! FUNCTIONAL DESCRIPTION:
!
! This routine is called at the end of a series of insertions. A line number
! increment is computed and the new lines are resequenced. At this time, the
! variable WK_INSCNT is the number of lines which were inserted,
! WK_STARTNO and WK_NXTLNO are the line numbers of
! the lines preceding and following the inserted lines. The line number increment
! is determined as follows: If the difference between START and NXT is greater
! than the number of lines to be inserted, then find the closest power of ten
! and increment in units of (1*that power) beginning with STARTNO. If there
! is not enough room, use an increment of .00001 and resequence the lines
!
! FORMAL PARAMETERS:
!
! NONE
!
! IMPLICIT INPUTS:
!
! WK_INSCNT
! WK_NXTLNO
! WK_STARTNO
! LNO_ZERO
! LNNO_BIG
! LNO0
!
! IMPLICIT OUTPUTS:
!
! NONE
!
! ROUTINE VALUE:
!
! NONE
!
! SIDE EFFECTS:
!
! Calls EDT$$RSEQ
!
!--
BEGIN
EXTERNAL ROUTINE
EDT$$CMP_LNO,
EDT$$RD_PRVLN,
EDT$$RD_CURLN : NOVALUE,
EDT$$RSEQ : NOVALUE;
EXTERNAL
LNO_BIG : LN_BLOCK, ! Maximum line number
WK_INSCNT : LN_BLOCK, ! The count of inserted lines
WK_NXTLNO : LN_BLOCK, ! Line number following an insert
WK_STARTNO : LN_BLOCK, ! Line number of line preceding an insert
LNO_ZERO : LN_BLOCK,
LNO0 : LNOVECTOR [14];
LOCAL
MAX,
DIF : LN_BLOCK,
INC : LN_BLOCK,
DIVISOR : LN_BLOCK;
!+
! Don't do anything if count is zero.
!-
IF (EDT$$CMP_LNO (LNO_ZERO, WK_INSCNT) EQL 0) THEN RETURN;
!+
! Position to the first inserted line.
!-
EDT$$RD_CURLN ();
MOVELINE (LNO_ZERO, INC);
DO
BEGIN
EDT$$RD_PRVLN ();
ADDLINE (LNO0, INC, INC);
END
UNTIL (EDT$$CMP_LNO (INC, WK_INSCNT) EQL 0);
!+
! Compute the difference in line numbers between the lines surrounding
! the inserted text.
!-
SUBLINE (WK_STARTNO, WK_NXTLNO, DIF);
!+
! If this is zero, we must be at the end of the buffer; choose an increment of 1.00000
!-
IF (EDT$$CMP_LNO (DIF, LNO_ZERO) EQL 0)
THEN
MOVELINE (LNO0 [5], INC)
ELSE
!+
! Compute an increment for numbering the lines.
!-
BEGIN
ADDLINE (LNO0, WK_INSCNT, DIVISOR); ! # of lines + 1
IF (EDT$$CMP_LNO (DIVISOR, DIF) GTR 0) ! If there are more lines to
THEN ! insert than room available
MOVELINE (LNO0, INC) ! use .00001 as increment
ELSE
BEGIN
MOVELINE (LNO0 [5], INC); ! Assume INC=1.00000
! unless another is found
INCR I FROM 0 TO 4 DO
BEGIN
!+
! Find the closest power of ten to the quotient of DIF/DIVISOR which is less than 10**5
! by increasing the divisor by a power of ten and comparing to DIF
!-
MULTLINE (LNO0 [1], DIVISOR, DIVISOR);
IF (EDT$$CMP_LNO (DIVISOR, DIF) GTR 0)
THEN
BEGIN
MOVELINE (LNO0 [.I], INC);
EXITLOOP;
END;
END;
END;
END;
!+
! Get the number of the first new line. If the maximum line number is
! exceeded, make the start number equal to the largest possible line number
!-
MAX = ADDLINE (INC, WK_STARTNO, WK_STARTNO);
IF ((.MAX NEQ 0) OR (EDT$$CMP_LNO(WK_STARTNO, LNO_BIG) GTR 0))
THEN
MOVELINE (LNO_BIG, WK_STARTNO);
!+
! And resequence the range.
!-
EDT$$RSEQ (WK_INSCNT, WK_STARTNO, INC)
END;
END
ELUDOM