Google
 

Trailing-Edge - PDP-10 Archives - BB-D480F-BB_1985_short - dowhil.for
There are 9 other files named dowhil.for in the archive. Click here to see a list.
	PROGRAM DOWHIL

!COPYRIGHT (C) DIGITAL EQUIPMENT CORPORATION 1983, 1985
!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.

C	CDM
C	July 1982

C	Tests the DOWHILE( cond ) statement.

	DIMENSION NRRY(4:5)
	LOGICAL LOG
	INTEGER VAR

C-100-	Simple

	I=1; J=10
	KNT=0

	DO WHILE(I .LT. J)

	I = I+1
	KNT = KNT + 1

	END DO

	IF (KNT .NE. 9) TYPE 100, KNT
100	FORMAT(' ?Error 100. KNT = 'I', should = 9')

C-200-	With label

	I=3
	DO 201 WHILE(I.NE.5)
	I = I+1
201	NRRY(I) = I

	IF (NRRY(4) .NE. 4) TYPE 210, 4,NRRY(4),4
	IF (NRRY(5) .NE. 5) TYPE 210, 5,NRRY(5),5
210	FORMAT(' ?Error 210. NRRY('I1')='I', should = 'I2)

C-300-	With regular incremental DO's

	LOG = .TRUE.
	IVAR = 0
	DO I=1,4
		LOG = .NOT. LOG
		KNT = 0
		DO WHILE((LOG) .AND. KNT.LT.3)
			KNT = KNT+1
			DO J=1,5
				IVAR = IVAR + I + J
			ENDDO
		ENDDO
	ENDDO

	IF (IVAR .NE. 180) TYPE 300, IVAR
300	FORMAT(' ?Error 330. IVAR='I', should = 180')

C-400-	Let's fool the parser!
C	This should not be ANY type of DO loop or DOUBLE PRECSION stmt.

	DOU = 1

C-500-	This is a DO loop, the incr var is U.

	VAR=0
	DOU=1,2
	  VAR=VAR+1
	ENDDO

	IF (VAR .NE. 2) TYPE 500, VAR
500	FORMAT(' ?Error 500.  VAR='I', should = 3')

	STOP 'DoWhile'
	END