Index: /trunk/psLib/test/dataManip/tst_psFunc02.c
===================================================================
--- /trunk/psLib/test/dataManip/tst_psFunc02.c	(revision 1945)
+++ /trunk/psLib/test/dataManip/tst_psFunc02.c	(revision 1946)
@@ -1,7 +1,6 @@
 /*****************************************************************************
     This routine must ensure that the psSpline1DAlloc() function properly
-    allocates the spline data structure.
- 
-    XXX: figure out the memory deallocator
+    allocates the spline data structure.  It allocates both linear and cubic
+    splines with a variety of min/max ranges.
  *****************************************************************************/
 #include <stdio.h>
@@ -11,5 +10,7 @@
 #include "psFunctions.h"
 
-#define N 10
+#define N 4
+#define LINEAR 1
+#define CUBIC 3
 
 int main()
@@ -18,5 +19,5 @@
     int memLeaks=0;
     int i;
-    //    int  currentId = psMemGetId();
+    int  currentId = psMemGetId();
     psSpline1D *tmpSpline;
 
@@ -26,61 +27,61 @@
     printPositiveTestHeader(stdout,
                             "psFunction functions",
-                            "psSpline1DAlloc()");
-
-    tmpSpline = psSpline1DAlloc(N, 1, 1.0, 10.0);
-    if (tmpSpline == NULL) {
-        printf("ERROR: Could not allocate psSpline1D data structure\n");
-        testStatus = false;
-    }
-    if (tmpSpline->spline == NULL) {
-        printf("ERROR: Could not allocate psSpline1D->spline data structure\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->n != N) {
-        printf("ERROR: spline->n set incorrectly (%d)\n", tmpSpline->n);
-        testStatus = false;
-    }
-
-    for (i=0;i<N;i++) {
-        if (tmpSpline->spline[i] == NULL) {
-            printf("ERROR: Could not allocate spline %d\n", i);
-            testStatus = false;
-        }
-        if ((tmpSpline->spline[i])->n != 2) {
-            printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n);
-            testStatus = false;
-        }
-    }
-
-    if (tmpSpline->domains == NULL) {
-        printf("ERROR: Could not allocate psSpline1D->domains data structure\n");
-        testStatus = false;
-    }
-
-    for (i=0;i<N+1;i++) {
-        printf("psSpline1D->domains[%d] is %f\n", i, tmpSpline->domains[i]);
-    }
-
-    psFree(tmpSpline);
-    psMemCheckCorruption(1);
-    //    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
-    if (0 != memLeaks) {
-        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout,
-                "psFunctions functions",
-                "psSpline1DAlloc()",
-                testStatus);
-
-    /****************************************************************************/
-    /****************************************************************************/
-    testStatus = true;
-    printPositiveTestHeader(stdout,
-                            "psFunction functions",
-                            "psSpline1DAlloc()");
-
-    tmpSpline = psSpline1DAlloc(N, 1, 1.0, 1.0);
+                            "psSpline1DAlloc(): linear, normal");
+
+    tmpSpline = psSpline1DAlloc(N, LINEAR, 1.0, 10.0);
+    if (tmpSpline == NULL) {
+        printf("ERROR: Could not allocate psSpline1D data structure\n");
+        testStatus = false;
+    }
+    if (tmpSpline->spline == NULL) {
+        printf("ERROR: Could not allocate psSpline1D->spline data structure\n");
+        testStatus = false;
+    }
+
+    if (tmpSpline->n != N) {
+        printf("ERROR: spline->n set incorrectly (%d)\n", tmpSpline->n);
+        testStatus = false;
+    }
+
+    for (i=0;i<N;i++) {
+        if (tmpSpline->spline[i] == NULL) {
+            printf("ERROR: Could not allocate spline %d\n", i);
+            testStatus = false;
+        }
+        if ((tmpSpline->spline[i])->n != LINEAR+1) {
+            printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n);
+            testStatus = false;
+        }
+    }
+
+    if (tmpSpline->domains == NULL) {
+        printf("ERROR: Could not allocate psSpline1D->domains data structure\n");
+        testStatus = false;
+    }
+
+    for (i=0;i<N+1;i++) {
+        printf("psSpline1D->domains[%d] is %f\n", i, tmpSpline->domains[i]);
+    }
+
+    p_psSpline1DFree(tmpSpline);
+    psMemCheckCorruption(1);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
+    if (0 != memLeaks) {
+        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
+    }
+
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAlloc(): linear, normal",
+                testStatus);
+
+    /****************************************************************************/
+    /****************************************************************************/
+    testStatus = true;
+    printPositiveTestHeader(stdout,
+                            "psFunction functions",
+                            "psSpline1DAlloc(): linear, min/max are equal");
+
+    tmpSpline = psSpline1DAlloc(N, LINEAR, 1.0, 1.0);
 
     if (tmpSpline != NULL) {
@@ -89,132 +90,132 @@
     }
 
