      SUBROUTINE XXXXXX( OPTION, FUNCNO, MODE, NF, FC,
CIO                      I       I       I     I   I
     +                   NX, X, NDX, XC, XINC,
CIO                      I   I  I    I   I
     +                   NDX1, XC1, XINC1, NDX2, XC2, XINC2,
CIO                      I     I    I      I     I    I
     +                   IVAL, CVAL, F, DF, D2F, ISTAT )
CIO                      O     O     IO IO  O    O
C
      INTEGER            FUNCNO, NF, FC(NF), NX, NDX, XC(NDX), NDX1,
     +                   XC1(NDX1), NDX2, XC2(NDX2), IVAL, ISTAT(NF)
      CHARACTER*(*)      OPTION, MODE, CVAL
      DOUBLE PRECISION   X(NX), XINC(NDX), XINC1(NDX1), XINC2(NDX2),
     +                   F(NF), DF(NF,NDX), D2F(NF,NDX1,NDX2)
C-----------------------------------------------------------------------
C  PART OF:  PROBAN
C
C  PURPOSE:  Library of functions for use with PROBAN
C
C  This is a template - to be used for programming functions for use
C  with PROBAN
C
C  RESTRICTIONS:
C
C  INPUT:
C    OPTION  Determines what must be passed back to the calling routine:
C            = 'SUBLNAME'  : Return CVAL = Name of a sublibrary
C            = 'SUBLDESC'  : Return CVAL = Description of a sublibrary
C            = 'SUBLNFUNC' : Return IVAL = Number of functions in a
C                            sublibrary
C            = other value: passed on to function
C    SUBLNO  Sublibrary number
C    FUNCNO  Function number inside sublibrary
C    MODE    Passed on to function
C    NF      Passed on to function
C    FC      Passed on to function
C    NX      Passed on to function
C    X       Passed on to function
C    NDX     Passed on to function
C    XC      Passed on to function
C    XINC    Passed on to function
C    NDX1    Passed on to function
C    XC1     Passed on to function
C    XINC1   Passed on to function
C    NDX2    Passed on to function
C    XC2     Passed on to function
C    XINC2   Passed on to function
C    F       Passed on to function
C    DF      Passed on to function
C
C  OUTPUT:
C    IVAL    Varies, depending on OPTION
C    CVAL    Varies, depending on OPTION
C            CVAL may also be used to pass a one line error message
C            back to PROBAN. If any ISTAT value is not = 0, the
C            contents of CVAL will be presented as an error message if
C            CVAL is not empty (CVAL will always be empty on input).
C    F       Function value(s)
C    DF      Gradient(s)
C    D2F     Second order derivative(s)
C    ISTAT   Return status:
C            = 0 : OK.
C            = 1 : Numerical or other error, cancel further calculations
C            =-1 : Numerical error, X yields F < 0
C            =-2 : Numerical error, X yields F = 0
C            =-3 : Numerical error, X yields F > 0
C
C  CODED BY:
C    Robert Olesen, VSS, July 1991
C
C  REVISIONS:
C
C  COPYRIGHT (C) 1991, VERITAS SESAM SYSTEMS
C
C-----------------------------------------------------------------------
C
C-----------------------------------------------------------------------
C  METHOD:  
C
C  INTERNAL VARIABLES:
C
C  COMMON VARIABLES:
C  Var:   IO  Type Common/File  Description
C
C-----------------------------------------------------------------------
C
      ISTAT(1) = 0
C
      IF (OPTION(1:4).NE.'SUBL') THEN
C
        IF (FUNCNO.EQ.1) THEN
C
C----     Pass the call on to the first function
C
          CALL ......( OPTION, MODE, NF, FC, NX, X, NDX, XC, XINC,
     +                 NDX1, XC1, XINC1, NDX2, XC2, XINC2,
     +                 IVAL, CVAL, F, DF, D2F, ISTAT )
C
        ELSE IF (FUNCNO.EQ.2) THEN
C
C----     Pass the call on to the second function (Remove this part
C         if there is only one function in the sublibrary)
C
          CALL ......( OPTION, MODE, NF, FC, NX, X, NDX, XC, XINC,
     +                 NDX1, XC1, XINC1, NDX2, XC2, XINC2,
     +                 IVAL, CVAL, F, DF, D2F, ISTAT )
C
C....    etc.
C
        ELSE
C
C----     Called with illegal function number.
C         Pass an error message back to PROBAN in CVAL.
C
          WRITE(CVAL,9100) FUNCNO
          ISTAT(1) = 1
C
        END IF
C
      ELSE IF (OPTION.EQ.'SUBLNAME') THEN
C
C----   Return name of this sublibrary. The name must contain
C       alphanumeric characters or hyphens ('-') and can be at most 12
C       characters long.  eg: 'Sublibrary' or: 'MySubl-11'
C
        CVAL = <enter name of sublibrary here>
C
      ELSE IF (OPTION.EQ.'SUBLDESC') THEN
C
C----   Return description of this sublibrary. The description should
C       not be longer than 50 characters
C
        CVAL = <enter description of sublibrary here>
C
      ELSE IF (OPTION.EQ.'SUBLNFUNC') THEN
C
C----   Return number of functions in this sublibrary
C
        IVAL = <enter number of functions here>
C
      END IF
C
      RETURN
C
 9100 FORMAT('XXXXXX called with illegal function number: ',I12)
C
C  End of XXXXXX
      END
