       subroutine table(n,m,a,ipmax,gl,lamda,rad,thetao,theta,iskip,    TABL001
     & icor,isys,parcal,sigma,covera,sigca,vol,sigvol,dev,sinqc,h,k,l)  TABL002
c ------------------------------------------------------------------    TABL003
c      evaluates numbers for tabular output and prints table (XLAT)     TABL004
c ------------------------------------------------------------------    TABL005
c      version 3.0 last revised 23.2.89 ETH-LNS                         TABL006
c ------------------------------------------------------------------    TABL007
                                                                        TABL008
       integer h(*)                                                     TABL009
       real*4 lamda                                                     TABL010
       dimension gl(ipmax+2,*),a(ipmax+1,*),iskip(*),thetao(*),theta(*) TABL011
       dimension parcal(*),sigma(*),dev(*),sinqc(*),k(*),l(*)           TABL012
                                                                        TABL013
C --------- prepare output of data                                      TABL014
      write(6,'(1x, 76(''-''))')                                        TABL015
      write(6,9001)                                                     TABL016
      write(6,9002)                                                     TABL017
      write(6,9003)                                                     TABL018
      write(6,'(1x, 76(''-''))')                                        TABL019
      do 0001 i=1,n                                                     TABL020
c ------ drift in sin**2(theta)                                         TABL021
         drift=a(m,1)*gl(m,i)                                           TABL022
c ------ sin**2(theta) calculated without drift                         TABL023
         theabs=asin(sqrt(sinqc(i)))*rad                                TABL024
c ------ sin**2(theta) calculated, drift-corrected                      TABL025
         cal=sinqc(i)-drift                                             TABL026
         thecal=asin(sqrt(cal))*rad                                     TABL027
c ------ dhkl, calculated and drift-corrected                           TABL028
         dhkl=lamda/sqrt(4*cal)                                         TABL029
c ------ sin**2(theta) observed, no drift                               TABL030
         sinqo=sin(theta(i)/rad)**2                                     TABL031
c ------ sin**2(theta) observed, drift-corrected                        TABL032
         sinqoc=sinqo-drift                                             TABL033
         theobs=asin(sqrt(sinqoc))*rad                                  TABL034
c ------ delta(theta)                                                   TABL035
         delthe=theobs-thecal                                           TABL036
c ------ drift in theta                                                 TABL037
         drift=theabs-thecal                                            TABL038
c ------ write *-indicator, if worst reflection                         TABL039
         if (iskip(i).eq.2) then                                        TABL040
            write (6,9004) H(I),K(I),L(I),thetao(I),dev(I),theta(I),    TABL041
     1      thecal,cal,dhkl,delthe,drift                                TABL042
         else                                                           TABL043
            write (6,9005) H(I),K(I),L(I),thetao(I),dev(I),theta(i),    TABL044
     1      thecal,cal,dhkl,delthe,drift                                TABL045
         endif                                                          TABL046
 0001  continue                                                         TABL047
                                                                        TABL048
c ---- write cell parameters and deviations                             TABL049
       write (6,9006) parcal(1),sigma(1)                                TABL050
       write (*,9007) parcal(1),sigma(1)                                TABL051
       if (isys.eq.4) then                                              TABL052
         write (6,9008) parcal(3), sigma(3)                             TABL053
         write (*,9009) parcal(3), sigma(3)                             TABL054
       end if                                                           TABL055
       if (isys.gt.1) then                                              TABL056
         write (6,9010) parcal(2), sigma(2)                             TABL057
         write (*,9011) parcal(2), sigma(2)                             TABL058
       end if                                                           TABL059
       write (6,9012) vol, sigvol                                       TABL060
       write (*,9013) vol, sigvol                                       TABL061
       if (isys.eq.2.or.isys.eq.3) write (6,9014) covera,sigca          TABL062
       if (icor.ne.2) write (6,9015) A(M,1)                             TABL063
       return                                                           TABL064
                                                                        TABL065
 9001  format('   H  K  L   theta   stnd   theta    theta    sin**2   dhTABL066
     1kl   delta   drift')                                              TABL067
 9002  format('             obs.    corr.  corr.    calc     calc     caTABL068
     1lc   theta   theta')                                              TABL069
 9003  format('                     term   (std)')                      TABL070
 9004  format(1H ,1h*,i2,2I3,2X,F7.3,1X,F5.3,2x,F7.3,2X,F7.3,           TABL071
     1 2X,F6.4,2x,F7.4,2X,F5.3,2X,F5.3,' *')                            TABL072
 9005  format(1H ,3I3,2X,F7.3,1X,F5.3,2x,F7.3,2X,F7.3,                  TABL073
     1 2X,F6.4,2x,F7.4,2X,F5.3,2X,F5.3)                                 TABL074
 9006  format(///,'     Cell constant          A =',F11.4,' +- ',F10.4) TABL075
 9007  format(/,'  A =',F11.4,' +- ',F10.4)                             TABL076
 9008  format('     Cell constant          B =',F11.4,' +- ',F10.4)     TABL077
 9009  format(  '  B =',F11.4,' +- ',F10.4)                             TABL078
 9010  format('     Cell constant          C =',F11.4,' +- ',F10.4)     TABL079
 9011  format(  '  C =',F11.4,' +- ',F10.4)                             TABL080
 9012  format('     Volume of unit cell    V = ',F10.4,' +- ',F10.4)    TABL081
 9013  format(  '  V =',F11.4,' +- ',F10.4)                             TABL082
 9014  format(/26X,'C/A =',F11.4,' +- ',F10.4)                          TABL083
 9015  format(/,  '     Drift parameter        D = ',F10.8)             TABL084
                                                                        TABL085
      end                                                               TABL086
                                                                        TABL087
