Google
 

Trailing-Edge - PDP-10 Archives - BB-H138F-BM_1988 - 7-sources/lfcount.bli
There are 10 other files named lfcount.bli in the archive. Click here to see a list.
 %TITLE 'LFCOUNT - type a message with a count'
MODULE LFCOUNT (				! Type a message with a count
		IDENT = '3-002'			! File: LFCOUNT.BLI Edit: 3002
		) =
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:
!
!	This module writes out that portion of a line mode message
!	giving a count.
!
! ENVIRONMENT:	Runs at any access mode - AST reentrant
!
! AUTHOR: Bob Kushlis, CREATION DATE: February 3, 1978
!
! MODIFIED BY:
!
! 1-001	- Original.  DJS 02-FEB-1981.  This module was created by
!	extracting the routine EDT$$FMT_STRCNT  from the module EXEC.BLI.
! 1-002	- Regularize headers.  JBS 19-Mar-1981
! 1-003 - Make it work for 32 or 48 bits so pass count pointer.  SMB 5-Feb-1982
! 1-004 - Change "division" to a routine call.  SMB 11-Feb-1982
! 3-001 - Start of modifications for Tops10/20. GB December 1982.
!	  Remove moveline macro and add code to copy line number.
! 3-002 - Fix EDT$$FMT_STR. CJG 22-Mar-1983
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$FMT_STRCNT : NOVALUE;			! Format a count for printing

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$FMT_STRCNT  - type a message with a count'

GLOBAL ROUTINE EDT$$FMT_STRCNT (		! Type a message with a count
	N, 					! The count
	S, 					! Pointer to message
	L					! Length of message
    ) : NOVALUE =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine writes out the portion of a message giving a count.
!	The count can be 48 bits long or less
!
! FORMAL PARAMETERS:
!
!  N 			the count pointer, which is written as a decimal number unless it
!			is zero, in which case it is written as 'No'
!
!  S 			a pointer to a string of characters which is written after the count,
!			followed by an 's' unless the count is exactly 1.
!
!  L 			the length of the sting pointed to by S.
!
! IMPLICIT INPUTS:
!
!	LNO_ZERO
!	LNO0-14
!
! IMPLICIT OUTPUTS:
!
!	NONE
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$LDIV,
	EDT$$FMT_CH,
	EDT$$FMT_DCML,
	EDT$$CMP_LNO,
	EDT$$FMT_STR;

    EXTERNAL
	LNO0 : LNOVECTOR [14],
	LNO_ZERO : LN_BLOCK;

    MAP
	N : REF LN_BLOCK;

    LOCAL
	DIGIT,
	LINNO : LN_BLOCK,
	SIGNIF;

!+
! Fetch the integer into a local
!-
    LINNO [LN_LO] = .N [LN_LO];
    LINNO [LN_MD] = .N [LN_MD];
    LINNO [LN_HI] = .N [LN_HI];

    IF (EDT$$CMP_LNO(LNO_ZERO, LINNO) EQL 0) THEN
	EDT$$FMT_STR (CH$PTR (UPLIT('No')),2)
    ELSE
	BEGIN
    SIGNIF = 0;
!+
! Loop once for each possible digit in the number starting with most 
! significant
!-

    DECR I FROM 14 TO 0 DO
	BEGIN
	
	EDT$$LDIV (LINNO, DIGIT, .I);
!+
! Write the digit out if the current digit is non-zero or
! we have seen a previous non zero digit 
!-

	    IF ((.DIGIT NEQ 0) OR (.SIGNIF NEQ 0))
	    THEN
		BEGIN
		EDT$$FMT_CH(.DIGIT + %C'0');
		SIGNIF = .SIGNIF + 1;
		END;

	END;
    	END;

    IF (.L NEQ 0)
    THEN
	BEGIN
    	EDT$$FMT_STR (.S, .L);
    	IF (EDT$$CMP_LNO(.N,LNO0) NEQ 0) THEN EDT$$FMT_CH (%C's');
	END;

    END;


END
ELUDOM