



      INTEGER FUNCTION GVFFFF(N,X)











      IMPLICIT      NONE
      INTEGER       N
      INTEGER       GVFLFR, I, IERR, IFND
      REAL          X(N)
      LOGICAL       WSVFOP
      CHARACTER*80  LINE







      IF (WSVFOP()) THEN
         CALL GVSRT0 (X,N)
         CALL WSVTO6 ('GVFFFF called')
         GVFFFF=N
         GOTO 998
      END IF

      DO 10 I=1,N
         IF (I.GT.1) THEN
            CALL PEEKWORD (LINE,IERR)
            IF (IERR.GT.0) THEN
               GVFFFF=I-1
               GOTO 998
            END IF
         END IF
         CALL GETWORD (LINE,IERR)
         IF (IERR.EQ.2) THEN
            GVFFFF=I-1
            GOTO 998
         ELSE IF (IERR.EQ.1) THEN 
            X(I)=0.0
         ELSE
            IFND=GVFLFR(1,X(I),LINE)
            IF (IFND.EQ.0) THEN
               CALL FLUSHAHEAD
               GVFFFF=0
               GOTO 998
            END IF
         END IF
   10 CONTINUE
      GVFFFF=N



 998  CONTINUE


      RETURN
      END
      SUBROUTINE GVSFFF (N,X)







      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       N
      INTEGER       NRES, GVFFFF, K
      REAL          X(N)
      LOGICAL       WSVFOP
      CHARACTER*80  SAVEPR







      IF (WSVFOP()) THEN
         CALL GVSRT0 (X,N)
         CALL WSVTO6 ('GVSFFF called')
         GOTO 998
      END IF

      CALL GVSSTX (SAVEPR,VPROMPT)
      K=1
   10 CONTINUE
      CALL GVSSTX (VPROMPT,SAVEPR)
      NRES=GVFFFF(N-K+1,X(K))
      IF (K+NRES-1.NE.N) THEN
         IF (N.EQ.1) THEN
            CALL WIFBO0
         ELSE
            CALL GVSTTI ('?R00124',N-K-NRES+1)
         END IF
         K=K+NRES
         GOTO 10
      END IF
      CALL WIFBO1 (0,' ')



 998  CONTINUE


      RETURN
      END
      INTEGER FUNCTION GVFFFI(N,X)










      IMPLICIT      NONE
      INTEGER       N
      INTEGER       GVFLFI, X(N), I, IFND, IERR
      LOGICAL       WSVFOP
      CHARACTER*80  LINE







      IF (WSVFOP()) THEN
         CALL GVSIT0 (X,N)
         CALL WSVTO6 ('GVFFFI called')
         GVFFFI=N
         GOTO 998
      END IF

      DO 10 I=1,N
         IF (I.GT.1) THEN
            CALL PEEKWORD (LINE,IERR)
            IF (IERR.GT.0) THEN
               GVFFFI=I-1
               GOTO 998
            END IF
         END IF
         CALL GETWORD (LINE,IERR)
         IF (IERR.EQ.2) THEN
            GVFFFI=I-1
            GOTO 998
         ELSE IF (IERR.EQ.1) THEN 
            X(I)=0
         ELSE
            IFND=GVFLFI(1,X(I),LINE)
            IF (IFND.EQ.0) THEN
               CALL FLUSHAHEAD
               GVFFFI=0
               GOTO 998
            END IF
         END IF
   10 CONTINUE
      GVFFFI=N



 998  CONTINUE


      RETURN
      END
      SUBROUTINE GVSFFI (N,X)







      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       N
      INTEGER       X(N), NRES, GVFFFI, K
      LOGICAL       WSVFOP
      CHARACTER*80  SAVEPR







      IF (WSVFOP()) THEN
         CALL GVSIT0 (X,N)
         CALL WSVTO6 ('GVSFFI called')
         GOTO 998
      END IF



      CALL GVSSTX (SAVEPR,VPROMPT)
      K=1



   10 CONTINUE
      CALL GVSSTX (VPROMPT,SAVEPR)
      NRES=GVFFFI(N-K+1,X(K))



      IF (N.EQ.1.AND.NRES.EQ.0.AND.WIFPAR(333).NE.0) THEN
         X(1)=WIFPAR(333)
         GOTO 998
      END IF



      IF (K+NRES-1.NE.N) THEN
         IF (N.EQ.1) THEN
            CALL WIFBO0
         ELSE
            CALL GVSTTI ('?R00124',N-K-NRES+1)
         END IF
         K=K+NRES
         GOTO 10
      END IF



      CALL WIFBO1 (0,' ')



 998  CONTINUE


      RETURN
      END
      INTEGER FUNCTION GVFLFI(N,I,LINEIN)















      IMPLICIT      NONE
      INTEGER       N
      INTEGER       I(N), GVFLEN, LENLIN, IVALUE, LREC, IA, LA, 
     +              IS, NEXT, J
      LOGICAL       FOUND
      CHARACTER*1   NUM(10), COMMA, CHAR, MINUS
      CHARACTER*(*) LINEIN
      SAVE          COMMA, MINUS, NUM
      DATA COMMA    /','/
      DATA MINUS    /'-'/
      DATA NUM      /'0','1','2','3','4','5','6','7','8','9'/







      LREC=GVFLEN(LINEIN)
      LENLIN=LEN(LINEIN)



      IF (LREC.LT.LENLIN) THEN
         LREC=LREC+1
         LINEIN(LREC:LREC)=' '
      END IF



      NEXT=1
      IA=0
      LA=IABS(N)
      IS=1
  100 CONTINUE
      FOUND=.FALSE.

  110 CONTINUE
      IF (NEXT.GT.LREC) GOTO 180
      CHAR=LINEIN(NEXT:NEXT)
      NEXT=NEXT+1

      DO 120 J=1,10
         IF (CHAR.EQ.NUM(J)) GOTO 140
  120 CONTINUE
      IF (CHAR.NE.MINUS) GOTO 130
      IS=-1
      IF (FOUND) GOTO 170
      GOTO 110

  130 CONTINUE
      IF (FOUND) GOTO 160
      IF (CHAR.NE.COMMA) GOTO 110
      IA=IA+1
      IF (N.GT.0) I(IA)=0
      GOTO 170

  140 CONTINUE
      IF (FOUND) GOTO 150
      FOUND=.TRUE.
      IA=IA+1
      I(IA)=ISIGN(J-1,IS)
      GOTO 110

  150 CONTINUE
      IVALUE=10*I(IA)+ISIGN(J-1,IS)
      I(IA)=IVALUE
      GOTO 110

  160 CONTINUE
      IS=1
  170 CONTINUE
      IF (IA.LT.LA) GOTO 100
  180 CONTINUE
      GVFLFI=IA
      IF (IA.EQ.LA.OR.N.LE.0) GOTO 998
      DO 190 J=IA+1,LA
         I(J)=0
  190 CONTINUE



 998  CONTINUE


      RETURN
      END
      INTEGER FUNCTION GVFLFR(NF,ROW,LINEIN)









      IMPLICIT      NONE
      INTEGER       GVFLEN, IS, IA, I, II, LREC, NF, LENLIN, NEXT,
     +              IE
      REAL          ROW(NF)
      CHARACTER*1   NUM(10), CHAR, MINUS, POINT
      CHARACTER*12  TSTRING
      CHARACTER*(*) LINEIN
      CHARACTER*10000 LINE
      LOGICAL       FOUNDP, FOUND
      SAVE          MINUS, POINT, NUM, TSTRING
      DATA          MINUS,POINT,NUM /'-','.',
     +              '0','1','2','3','4','5','6','7','8','9'/
      DATA TSTRING  /'-.0123456789'/







      CALL GVSSTX (LINE,LINEIN(1:MIN(LEN(LINEIN),10000)))
      DO 10 I=1,NF
         ROW(I)=0
 10   CONTINUE
      GVFLFR=0
      LENLIN=LEN(LINE)
      IF (LENLIN.LE.0) GOTO 998
      NEXT=0
      IA = 1



      DO 11 I=1,LENLIN
         IF (INDEX(TSTRING,LINE(I:I)).EQ.0) LINE(I:I)=' '
   11 CONTINUE
      CALL GVSRDB (LINE)
      CALL GVSSHL (LINE)
      LREC=GVFLEN(LINE)
      IF (LREC.LE.0) GOTO 998



  100 CONTINUE
      FOUNDP = .FALSE.
      FOUND  = .FALSE.
      IE     = 0
      IS     = 1



  110 CONTINUE



      NEXT = NEXT+1



      IF (NEXT.GT.LREC) THEN
         IF (IA.LE.NF.AND.IA.GE.1) THEN
            IF (IE.GE.1) THEN
               DO 115 I=1,IE
                  ROW(IA)=ROW(IA)/10.0
 115           CONTINUE
            END IF
            ROW(IA)=FLOAT(IS)*ROW(IA)
            IA=IA+1
         END IF
         GVFLFR=IA-1
         GOTO 998
      END IF
      CHAR = LINE(NEXT:NEXT)



      DO 120 II = 1,10
         I=II
         IF (CHAR.EQ.NUM(I)) THEN
            FOUND=.TRUE.
            ROW(IA)=10.0*ROW(IA)+I-1
            IF (FOUNDP) IE=IE+1
            GOTO 110
         END IF
  120 CONTINUE



      IF (CHAR.EQ.MINUS) THEN
         IS = -1
         GOTO 110
      END IF



      IF (CHAR.EQ.POINT) THEN
         FOUNDP=.TRUE.
         GOTO 110
      END IF



      IF (FOUND) THEN
         IF (IA.LE.NF.AND.IA.GE.1) THEN
            IF (IE.GT.0) THEN
               DO 180 I=1,IE
                  ROW (IA) = ROW(IA)/10.0
  180          CONTINUE
            END IF
            ROW(IA)=FLOAT(IS)*ROW(IA)
         END IF
         IA=IA+1



         IF (IA.GT.NF) THEN
            GVFLFR=IA-1
            GOTO 998
         ELSE
            GOTO 100
         END IF
      ELSE
         GOTO 110
      END IF



 998  CONTINUE


      END
      SUBROUTINE GVSLFR (N,R,LINEIN)







      IMPLICIT      NONE
      INTEGER       N
      INTEGER       GVFLFR, NRES
      REAL          R(N)
      CHARACTER*(*) LINEIN





      NRES=GVFLFR(N,R,LINEIN)
      IF (NRES.NE.N) THEN
         CALL GVSTTB ('?R00126')
         CALL GVSKIL
      END IF





      RETURN
      END
      SUBROUTINE GVSMTI (RMAT,TVEC,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, GVFFFF, J
      REAL          RMAT(3,3), TVEC(3)
      LOGICAL       WSVFOP







      IF (WSVFOP()) THEN
         CALL WSVTO6 ('GVSMTI called')
         CALL GVSMTU (RMAT,3)
         CALL GVSRT0 (TVEC,3)
         GOTO 998
      END IF



      IERR=0
      CALL GVSCLP



      CALL GVSMTU (RMAT,3)
      CALL GVSRT0 (TVEC,3)



      CALL GVSTT6 ('?R00125')
      CALL IPROMPT ('M(1,1)=')
      J=GVFFFF(1,RMAT(1,1))
      IF (J.EQ.0) THEN
         IERR=1
         GOTO 998
      END IF



      CALL GVSCLP
      CALL GVSFMT ('?FMT068')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) RMAT(1,1)
      CALL IPROMPT (LINE)
      CALL GVSFFF (1,RMAT(1,2))



      CALL GVSCLP
      CALL GVSFMT ('?FMT069')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) RMAT(1,1),RMAT(1,2)
      CALL IPROMPT (LINE)
      CALL GVSFFF (1,RMAT(1,3))



      CALL GVSCLP
      CALL GVSFMT ('?FMT070')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) RMAT(1,1),RMAT(1,2),RMAT(1,3)
      CALL IPROMPT (LINE)
      CALL GVSFFF (1,TVEC(1))



      CALL GVSCLP
      CALL GVSFMT ('?FMT071')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) (RMAT(1,J),J=1,3),TVEC(1)
      CALL GVSTT6 (LINE)
      CALL IPROMPT ('M(2,1)= ')
      CALL GVSFFF (1,RMAT(2,1))



      CALL GVSCLP
      CALL GVSFMT ('?FMT071')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) (RMAT(1,J),J=1,3),TVEC(1)
      CALL GVSTT6 (LINE)
      CALL GVSFMT ('?FMT073')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) RMAT(2,1)
      CALL IPROMPT (LINE)
      CALL GVSFFF (1,RMAT(2,2))



      CALL GVSCLP
      CALL GVSFMT ('?FMT071')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) (RMAT(1,J),J=1,3),TVEC(1)
      CALL GVSTT6 (LINE)
      CALL GVSFMT ('?FMT074')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) RMAT(2,1),RMAT(2,2)
      CALL IPROMPT (LINE)
      CALL GVSFFF (1,RMAT(2,3))



      CALL GVSCLP
      CALL GVSFMT ('?FMT071')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) (RMAT(1,J),J=1,3),TVEC(1)
      CALL GVSTT6 (LINE)
      CALL GVSFMT ('?FMT075')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) RMAT(2,1),RMAT(2,2),RMAT(2,3)
      CALL IPROMPT (LINE)
      CALL GVSFFF (1,TVEC(2))



      CALL GVSCLP
      CALL GVSFMT ('?FMT071')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) (RMAT(1,J),J=1,3),TVEC(1)
      CALL GVSTT6 (LINE)
      CALL GVSFMT ('?FMT072')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) (RMAT(2,J),J=1,3),TVEC(2)
      CALL GVSTT6 (LINE)
      CALL IPROMPT ('M(3,1)= ')
      CALL GVSFFF (1,RMAT(3,1))



      CALL GVSCLP
      CALL GVSFMT ('?FMT071')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) (RMAT(1,J),J=1,3),TVEC(1)
      CALL GVSTT6 (LINE)
      CALL GVSFMT ('?FMT072')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) (RMAT(2,J),J=1,3),TVEC(2)
      CALL GVSTT6 (LINE)
      CALL GVSFMT ('?FMT076')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) RMAT(3,1)
      CALL IPROMPT (LINE)
      CALL GVSFFF (1,RMAT(3,2))



      CALL GVSCLP
      CALL GVSFMT ('?FMT071')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) (RMAT(1,J),J=1,3),TVEC(1)
      CALL GVSTT6 (LINE)
      CALL GVSFMT ('?FMT072')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) (RMAT(2,J),J=1,3),TVEC(2)
      CALL GVSTT6 (LINE)
      CALL GVSFMT ('?FMT077')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) RMAT(3,1),RMAT(3,2)
      CALL IPROMPT (LINE)
      CALL GVSFFF (1,RMAT(3,3))



      CALL GVSCLP
      CALL GVSFMT ('?FMT071')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) (RMAT(1,J),J=1,3),TVEC(1)
      CALL GVSTT6 (LINE)
      CALL GVSFMT ('?FMT072')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) (RMAT(2,J),J=1,3),TVEC(2)
      CALL GVSTT6 (LINE)
      CALL GVSFMT ('?FMT078')
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) RMAT(3,1),RMAT(3,2),RMAT(3,3)
      CALL IPROMPT (LINE)
      CALL GVSFFF (1,TVEC(3))
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('GVSMTI')



 998  CONTINUE


      RETURN
      END
      SUBROUTINE GETLINE (NUMUNT,LINEIN,IERR)
























      IMPLICIT      NONE
      INTEGER       IERR, NUMUNT, I, IOS
      LOGICAL       GVFFOP
      CHARACTER*80  FILNAM
      CHARACTER*(*) LINEIN







      IF (.NOT.GVFFOP(NUMUNT)) THEN
         CALL GVSTTE ('?FILNOP')
         CALL GVSTTI ('?M3660',NUMUNT)
         IERR=1
         CALL GVSKIL
         GOTO 998
      END IF



      DO 10 I=1,LEN(LINEIN)
         LINEIN(I:I)=' '
 10   CONTINUE
      IERR=0



      READ (NUMUNT,'(A)',ERR=20,END=100) LINEIN
      GOTO 998



   20 CONTINUE
      BACKSPACE (NUMUNT)
      CALL GVSTTE ('?M0924')
      CALL GVSTTI ('?M3660',NUMUNT)
      INQUIRE (UNIT=NUMUNT,NAME=FILNAM,IOSTAT=IOS,ERR=999)
      CALL GVST6C ('?M3661',FILNAM,.FALSE.)
      CALL GVSKIL
      READ (NUMUNT,ERR=999,END=100) LINEIN
      GOTO 998



 100  CONTINUE
      IERR=2
      GOTO 998



 999  CONTINUE
      CALL GVSTTE ('?ERTFIN')
      IERR=1
      CALL FLUSHAHEAD



 998  CONTINUE


      RETURN
      END