-    psFree(tmpSpline);
-    psMemCheckCorruption(1);
-    //    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
-    if (0 != memLeaks) {
-        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout,
-                "psFunctions functions",
-                "psSpline1DAlloc()",
-                testStatus);
-
-    /****************************************************************************/
-    /****************************************************************************/
-    testStatus = true;
-    printPositiveTestHeader(stdout,
-                            "psFunction functions",
-                            "psSpline1DAlloc()");
-
-    tmpSpline = psSpline1DAlloc(N, 1, 1.0, -1.0);
-    if (tmpSpline == NULL) {
-        printf("ERROR: Could not allocate psSpline1D data structure\n");
-        testStatus = false;
-    }
-    if (tmpSpline->spline == NULL) {
-        printf("ERROR: Could not allocate psSpline1D->spline data structure\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->n != N) {
-        printf("ERROR: spline->n set incorrectly (%d)\n", tmpSpline->n);
-        testStatus = false;
-    }
-
-    for (i=0;i<N;i++) {
-        if (tmpSpline->spline[i] == NULL) {
-            printf("ERROR: Could not allocate spline %d\n", i);
-            testStatus = false;
-        }
-        if ((tmpSpline->spline[i])->n != 2) {
-            printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n);
-            testStatus = false;
-        }
-    }
-
-    if (tmpSpline->domains == NULL) {
-        printf("ERROR: Could not allocate psSpline1D->domains data structure\n");
-        testStatus = false;
-    }
-
-    for (i=0;i<N+1;i++) {
-        printf("psSpline1D->domains[%d] is %f\n", i, tmpSpline->domains[i]);
-    }
-
-    psFree(tmpSpline);
-    psMemCheckCorruption(1);
-    //    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
-    if (0 != memLeaks) {
-        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout,
-                "psFunctions functions",
-                "psSpline1DAlloc()",
-                testStatus);
-
-    /****************************************************************************/
-    /****************************************************************************/
-    testStatus = true;
-    printPositiveTestHeader(stdout,
-                            "psFunction functions",
-                            "psSpline1DAlloc()");
-
-    tmpSpline = psSpline1DAlloc(N, 3, 1.0, 10.0);
-    if (tmpSpline == NULL) {
-        printf("ERROR: Could not allocate psSpline1D data structure\n");
-        testStatus = false;
-    }
-    if (tmpSpline->spline == NULL) {
-        printf("ERROR: Could not allocate psSpline1D->spline data structure\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->n != N) {
-        printf("ERROR: spline->n set incorrectly (%d)\n", tmpSpline->n);
-        testStatus = false;
-    }
-
-    for (i=0;i<N;i++) {
-        if (tmpSpline->spline[i] == NULL) {
-            printf("ERROR: Could not allocate spline %d\n", i);
-            testStatus = false;
-        }
-        if ((tmpSpline->spline[i])->n != 4) {
-            printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n);
-            testStatus = false;
-        }
-    }
-
-    if (tmpSpline->domains == NULL) {
-        printf("ERROR: Could not allocate psSpline1D->domains data structure\n");
-        testStatus = false;
-    }
-
-    for (i=0;i<N+1;i++) {
-        printf("psSpline1D->domains[%d] is %f\n", i, tmpSpline->domains[i]);
-    }
-
-    psFree(tmpSpline);
-    psMemCheckCorruption(1);
-    //    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
-    if (0 != memLeaks) {
-        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout,
-                "psFunctions functions",
-                "psSpline1DAlloc()",
-                testStatus);
-
-    /****************************************************************************/
-    /****************************************************************************/
-    testStatus = true;
-    printPositiveTestHeader(stdout,
-                            "psFunction functions",
-                            "psSpline1DAlloc()");
-
-    tmpSpline = psSpline1DAlloc(N, 3, 1.0, 1.0);
+    p_psSpline1DFree(tmpSpline);
+    psMemCheckCorruption(1);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
+    if (0 != memLeaks) {
+        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
+    }
+
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAlloc(): linear, min/max are equal",
+                testStatus);
+
+    /****************************************************************************/
+    /****************************************************************************/
+    testStatus = true;
+    printPositiveTestHeader(stdout,
+                            "psFunction functions",
+                            "psSpline1DAlloc(): linear, min > max.");
+
+    tmpSpline = psSpline1DAlloc(N, LINEAR, 1.0, -1.0);
+    if (tmpSpline == NULL) {
+        printf("ERROR: Could not allocate psSpline1D data structure\n");
+        testStatus = false;
+    }
+    if (tmpSpline->spline == NULL) {
+        printf("ERROR: Could not allocate psSpline1D->spline data structure\n");
+        testStatus = false;
+    }
+
+    if (tmpSpline->n != N) {
+        printf("ERROR: spline->n set incorrectly (%d)\n", tmpSpline->n);
+        testStatus = false;
+    }
+
+    for (i=0;i<N;i++) {
+        if (tmpSpline->spline[i] == NULL) {
+            printf("ERROR: Could not allocate spline %d\n", i);
+            testStatus = false;
+        }
+        if ((tmpSpline->spline[i])->n != LINEAR+1) {
+            printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n);
+            testStatus = false;
+        }
+    }
+
+    if (tmpSpline->domains == NULL) {
+        printf("ERROR: Could not allocate psSpline1D->domains data structure\n");
+        testStatus = false;
+    }
+
+    for (i=0;i<N+1;i++) {
+        printf("psSpline1D->domains[%d] is %f\n", i, tmpSpline->domains[i]);
+    }
+
+    p_psSpline1DFree(tmpSpline);
+    psMemCheckCorruption(1);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
+    if (0 != memLeaks) {
+        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
+    }
+
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAlloc(): linear, min > max.",
+                testStatus);
+
+    /****************************************************************************/
+    /****************************************************************************/
+    testStatus = true;
+    printPositiveTestHeader(stdout,
+                            "psFunction functions",
+                            "psSpline1DAlloc(), cubic, normal");
+
+    tmpSpline = psSpline1DAlloc(N, CUBIC, 1.0, 10.0);
+    if (tmpSpline == NULL) {
+        printf("ERROR: Could not allocate psSpline1D data structure\n");
+        testStatus = false;
+    }
+    if (tmpSpline->spline == NULL) {
+        printf("ERROR: Could not allocate psSpline1D->spline data structure\n");
+        testStatus = false;
+    }
+
+    if (tmpSpline->n != N) {
+        printf("ERROR: spline->n set incorrectly (%d)\n", tmpSpline->n);
+        testStatus = false;
+    }
+
+    for (i=0;i<N;i++) {
+        if (tmpSpline->spline[i] == NULL) {
+            printf("ERROR: Could not allocate spline %d\n", i);
+            testStatus = false;
+        }
+        if ((tmpSpline->spline[i])->n != CUBIC+1) {
+            printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n);
+            testStatus = false;
+        }
+    }
+
+    if (tmpSpline->domains == NULL) {
+        printf("ERROR: Could not allocate psSpline1D->domains data structure\n");
+        testStatus = false;
+    }
+
+    for (i=0;i<N+1;i++) {
+        printf("psSpline1D->domains[%d] is %f\n", i, tmpSpline->domains[i]);
+    }
+
+    p_psSpline1DFree(tmpSpline);
+    psMemCheckCorruption(1);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
+    if (0 != memLeaks) {
+        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
+    }
+
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAlloc(): cubic, normal",
+                testStatus);
+
+    /****************************************************************************/
+    /****************************************************************************/
+    testStatus = true;
+    printPositiveTestHeader(stdout,
+                            "psFunction functions",
+                            "psSpline1DAlloc(): cubic, min/max are equal");
+
+    tmpSpline = psSpline1DAlloc(N, CUBIC, 1.0, 1.0);
 
     if (tmpSpline != NULL) {
@@ -223,68 +224,68 @@
     }
 
