Trailing-Edge
-
PDP-10 Archives
-
BB-AE97C-BM
-
sources/ldivision.bli
There are 10 other files named ldivision.bli in the archive. Click here to see a list.
%TITLE 'LDIVISION - divide line number by 10**(0-14)'
MODULE LDIVISION ( ! Pseudo division by 10**(0-14)
IDENT = '1-003' ! File: LDIVISION.BLI Edit: GB1003
) =
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 replaces all division in EDT. it determines the highest
! power of ten (from 10**0 to 10**14) which can be divided into a line
! number.
!
! ENVIRONMENT: Runs at any access mode - AST reentrant
!
! AUTHOR: Sharon M. Burlingame, CREATION DATE: February 11, 1982
!
! MODIFIED BY:
!
! 1-001 - Original. SMB 11-FEB-1982
! 1-002 - Minor modifications due to code review input. SMB 24-May-1982
! 1-003 - Start of modifications for Tops10/20. GB December 1982
! Remove moveline macro and add code to copy line no.
!--
%SBTTL 'Declarations'
!
! TABLE OF CONTENTS:
!
REQUIRE 'EDTSRC:TRAROUNAM';
FORWARD ROUTINE
EDT$$LDIV : NOVALUE; ! Divide a line number by 10**(0-14)
!
! INCLUDE FILES:
!
REQUIRE 'EDTSRC:EDTREQ';
!
! MACROS:
!
! NONE
!
! EQUATED SYMBOLS:
!
! NONE
!
! OWN STORAGE:
!
! NONE
!
! EXTERNAL REFERENCES:
!
! In the routine
%SBTTL 'EDT$$LDIV - divide line number by 10**(0-14)'
GLOBAL ROUTINE EDT$$LDIV ( ! Divide line number by 10**(0-14)
NUMBER, ! The line number
D, ! Number of times divisible
I ! Power of ten to divide by
) : NOVALUE =
!++
! FUNCTIONAL DESCRIPTION:
!
! This routine performs division by repeated comparisons and
! subtractions. It determines how many times a line number
! is divisible by a power of ten and returns a digit from 0-9.
!
! FORMAL PARAMETERS:
!
! NUMBER input/output parameter - line number to be divided
!
! D output parameter - digit to be returned = number of times
! a power of ten divided the line number
!
! I input parameter - power of ten to divide by
!
! IMPLICIT INPUTS:
!
! LNO0
!
! IMPLICIT OUTPUTS:
!
! NONE
!
! ROUTINE VALUE:
!
! NONE
!
! SIDE EFFECTS:
!
! The value in NUMBER is decreased by D * 10**(I)
!
!--
BEGIN
EXTERNAL ROUTINE
EDT$$CMP_LNO;
EXTERNAL
LNO0 : LNOVECTOR [14];
MAP
NUMBER : REF LN_BLOCK;
LOCAL
DIGIT,
LINNO : LN_BLOCK;
!+
! Fetch the line number into a local
!-
LINNO [LN_LO] = .NUMBER [LN_LO];
LINNO [LN_MD] = .NUMBER [LN_MD];
LINNO [LN_HI] = .NUMBER [LN_HI];
!+
! Determine how many times this power of ten will divide the line number
!-
DIGIT = 0;
WHILE (EDT$$CMP_LNO (LINNO, LNO0 [.I]) GEQ 0) DO
!+
! We've found the correct power of ten
! Find the digit corresponding to this power of ten
!-
BEGIN
SUBLINE (LNO0 [.I], LINNO, LINNO);
DIGIT = .DIGIT + 1;
END;
!+
! Transfer the digit and new line number to return parameters
!-
.D = .DIGIT;
NUMBER [LN_LO] = .LINNO [LN_LO];
NUMBER [LN_MD] = .LINNO [LN_MD];
NUMBER [LN_HI] = .LINNO [LN_HI];
END;
END
ELUDOM