Google
 

Trailing-Edge - PDP-10 Archives - BB-H138E-BM - 6-1-sources/fdec.bli
There are 10 other files named fdec.bli in the archive. Click here to see a list.
 %TITLE 'FDEC - format a decimal number'
MODULE FDEC (				! Format a decimal number
		IDENT = '1-005'			! File: FDEC.BLI Edit: GB1005
		) =
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:
!
!	Format a decimal number.
!
! ENVIRONMENT:	Runs at any access mode - AST reentrant
!
! AUTHOR: Bob Kushlis, CREATION DATE: March 18, 1979
!
! MODIFIED BY:
!
! 1-001	- Original.  DJS 19-FEB-1981.  This module was created by
!	extracting routine EDT$$FMT_DCML  from module FORMAT.
! 1-002	- Regularize headers.  JBS 05-Mar-1981
! 1-003	- Rewrite to use recursion.  This saves 17 words over version 1-002
!	   on the PDP-11.  JBS 05-Mar-1981
! 1-004	- Correct infinite recursion.  JBS 02-Apr-1981
! 1-005 - Make arguments to FMT_CH consistent ie right justified.  GB 14-Feb-1983
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$FMT_DCML : NOVALUE;

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$FMT_DCML  - format a decimal number'

GLOBAL ROUTINE EDT$$FMT_DCML (			! Format a decimal number
	N					! The number to format
    ) : NOVALUE =

!++
! FUNCTIONAL DESCRIPTION:
!
!	Convert a decimal number to displayable ascii in the format buffer.
!	The number is written with a leading minus and leading zeros suppressed.
!
! FORMAL PARAMETERS:
!
!	N		The number to write out.
!
! IMPLICIT INPUTS:
!
!	NONE
!
! IMPLICIT OUTPUTS:
!
!	NONE
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	Calls itself for large numbers.
!
!--

    BEGIN

    EXTERNAL ROUTINE
	EDT$$FMT_CH : NOVALUE;

    LOCAL
	POSITIVE_N;

!+
! See if we should put out a minus.
!-

    IF (.N LSS 0)
    THEN
	BEGIN
	EDT$$FMT_CH (%C'-');
	POSITIVE_N = -.N;
	END
    ELSE
	POSITIVE_N = .N;

!+
! If the number is greater than or equal to 10, print
! the leading digits first.
!-

    IF (.POSITIVE_N GEQ 10) THEN EDT$$FMT_DCML (.POSITIVE_N/10);

!+
! Now print the low-order (last) digit.
!-
    EDT$$FMT_CH ((.POSITIVE_N MOD 10) + %C'0');
    END;


END
ELUDOM