c
c
c***********************************************************************
c
      subroutine PR ( num, icode, mmax, m, n, kg, p, iv, t, y, weight,
c
     *                                                            alf)
c
c-----------------------------------------------------------------------
c
c   print the values of any or all of the initialized
c   parameters.  this subroutine is called in
c   response to one of the "print" commands or
c   when the initialized data is obtained from a
c   saved file.
c
      PARAMETER ( maxn=100 , maxkg=50 , maxp=200 )
c
      dimension  t(mmax,iv), y(m), weight(m), alf(kg)
c 
      real  ndi(maxp)
c
      integer  inc(maxkg,maxn+1), ia(maxn+1), p
c
      character*1  ians
      character*4  icode, ind, var
c
      logical  ip, itp 
c
      common /blkinc/ inc
      common /blkndi/ ndi
      common /blokip/ ip
      common /blkitp/ itp
c
      data ind /'ind '/ , var /'var '/
c
c----------------------------------------------------------------------
c
210   format (a1)
c
220   format (' (type its index no. as it appears in the',' list)')
c
      if ( num .eq. 1 ) go to 640
c 
      if ( icode .eq. 'pm' ) go to 230
c
      if ( icode .eq. 'pn' ) go to 250
c
      if ( icode .eq. 'pkg' ) go to 270
c
      if ( icode .eq. 'pinc' ) go to 290
c
      if ( icode .eq. 'piv' ) go to 340
c
      if ( icode .eq. 'ptw' ) go to 360
c
      if ( icode .eq. 'palf' ) go to 500
c
      if ( icode .eq. 'pndi' ) go to 590
c
      if ( icode .eq. 'lp' ) go to 620
c
      if ( icode .eq. 'np' ) go to 630
c
      if ( icode .eq. 'tp' ) go to 632
c
      if ( icode .eq. 'ntp' ) go to 634
c
c
c ------------- print the no. of data points ----------------------
c
230   continue
      print 240, m
      if (ip) write (10,240) m
240   format (/' '/' no. of data points:   ',i4)
      go to 700
c
c------------- print the no. of linear parameters -----------
c
250   continue
      print 260, n
      if (ip) write (10,260) n
260   format (/' '/' no. of linear parameters:   ',i4)
      go to 700
c
c----------- print the no. of nonlinear parameters -----------
c
270   continue
      print 280, kg 
      if (ip) write (10,280) kg
280   format (/' '/' no. of nonlinear parameters:   ',i4)
      go to 700
c
c---------- print which terms depend on nonlin parm ------------
c
290   continue
      np1=n+1
      do 330 i=1,kg 
         k=1
         do 300 j=1,np1
300         ia(j)=0 
         do 310 j=1,np1
            if (inc(i,j).ne.1) go to 310
            ia(k)=j 
            k=k+1
310      continue
         print 320, i,(ia(k),k=1,np1)
320    format (' '/' Terms with nonlin parm',i3,': ',26i3,/
     1             '                       ',    5x, 26i3,/
     2             '                       ',    5x, 26i3,/
     3             '                       ',    5x, 22i3 )
330      if (ip) write (10,320) i,(ia(k),k=1,np1) 
      go to 700
c
c---------- print the no. of independent variables ----------------
c
340   continue
      print 350, iv 
      if (ip) write (10,350) iv
350   format (/' '/' no. of independent variables:   ',i4)
      go to 700
c
c------------ print the data points & weights ------------------
c
360   continue
      print 370
370   format (' all of the data points ?  ')
      read 210, ians
      if (ians.eq.'y') go to 430
380   continue
      print 390
390   format (' which data point ?  ')
      print 220
      read (5,*) il 
      print 400, il 
      if (ip) write (10,400) il
400   format (/' '/' for point',i4,' values of indep. var,',
     2        ' dep var & wt are')
      print 410, (t(il,j),j=1,iv),y(il),weight(il)
      if (ip) write (10,410) (t(il,j),j=1,iv),y(il),weight(il)
410   format (' ',1p4e15.6/15x,1p4e15.6,/)
      print 420
420   format (' do you want to examine any others ?  ')
      read 210, ians
      if (ians.eq.'y') go to 380
      go to 700
