c===============================GETUNIT.FOR============================= c C---GETS FIRST UNIT IN ARG WITH POWER. REPLACES CORRESPONDING C ELEMENTS IN ARG WITH BLANKS. C ARG: STING OF UNITS C U: A SINGLE CHARACTER UNIT C POW: THE POWER ASSOCIATED WITH THE UNIT C SIGN: THE SIGN OF THIS UNIT TO GET. MUST GIVEN AS INPUT. C J: THE LENGTH OF THE UNIT. /DEE 1-89 c SUBROUTINE GETUNIT(ARG,U,POW,SIGN,J) PARAMETER (MAXPOW=5, MAXUNIT=7, MAXARG=70) CHARACTER*(*) ARG CHARACTER*(*) U INTEGER POW, SIGN CHARACTER*(MAXPOW) SPOW I=1 J=1 POW=1 NSIGN = 0 10 IF (I .GT. MAXARG) GOTO 16 IF (ARG(I:I) .EQ. ' ') GOTO 15 IF (ARG(I:I) .EQ. '*') GOTO 11 IF (ARG(I:I) .EQ. '/') GOTO 12 IF (ARG(I:I) .EQ. '^') GOTO 13 c U(J:J) = ARG(I:I) ARG(I:I) = ' ' J=J+1 GOTO 15 c 11 NSIGN=1 ARG(I:I)=' ' GOTO 16 12 NSIGN = -1 ARG(I:I)= ' ' GOTO 16 13 K=1 131 ARG(I:I)=' ' I=I+1 IF (I .GT. MAXARG) GOTO 132 IF (ARG(I:I) .EQ. ' ') GOTO 131 IF ((ARG(I:I) .EQ. '*') .OR. (ARG(I:I) .EQ. '/')) GOTO 132 SPOW(K:K) = ARG(I:I) K=K+1 GOTO 131 132 CALL CTOI(SPOW, POW, K-1) GOTO 10 15 I=I+1 GOTO 10 16 POW=POW*SIGN SIGN=SIGN*NSIGN IF (J .EQ. 1) SIGN = 99 J=J-1 RETURN END