Functions and subroutines within this library:
pthseqEnd of directory
C *********************************************************
C * *
C * SUBROUTINE 02.01/pthseq *
C * *
C * PHIGS Validation Tests, produced by NIST *
C * *
C *********************************************************
SUBROUTINE PTHSEQ (ADSW, STRID, PTHORD, PTHDEP, RETCOD, EXPCTD)
C Pthseq obtains a set of ancestor or descendant paths
C and compares the reported set to an expected value to test
C for set-equality, where each element of the set is a path.
C The result is returned in retcod, which is zero if the sets
C are equal. If the sets are not equal, pthseq writes out an
C informative message explaining the conditions of failure.
C --- Input Parameters:
C adsw : A/D switch to indicate ancestor or descendant paths
C strid : structure identifier for start of path
C pthord : path order
C pthdep : path depth
C expctd : expected value, encoded as string; ER paths are terminated
C by slashes, elements separated by commas. The sequence of
C integers is interpreted as: structure-id, execute-position,
C ...
C --- Output Parameters:
C retcod : return code, indicating result of test
C maximum path size, number of paths, and array length
INTEGER PSIZE, MXNPTH, ARLEN
PARAMETER (PSIZE = 25, MXNPTH = 20, ARLEN = PSIZE*2)
INTEGER STRID, PTHORD, PTHDEP, RETCOD
INTEGER IPATH, IDUM, IEXP, ERRIND
C these are variables to represent expected paths
INTEGER EXPNUM, EXPLEN (MXNPTH), EXPPTH (ARLEN, MXNPTH)
C these are variables to hold paths as reported by inquire
INTEGER REPNUM, REPLEN, REPPTH (ARLEN)
LOGICAL ANCEST, IAREQ
CHARACTER ADSW*1, EXPCTD*(*), MSG*300
C First, parse expctd to set up 2D ragged array of expected paths.
CALL SET2D (EXPCTD, ARLEN, EXPNUM, EXPLEN, EXPPTH)
C check adsw validity
IF (ADSW .EQ. 'a' .OR. ADSW .EQ. 'A') THEN
ANCEST = .TRUE.
ELSEIF (ADSW .EQ. 'd' .OR. ADSW .EQ. 'D') THEN
ANCEST = .FALSE.
ELSE
C invalid adsw
CALL UNMSG ('Invalid adsw in pthseq:' // ADSW)
ENDIF
C now get actual paths and compare them to expected;
C first get number of paths = repnum
IF (ANCEST) THEN
CALL PQPAN (STRID, PTHORD, PTHDEP, PSIZE, 0,
1 ERRIND, REPNUM, REPLEN, REPPTH)
CALL CHKINQ ('pqpan', ERRIND)
ELSE
CALL PQPDE (STRID, PTHORD, PTHDEP, PSIZE, 0,
1 ERRIND, REPNUM, REPLEN, REPPTH)
CALL CHKINQ ('pqpde', ERRIND)
ENDIF
C if number of paths unequal, whole set is unequal
IF (REPNUM .NE. EXPNUM) THEN
RETCOD = 2
WRITE (MSG, '(A,I4,A,I4,A,A,A, 3I5)')
1 'Number of reported paths (', REPNUM,
2 ') not equal to expected number (', EXPNUM, '), ',
3 'resulting from inquire with structure-id, path ',
4 'order, path depth = ', STRID, PTHORD, PTHDEP
CALL INMSG (MSG)
RETURN
ENDIF
C go thru set of actual paths, one at a time and compare.
DO 100 IPATH = 1,REPNUM
C get next path
IF (ANCEST) THEN
CALL PQPAN (STRID, PTHORD, PTHDEP, PSIZE, IPATH,
1 ERRIND, IDUM, REPLEN, REPPTH)
CALL CHKINQ ('pqpan', ERRIND)
ELSE
CALL PQPDE (STRID, PTHORD, PTHDEP, PSIZE, IPATH,
1 ERRIND, IDUM, REPLEN, REPPTH)
CALL CHKINQ ('pqpde', ERRIND)
ENDIF
C look for a match among expected
DO 200 IEXP = 1, EXPNUM
C seek matching length;
C multiply by 2, because paths have 2 integers per element -
C structure id and element ref
IF (REPLEN*2 .NE. EXPLEN(IEXP)) GOTO 200
C check contents
IF (IAREQ (REPLEN*2, REPPTH, EXPPTH(1, IEXP))) THEN
C got a match - mark out length to prevent re-matching same column
EXPLEN(IEXP) = -1
GOTO 100
ENDIF
200 CONTINUE
C no match found - fail
RETCOD = 3
WRITE (MSG, '(A,A,A, 3I5)')
1 'Reported path unmatched within set of expected paths ',
2 'resulting from inquire with structure-id, path ',
3 'order, path depth = ', STRID, PTHORD, PTHDEP
CALL INMSG (MSG)
RETURN
100 CONTINUE
C every reported path found a match - success
RETCOD = 0
END