Index: trunk/psLib/src/math/psSpline.c
===================================================================
--- trunk/psLib/src/math/psSpline.c	(revision 2329)
+++ trunk/psLib/src/math/psSpline.c	(revision 2338)
@@ -7,6 +7,6 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.62 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-11-10 23:22:32 $
+ *  @version $Revision: 1.63 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-11-11 19:32:20 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -816,5 +816,5 @@
 
 /*****************************************************************************
-p_psInterpolate1D(): This routine will take as input n-element floating
+fullInterpolate1DF32(): This routine will take as input n-element floating
 point arrays domain and range, and the x value, assumed to lie with the
 domain vector.  It produces as output the (n-1)-order LaGrange interpolated
@@ -823,63 +823,65 @@
 XXX: do we error check for non-distinct domain values?
  *****************************************************************************/
-static float fullInterpolate1DF32(float *domain,
-                                  float *range,
-                                  psS32 n,
-                                  float x)
-{
-    PS_INT_CHECK_NON_NEGATIVE(n, NAN);
-    PS_PTR_CHECK_NULL(domain, NAN);
-    PS_PTR_CHECK_NULL(range, NAN);
-
-    psS32 i;
-    psS32 m;
-    static psVector *p = NULL;
-    p = psVectorRecycle(p, n, PS_TYPE_F32);
-    p_psMemSetPersistent(p, true);
-    p_psMemSetPersistent(p->data.F32, true);
-    /*
-        psVector *p = psVectorAlloc(n, PS_TYPE_F32);
-        float tmp;
-    */
-
-    psTrace(".psLib.dataManip.psFunctions.fullInterpolate1DF32", 4,
-            "---- fullInterpolate1DF32() begin (%d-order at x=%f) (%d data points)----\n", n-1, x, n);
-
-    for (i=0;i<n;i++) {
-        psTrace(".psLib.dataManip.psFunctions.fullInterpolate1DF32", 6,
-                "domain/range is (%f %f)\n", domain[i], range[i]);
-    }
-
-    for (i=0;i<n;i++) {
-        p->data.F32[i] = range[i];
-        psTrace(".psLib.dataManip.psFunctions.fullInterpolate1DF32", 6,
-                "p->data.F32[%d] is %f\n", i, p->data.F32[i]);
-
-    }
-
-    // From NR, during each iteration of the m loop, we are computing the
-    // p_{i ... i+m} terms.
-    for (m=1;m<n;m++) {
-        for (i=0;i<n-m;i++) {
-            // From NR: we are computing P_{i ... i+m}
-            p->data.F32[i] = (((x-domain[i+m]) * p->data.F32[i]) +
-                              ((domain[i]-x) * p->data.F32[i+1])) /
-                             (domain[i] - domain[i+m]);
-            //printf("((%f-%f * %f) + (%f-%f * %f)) / (%f - %f)\n", x, domain[i+m], p->data.F32[i], domain[i], x, p->data.F32[i+1], domain[i], domain[i+m]);
-            psTrace(".psLib.dataManip.psFunctions.fullInterpolate1DF32", 6,
-                    "p->data.F32[%d] is %f\n", i, p->data.F32[i]);
-        }
-    }
-    psTrace(".psLib.dataManip.psFunctions.fullInterpolate1DF32", 4,
-            "---- fullInterpolate1DF32() end ----\n");
-
-    /*
-        tmp = p->data.F32[0];
-        psFree(p);
-        return(tmp);
-    */
-    return(p->data.F32[0]);
-}
-
+#define FUNC_MACRO_FULL_INTERPOLATE_1D(TYPE) \
+static float fullInterpolate1D##TYPE(float *domain, \
+                                     float *range, \
+                                     psS32 n, \
+                                     float x) \
+{ \
+    \
+    psS32 i; \
+    psS32 m; \
+    static psVector *p = NULL; \
+    p = psVectorRecycle(p, n, PS_TYPE_##TYPE); \
+    p_psMemSetPersistent(p, true); \
+    p_psMemSetPersistent(p->data.TYPE, true); \
+    \
+    psTrace(".psLib.dataManip.psFunctions.fullInterpolate1D##TYPE", 4, \
+            "---- fullInterpolate1D##TYPE() begin (%d-order at x=%f) (%d data points)----\n", n-1, x, n); \
+    \
+    for (i=0;i<n;i++) { \
+        psTrace(".psLib.dataManip.psFunctions.fullInterpolate1D##TYPE", 6, \
+                "domain/range is (%f %f)\n", domain[i], range[i]); \
+    } \
+    \
+    for (i=0;i<n;i++) { \
+        p->data.TYPE[i] = range[i]; \
+        psTrace(".psLib.dataManip.psFunctions.fullInterpolate1D##TYPE", 6, \
+                "p->data.TYPE[%d] is %f\n", i, p->data.TYPE[i]); \
+        \
+    } \
+    \
+    /* From NR, during each iteration of the m loop, we are computing the \
+       p_{i ... i+m} terms. \
+    */ \
+    for (m=1;m<n;m++) { \
+        for (i=0;i<n-m;i++) { \
+            /* From NR: we are computing P_{i ... i+m} \
+             */ \
+            p->data.TYPE[i] = (((x-domain[i+m]) * p->data.TYPE[i]) + \
+                               ((domain[i]-x) * p->data.TYPE[i+1])) / \
+                              (domain[i] - domain[i+m]); \
+            /*printf("((%f-%f * %f) + (%f-%f * %f)) / (%f - %f)\n", x, domain[i+m], p->data.TYPE[i], domain[i], x, p->data.TYPE[i+1], domain[i], domain[i+m]); \
+             */ \
+            psTrace(".psLib.dataManip.psFunctions.fullInterpolate1D##TYPE", 6, \
+                    "p->data.TYPE[%d] is %f\n", i, p->data.TYPE[i]); \
+        } \
+    } \
+    psTrace(".psLib.dataManip.psFunctions.fullInterpolate1D##TYPE", 4, \
+            "---- fullInterpolate1D##TYPE() end ----\n"); \
+    \
+    return(p->data.TYPE[0]); \
+} \
+
+FUNC_MACRO_FULL_INTERPOLATE_1D(U8)
+FUNC_MACRO_FULL_INTERPOLATE_1D(U16)
+FUNC_MACRO_FULL_INTERPOLATE_1D(U32)
+FUNC_MACRO_FULL_INTERPOLATE_1D(U64)
+FUNC_MACRO_FULL_INTERPOLATE_1D(S8)
+FUNC_MACRO_FULL_INTERPOLATE_1D(S16)
+FUNC_MACRO_FULL_INTERPOLATE_1D(S32)
+FUNC_MACRO_FULL_INTERPOLATE_1D(S64)
+FUNC_MACRO_FULL_INTERPOLATE_1D(F32)
+FUNC_MACRO_FULL_INTERPOLATE_1D(F64)
 
 /*****************************************************************************