-    psFree(tmpSpline);
-    psMemCheckCorruption(1);
-    //    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
-    if (0 != memLeaks) {
-        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout,
-                "psFunctions functions",
-                "psSpline1DAlloc()",
-                testStatus);
-
-    /****************************************************************************/
-    /****************************************************************************/
-    testStatus = true;
-    printPositiveTestHeader(stdout,
-                            "psFunction functions",
-                            "psSpline1DAlloc()");
-
-    tmpSpline = psSpline1DAlloc(N, 3, 1.0, -1.0);
-    if (tmpSpline == NULL) {
-        printf("ERROR: Could not allocate psSpline1D data structure\n");
-        testStatus = false;
-    }
-    if (tmpSpline->spline == NULL) {
-        printf("ERROR: Could not allocate psSpline1D->spline data structure\n");
-        testStatus = false;
-    }
-
-    if (tmpSpline->n != N) {
-        printf("ERROR: spline->n set incorrectly (%d)\n", tmpSpline->n);
-        testStatus = false;
-    }
-
-    for (i=0;i<N;i++) {
-        if (tmpSpline->spline[i] == NULL) {
-            printf("ERROR: Could not allocate spline %d\n", i);
-            testStatus = false;
-        }
-        if ((tmpSpline->spline[i])->n != 4) {
-            printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n);
-            testStatus = false;
-        }
-    }
-
-    if (tmpSpline->domains == NULL) {
-        printf("ERROR: Could not allocate psSpline1D->domains data structure\n");
-        testStatus = false;
-    }
-
-    for (i=0;i<N+1;i++) {
-        printf("psSpline1D->domains[%d] is %f\n", i, tmpSpline->domains[i]);
-    }
-
-    psFree(tmpSpline);
-    psMemCheckCorruption(1);
-    //    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
-    if (0 != memLeaks) {
-        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout,
-                "psFunctions functions",
-                "psSpline1DAlloc()",
+    p_psSpline1DFree(tmpSpline);
+    psMemCheckCorruption(1);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
+    if (0 != memLeaks) {
+        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
+    }
+
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAlloc(): cubic, min/max are equal",
+                testStatus);
+
+    /****************************************************************************/
+    /****************************************************************************/
+    testStatus = true;
+    printPositiveTestHeader(stdout,
+                            "psFunction functions",
+                            "psSpline1DAlloc(): cubic, min > max.");
+
+    tmpSpline = psSpline1DAlloc(N, CUBIC, 1.0, -1.0);
+    if (tmpSpline == NULL) {
+        printf("ERROR: Could not allocate psSpline1D data structure\n");
+        testStatus = false;
+    }
+    if (tmpSpline->spline == NULL) {
+        printf("ERROR: Could not allocate psSpline1D->spline data structure\n");
+        testStatus = false;
+    }
+
+    if (tmpSpline->n != N) {
+        printf("ERROR: spline->n set incorrectly (%d)\n", tmpSpline->n);
+        testStatus = false;
+    }
+
+    for (i=0;i<N;i++) {
+        if (tmpSpline->spline[i] == NULL) {
+            printf("ERROR: Could not allocate spline %d\n", i);
+            testStatus = false;
+        }
+        if ((tmpSpline->spline[i])->n != CUBIC+1) {
+            printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n);
+            testStatus = false;
+        }
+    }
+
+    if (tmpSpline->domains == NULL) {
+        printf("ERROR: Could not allocate psSpline1D->domains data structure\n");
+        testStatus = false;
+    }
+
+    for (i=0;i<N+1;i++) {
+        printf("psSpline1D->domains[%d] is %f\n", i, tmpSpline->domains[i]);
+    }
+
+    p_psSpline1DFree(tmpSpline);
+    psMemCheckCorruption(1);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
+    if (0 != memLeaks) {
+        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
+    }
+
+    printFooter(stdout,
+                "psFunctions functions",
+                "psSpline1DAlloc(): cubic, min > max.",
                 testStatus);
 
