*DECK SCRTOC
      SUBROUTINE SCRTOC(IPSAP)
*
*-----------------------------------------------------------------------
*
*Purpose:
* print the table of content of a Saphyb.
*
*Copyright:
* Copyright (C) 2012 Ecole Polytechnique de Montreal
*
*Author(s): A. Hebert
*
*Parameters: input
* IPSAP   address of the multidimensional Saphyb object.
*
*-----------------------------------------------------------------------
*
      USE GANLIB
*----
*  SUBROUTINE ARGUMENTS
*----
      TYPE(C_PTR) IPSAP
*----
*  LOCAL VARIABLES
*----
      PARAMETER (IOUT=6,MAXPAR=50,MAXLIN=50,MAXVAL=200)
      INTEGER DIMSAP(50),NVALUE(MAXPAR),VINTE(MAXVAL)
      REAL VREAL(MAXVAL)
      CHARACTER PARKEY(MAXPAR)*4,PARTYP(MAXPAR)*4,PARFMT(MAXPAR)*8,
     1 VCHAR(MAXVAL)*12,RECNAM*12
*----
*  DIMSAP INFORMATION
*----
      CALL LCMLEN(IPSAP,'DIMSAP',ILENG,ITYLCM)
      IF(ILENG.EQ.0) CALL XABORT('SCRTOC: INVALID SAPHYB.')
      CALL LCMGET(IPSAP,'DIMSAP',DIMSAP)
      NREA=DIMSAP(4)   ! number of reactions
      NISO=DIMSAP(5)   ! number of particularized isotopes
      NMAC=DIMSAP(6)   ! number of macroscopic sets
      NMIL=DIMSAP(7)   ! number of mixtures
      NPAR=DIMSAP(8)   ! number of global parameters
      NPARL=DIMSAP(11) ! number of local variables
      NADRX=DIMSAP(18) ! number of address sets
      NCALS=DIMSAP(19) ! number of elementary calculations in the Saphyb
      NGROUP=DIMSAP(20) ! number of energy groups
      NISOTS=DIMSAP(32) ! number of isotopes in edition tables
      WRITE(IOUT,'(/38H SCRTOC: table of content information:)')
      WRITE(IOUT,'(24H   number of reactions =,I3)') NREA
      WRITE(IOUT,'(38H   number of particularized isotopes =,I4)') NISO
      WRITE(IOUT,'(31H   number of macroscopic sets =,I2)') NMAC
      WRITE(IOUT,'(23H   number of mixtures =,I5)') NMIL
      WRITE(IOUT,'(32H   number of global parameters =,I4)') NPAR
      WRITE(IOUT,'(30H   number of local variables =,I4)') NPARL
      WRITE(IOUT,'(27H   number of address sets =,I4)') NADRX
      WRITE(IOUT,'(27H   number of calculations =,I5)') NCALS
      WRITE(IOUT,'(28H   number of energy groups =,I4)') NGROUP
      WRITE(IOUT,'(40H   number of isotopes in output tables =,I4/)')
     1 NISOTS
*----
*  GLOBAL PARAMETERS INFORMATION
*----
      IF(NPAR.GT.MAXPAR) CALL XABORT('SCRTOC: MAXPAR OVERFLOW')
      CALL LCMSIX(IPSAP,'paramdescrip',1)
        CALL LCMGET(IPSAP,'NVALUE',NVALUE)
        CALL LCMGTC(IPSAP,'PARKEY',4,NPAR,PARKEY)
        CALL LCMGTC(IPSAP,'PARTYP',4,NPAR,PARTYP)
        CALL LCMGTC(IPSAP,'PARFMT',8,NPAR,PARFMT)
      CALL LCMSIX(IPSAP,' ',2)
      CALL LCMSIX(IPSAP,'paramvaleurs',1)
        DO IPAR=1,NPAR
          WRITE(IOUT,'(25H SCRTOC: global parameter,A5,8H of type,A5,
     1    1H:)') PARKEY(IPAR),PARTYP(IPAR)
          IF(NVALUE(IPAR).GT.MAXVAL) CALL XABORT('SCRTOC: MAXVAL OVERF'
     1    //'LOW')
          WRITE(RECNAM,'(''pval'',I8)') IPAR
          IF(PARFMT(IPAR).EQ.'ENTIER') THEN
            CALL LCMGET(IPSAP,RECNAM,VINTE)
            WRITE(IOUT,'(20H   TABULATED POINTS=,1P,6I12/(20X,6I12))')
     1      (VINTE(I),I=1,NVALUE(IPAR))
          ELSE IF(PARFMT(IPAR).EQ.'FLOTTANT') THEN
            CALL LCMGET(IPSAP,RECNAM,VREAL)
            WRITE(IOUT,'(20H   TABULATED POINTS=,1P,6E12.4/(20X,
     1      6E12.4))') (VREAL(I),I=1,NVALUE(IPAR))
          ELSE IF(PARFMT(IPAR).EQ.'CHAINE') THEN
            CALL LCMGTC(IPSAP,RECNAM,12,NVALUE(IPAR),VCHAR)
            WRITE(IOUT,'(20H   TABULATED POINTS=,2X,6A12/(22X,6A12))')
     1      (VCHAR(I),I=1,NVALUE(IPAR))
          ENDIF
        ENDDO
      CALL LCMSIX(IPSAP,' ',2)
*----
*  LOCAL VARIABLES INFORMATION
*----
      IF(NPARL.GT.0) THEN
        IF(NPARL.GT.MAXPAR) CALL XABORT('SCRTOC: MAXPAR OVERFLOW')
        CALL LCMSIX(IPSAP,'varlocdescri',1)
          CALL LCMGTC(IPSAP,'PARKEY',4,NPARL,PARKEY)
          CALL LCMGTC(IPSAP,'PARTYP',4,NPARL,PARTYP)
          CALL LCMGTC(IPSAP,'PARFMT',8,NPARL,PARFMT)
          DO IPAR=1,NPARL
            WRITE(IOUT,'(23H SCRTOC: local variable,A5,8H of type,A5,
     1      11H and format,A9,1H:)') PARKEY(IPAR),PARTYP(IPAR),
     2      PARFMT(IPAR)
          ENDDO
        CALL LCMSIX(IPSAP,' ',2)
      ENDIF
      WRITE(IOUT,'(/)')
      RETURN
      END
