Trailing-Edge
-
PDP-10 Archives
-
BB-R775E-BM
-
sources/edt/lres.bli
There are 10 other files named lres.bli in the archive. Click here to see a list.
%TITLE 'LRES - RESEQUENCE line-mode command'
MODULE LRES ( ! RESEQUENCE line-mode command
IDENT = '3-002' ! File: LRES.BLI Edit: GB3002
) =
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 COPYRIT 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 RESEQUENCE 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-1981. This module was created by
! extracting the routine EDT$$RSEQ_CMD from the module EXEC.BLI.
! 1-002 - Regularize headers. JBS 20-Mar-1981
! 1-003 - Use new message codes. JBS 04-Aug-1981
! 1-004 - Change the count to 48-bits. SMB 05-Feb-1982
! 1-005 - Pass count by address - use new global for reseq. count printout. SMB 07-Feb-1982
! 1-006 - Use EDT$$FMT_BUF instead of EDT$$OUT_FMTBUF. JBS 05-Jul-1982
! 1-007 - Make edt$$tst_eob in line. STS 22-Sep-1982
! 1-009 - Put edt$$rng_posfrst in line. STS 11-Oct-1982
! 3-001 - Fix EDT$$FMT_STR and EDT$$FMT_STRCNT. CJG 22-Mar-1983
! 3-002 - Add updates from V3 sources. GB 29-Apr-1983
!--
%SBTTL 'Declarations'
!
! TABLE OF CONTENTS:
!
REQUIRE 'EDTSRC:TRAROUNAM';
FORWARD ROUTINE
EDT$$RSEQ_CMD : NOVALUE; ! Process the RESEQUENCE command
!
! INCLUDE FILES:
!
REQUIRE 'EDTSRC:EDTREQ';
!
! MACROS:
!
! NONE
!
! EQUATED SYMBOLS:
!
! NONE
!
! OWN STORAGE:
!
! NONE
!
! EXTERNAL REFERENCES:
!
! In the routine
%SBTTL 'EDT$$RSEQ_CMD - RESEQUENCE line-mode command'
GLOBAL ROUTINE EDT$$RSEQ_CMD ! RESEQUENCE line-mode command
: NOVALUE =
!++
! FUNCTIONAL DESCRIPTION:
!
! Command processing routine for RESEQUENCE.
!
! FORMAL PARAMETERS:
!
! NONE
!
! IMPLICIT INPUTS:
!
! CUR_BUF
! LNO5
! RNG_ORIGPOS
! WK_LN
! EXE_CURCMD
! EXE_SBITS
! EXE_SBLK
!
! IMPLICIT OUTPUTS:
!
! CUR_BUF
!
! ROUTINE VALUE:
!
! NONE
!
! SIDE EFFECTS:
!
! NONE
!
!--
BEGIN
EXTERNAL ROUTINE
EDT$$FMT_STRCNT : NOVALUE,
EDT$$FMT_CRLF, ! Terminate an output line
EDT$$FMT_MSG,
EDT$$FMT_STR,
EDT$$NXT_LNRNG,
EDT$$RNG_REPOS,
EDT$$RNG_RETFRST,
EDT$$CMP_LNO,
EDT$$TST_EOB,
EDT$$RD_PRVLN,
EDT$$RD_CURLN,
EDT$$RD_NXTLN,
EDT$$RSEQ;
EXTERNAL
WK_RESCNT : LN_BLOCK, ! Actual count of lines resequenced
CUR_BUF : REF TBCB_BLOCK,
LNO_ZERO : LN_BLOCK,
LNO5 : LN_BLOCK,
LNO0 : LN_BLOCK,
RNG_ORIGPOS : POS_BLOCK,
RNG_SAVPOS : POS_BLOCK,
WK_LN : REF LIN_BLOCK,
EXE_CURCMD : REF NODE_BLOCK, ! Pointer to the current command.
RNG_FRSTLN,
EXE_SBITS, ! The options switches.
EOB_LN,
EXE_SBLK : REF NODE_BLOCK; ! The option switch value block.
MESSAGES ((RANSPCSEQ));
LOCAL
COUNT : LN_BLOCK, ! The number of lines in the range.
RANGE : REF NODE_BLOCK, ! Address of the range block
SWB : NODE_BLOCK; ! Address of the switch value block.
!+
! Check for the /SEQ option. If not specified, then default the values
! to 1 and 1.
!-
IF ( NOT .EXE_SBITS<OPB_SEQ>)
THEN
BEGIN
EXE_SBLK = SWB;
MOVELINE (LNO5, SWB [SW_VAL1]);
MOVELINE (LNO5, SWB [SW_VAL2]);
END;
!+
! Check for the null range, making it WHOLE.
!-
RANGE = .EXE_CURCMD [RANGE1];
IF (.RANGE [RAN_TYPE] EQL RAN_NULL) THEN RANGE [RAN_TYPE] = RAN_WHOLE;
!+
! Position to the first line of the range.
!-
RNG_FRSTLN = 1;
EDT$$CPY_MEM(POS_SIZE, .CUR_BUF, RNG_ORIGPOS);
IF ( NOT EDT$$RNG_REPOS (.RANGE)) THEN RETURN;
!+
! If there is a preceding line, then make sure the starting line number
! is okay.
!-
IF EDT$$RD_PRVLN ()
THEN
BEGIN
IF (EDT$$CMP_LNO (WK_LN [LIN_NUM], EXE_SBLK [SW_VAL1]) GEQ 0)
THEN
BEGIN
EDT$$FMT_MSG (EDT$_RANSPCSEQ);
EDT$$CPY_MEM (POS_SIZE, RNG_ORIGPOS, .CUR_BUF);
EDT$$RD_CURLN ();
RETURN;
END;
EDT$$RD_NXTLN ();
END;
!+
! Count the lines in the range.
!-
MOVELINE (LNO_ZERO, COUNT);
WHILE (EDT$$NXT_LNRNG (0) AND (.WK_LN NEQA EOB_LN )) DO
ADDLINE (LNO0, COUNT, COUNT);
!+
! Reposition to the first line of the range.
!-
EDT$$CPY_MEM(POS_SIZE, RNG_SAVPOS, .CUR_BUF);
EDT$$RD_CURLN();
!+
! Do the resequence.
!-
EDT$$RSEQ (COUNT, EXE_SBLK [SW_VAL1], EXE_SBLK [SW_VAL2]);
!+
! Reposition to our place before starting the command.
!-
EDT$$CPY_MEM (POS_SIZE, RNG_ORIGPOS, .CUR_BUF);
EDT$$RD_CURLN ();
!+
! And display the number of lines processed.
!-
EDT$$FMT_STRCNT (WK_RESCNT, CH$PTR (UPLIT (%STRING (' line'))), 5);
EDT$$FMT_STR (CH$PTR (UPLIT (%STRING (' resequenced'))), 12);
EDT$$FMT_CRLF ();
END; ! of routine EDT$$RSEQ_CMD
END
ELUDOM