Index: /trunk/psLib/test/dataManip/tst_psFunc03.c
===================================================================
--- /trunk/psLib/test/dataManip/tst_psFunc03.c	(revision 1945)
+++ /trunk/psLib/test/dataManip/tst_psFunc03.c	(revision 1946)
@@ -3,5 +3,4 @@
     allocates the spline data structure.
  
-    XXX: figure out the memory deallocator
     XXX: test bounds?
  *****************************************************************************/
@@ -13,4 +12,6 @@
 
 #define N 10
+#define LINEAR 1
+#define CUBIC 3
 
 int main()
@@ -19,5 +20,5 @@
     int memLeaks=0;
     int i;
-    //    int  currentId = psMemGetId();
+    int  currentId = psMemGetId();
     psSpline1D *tmpSpline;
     psVector *bounds;
@@ -28,5 +29,5 @@
     printPositiveTestHeader(stdout,
                             "psFunction functions",
-                            "psSpline1DAlloc()");
+                            "psSpline1DAllocGeneric(): linear");
     bounds = psVectorAlloc(N+1, PS_TYPE_F32);
     for (i=0;i<N+1;i++) {
@@ -34,5 +35,5 @@
     }
 
-    tmpSpline = psSpline1DAllocGeneric(bounds, 1);
+    tmpSpline = psSpline1DAllocGeneric(bounds, LINEAR);
     if (tmpSpline == NULL) {
         printf("ERROR: Could not allocate psSpline1D data structure\n");
@@ -54,5 +55,5 @@
             testStatus = false;
         }
