```      SUBROUTINE XXNBBF( NCAP7 , LAMDA , C , X ,S , IFAIL )
C
C
C-----------------------------------------------------------------------
C
C  PURPOSE: Evaluates a cubic spline from its B-spline representation
C
C  CALLING PROGRAM: VARIOUS
C
C  SUBROUTINE:
C
C  INPUT: (I*4) NCAP7        = NBAR+7, where NBAR is the number of
C                              intervals (one greater than the number
C                              of interior knots, i.e. the knots
C                              strictly in the range LAMDA(4) to
C                              LAMDA(NCAP+4)) over which the spline
C                              is defined.
C                              CONSTRAINT: NCAP7 >= 8
C
C  INPUT:  (R*8) LAMDA()     = Values of the complete set of knots
C                              LAMDA(J), J=1,NBAR+7.
C                              CONSTRAINT: Must be in non-decreasing
C                              order with LAMDA(NCAP7-3) > LAMDA(4).
C
C  INPUT:  (R*8) C()         = The coefficients of the B-spline N_i(x),
C                              for i=1,2,...,nbar+3. The remaining
C                              elements (from NBAR+4 to NBAR+7) are not
C                              used.
C
C  INPUT:  (R*8) X           = The argument x at which the cubic spline
C                              is to be evaluated.
C                              CONSTRAINT:
C                                 LAMDA(4) <= X <= LAMDA(NCAP7-3)
C  INPUT:  (I*8) IFAIL       = 0 : stop if any error
C                            = 1 : continue if non-fatal error.
C
C  OUTPUT: (R*8) S           = The value of the spline, s(x)
C
C  OUTPUT: (I*4) IFAIL       = 0 : no error detected
C                            = 1 : X does not satisfy
C                                   LAMDA(4) <= X <= LAMDA(NCAP7-3)
C                            = 2 : NCAP7 < 8
C
C
C          (I*4)  KL         = GENERAL INDEX
C          (I*4)  KU         = GENERAL INDEX
C          (I*4)  K          = GENERAL INDEX
C          (I*4)  J          = GENERAL INDEX
C          (R*8)  E1         = GENERAL REAL
C          (R*8)  E2         = GENERAL REAL
C
C  ROUTINES:  NONE
C
C  AUTHORS: H. P. Summers and A. C. Lanzafame, University of Strathclyde
C
C  DATE:    11 January 1995
C
C UNIX-IDL PORT:
C
C VERSION: 1.1                          DATE: 22-1-96
C MODIFIED: TIM HAMMOND (TESSELLA SUPPORT SERVICES PLC)
C               - PUT UNDER SCCS CONTROL
C
C VERSION: 1.2                          DATE: 06-07-2004
C MODIFIED: Allan Whiteford
C               - Changed name from dxnbbf to xxnbbf
C
C-----------------------------------------------------------------------
C
C-----------------------------------------------------------------------
INTEGER             IFAIL,       NCAP7
REAL*8              C(NCAP7),    LAMDA(NCAP7),             S
REAL*8              X
```