Trailing-Edge
-
PDP-10 Archives
-
BB-R595B-SM_11-9-85
-
mcb/utilities/catb.bli
There are 2 other files named catb.bli in the archive. Click here to see a list.
MODULE CATB ( !ASCII to binary conversion routines
IDENT = '001010',
LANGUAGE (BLISS16, BLISS36) %BLISS36 (, ENTRY ($CDTB, $COTB))
) =
BEGIN
!
!
!
! COPYRIGHT (c) 1980, 1981, 1982
! DIGITAL EQUIPMENT CORPORATION
! Maynard, Massachusetts
!
! 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: SYSTEM LIBRARY
!
! ABSTRACT:
!
!
! THIS MODULE CONTAINS ROUTINES TO CONVERT DECIMAL OR OCTAL ASCII
! TO BINARY.
!
!
! ENVIRONMENT: ANY
!
! AUTHOR: ALAN D. PECKHAM, CREATION DATE: 28-AUG-78
!
! MODIFIED BY:
!
! , : VERSION
! 01 -
!--
!
! TABLE OF CONTENTS:
!
FORWARD ROUTINE
$CDTB, !Convert decimal ASCII to binary.
$COTB, !Convert octal ASCII to binary.
COTB; !ASCII to binary common routine
!
! INCLUDE FILES
!
! NONE
!
! MACROS:
!
! NONE
!
! EQUATED SYMBOLS:
!
! NONE
!
! OWN STORAGE:
!
! NONE
!
! EXTERNAL REFERENCES:
!
! NONE
!
GLOBAL ROUTINE $CDTB (BUF_PTR_ADR) =
!++
! FUNCTIONAL DESCRIPTION:
!
!
!
!
! FORMAL PARAMETERS:
!
! .BUF_PTR_ADR !Address of character sequence
! !pointer to buffer to extract
! !number from.
!
! IMPLICIT INPUTS:
!
! NONE
!
! IMPLICIT OUTPUTS:
!
! The buffer pointer ..BUF_PTR_ADR is updated to point past
! the characters used in the conversion.
!
! ROUTINE VALUE:
!
! The binary equivalent of the decimal number.
!
! SIDE EFFECTS
!
! NONE
!
!--
BEGIN
LITERAL
RADIX = 10; !Use a radix of 10.
COTB (.BUF_PTR_ADR, RADIX) !Convert the number.
END; !OF $CDTB
GLOBAL ROUTINE $COTB (BUF_PTR_ADR) =
!++
! FUNCTIONAL DESCRIPTION:
!
!
!
!
! FORMAL PARAMETERS:
!
! .BUF_PTR_ADR !Address of character sequence
! !pointer to buffer to extract
! !number from.
!
! IMPLICIT INPUTS:
!
! NONE
!
! IMPLICIT OUTPUTS:
!
! The buffer pointer ..BUF_PTR_ADR is updated to point past
! the characters used in the conversion.
!
! ROUTINE VALUE:
!
! The binary equivalent of the octal number.
!
! SIDE EFFECTS
!
! NONE
!
!--
BEGIN
LITERAL
RADIX = 10; !Use a radix of 10.
COTB (.BUF_PTR_ADR, RADIX) !Convert the number.
END; !OF $COTB
ROUTINE COTB (BUF_PTR_ADR, RADIX) =
!++
! FUNCTIONAL DESCRIPTION:
!
!
!
!
! FORMAL PARAMETERS:
!
! .BUF_PTR_ADR !Address of character sequence
! !pointer to buffer to extract
! !number from.
! RADIX !Radix for conversion
!
! IMPLICIT INPUTS:
!
! NONE
!
! IMPLICIT OUTPUTS:
!
! The buffer pointer ..BUF_PTR_ADR is updated to point past
! the characters used in the conversion.
!
! ROUTINE VALUE:
!
! The binary equivalent of the number in the specified radix.
!
! SIDE EFFECTS
!
! NONE
!
!--
BEGIN
LOCAL
BUF_PTR,
DIGIT, !NEXT digit FROM STRING
VALUE; !RESULTING VALUE EXTRACTED
BUF_PTR = ..BUF_PTR_ADR;
VALUE = 0;
WHILE (DIGIT = CH$RCHAR_A (BUF_PTR) - %C'0') GEQ 0 AND .DIGIT LSS .RADIX DO
VALUE = (.VALUE*.RADIX) + .DIGIT;
.BUF_PTR_ADR = CH$PLUS (.BUF_PTR, -1);
.VALUE
END; !OF COTB
END
ELUDOM