-        if ((tmpSpline->spline[i])->n != 2) {
+        if ((tmpSpline->spline[i])->n != LINEAR+1) {
             printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n);
             testStatus = false;
@@ -71,7 +72,8 @@
     }
 
-    psFree(tmpSpline);
+    p_psSpline1DFree(tmpSpline);
+    psFree(bounds);
     psMemCheckCorruption(1);
-    //    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
     if (0 != memLeaks) {
         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
@@ -80,5 +82,5 @@
     printFooter(stdout,
                 "psFunctions functions",
-                "psSpline1DAlloc()",
+                "psSpline1DAllocGeneric(): linear",
                 testStatus);
     /****************************************************************************/
@@ -87,5 +89,5 @@
     printPositiveTestHeader(stdout,
                             "psFunction functions",
-                            "psSpline1DAlloc()");
+                            "psSpline1DAllocGeneric(): cubic");
     bounds = psVectorAlloc(N+1, PS_TYPE_F32);
     for (i=0;i<N+1;i++) {
@@ -93,5 +95,5 @@
     }
 
-    tmpSpline = psSpline1DAllocGeneric(bounds, 3);
+    tmpSpline = psSpline1DAllocGeneric(bounds, CUBIC);
     if (tmpSpline == NULL) {
         printf("ERROR: Could not allocate psSpline1D data structure\n");
@@ -113,5 +115,5 @@
             testStatus = false;
         }
-        if ((tmpSpline->spline[i])->n != 4) {
+        if ((tmpSpline->spline[i])->n != CUBIC+1) {
             printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n);
             testStatus = false;
@@ -130,7 +132,8 @@
     }
 
-    psFree(tmpSpline);
+    p_psSpline1DFree(tmpSpline);
+    psFree(bounds);
     psMemCheckCorruption(1);
-    //    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
     if (0 != memLeaks) {
         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
@@ -139,5 +142,5 @@
     printFooter(stdout,
                 "psFunctions functions",
-                "psSpline1DAlloc()",
+                "psSpline1DAllocGeneric(): cubic",
                 testStatus);
 
Index: /trunk/psLib/test/dataManip/tst_psFunc04.c
===================================================================
--- /trunk/psLib/test/dataManip/tst_psFunc04.c	(revision 1945)
+++ /trunk/psLib/test/dataManip/tst_psFunc04.c	(revision 1946)
@@ -24,9 +24,10 @@
     float x;
     float y;
-    //    int  currentId = psMemGetId();
+    int  currentId = psMemGetId();
     psSpline1D *tmpSpline;
     psVector *data;
 
     psTraceSetLevel(".", 0);
+
     /****************************************************************************/
     /****************************************************************************/
@@ -52,7 +53,8 @@
     }
 
