C===============================COMP.FOR================================
C     
C       COMP:   COMPILES STRING OF UNITS TO ITS FUNDAMENTAL CONVERSION 
C               FACTOR AND PRODUCES AN EIGHT ELEMENT VECTOR OF FUNDA-
C               MANTAL UNIT POWERS.
C
C       CF:     FINAL COVERSION FACTOR IN TERMS OF FUNDAMENTAL UNITS.
C       VPOW:   8 ELEMENT VECTOR;
C                       1 = Kilogram
C                       2 = Meter
C                       3 = Second
C                       4 = Ampere
C                       5 = Candela
C                       6 = Kelvin
C                       7 = Null (Dimensionless)
C                       8 = Mol
C       STRU:   STRING OF UNITS
C       TV:     TABLE OF VALUES (FUNDAMENTAL CONVERSION FACTORS)
C       TU:     TABLE OF FUNDAMENTAL UNIT NAMES 
C       TFUP:   TABLE OF FUNDAMENTAL UNIT POWERS

      SUBROUTINE COMP(CF, VPOW, STRU, TV, TU, TUIND, TFUP)
      PARAMETER (MAXUNIT=7, MAXARG=70)
      REAL*8 CF, F, TV(120)
      INTEGER VPOW(8), VP(8), TFUP(120,8), SIGN, IND, POWER, SH
      INTEGER TUIND(120)
      CHARACTER*(MAXARG) STRU
      CHARACTER*423 TU
      CHARACTER*(MAXUNIT) UNIT
      SIGN=1
      CF=1D0
      DO 100, K=1,8
      VPOW(K)=0
 100  CONTINUE
 5    IF (SIGN .EQ.  0) GOTO 30
      IF (SIGN .EQ. 99) GOTO 20
      CALL GETUNIT(STRU, UNIT, POWER, SIGN, SH)
      CALL GETCF(F, IND, TU, TUIND, TV, UNIT, POWER, SH)
      CALL GETFU(VP, IND, POWER, TFUP)
      CALL VADD(VPOW,VP)
      CF=CF*F
      GOTO 5
 20   PRINT *,'FINISHED WITH 99'
 30   RETURN
      END