430   continue
      ivp=min0(iv,2)
      print 440, (ind,var,j,j=1,ivp)
      if (ip) write (10,440) (ind,var,j,j=1,ivp)
440   format (/' '/' index',5x,'weight',9x,'dep var',8x,2(2a4,i2,5x)/)
      do 460 k=1,m
         print 450, k,weight(k),y(k),(t(k,j),j=1,ivp)
         if (ip) write (10,450) k,weight(k),y(k),(t(k,j),j=1,ivp)
450      format (' ',i3,3x,1p4e15.6)
460   continue
      if (iv.le.2) go to 700
      print 470, (ind,var,j,j=3,iv)
470   format (/' index',3x,4(2a4,i2,5x)/)
      if (ip) write (10,470) (ind,var,j,j=3,iv)
      do 490 k=1,m
         print 480, k,(t(k,j),j=3,iv)
         if (ip) write (10,480) k,(t(k,j),j=3,iv) 
480      format (' ',i3,3x,1p4e15.6)
490   continue
      go to 700
c
c------------ print the values of the nonlinear parameters ----------
c
500   continue
c
      if ( kg .le. 20 ) go to 550
      print 510
510   format (' all the nonlinear parameters ?  ') 
      read 210, ians
      if (ians.eq.'y') go to 550
520   continue
      print 530
530   format (' which parameter ?  ')
      print 220
      read (5,*) il 
      print 540, il,alf(il)
      if (ip) write (10,540) il,alf(il) 
540   format (/' '/' nonlinear parameter',i4,' is',1pe15.6) 
      print 420
      read 210, ians
      if (ians.eq.'y') go to 520
      go to 700
550   continue
      print 560
      if (ip) write (10,560)
560   format (/' '/' nonlinear parameters:   ')
      do 580 k=1,kg 
         print 570, k,alf(k)
         if (ip) write (10,570) k,alf(k)
570      format (' ',i3,3x,1pe15.6)
580   continue
      go to 700
c
c--------------- print the numer deriv increments -------------------
c
590   continue
      print 600
      if (ip) write (10,600)
600   format (/' '/' numerical derivative increments:')
      do 610 j=1,p
         print 570, j,ndi(j)
         if (ip) write (10,570) j,ndi(j)
610   continue
      go to 700
c
c------------- turn on the line printer flag ------------------
c
620   continue
      ip=.true.
      go to 700
c
c------------ turn off the line printer flag -----------------
c
630   continue
      ip=.false.
      go to 700
c
c------------- turn on the crt plotting flag ------------------
c
632   continue
      itp = .true.
      goto 700
c
c------------- turn off the crt plotting flag ------------------- 
c
634   continue
      itp = .false. 
      goto 700
c
c--------------- print all initial values ----------------------
c
640   continue
      print 240, m
      if (ip) write (10,240) m
      print 260, n
      if (ip) write (10,260) n
      print 280, kg 
      if (ip) write (10,280) kg
      print 350, iv 
      if (ip) write (10,350) iv
      ivp=min0(iv,2)
      print 440, (ind,var,j,j=1,ivp)
      if (ip) write (10,440) (ind,var,j,j=1,ivp)
      do 650 k=1,m
         print 450, k,weight(k),y(k),(t(k,j),j=1,ivp)
650      if (ip) write (10,450) k,weight(k),y(k),(t(k,j),j=1,ivp)
      if (iv.le.2) go to 670
      print 470, (ind,var,j,j=3,iv)
      if (ip) write (10,470) (ind,var,j,j=3,iv)
      do 660 k=1,m
         print 480, k,(t(k,j),j=3,iv)
         if (ip) write (10,480) k,(t(k,j),j=3,iv) 
660   continue
670   if (kg.eq.0) go to 700
      print 560
      if (ip) write (10,560)
      do 680 k=1,kg 
         print 570, k,alf(k)
         if (ip) write (10,570) k,alf(k)
680   continue
      print 600
      if (ip) write (10,600)
      do 690 k=1,p
         print 570, k,ndi(k)
         if (ip) write (10,570) k,ndi(k)
690   continue
c
      go to 290
c
700   return
c
      end 