-    psFree(tmpSpline);
+    p_psSpline1DFree(tmpSpline);
     psMemCheckCorruption(1);
-    //    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
+    psFree(data);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
     if (0 != memLeaks) {
         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
Index: /trunk/psLib/test/dataManip/tst_psFunc05.c
===================================================================
--- /trunk/psLib/test/dataManip/tst_psFunc05.c	(revision 1945)
+++ /trunk/psLib/test/dataManip/tst_psFunc05.c	(revision 1946)
@@ -1,10 +1,9 @@
 /*****************************************************************************
-    This routine must ensure that the psSpline1DEval() function works
-    properly.  It creates a spline with psSpline1DAlloc(), creates a set of
-    data values, sets the spline polynomials with psVectorFitSpline1D(), then
-    calls psSpline1DEval() on new data values and ensures that the results
+    This routine must ensure that the psSpline1DEvalVector() function works
+    properly.  It creates a spline with psSpline1DAlloc(), (1-D functions
+    are used for the spline polynomials) creates a set of data values, sets
+    the spline polynomials with psVectorFitSpline1D(), then calls
+    psSpline1DEvalVector() on new data values and ensures that the results
     are correct.
- 
-    XXX: figure out the memory deallocator
  *****************************************************************************/
 #include <stdio.h>
@@ -14,6 +13,6 @@
 #include "psMemory.h"
 #include "psFunctions.h"
-
 #define N 8
+#define SPLINE_ORDER 1
 
 int main()
@@ -22,5 +21,5 @@
     int memLeaks=0;
     int i;
-    //    int  currentId = psMemGetId();
+    int  currentId = psMemGetId();
     psSpline1D *tmpSpline;
     psVector *data;
@@ -37,6 +36,5 @@
     data = psVectorAlloc(N+1, PS_TYPE_F32);
     x = psVectorAlloc(N+1, PS_TYPE_F32);
-    y = psVectorAlloc(N+1, PS_TYPE_F32);
-    tmpSpline = psSpline1DAlloc(N, 1, 1.0, 10.0);
+    tmpSpline = psSpline1DAlloc(N, SPLINE_ORDER, 1.0, 10.0);
 
     for (i=0;i<N+1;i++) {
@@ -59,7 +57,12 @@
     }
 
-    psFree(tmpSpline);
+    p_psSpline1DFree(tmpSpline);
+
+    psFree(x);
+    psFree(y);
+    psFree(data);
+
     psMemCheckCorruption(1);
-    //    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
     if (0 != memLeaks) {
         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
Index: /trunk/psLib/test/dataManip/tst_psFunc07.c
===================================================================
--- /trunk/psLib/test/dataManip/tst_psFunc07.c	(revision 1945)
+++ /trunk/psLib/test/dataManip/tst_psFunc07.c	(revision 1946)
@@ -4,8 +4,4 @@
 values, sets the spline polynomials with psVectorFitSpline1D(), then calls
 psSpline1DEval() on new data values and ensures that the results are correct.
- 
-XXX: figure out the memory deallocator
- 
-XXX: Remove NR code.
  *****************************************************************************/
 #include <stdio.h>
@@ -16,5 +12,5 @@
 #include "psFunctions.h"
 
-#define NUM_SPLINES 200
+#define NUM_SPLINES 5
 #define A 4.0
 #define B -3.0
@@ -30,75 +26,15 @@
 }
 
-/*****************************************************************************
-XXX: This is Numerical Recipes in C code.  Remove from distribution.
- *****************************************************************************/
-void spline(float *x, float *y, int n, float yp1, float ypn, float *y2)
-{
-    int i,k;
-    float p,qn,sig,un,u[NUM_SPLINES+1];
-
-    if (yp1 > 0.99e30) {
-        y2[1]=u[1]=0.0;
-    } else {
-        y2[1] = -0.5;
-        u[1]=(3.0/(x[2]-x[1]))*((y[2]-y[1])/(x[2]-x[1])-yp1);
-    }
-
-    for (i=2;i<=n-1;i++) {
-        sig=(x[i]-x[i-1])/(x[i+1]-x[i-1]);
-        p=sig*y2[i-1]+2.0;
-        y2[i]=(sig-1.0)/p;
-        u[i]=(y[i+1]-y[i])/(x[i+1]-x[i]) - (y[i]-y[i-1])/(x[i]-x[i-1]);
-        u[i]=(6.0*u[i]/(x[i+1]-x[i-1])-sig*u[i-1])/p;
-    }
-
-    if (ypn > 0.99e30) {
-        qn=un=0.0;
-    } else {
-        qn=0.5;
-        un=(3.0/(x[n]-x[n-1]))*(ypn-(y[n]-y[n-1])/(x[n]-x[n-1]));
-    }
-    y2[n]=(un-qn*u[n-1])/(qn*y2[n-1]+1.0);
-
-    for (k=n-1;k>=1;k--) {
-        y2[k]=y2[k]*y2[k+1]+u[k];
-    }
-}
-
-/*****************************************************************************
-XXX: This is Numerical Recipes in C code.  Remove from distribution.
- *****************************************************************************/
-void splint(float xa[], float ya[], float y2a[], int n, float x, float *y)
-{
-    int klo,khi,k;
-    float h,b,a;
-
-    klo=1;
-    khi=n;
-    while (khi-klo > 1) {
-        k=(khi+klo) >> 1;
-        if (xa[k] > x)
-            khi=k;
-        else
-            klo=k;
-    }
-    h=xa[khi]-xa[klo];
-    a=(xa[khi]-x)/h;
-    b=(x-xa[klo])/h;
-    *y=a*ya[klo]+b*ya[khi]+((a*a*a-a)*y2a[klo]+(b*b*b-b)*y2a[khi])*(h*h)/6.0;
-}
-
-
 int main()
 {
     int testStatus = true;
     int memLeaks=0;
+    int  currentId = psMemGetId();
     int i;
-    //    int  currentId = psMemGetId();
-    psSpline1D *tmpSpline;
-    psVector *x;
-    psVector *newX;
-    psVector *y;
-    psVector *newY;
+    psSpline1D *tmpSpline = NULL;
+    psVector *x = NULL;
+    psVector *newX = NULL;
+    psVector *y = NULL;
+    psVector *newY = NULL;
     float NRX[NUM_SPLINES+2];
     float NRY[NUM_SPLINES+2];
@@ -128,38 +64,8 @@
     newX->data.F32[NUM_SPLINES] = x->data.F32[NUM_SPLINES];
     /****************************************************************************/
-    /*   NR Code       */
-    /****************************************************************************/
-    /*
-        printf("========================== NR Code =========================\n");
-        spline(&NRX[0],
-               &NRY[0],
-               NUM_SPLINES+1,
-               0.0,
-               0.0,
-               &derivs[0]);
-        for (i=1;i<=NUM_SPLINES+1;i++) {
-            printf("NR: derivs[%d] is %f\n", i, derivs[i]);
-        }
-     
-        for (i=1;i<=NUM_SPLINES+1;i++) {
-            printf("===================================================\n");
-            splint(&NRX[0],
-                   &NRY[0],
-                   &derivs[0],
-                   NUM_SPLINES+1,
-                   newX->data.F32[i-1],
-                   &tmpY);
-     
-            printf("NR: p_psNRSpline1DEval(%f) is %f.  Should be %f\n",
-                    newX->data.F32[i-1], tmpY, myFunc(newX->data.F32[i-1]));
-        }
-    */
-    /****************************************************************************/
     /*   psLib Code      */
     /****************************************************************************/
+
     psVectorFitSpline1D(tmpSpline, x, y, NULL);
-    for (i=0;i<NUM_SPLINES+1;i++) {
-        //       printf("psLib: derivs[%d] is %f\n", i, tmpSpline->p_psDeriv2[i]);
-    }
     newY = psSpline1DEvalVector(newX, tmpSpline);
 
@@ -174,7 +80,12 @@
     }
 
-    psFree(tmpSpline);
+    psFree(x);
+    psFree(newX);
+    psFree(y);
+    p_psSpline1DFree(tmpSpline);
+    psFree(newY);
+
     psMemCheckCorruption(1);
-    //    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
+    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
     if (0 != memLeaks) {
         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
