Index: trunk/psLib/src/math/psPolynomial.c
===================================================================
--- trunk/psLib/src/math/psPolynomial.c	(revision 2197)
+++ trunk/psLib/src/math/psPolynomial.c	(revision 2204)
@@ -7,6 +7,6 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-26 21:24:42 $
+ *  @version $Revision: 1.54 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-10-27 00:57:31 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -50,5 +50,5 @@
     \
     if (IN->type.type == PS_TYPE_F64) { \
-        for (int i=0;i<IN->n;i++) { \
+        for (psS32 i=0;i<IN->n;i++) { \
             OUT->data.F32[i] = (float) (IN->data.F64[i]); \
         } \
@@ -69,5 +69,5 @@
     \
     if (IN->type.type == PS_TYPE_F32) { \
-        for (int i=0;i<IN->n;i++) { \
+        for (psS32 i=0;i<IN->n;i++) { \
             OUT->data.F64[i] = (float) (IN->data.F32[i]); \
         } \
@@ -117,9 +117,9 @@
 outer coefficients of the Chebyshev polynomials.
  *****************************************************************************/
-static psPolynomial1D **CreateChebyshevPolys(int maxChebyPoly)
+static psPolynomial1D **CreateChebyshevPolys(psS32 maxChebyPoly)
 {
     psPolynomial1D **chebPolys = NULL;
-    int i = 0;
-    int j = 0;
+    psS32 i = 0;
+    psS32 j = 0;
 
     chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *));
@@ -153,5 +153,5 @@
     evaluated Gaussian is: \f[ exp(-\frac{(x-mean)^2}{2\sigma^2}) \f]
  *****************************************************************************/
-float psGaussian(float x, float mean, float sigma, bool normal)
+float psGaussian(float x, float mean, float sigma, psBool normal)
 {
     float tmp = 1.0;
@@ -185,10 +185,10 @@
  NOTE: XXX: There is no way to seed the random generator.
  *****************************************************************************/
-psVector* psGaussianDev(float mean, float sigma, int Npts)
+psVector* psGaussianDev(float mean, float sigma, psS32 Npts)
 {
     psVector* gauss = NULL;
     const gsl_rng_type *T = NULL;
     gsl_rng *r = NULL;
-    int i = 0;
+    psS32 i = 0;
 
     gauss = psVectorAlloc(Npts, PS_TYPE_F32);
@@ -209,8 +209,8 @@
     This routine must allocate memory for the polynomial structures.
  *****************************************************************************/
-psPolynomial1D* psPolynomial1DAlloc(int n,
+psPolynomial1D* psPolynomial1DAlloc(psS32 n,
                                     psPolynomialType type)
 {
-    int i = 0;
+    psS32 i = 0;
     psPolynomial1D* newPoly = NULL;
 
@@ -232,9 +232,9 @@
 }
 
-psPolynomial2D* psPolynomial2DAlloc(int nX, int nY,
+psPolynomial2D* psPolynomial2DAlloc(psS32 nX, psS32 nY,
                                     psPolynomialType type)
 {
-    int x = 0;
-    int y = 0;
+    psS32 x = 0;
+    psS32 y = 0;
     psPolynomial2D* newPoly = NULL;
 
@@ -265,10 +265,10 @@
 }
 
-psPolynomial3D* psPolynomial3DAlloc(int nX, int nY, int nZ,
+psPolynomial3D* psPolynomial3DAlloc(psS32 nX, psS32 nY, psS32 nZ,
                                     psPolynomialType type)
 {
-    int x = 0;
-    int y = 0;
-    int z = 0;
+    psS32 x = 0;
+    psS32 y = 0;
+    psS32 z = 0;
     psPolynomial3D* newPoly = NULL;
 
@@ -307,11 +307,11 @@
 }
 
-psPolynomial4D* psPolynomial4DAlloc(int nW, int nX, int nY, int nZ,
+psPolynomial4D* psPolynomial4DAlloc(psS32 nW, psS32 nX, psS32 nY, psS32 nZ,
                                     psPolynomialType type)
 {
-    int w = 0;
-    int x = 0;
-    int y = 0;
-    int z = 0;
+    psS32 w = 0;
+    psS32 x = 0;
+    psS32 y = 0;
+    psS32 z = 0;
     psPolynomial4D* newPoly = NULL;
 
@@ -367,5 +367,5 @@
 static void polynomial2DFree(psPolynomial2D* myPoly)
 {
-    int x = 0;
+    psS32 x = 0;
 
     for (x = 0; x < myPoly->nX; x++) {
@@ -381,6 +381,6 @@
 static void polynomial3DFree(psPolynomial3D* myPoly)
 {
-    int x = 0;
-    int y = 0;
+    psS32 x = 0;
+    psS32 y = 0;
 
     for (x = 0; x < myPoly->nX; x++) {
@@ -402,7 +402,7 @@
 static void polynomial4DFree(psPolynomial4D* myPoly)
 {
-    int w = 0;
-    int x = 0;
-    int y = 0;
+    psS32 w = 0;
+    psS32 x = 0;
+    psS32 y = 0;
 
     for (w = 0; w < myPoly->nW; w++) {
@@ -434,5 +434,5 @@
 float p_psOrdPolynomial1DEval(float x, const psPolynomial1D* myPoly)
 {
-    int loop_x = 0;
+    psS32 loop_x = 0;
     float polySum = 0.0;
     float xSum = 1.0;
@@ -478,6 +478,6 @@
 {
     psVector *d;
-    int n;
-    int i;
+    psS32 n;
+    psS32 i;
     float tmp;
 
@@ -500,6 +500,6 @@
     /*
 
-    int n;
-    int i;
+    psS32 n;
+    psS32 i;
     float tmp;
     psPolynomial1D **chebPolys = NULL;
@@ -537,5 +537,5 @@
     psVector *tmp;
     psVector *myX;
-    int i;
+    psS32 i;
 
     PS_CONVERT_VECTOR_F32(x, myX);
@@ -555,6 +555,6 @@
 float p_psOrdPolynomial2DEval(float x, float y, const psPolynomial2D* myPoly)
 {
-    int loop_x = 0;
-    int loop_y = 0;
+    psS32 loop_x = 0;
+    psS32 loop_y = 0;
     float polySum = 0.0;
     float xSum = 1.0;
@@ -577,10 +577,10 @@
 float p_psChebPolynomial2DEval(float x, float y, const psPolynomial2D* myPoly)
 {
-    int loop_x = 0;
-    int loop_y = 0;
-    int i = 0;
+    psS32 loop_x = 0;
+    psS32 loop_y = 0;
+    psS32 i = 0;
     float polySum = 0.0;
     psPolynomial1D* *chebPolys = NULL;
-    int maxChebyPoly = 0;
+    psS32 maxChebyPoly = 0;
 
     // Determine how many Chebyshev polynomials
@@ -628,6 +628,6 @@
     psVector *myX;
     psVector *myY;
-    int i;
-    int vecLen=x->n;
+    psS32 i;
+    psS32 vecLen=x->n;
 
     PS_CONVERT_VECTOR_F32(x, myX);
@@ -658,7 +658,7 @@
 float p_psOrdPolynomial3DEval(float x, float y, float z, const psPolynomial3D* myPoly)
 {
-    int loop_x = 0;
-    int loop_y = 0;
-    int loop_z = 0;
+    psS32 loop_x = 0;
+    psS32 loop_y = 0;
+    psS32 loop_z = 0;
     float polySum = 0.0;
     float xSum = 1.0;
@@ -686,11 +686,11 @@
 float p_psChebPolynomial3DEval(float x, float y, float z, const psPolynomial3D* myPoly)
 {
-    int loop_x = 0;
-    int loop_y = 0;
-    int loop_z = 0;
-    int i = 0;
+    psS32 loop_x = 0;
+    psS32 loop_y = 0;
+    psS32 loop_z = 0;
+    psS32 i = 0;
     float polySum = 0.0;
     psPolynomial1D* *chebPolys = NULL;
-    int maxChebyPoly = 0;
+    psS32 maxChebyPoly = 0;
 
     // Determine how many Chebyshev polynomials
@@ -746,6 +746,6 @@
     psVector *myY;
     psVector *myZ;
-    int i;
-    int vecLen=x->n;
+    psS32 i;
+    psS32 vecLen=x->n;
 
     PS_CONVERT_VECTOR_F32(x, myX);
@@ -787,8 +787,8 @@
 float p_psOrdPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D* myPoly)
 {
-    int loop_w = 0;
-    int loop_x = 0;
-    int loop_y = 0;
-    int loop_z = 0;
+    psS32 loop_w = 0;
+    psS32 loop_x = 0;
+    psS32 loop_y = 0;
+    psS32 loop_z = 0;
     float polySum = 0.0;
     float wSum = 1.0;
@@ -821,12 +821,12 @@
 float p_psChebPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D* myPoly)
 {
-    int loop_w = 0;
-    int loop_x = 0;
-    int loop_y = 0;
-    int loop_z = 0;
-    int i = 0;
+    psS32 loop_w = 0;
+    psS32 loop_x = 0;
+    psS32 loop_y = 0;
+    psS32 loop_z = 0;
+    psS32 i = 0;
     float polySum = 0.0;
     psPolynomial1D* *chebPolys = NULL;
-    int maxChebyPoly = 0;
+    psS32 maxChebyPoly = 0;
 
     // Determine how many Chebyshev polynomials
@@ -890,6 +890,6 @@
     psVector *myY;
     psVector *myZ;
-    int i;
-    int vecLen=x->n;
+    psS32 i;
+    psS32 vecLen=x->n;
 
     PS_CONVERT_VECTOR_F32(w, myW);
@@ -936,8 +936,8 @@
 
 
-psDPolynomial1D* psDPolynomial1DAlloc(int n,
+psDPolynomial1D* psDPolynomial1DAlloc(psS32 n,
                                       psPolynomialType type)
 {
-    int i = 0;
+    psS32 i = 0;
     psDPolynomial1D* newPoly = NULL;
 
@@ -959,9 +959,9 @@
 }
 
-psDPolynomial2D* psDPolynomial2DAlloc(int nX, int nY,
+psDPolynomial2D* psDPolynomial2DAlloc(psS32 nX, psS32 nY,
                                       psPolynomialType type)
 {
-    int x = 0;
-    int y = 0;
+    psS32 x = 0;
+    psS32 y = 0;
     psDPolynomial2D* newPoly = NULL;
 
@@ -992,10 +992,10 @@
 }
 
-psDPolynomial3D* psDPolynomial3DAlloc(int nX, int nY, int nZ,
+psDPolynomial3D* psDPolynomial3DAlloc(psS32 nX, psS32 nY, psS32 nZ,
                                       psPolynomialType type)
 {
-    int x = 0;
-    int y = 0;
-    int z = 0;
+    psS32 x = 0;
+    psS32 y = 0;
+    psS32 z = 0;
     psDPolynomial3D* newPoly = NULL;
 
@@ -1034,11 +1034,11 @@
 }
 
-psDPolynomial4D* psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ,
+psDPolynomial4D* psDPolynomial4DAlloc(psS32 nW, psS32 nX, psS32 nY, psS32 nZ,
                                       psPolynomialType type)
 {
-    int w = 0;
-    int x = 0;
-    int y = 0;
-    int z = 0;
+    psS32 w = 0;
+    psS32 x = 0;
+    psS32 y = 0;
+    psS32 z = 0;
     psDPolynomial4D* newPoly = NULL;
 
@@ -1094,5 +1094,5 @@
 static void dPolynomial2DFree(psDPolynomial2D* myPoly)
 {
-    int x = 0;
+    psS32 x = 0;
 
     for (x = 0; x < myPoly->nX; x++) {
@@ -1108,6 +1108,6 @@
 static void dPolynomial3DFree(psDPolynomial3D* myPoly)
 {
-    int x = 0;
-    int y = 0;
+    psS32 x = 0;
+    psS32 y = 0;
 
     for (x = 0; x < myPoly->nX; x++) {
@@ -1129,7 +1129,7 @@
 static void dPolynomial4DFree(psDPolynomial4D* myPoly)
 {
-    int w = 0;
-    int x = 0;
-    int y = 0;
+    psS32 w = 0;
+    psS32 x = 0;
+    psS32 y = 0;
 
     for (w = 0; w < myPoly->nW; w++) {
@@ -1159,5 +1159,5 @@
 double p_psDOrdPolynomial1DEval(double x, const psDPolynomial1D* myPoly)
 {
-    int loop_x = 0;
+    psS32 loop_x = 0;
     double polySum = 0.0;
     double xSum = 1.0;
@@ -1183,6 +1183,6 @@
 {
     psVector *d;
-    int n;
-    int i;
+    psS32 n;
+    psS32 i;
     double tmp;
 
@@ -1222,5 +1222,5 @@
     psVector *tmp;
     psVector *myX;
-    int i;
+    psS32 i;
 
     PS_CONVERT_VECTOR_F64(x, myX);
@@ -1241,6 +1241,6 @@
 double p_psDOrdPolynomial2DEval(double x, double y, const psDPolynomial2D* myPoly)
 {
-    int loop_x = 0;
-    int loop_y = 0;
+    psS32 loop_x = 0;
+    psS32 loop_y = 0;
     double polySum = 0.0;
     double xSum = 1.0;
@@ -1263,10 +1263,10 @@
 double p_psDChebPolynomial2DEval(double x, double y, const psDPolynomial2D* myPoly)
 {
-    int loop_x = 0;
-    int loop_y = 0;
-    int i = 0;
+    psS32 loop_x = 0;
+    psS32 loop_y = 0;
+    psS32 i = 0;
     double polySum = 0.0;
     psPolynomial1D* *chebPolys = NULL;
-    int maxChebyPoly = 0;
+    psS32 maxChebyPoly = 0;
 
     // Determine how many Chebyshev polynomials
@@ -1314,6 +1314,6 @@
     psVector *myX;
     psVector *myY;
-    int i;
-    int vecLen=x->n;
+    psS32 i;
+    psS32 vecLen=x->n;
 
     PS_CONVERT_VECTOR_F64(x, myX);
@@ -1344,7 +1344,7 @@
 double p_psDOrdPolynomial3DEval(double x, double y, double z, const psDPolynomial3D* myPoly)
 {
-    int loop_x = 0;
-    int loop_y = 0;
-    int loop_z = 0;
+    psS32 loop_x = 0;
+    psS32 loop_y = 0;
+    psS32 loop_z = 0;
     double polySum = 0.0;
     double xSum = 1.0;
@@ -1372,11 +1372,11 @@
 double p_psDChebPolynomial3DEval(double x, double y, double z, const psDPolynomial3D* myPoly)
 {
-    int loop_x = 0;
-    int loop_y = 0;
-    int loop_z = 0;
-    int i = 0;
+    psS32 loop_x = 0;
+    psS32 loop_y = 0;
+    psS32 loop_z = 0;
+    psS32 i = 0;
     double polySum = 0.0;
     psPolynomial1D* *chebPolys = NULL;
-    int maxChebyPoly = 0;
+    psS32 maxChebyPoly = 0;
 
     // Determine how many Chebyshev polynomials
@@ -1432,6 +1432,6 @@
     psVector *myY;
     psVector *myZ;
-    int i;
-    int vecLen=x->n;
+    psS32 i;
+    psS32 vecLen=x->n;
 
     PS_CONVERT_VECTOR_F64(x, myX);
@@ -1475,8 +1475,8 @@
 double p_psDOrdPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D* myPoly)
 {
-    int loop_w = 0;
-    int loop_x = 0;
-    int loop_y = 0;
-    int loop_z = 0;
+    psS32 loop_w = 0;
+    psS32 loop_x = 0;
+    psS32 loop_y = 0;
+    psS32 loop_z = 0;
     double polySum = 0.0;
     double wSum = 1.0;
@@ -1509,12 +1509,12 @@
 double p_psDChebPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D* myPoly)
 {
-    int loop_w = 0;
-    int loop_x = 0;
-    int loop_y = 0;
-    int loop_z = 0;
-    int i = 0;
+    psS32 loop_w = 0;
+    psS32 loop_x = 0;
+    psS32 loop_y = 0;
+    psS32 loop_z = 0;
+    psS32 i = 0;
     double polySum = 0.0;
     psPolynomial1D* *chebPolys = NULL;
-    int maxChebyPoly = 0;
+    psS32 maxChebyPoly = 0;
 
     // Determine how many Chebyshev polynomials
@@ -1578,6 +1578,6 @@
     psVector *myY;
     psVector *myZ;
-    int i;
-    int vecLen=x->n;
+    psS32 i;
+    psS32 vecLen=x->n;
 
     PS_CONVERT_VECTOR_F64(w, myW);
@@ -1624,5 +1624,5 @@
 
 //typedef struct {
-//    int n;
+//    psS32 n;
 //    psPolynomial1D **spline;
 //    float *p_psDeriv2;
@@ -1636,11 +1636,11 @@
 XXX: Ensure that domain[i+1] != domain[i]
  *****************************************************************************/
-psSpline1D *psSpline1DAlloc(int numSplines,
-                            int order,
+psSpline1D *psSpline1DAlloc(psS32 numSplines,
+                            psS32 order,
                             float min,
                             float max)
 {
     psSpline1D *tmp = NULL;
-    int i;
+    psS32 i;
     float tmpDomain;
     float width;
@@ -1677,7 +1677,7 @@
 
 // XXX: Have Robert put the dealocator in the memory file.
-int p_psSpline1DFree(psSpline1D *tmpSpline)
-{
-    int i;
+psS32 p_psSpline1DFree(psSpline1D *tmpSpline)
+{
+    psS32 i;
 
     if (tmpSpline == NULL) {
@@ -1704,9 +1704,9 @@
  *****************************************************************************/
 psSpline1D *psSpline1DAllocGeneric(const psVector *bounds,
-                                   int order)
+                                   psS32 order)
 {
     psSpline1D *tmp = NULL;
-    int i;
-    int numSplines;
+    psS32 i;
+    psS32 numSplines;
 
     tmp = (psSpline1D *) psAlloc(sizeof(psSpline1D));
@@ -1746,11 +1746,11 @@
 XXX: name since we don't take psVectors as input.
  *****************************************************************************/
-int p_psVectorBinDisectF32(float *bins,
-                           int numBins,
-                           float x)
-{
-    int min;
-    int max;
-    int mid;
+psS32 p_psVectorBinDisectF32(float *bins,
+                             psS32 numBins,
+                             float x)
+{
+    psS32 min;
+    psS32 max;
+    psS32 mid;
 
     psTrace(".psLib.dataManip.psFunctions.p_psVectorBinDisectF32", 4,
@@ -1800,11 +1800,11 @@
 p_psVectorBinDisectS32(): integer version of above.
  *****************************************************************************/
-int p_psVectorBinDisectS32(int *bins,
-                           int numBins,
-                           int x)
-{
-    int min;
-    int max;
-    int mid;
+psS32 p_psVectorBinDisectS32(psS32 *bins,
+                             psS32 numBins,
+                             psS32 x)
+{
+    psS32 min;
+    psS32 max;
+    psS32 mid;
 
     psTrace(".psLib.dataManip.psFunctions.p_psVectorBinDisectS32", 4,
@@ -1848,6 +1848,6 @@
 p_psVectorBinDisect(): A wrapper to the above p_psVectorBinDisect().
  *****************************************************************************/
-int p_psVectorBinDisect(psVector *bins,
-                        psScalar *x)
+psS32 p_psVectorBinDisect(psVector *bins,
+                          psScalar *x)
 {
     if (x->type.type != bins->type.type) {
@@ -1877,9 +1877,9 @@
 float p_ps1DFullInterpolateF32(float *domain,
                                float *range,
-                               int n,
+                               psS32 n,
                                float x)
 {
-    int i;
-    int m;
+    psS32 i;
+    psS32 m;
     static psVector *p = NULL;
     p = psVectorRecycle(p, n, PS_TYPE_F32);
@@ -1937,11 +1937,11 @@
 float p_ps1DInterpolateF32(float *domain,
                            float *range,
-                           int n,
-                           int order,
+                           psS32 n,
+                           psS32 order,
                            float x)
 {
-    int binNum;
-    int numIntPoints = order+1;
-    int origin;
+    psS32 binNum;
+    psS32 numIntPoints = order+1;
+    psS32 origin;
 
     psTrace(".psLib.dataManip.psFunctions.p_ps1DInterpolateF32", 4,
@@ -1987,5 +1987,5 @@
 psScalar *p_psVectorInterpolate(psVector *domain,
                                 psVector *range,
-                                int order,
+                                psS32 order,
                                 psScalar *x)
 {
@@ -2065,6 +2065,6 @@
                      float x)
 {
-    int binNum;
-    int n;
+    psS32 binNum;
+    psS32 n;
 
     n = spline->n;
@@ -2091,5 +2091,5 @@
                                const psSpline1D *spline)
 {
-    int i;
+    psS32 i;
     psVector *tmpVector;
 
