Google
 

Trailing-Edge - PDP-10 Archives - BB-H138F-BM_1988 - 7-sources/chmgcount.bli
There are 11 other files named chmgcount.bli in the archive. Click here to see a list.
 %TITLE 'CHMGCOUNT - look for a repeat or entity count'
MODULE CHMGCOUNT (				! Look for a repeat or entity count
		IDENT = '3-003'			! File: CHMGCOUNT.BLI Edit: GB3003
		) =
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 looks for a repeat/entity count.
!
! ENVIRONMENT:	Runs at any access mode - AST reentrant
!
! AUTHOR: Bob Kushlis, CREATION DATE: Unknown
!
! MODIFIED BY:
!
! 1-001	- Original.  DJS 04-Feb-1981.  This module was created by
!	extracting the routine EDT$$CHK_CNT  from module CHANGE.BLI.
! 1-002	- Regularize headers.  JBS 02-Mar-1981
! 1-003	- Don't allow repeat counts greater than 32767.  JBS 10-Mar-1982
! 1-004	- Change numeric test.  JBS 19-Jul-1982
! 1-005	- Add conditional for VT220 support.  JBS 11-Feb-1983
! 3-001 - Change CMD_BUF to CMD_PTR since this is now the command ptr.  GB 8-Apr-1983
! 3-002 - Add updates from V3 source kit.  GB 27-Apr-1983
! 3-003 - Remove VT220 conditional to speed up code. CJG 25-Nov-1983
!--

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

REQUIRE 'EDTSRC:TRAROUNAM';

FORWARD ROUTINE
    EDT$$CHK_CNT;				! Look for a repeat/entity count

!
! INCLUDE FILES:
!

REQUIRE 'EDTSRC:EDTREQ';

LIBRARY 'EDTSRC:TRANSLATE';

!
! MACROS:
!
!	NONE
!
! EQUATED SYMBOLS:
!
!	NONE
!
! OWN STORAGE:
!
!	NONE
!
! EXTERNAL REFERENCES:
!
!	In the routine
%SBTTL 'EDT$$CHK_CNT  - look for a repeat/entity count'

GLOBAL ROUTINE EDT$$CHK_CNT (			! Look for a repeat or entity count
    COUNT					! Where to store count
    ) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine looks for a repeat/entity count, and stores it in the
!	formal parameter COUNT.
!
! FORMAL PARAMETERS:
!
!  COUNT		Where to return the value of the count
!
! IMPLICIT INPUTS:
!
!	CMD_PTR
!
! IMPLICIT OUTPUTS:
!
!	CMD_PTR
!
! ROUTINE VALUE:
!
!	A value of 1 is returned if an explicit count was seen,
!	0 means no explicit count, COUNT retains its value,
!	2 means the count is invalid.
!
! SIDE EFFECTS:
!
!	NONE
!
!--

    BEGIN

    EXTERNAL
	CMD_PTR,				! Command string pointer
	CHAR_INFO : BLOCKVECTOR [256, 1];	! Information about characters

    LOCAL
	RET_VALUE,
	CHAR,
	L_COUNT;

    L_COUNT = ..COUNT;
    CHAR = CH$RCHAR (.CMD_PTR);

    IF NOT .CHAR_INFO [.CHAR, CI_DIG]
    THEN
	RET_VALUE = 0
    ELSE
	BEGIN
	RET_VALUE = 1;
	L_COUNT = 0;

	WHILE (.CHAR_INFO [.CHAR, CI_DIG] AND (.RET_VALUE EQL 1)) DO
	    BEGIN

	    IF (.L_COUNT GTR 3276)
	    THEN
		RET_VALUE = 2
	    ELSE
		BEGIN
		L_COUNT = .L_COUNT*10 + .CHAR - %C'0';
		CHAR = CH$A_RCHAR (CMD_PTR);
		END;

	    IF ((.L_COUNT GTR 32767) OR (.L_COUNT LSS 0)) THEN RET_VALUE = 2;

	    END;

	END;

    .COUNT = .L_COUNT;
    RETURN (.RET_VALUE);
    END;					! of routine EDT$$CHK_CNT

!<BLF/PAGE>

END
ELUDOM