Index: /trunk/psLib/src/astro/psCoord.c
===================================================================
--- /trunk/psLib/src/astro/psCoord.c	(revision 1406)
+++ /trunk/psLib/src/astro/psCoord.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psCoord.c
 *
@@ -10,6 +11,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 22:34:05 $
+*  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -27,68 +28,56 @@
 #include <float.h>
 
-static float cot( float x );
-static float arg( float x, float y );
+static float cot(float x);
+static float arg(float x, float y);
 
 // This is the only function in this file which I understand.
-psPlane *psPlaneTransformApply( psPlane *out,
-                                const psPlaneTransform *transform,
-                                const psPlane *coords )
-{
-    if ( out == NULL ) {
-        out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
-    }
-    out->x = transform->x->coeff[ 0 ][ 0 ] +
-             ( transform->x->coeff[ 1 ][ 0 ] * coords->x ) +
-             ( transform->x->coeff[ 0 ][ 1 ] * coords->y );
-
-    out->y = transform->y->coeff[ 0 ][ 0 ] +
-             ( transform->y->coeff[ 1 ][ 0 ] * coords->x ) +
-             ( transform->y->coeff[ 0 ][ 1 ] * coords->y );
-
-    return ( out );
-}
-
+psPlane *psPlaneTransformApply(psPlane * out, const psPlaneTransform * transform, const psPlane * coords)
+{
+    if (out == NULL) {
+        out = (psPlane *) psAlloc(sizeof(psPlane));
+    }
+    out->x = transform->x->coeff[0][0] +
+             (transform->x->coeff[1][0] * coords->x) + (transform->x->coeff[0][1] * coords->y);
+
+    out->y = transform->y->coeff[0][0] +
+             (transform->y->coeff[1][0] * coords->x) + (transform->y->coeff[0][1] * coords->y);
+
+    return (out);
+}
 
 // This transformation takes into account parameters beyond an objects
 // spatial coordinates: term3 and term4.
-psPlane *psPlaneDistortApply( psPlane *out,
-                              const psPlaneDistort *transform,
-                              const psPlane *coords,
-                              float term3,
-                              float term4 )
-{
-    if ( out == NULL ) {
-        out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
-    }
-
-    out->x = transform->x->coeff[ 0 ][ 0 ][ 0 ][ 0 ] +
-             ( transform->x->coeff[ 1 ][ 0 ][ 0 ][ 0 ] * coords->x ) +
-             ( transform->x->coeff[ 0 ][ 1 ][ 0 ][ 0 ] * coords->y ) +
-             ( transform->x->coeff[ 0 ][ 0 ][ 1 ][ 0 ] * term3 ) +
-             ( transform->x->coeff[ 0 ][ 0 ][ 0 ][ 1 ] * term4 );
-
-    out->y = transform->y->coeff[ 0 ][ 0 ][ 0 ][ 0 ] +
-             ( transform->y->coeff[ 1 ][ 0 ][ 0 ][ 0 ] * coords->x ) +
-             ( transform->y->coeff[ 0 ][ 1 ][ 0 ][ 0 ] * coords->y ) +
-             ( transform->y->coeff[ 0 ][ 0 ][ 1 ][ 0 ] * term3 ) +
-             ( transform->y->coeff[ 0 ][ 0 ][ 0 ][ 1 ] * term4 );
-
-    return ( out );
-}
-
+psPlane *psPlaneDistortApply(psPlane * out,
+                             const psPlaneDistort * transform,
+                             const psPlane * coords, float term3, float term4)
+{
+    if (out == NULL) {
+        out = (psPlane *) psAlloc(sizeof(psPlane));
+    }
+
+    out->x = transform->x->coeff[0][0][0][0] +
+             (transform->x->coeff[1][0][0][0] * coords->x) +
+             (transform->x->coeff[0][1][0][0] * coords->y) +
+             (transform->x->coeff[0][0][1][0] * term3) + (transform->x->coeff[0][0][0][1] * term4);
+
+    out->y = transform->y->coeff[0][0][0][0] +
+             (transform->y->coeff[1][0][0][0] * coords->x) +
+             (transform->y->coeff[0][1][0][0] * coords->y) +
+             (transform->y->coeff[0][0][1][0] * term3) + (transform->y->coeff[0][0][0][1] * term4);
+
+    return (out);
+}
 
 // This function prototype has been modified since the SDRS.
-psSphereTransform *psSphereTransformAlloc( double NPlat,
-        double Xo,
-        double xo )
-{
-    psSphereTransform * tmp = ( psSphereTransform * ) psAlloc( sizeof( psSphereTransform ) );
-
-    tmp->sinPhi = sin( NPlat );
-    tmp->cosPhi = cos( NPlat );
+psSphereTransform *psSphereTransformAlloc(double NPlat, double Xo, double xo)
+{
+    psSphereTransform *tmp = (psSphereTransform *) psAlloc(sizeof(psSphereTransform));
+
+    tmp->sinPhi = sin(NPlat);
+    tmp->cosPhi = cos(NPlat);
     tmp->Xo = Xo;
     tmp->xo = xo;
 
-    return ( tmp );
+    return (tmp);
 }
 
@@ -100,7 +89,5 @@
 // there are no typo's.
 
-psSphere *psSphereTransformApply( psSphere *out,
-                                  const psSphereTransform *transform,
-                                  const psSphere *coord )
+psSphere *psSphereTransformApply(psSphere * out, const psSphereTransform * transform, const psSphere * coord)
 {
     double sinY = 0.0;
@@ -112,6 +99,6 @@
     double dx = 0.0;
 
-    if ( out == NULL ) {
-        out = ( psSphere * ) psAlloc( sizeof( psSphere ) );
+    if (out == NULL) {
+        out = (psSphere *) psAlloc(sizeof(psSphere));
     }
 
@@ -119,20 +106,19 @@
     y = coord->d;
     dx = x - transform->xo;
-    sinY = cos( y ) * sin( dx ) * transform->sinPhi + sin( y ) * transform->cosPhi;
-    cosY = sqrt( 1.0 - sinY * sinY );
-    sinX = ( cos( y ) * sin( dx ) * transform->cosPhi - sin( y ) * transform->sinPhi ) /
-           cos( y );
-    cosX = cos( y ) * cos( dx ) / cos( y );
-
-    out->r = atan2( sinX, cosX ) + transform->Xo;
-    out->d = atan2( sinY, cosY );
-
-    return ( out );
-}
-
-psSphereTransform *psSphereTransformICRStoEcliptic( psTime time )
-{
-    struct tm * tmTime = psTimeToTM( time );
-    double year = ( double ) ( 1900 + tmTime->tm_year );
+    sinY = cos(y) * sin(dx) * transform->sinPhi + sin(y) * transform->cosPhi;
+    cosY = sqrt(1.0 - sinY * sinY);
+    sinX = (cos(y) * sin(dx) * transform->cosPhi - sin(y) * transform->sinPhi) / cos(y);
+    cosX = cos(y) * cos(dx) / cos(y);
+
+    out->r = atan2(sinX, cosX) + transform->Xo;
+    out->d = atan2(sinY, cosY);
+
+    return (out);
+}
+
+psSphereTransform *psSphereTransformICRStoEcliptic(psTime time)
+{
+    struct tm *tmTime = psTimeToTM(time);
+    double year = (double)(1900 + tmTime->tm_year);
     double T = year / 100.0;
     double phi = -23.452294 + 0.013013 * T + 0.000001639 * T * T - 0.000000503 * T * T * T;
@@ -140,112 +126,99 @@
     double xo = 0.0;
 
-    return ( psSphereTransformAlloc( phi, Xo, xo ) );
-}
-
-psSphereTransform *psSphereTransformEcliptictoICRS( psTime time )
-{
-    struct tm * tmTime = psTimeToTM( time );
-    double year = ( double ) ( 1900 + tmTime->tm_year );
+    return (psSphereTransformAlloc(phi, Xo, xo));
+}
+
+psSphereTransform *psSphereTransformEcliptictoICRS(psTime time)
+{
+    struct tm *tmTime = psTimeToTM(time);
+    double year = (double)(1900 + tmTime->tm_year);
     double T = year / 100.0;
-    double phi = + 23.452294 - 0.013013 * T - 0.000001639 * T * T + 0.000000503 * T * T * T;
+    double phi = +23.452294 - 0.013013 * T - 0.000001639 * T * T + 0.000000503 * T * T * T;
     double Xo = 0.0;
     double xo = 0.0;
 
-    return ( psSphereTransformAlloc( phi, Xo, xo ) );
-}
-
-psSphereTransform *psSphereTransformICRStoGalatic( void )
-{
-    return ( psSphereTransformAlloc( 62.6, 282.25, 33.0 ) );
-}
-
-psSphereTransform *psSphereTransformGalatictoICRS( void )
-{
-    return ( psSphereTransformAlloc( -62.6, 33.0, 282.25 ) );
+    return (psSphereTransformAlloc(phi, Xo, xo));
+}
+
+psSphereTransform *psSphereTransformICRStoGalatic(void)
+{
+    return (psSphereTransformAlloc(62.6, 282.25, 33.0));
+}
+
+psSphereTransform *psSphereTransformGalatictoICRS(void)
+{
+    return (psSphereTransformAlloc(-62.6, 33.0, 282.25));
 }
 
 // XXX: Is this the correct way to calculate this?
-float cot( float x )
-{
-    return ( 1.0 / atan( x ) );
+float cot(float x)
+{
+    return (1.0 / atan(x));
 }
 
 // This is some kind of arc tan function.
-float arg( float x, float y )
-{
-    if ( x > 0 ) {
-        return ( atan( y / x ) );
-    } else
-        if ( ( x == 0 ) && ( y == 0 ) ) {
-            return ( 0.5 * M_PI );
-        } else
-            if ( ( x == 0 ) && ( y == 0 ) ) {
-                return ( -0.5 * M_PI );
-            } else
-                if ( ( x == 0 ) && ( y == 0 ) ) {
-                    return ( M_PI + atan( y / x ) );
-                } else
-                    if ( ( x == 0 ) && ( y == 0 ) ) {
-                        return ( -M_PI + atan( y / x ) );
-                    }
-
-    psAbort( __func__, "Unacceptable range for (arg(%f, %f).\n", x, y );
-    return ( 0.0 );
+float arg(float x, float y)
+{
+    if (x > 0) {
+        return (atan(y / x));
+    } else if ((x == 0) && (y == 0)) {
+        return (0.5 * M_PI);
+    } else if ((x == 0) && (y == 0)) {
+        return (-0.5 * M_PI);
+    } else if ((x == 0) && (y == 0)) {
+        return (M_PI + atan(y / x));
+    } else if ((x == 0) && (y == 0)) {
+        return (-M_PI + atan(y / x));
+    }
+
+    psAbort(__func__, "Unacceptable range for (arg(%f, %f).\n", x, y);
+    return (0.0);
 }
 
 // XXX: Waiting for the definition of the PS_PROJ_PAR projection.
 // XXX: Waiting for the definition of the PS_PROJ_GLS projection.
-psPlane *psProject( const psSphere *coord,
-                    const psProjection *projection )
+psPlane *psProject(const psSphere * coord, const psProjection * projection)
 {
     float R = 0.0;
     float alpha = 0.0;
-    psPlane *tmp = ( psPlane * ) psAlloc( sizeof( psPlane ) );
-
-    if ( projection->type == PS_PROJ_TAN ) {
-        R = cot( coord->r ) * ( 180.0 / M_PI );
-        tmp->x = R * sin( coord->d );
-        tmp->y = R * cos( coord->d );
-
-    } else
-        if ( projection->type == PS_PROJ_SIN ) {
-            R = cos( coord->r ) * ( 180.0 / M_PI );
-            tmp->x = R * sin( coord->d );
-            tmp->y = R * cos( coord->d );
-
-        } else
-            if ( projection->type == PS_PROJ_CAR ) {
-                tmp->x = coord->d;
-                tmp->y = coord->r;
-
-            } else
-                if ( projection->type == PS_PROJ_MER ) {
-                    tmp->x = coord->d;
-                    tmp->y = log( tan( 45.0 + ( 0.5 * coord->r ) ) ) * 180.0 / M_PI;
-
-                } else
-                    if ( projection->type == PS_PROJ_AIT ) {
-                        alpha = 1.0 / ( ( 180.0 / M_PI ) *
-                                        sqrt( 1.0 + ( cos( coord->r ) * cos( 0.5 * coord->d ) * 0.5 ) ) );
-
-                        tmp->x = 2.0 * alpha * cos( coord->r ) * sin( 0.5 * coord->d );
-                        tmp->y = alpha * sin( coord->d );
-
-                    } else
-                        if ( projection->type == PS_PROJ_PAR ) {
-                            psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" );
-
-                        } else
-                            if ( projection->type == PS_PROJ_GLS ) {
-                                psAbort( __func__, "The projection type PS_PROJ_GLS is undefined.\n" );
-                            }
-
-    return ( tmp );
+    psPlane *tmp = (psPlane *) psAlloc(sizeof(psPlane));
+
+    if (projection->type == PS_PROJ_TAN) {
+        R = cot(coord->r) * (180.0 / M_PI);
+        tmp->x = R * sin(coord->d);
+        tmp->y = R * cos(coord->d);
+
+    } else if (projection->type == PS_PROJ_SIN) {
+        R = cos(coord->r) * (180.0 / M_PI);
+        tmp->x = R * sin(coord->d);
+        tmp->y = R * cos(coord->d);
+
+    } else if (projection->type == PS_PROJ_CAR) {
+        tmp->x = coord->d;
+        tmp->y = coord->r;
+
+    } else if (projection->type == PS_PROJ_MER) {
+        tmp->x = coord->d;
+        tmp->y = log(tan(45.0 + (0.5 * coord->r))) * 180.0 / M_PI;
+
+    } else if (projection->type == PS_PROJ_AIT) {
+        alpha = 1.0 / ((180.0 / M_PI) * sqrt(1.0 + (cos(coord->r) * cos(0.5 * coord->d) * 0.5)));
+
+        tmp->x = 2.0 * alpha * cos(coord->r) * sin(0.5 * coord->d);
+        tmp->y = alpha * sin(coord->d);
+
+    } else if (projection->type == PS_PROJ_PAR) {
+        psAbort(__func__, "The projection type PS_PROJ_PAR is undefined.\n");
+
+    } else if (projection->type == PS_PROJ_GLS) {
+        psAbort(__func__, "The projection type PS_PROJ_GLS is undefined.\n");
+    }
+
+    return (tmp);
 }
 
 // XXX: Waiting for the definition of the PS_PROJ_PAR projection.
 // XXX: Waiting for the definition of the PS_PROJ_GLS projection.
-psSphere *psDeproject( const psPlane *coord,
-                       const psProjection *projection )
+psSphere *psDeproject(const psPlane * coord, const psProjection * projection)
 {
     float R = 0.0;
@@ -253,58 +226,50 @@
     float chu1 = 0.0;
     float chu2 = 0.0;
-    psSphere *tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) );
-
-    if ( projection->type == PS_PROJ_TAN ) {
-        R = sqrt( ( coord->x * coord->x ) + ( coord->y * coord->y ) );
-        tmp->d = arg( -coord->y, coord->x );
-        tmp->r = atan( 180.0 / ( R * M_PI ) );
-
-    } else
-        if ( projection->type == PS_PROJ_SIN ) {
-            R = sqrt( ( coord->x * coord->x ) + ( coord->y * coord->y ) );
-            tmp->d = arg( -coord->y, coord->x );
-            tmp->r = acos( ( R * M_PI ) / 180.0 );
-
-        } else
-            if ( projection->type == PS_PROJ_CAR ) {
-                tmp->d = coord->x;
-                tmp->r = coord->y;
-
-            } else
-                if ( projection->type == PS_PROJ_MER ) {
-                    tmp->d = coord->x;
-                    tmp->r = ( 2.0 * atan( exp( ( coord->y * M_PI / 180.0 ) ) ) ) - 180.0;
-
-                } else
-                    if ( projection->type == PS_PROJ_AIT ) {
-                        chu1 = ( coord->x * M_PI ) / 720.0;
-                        chu1 *= chu1;
-                        chu2 = ( coord->y * M_PI ) / 360.0;
-                        chu2 *= chu2;
-                        chu = sqrt( 1.0 - chu1 - chu2 );
-                        tmp->d = 2.0 * arg( ( 2.0 * chu * chu ) - 1.0,
-                                            ( coord->x * chu * M_PI ) / 360.0 );
-                        tmp->r = asin( ( coord->y * chu * M_PI ) / 180.0 );
-
-                    } else
-                        if ( projection->type == PS_PROJ_PAR ) {
-                            psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" );
-
-                        } else
-                            if ( projection->type == PS_PROJ_GLS ) {
-                                psAbort( __func__, "The projection type PS_PROJ_GLG is undefined.\n" );
-                            }
-
-    return ( tmp );
+    psSphere *tmp = (psSphere *) psAlloc(sizeof(psSphere));
+
+    if (projection->type == PS_PROJ_TAN) {
+        R = sqrt((coord->x * coord->x) + (coord->y * coord->y));
+        tmp->d = arg(-coord->y, coord->x);
+        tmp->r = atan(180.0 / (R * M_PI));
+
+    } else if (projection->type == PS_PROJ_SIN) {
+        R = sqrt((coord->x * coord->x) + (coord->y * coord->y));
+        tmp->d = arg(-coord->y, coord->x);
+        tmp->r = acos((R * M_PI) / 180.0);
+
+    } else if (projection->type == PS_PROJ_CAR) {
+        tmp->d = coord->x;
+        tmp->r = coord->y;
+
+    } else if (projection->type == PS_PROJ_MER) {
+        tmp->d = coord->x;
+        tmp->r = (2.0 * atan(exp((coord->y * M_PI / 180.0)))) - 180.0;
+
+    } else if (projection->type == PS_PROJ_AIT) {
+        chu1 = (coord->x * M_PI) / 720.0;
+        chu1 *= chu1;
+        chu2 = (coord->y * M_PI) / 360.0;
+        chu2 *= chu2;
+        chu = sqrt(1.0 - chu1 - chu2);
+        tmp->d = 2.0 * arg((2.0 * chu * chu) - 1.0, (coord->x * chu * M_PI) / 360.0);
+        tmp->r = asin((coord->y * chu * M_PI) / 180.0);
+
+    } else if (projection->type == PS_PROJ_PAR) {
+        psAbort(__func__, "The projection type PS_PROJ_PAR is undefined.\n");
+
+    } else if (projection->type == PS_PROJ_GLS) {
+        psAbort(__func__, "The projection type PS_PROJ_GLG is undefined.\n");
+    }
+
+    return (tmp);
 }
 
 // XXX: Do I need to check for unacceptable transformation parameters?
 // Maybe, if the points are on the North/South Pole, etc?
-psSphere *psSphereGetOffset( const psSphere *restrict position1,
-                             const psSphere *restrict position2,
-                             psSphereOffsetMode mode,
-                             psSphereOffsetUnit unit )
-{
-    //    psPlane *lin;
+psSphere *psSphereGetOffset(const psSphere * restrict position1,
+                            const psSphere * restrict position2,
+                            psSphereOffsetMode mode, psSphereOffsetUnit unit)
+{
+    // psPlane *lin;
     psProjection proj;
     psSphere *tmp;
@@ -312,5 +277,5 @@
     double tmpD = 0.0;
 
-    if ( mode == PS_LINEAR ) {
+    if (mode == PS_LINEAR) {
         // XXX: I have no idea how to construct this.  Maybe project both
         // sperical positions onto the plane, set the origin at one of the
@@ -318,5 +283,5 @@
 
         // XXX: Do I need to somehow scale this projection?
-        // project position1?  Will it project to (0.0, 0.0)?
+        // project position1? Will it project to (0.0, 0.0)?
         proj.R = position1->r;
         proj.D = position1->d;
@@ -325,51 +290,45 @@
         proj.type = PS_PROJ_TAN;
 
-        //        lin = psProject(position2, proj);
-        //        tmp = psDeproject(lin, proj);
+        // lin = psProject(position2, proj);
+        // tmp = psDeproject(lin, proj);
 
         // XXX: Do we need to convert units in tmp?
-        return ( tmp );
-    } else
-        if ( mode == PS_SPHERICAL ) {
-            tmpR = position2->r - position1->r;
-            tmpD = position2->d - position1->d;
-
-            if ( unit == PS_ARCSEC ) {
-                tmpR = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI;
-                tmpD = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI;
-            } else
-                if ( unit == PS_ARCMIN ) {
-                    tmpR = ( tmpR * 180.0 * 60.0 ) / M_PI;
-                    tmpD = ( tmpR * 180.0 * 60.0 ) / M_PI;
-                } else
-                    if ( unit == PS_DEGREE ) {
-                        tmpR = ( tmpR * 180.0 ) / M_PI;
-                        tmpD = ( tmpR * 180.0 ) / M_PI;
-                    } else
-                    if ( unit == PS_RADIAN ) {}
-                        else {
-                            psAbort( __func__, "Unknown offset unit: 0x%x\n", unit );
-                        }
-
-            tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) );
-            tmp->r = tmpR;
-            tmp->d = tmpD;
-            tmp->rErr = 0.0;
-            tmp->dErr = 0.0;
-            // XXX: Do we need to wrap these to an acceptable range?
-            return ( tmp );
+        return (tmp);
+    } else if (mode == PS_SPHERICAL) {
+        tmpR = position2->r - position1->r;
+        tmpD = position2->d - position1->d;
+
+        if (unit == PS_ARCSEC) {
+            tmpR = (tmpR * 180.0 * 60.0 * 60.0) / M_PI;
+            tmpD = (tmpR * 180.0 * 60.0 * 60.0) / M_PI;
+        } else if (unit == PS_ARCMIN) {
+            tmpR = (tmpR * 180.0 * 60.0) / M_PI;
+            tmpD = (tmpR * 180.0 * 60.0) / M_PI;
+        } else if (unit == PS_DEGREE) {
+            tmpR = (tmpR * 180.0) / M_PI;
+            tmpD = (tmpR * 180.0) / M_PI;
+        } else if (unit == PS_RADIAN) {}
+        else {
+            psAbort(__func__, "Unknown offset unit: 0x%x\n", unit);
         }
-    psAbort( __func__, "Unrecognized offset mode\n" );
-    return ( NULL );
-}
-
+
+        tmp = (psSphere *) psAlloc(sizeof(psSphere));
+        tmp->r = tmpR;
+        tmp->d = tmpD;
+        tmp->rErr = 0.0;
+        tmp->dErr = 0.0;
+        // XXX: Do we need to wrap these to an acceptable range?
+        return (tmp);
+    }
+    psAbort(__func__, "Unrecognized offset mode\n");
+    return (NULL);
+}
 
 // XXX: Do I need to check for unacceptable transformation parameters?
 // Maybe, if the points are on the North/South Pole, etc?
 // XXX: I copied the algorithm from the ADD exactly.
-psSphere *psSphereSetOffset( const psSphere *restrict position,
-                             const psSphere *restrict offset,
-                             psSphereOffsetMode mode,
-                             psSphereOffsetUnit unit )
+psSphere *psSphereSetOffset(const psSphere * restrict position,
+                            const psSphere * restrict offset,
+                            psSphereOffsetMode mode, psSphereOffsetUnit unit)
 {
     psPlane lin;
@@ -379,5 +338,5 @@
     double tmpD = 0.0;
 
-    if ( mode == PS_LINEAR ) {
+    if (mode == PS_LINEAR) {
         proj.R = position->r;
         proj.D = position->d;
@@ -389,39 +348,35 @@
         lin.y = offset->d;
 
-        tmp = psDeproject( &lin, &proj );
-        return ( tmp );
-
-    } else
-        if ( mode == PS_SPHERICAL ) {
-            if ( unit == PS_ARCSEC ) {
-                tmpR = ( M_PI * offset->r ) / ( 180.0 * 60.0 * 60.0 );
-                tmpD = ( M_PI * offset->d ) / ( 180.0 * 60.0 * 60.0 );
-            } else
-                if ( unit == PS_ARCMIN ) {
-                    tmpR = ( M_PI * offset->r ) / ( 180.0 * 60.0 );
-                    tmpD = ( M_PI * offset->d ) / ( 180.0 * 60.0 );
-                } else
-                    if ( unit == PS_DEGREE ) {
-                        tmpR = ( M_PI * offset->r ) / ( 180.0 );
-                        tmpD = ( M_PI * offset->d ) / ( 180.0 );
-                    } else
-                        if ( unit == PS_RADIAN ) {
-                            tmpR = offset->r;
-                            tmpD = offset->d;
-                        } else {
-                            psAbort( __func__, "Unknown offset unit: 0x%x\n", unit );
-                        }
-
-            tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) );
-            tmp->r = position->r + tmpR;
-            tmp->r = position->d + tmpD;
-            tmp->rErr = 0.0;
-            tmp->dErr = 0.0;
-
-            // XXX: wrap tmp->r and tmp->d to the allowed range (-PI to PI)
-            // and (0 to 2*PI).
-            return ( tmp );
+        tmp = psDeproject(&lin, &proj);
+        return (tmp);
+
+    } else if (mode == PS_SPHERICAL) {
+        if (unit == PS_ARCSEC) {
+            tmpR = (M_PI * offset->r) / (180.0 * 60.0 * 60.0);
+            tmpD = (M_PI * offset->d) / (180.0 * 60.0 * 60.0);
+        } else if (unit == PS_ARCMIN) {
+            tmpR = (M_PI * offset->r) / (180.0 * 60.0);
+            tmpD = (M_PI * offset->d) / (180.0 * 60.0);
+        } else if (unit == PS_DEGREE) {
+            tmpR = (M_PI * offset->r) / (180.0);
+            tmpD = (M_PI * offset->d) / (180.0);
+        } else if (unit == PS_RADIAN) {
+            tmpR = offset->r;
+            tmpD = offset->d;
+        } else {
+            psAbort(__func__, "Unknown offset unit: 0x%x\n", unit);
         }
-    psAbort( __func__, "Unrecognized offset mode\n" );
-    return ( NULL );
-}
+
+        tmp = (psSphere *) psAlloc(sizeof(psSphere));
+        tmp->r = position->r + tmpR;
+        tmp->r = position->d + tmpD;
+        tmp->rErr = 0.0;
+        tmp->dErr = 0.0;
+
+        // XXX: wrap tmp->r and tmp->d to the allowed range (-PI to PI)
+        // and (0 to 2*PI).
+        return (tmp);
+    }
+    psAbort(__func__, "Unrecognized offset mode\n");
+    return (NULL);
+}
Index: /trunk/psLib/src/astro/psCoord.h
===================================================================
--- /trunk/psLib/src/astro/psCoord.h	(revision 1406)
+++ /trunk/psLib/src/astro/psCoord.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psCoord.h
 *
@@ -10,19 +11,19 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-05 19:38:51 $
+*  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
 */
 
-# ifndef PS_COORD_H
-# define PS_COORD_H
-
-#include "psType.h"
-#include "psImage.h"
-#include "psArray.h"
-#include "psList.h"
-#include "psFunctions.h"
-#include "psTime.h"
+#ifndef PS_COORD_H
+#    define PS_COORD_H
+
+#    include "psType.h"
+#    include "psImage.h"
+#    include "psArray.h"
+#    include "psList.h"
+#    include "psFunctions.h"
+#    include "psTime.h"
 
 /// @addtogroup CoordinateTransform
@@ -38,8 +39,8 @@
 typedef struct
 {
-    double x;      ///< x position
-    double y;      ///< y position
-    double xErr;   ///< Error in x position
-    double yErr;   ///< Error in y position
+    double x;                   // /< x position
+    double y;                   // /< y position
+    double xErr;                // /< Error in x position
+    double yErr;                // /< Error in y position
 }
 psPlane;
@@ -54,8 +55,8 @@
 typedef struct
 {
-    double r;      ///< RA
-    double d;      ///< Dec
-    double rErr;   ///< Error in RA
-    double dErr;   ///< Error in Dec
+    double r;                   // /< RA
+    double d;                   // /< Dec
+    double rErr;                // /< Error in RA
+    double dErr;                // /< Error in Dec
 }
 psSphere;
@@ -71,6 +72,6 @@
 typedef struct
 {
-    psDPolynomial2D *x;                ///< 2D polynomial transform of X coordinates
-    psDPolynomial2D *y;                ///< 2D polynomial transform of Y coordinates
+    psDPolynomial2D *x;         // /< 2D polynomial transform of X coordinates
+    psDPolynomial2D *y;         // /< 2D polynomial transform of Y coordinates
 }
 psPlaneTransform;
@@ -90,6 +91,6 @@
 typedef struct
 {
-    psDPolynomial4D *x;                ///< 4D polynomial transform of X coordinates
-    psDPolynomial4D *y;                ///< 4D polynomial transform of Y coordinates
+    psDPolynomial4D *x;         // /< 4D polynomial transform of X coordinates
+    psDPolynomial4D *y;         // /< 4D polynomial transform of Y coordinates
 }
 psPlaneDistort;
@@ -107,8 +108,8 @@
 typedef struct
 {
-    double sinPhi;                    ///< sin of North Pole lattitude
-    double cosPhi;                    ///< cos of North Pole lattitude
-    double Xo;                        ///< First PT of Ares lon
-    double xo;                        ///< First PT of Ares equiv lon
+    double sinPhi;              // /< sin of North Pole lattitude
+    double cosPhi;              // /< cos of North Pole lattitude
+    double Xo;                  // /< First PT of Ares lon
+    double xo;                  // /< First PT of Ares equiv lon
 }
 psSphereTransform;
@@ -120,12 +121,12 @@
  */
 typedef enum {
-    PS_PROJ_TAN,        ///< Tangent projection
-    PS_PROJ_SIN,        ///< Sine projection
-    PS_PROJ_AIT,        ///< Aitoff projection
-    PS_PROJ_PAR,        ///< Par projection
-    PS_PROJ_GLS,        ///< GLS projection
-    PS_PROJ_CAR,        ///< CAR projection
-    PS_PROJ_MER,        ///< MER projection
-    PS_PROJ_NTYPE      ///< Number of types; must be last.
+    PS_PROJ_TAN,                // /< Tangent projection
+    PS_PROJ_SIN,                // /< Sine projection
+    PS_PROJ_AIT,                // /< Aitoff projection
+    PS_PROJ_PAR,                // /< Par projection
+    PS_PROJ_GLS,                // /< GLS projection
+    PS_PROJ_CAR,                // /< CAR projection
+    PS_PROJ_MER,                // /< MER projection
+    PS_PROJ_NTYPE               // /< Number of types; must be last.
 } psProjectionType;
 
@@ -137,9 +138,9 @@
 typedef struct
 {
-    double R;     ///< Coordinates of projection center
-    double D;     ///< Coordinates of projection center
-    double Xs;    ///< plate-scale in X direction
-    double Ys;    ///< plate-scale in Y direction
-    psProjectionType type;  ///< Projection type
+    double R;                   // /< Coordinates of projection center
+    double D;                   // /< Coordinates of projection center
+    double Xs;                  // /< plate-scale in X direction
+    double Ys;                  // /< plate-scale in Y direction
+    psProjectionType type;      // /< Projection type
 }
 psProjection;
@@ -151,6 +152,6 @@
  */
 typedef enum {
-    PS_SPHERICAL,                      ///< offset corresponds to an angular offset
-    PS_LINEAR                          ///< offset corresponds to a linear offset
+    PS_SPHERICAL,               // /< offset corresponds to an angular offset
+    PS_LINEAR                   // /< offset corresponds to a linear offset
 } psSphereOffsetMode;
 
@@ -161,8 +162,8 @@
  */
 typedef enum {
-    PS_ARCSEC,                         ///< Arcseconds
-    PS_ARCMIN,                         ///< Arcminutes
-    PS_DEGREE,                         ///< Degrees
-    PS_RADIAN                          ///< Radians
+    PS_ARCSEC,                  // /< Arcseconds
+    PS_ARCMIN,                  // /< Arcminutes
+    PS_DEGREE,                  // /< Degrees
+    PS_RADIAN                   // /< Radians
 } psSphereOffsetUnit;
 
@@ -170,75 +171,55 @@
  *
  */
-psPlane *psPlaneTransformApply(
-    psPlane *out,                      ///< a psPlane to recycle.  If NULL, a new one is generated.
-    const psPlaneTransform *transform, ///< the transform to apply
-    const psPlane *coords              ///< the coordinate to apply the transform above.
-);
+psPlane *psPlaneTransformApply(psPlane * out,   // /< a psPlane to recycle.  If NULL, a new one is generated.
+                               const psPlaneTransform * transform,      // /< the transform to apply
+                               const psPlane * coords   // /< the coordinate to apply the transform above.
+                              );
 
 /** Applies the psPlaneDistort transform to a specified coordinate
  *
  */
-psPlane *psPlaneDistortApply(
-    psPlane *out,                      ///< a psPlane to recycle.  If NULL, a new one is generated.
-    const psPlaneDistort *transform,   ///< the transform to apply
-    const psPlane *coords,             ///< the coordinate to apply the transform above.
-    float term3,                       ///< third term -- maybe magnitude
-    float term4                        ///< forth term -- maybe color
-);
+psPlane *psPlaneDistortApply(psPlane * out,     // /< a psPlane to recycle.  If NULL, a new one is generated.
+                             const psPlaneDistort * transform,  // /< the transform to apply
+                             const psPlane * coords,    // /< the coordinate to apply the transform above.
+                             float term3,       // /< third term -- maybe magnitude
+                             float term4        // /< forth term -- maybe color
+                            );
 
 /** Allocator for psSphereTransform
  *
  */
-psSphereTransform *psSphereTransformAlloc(
-    double NPlat,                      ///< north pole latitude
-    double Xo,                         ///< First PT of Ares lon
-    double xo                          ///< First PT of Ares equiv lon
-);
-
+psSphereTransform *psSphereTransformAlloc(double NPlat, // /< north pole latitude
+        double Xo,    // /< First PT of Ares lon
+        double xo     // /< First PT of Ares equiv lon
+                                         );
 
 /** Applies the psSphereTransform transform for a specified coordinate
  *
  */
-psSphere *psSphereTransformApply(
-    psSphere *out,                     ///< a psSphere to recycle.  If NULL, a new one is generated.
-    const psSphereTransform *transform,///< the transform to apply
-    const psSphere *coord              ///< the coordinate to apply the transform above.x
-);
-
-psSphereTransform *psSphereTransformICRStoEcliptic(
-    psTime time
-);
-
-psSphereTransform *psSphereTransformEcliptictoICRS(
-    psTime time
-);
-
-psSphereTransform *psSphereTransformICRStoGalatic( void );
-
-psSphereTransform *psSphereTransformGalatictoICRS( void );
-
-psPlane *psProject(
-    const psSphere *coord,
-    const psProjection *projection
-);
-
-psSphere *psDeproject(
-    const psPlane *coord,
-    const psProjection *projection
-);
-
-psSphere *psSphereGetOffset(
-    const psSphere *restrict position1,
-    const psSphere *restrict position2,
-    psSphereOffsetMode mode,
-    psSphereOffsetUnit unit
-);
-
-psSphere *psSphereSetOffset(
-    const psSphere *restrict position,
-    const psSphere *restrict offset,
-    psSphereOffsetMode mode,
-    psSphereOffsetUnit unit
-);
+psSphere *psSphereTransformApply(psSphere * out,        // /< a psSphere to recycle.  If NULL, a new one is
+                                 // generated.
+                                 const psSphereTransform * transform,   // /< the transform to apply
+                                 const psSphere * coord // /< the coordinate to apply the transform above.x
+                                );
+
+psSphereTransform *psSphereTransformICRStoEcliptic(psTime time);
+
+psSphereTransform *psSphereTransformEcliptictoICRS(psTime time);
+
+psSphereTransform *psSphereTransformICRStoGalatic(void);
+
+psSphereTransform *psSphereTransformGalatictoICRS(void);
+
+psPlane *psProject(const psSphere * coord, const psProjection * projection);
+
+psSphere *psDeproject(const psPlane * coord, const psProjection * projection);
+
+psSphere *psSphereGetOffset(const psSphere * restrict position1,
+                            const psSphere * restrict position2,
+                            psSphereOffsetMode mode, psSphereOffsetUnit unit);
+
+psSphere *psSphereSetOffset(const psSphere * restrict position,
+                            const psSphere * restrict offset,
+                            psSphereOffsetMode mode, psSphereOffsetUnit unit);
 
 /// @}
Index: /trunk/psLib/src/astro/psTime.c
===================================================================
--- /trunk/psLib/src/astro/psTime.c	(revision 1406)
+++ /trunk/psLib/src/astro/psTime.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psTime.c
  *
@@ -12,13 +13,14 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
 
-
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 
@@ -32,5 +34,7 @@
 
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
@@ -73,6 +77,9 @@
 }                                                                                                            \
 
+
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -80,5 +87,7 @@
 
 /*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
+
 /*****************************************************************************/
 
@@ -86,5 +95,7 @@
 
 /*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
+
 /*****************************************************************************/
 
@@ -119,79 +130,57 @@
 
 // Table for Julian date of leapsecond update and current total number of leapseconds at that date
-static double leapseconds[NUM_LEAPSECOND_UPDATES][2] =
-    {
-        {
-            2441317.5, 10.0
-        },
-        {
-            2441499.5, 11.0
-        },
-        {
-            2441683.5, 12.0
-        },
-        {
-            2442048.5, 13.0
-        },
-        {
-            2442413.5, 14.0
-        },
-        {
-            2442778.5, 15.0
-        },
-        {
-            2443144.5, 16.0
-        },
-        {
-            2443509.5, 17.0
-        },
-        {
-            2443874.5, 18.0
-        },
-        {
-            2444239.5, 19.0
-        },
-        {
-            2444786.5, 20.0
-        },
-        {
-            2445151.5, 21.0
-        },
-        {
-            2445516.5, 22.0
-        },
-        {
-            2446247.5, 23.0
-        },
-        {
-            2447161.5, 24.0
-        },
-        {
-            2447892.5, 25.0
-        },
-        {
-            2448257.5, 26.0
-        },
-        {
-            2448804.5, 27.0
-        },
-        {
-            2449169.5, 28.0
-        },
-        {
-            2449534.5, 29.0
-        },
-        {
-            2450083.5, 30.0
-        },
-        {
-            2450630.5, 31.0
-        },
-        {
-            2451179.5, 32.0
-        }
-    };
-
-/*****************************************************************************/
+static double leapseconds[NUM_LEAPSECOND_UPDATES][2] = {
+            {
+                2441317.5, 10.0},
+            {
+                2441499.5, 11.0},
+            {
+                2441683.5, 12.0},
+            {
+                2442048.5, 13.0},
+            {
+                2442413.5, 14.0},
+            {
+                2442778.5, 15.0},
+            {
+                2443144.5, 16.0},
+            {
+                2443509.5, 17.0},
+            {
+                2443874.5, 18.0},
+            {
+                2444239.5, 19.0},
+            {
+                2444786.5, 20.0},
+            {
+                2445151.5, 21.0},
+            {
+                2445516.5, 22.0},
+            {
+                2446247.5, 23.0},
+            {
+                2447161.5, 24.0},
+            {
+                2447892.5, 25.0},
+            {
+                2448257.5, 26.0},
+            {
+                2448804.5, 27.0},
+            {
+                2449169.5, 28.0},
+            {
+                2449534.5, 29.0},
+            {
+                2450083.5, 30.0},
+            {
+                2450630.5, 31.0},
+            {
+                2451179.5, 32.0}
+        };
+
+/*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
+
 /*****************************************************************************/
 
@@ -199,5 +188,7 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
+
 /*****************************************************************************/
 
@@ -210,9 +201,8 @@
     time.tv_usec = 0;
 
-    if(gettimeofday(&now,(struct timezone *) 0) == -1) {
+    if (gettimeofday(&now, (struct timezone *)0) == -1) {
         psError(__func__, " : Line %d - Failed to get time", __LINE__);
         return time;
     }
-
     // Convert timeval time to psTime
     time.tv_sec = now.tv_sec;
@@ -220,10 +210,10 @@
 
     // Add most current leapseconds value to UTC time to get TAI time
-    time.tv_sec += leapseconds[NUM_LEAPSECOND_UPDATES-1][1];
+    time.tv_sec += leapseconds[NUM_LEAPSECOND_UPDATES - 1][1];
 
     return time;
 }
 
-char* psTimeToISO(psTime time)
+char *psTimeToISO(psTime time)
 {
     int ms = 0;
@@ -232,5 +222,5 @@
     struct tm *tmTime = NULL;
 
-    CHECK_NEGATIVE_TIME_STRUCT(time,NULL);
+    CHECK_NEGATIVE_TIME_STRUCT(time, NULL);
 
     tempString = psAlloc(MAX_TIME_STRING_LENGTH);
@@ -238,13 +228,13 @@
 
     // Converts psTime to YYYY/MM/DD,HH:MM:SS.SSS in string form
-    ms = time.tv_usec/1000;
+    ms = time.tv_usec / 1000;
 
     // tmTime variable is statically allocated, no need to free
     tmTime = gmtime(&time.tv_sec);
-    if(!strftime(tempString, MAX_TIME_STRING_LENGTH, "%Y/%m/%d,%H:%M:%S", tmTime)) {
+    if (!strftime(tempString, MAX_TIME_STRING_LENGTH, "%Y/%m/%d,%H:%M:%S", tmTime)) {
         psError(__func__, " : Line %d - Failed strftime conversion", __LINE__);
     }
 
-    if(snprintf(timeString,MAX_TIME_STRING_LENGTH,"%s.%3.3d", tempString, ms) < 0) {
+    if (snprintf(timeString, MAX_TIME_STRING_LENGTH, "%s.%3.3d", tempString, ms) < 0) {
         psError(__func__, " : Line %d - Failed snprintf conversion", __LINE__);
     }
@@ -262,11 +252,11 @@
     psTime outTime;
 
-    CHECK_NEGATIVE_TIME_STRUCT(time,outTime);
+    CHECK_NEGATIVE_TIME_STRUCT(time, outTime);
 
     // Find leapseconds to subtract from psTime to get UTC time
     jd = psTimeToJD(time);
     jdTable = leapseconds[0];
-    for(i=0; i<NUM_LEAPSECOND_UPDATES; i++, jdTable+=2) {
-        if(jd > *jdTable) {
+    for (i = 0; i < NUM_LEAPSECOND_UPDATES; i++, jdTable += 2) {
+        if (jd > *jdTable) {
             ls = *(jdTable + 1);
         }
@@ -276,5 +266,5 @@
     outTime.tv_usec = time.tv_usec;
 
-    CHECK_NEGATIVE_TIME_STRUCT(outTime,outTime);
+    CHECK_NEGATIVE_TIME_STRUCT(outTime, outTime);
 
     return outTime;
@@ -285,8 +275,8 @@
     double mjd = 0.0;
 
-    CHECK_NEGATIVE_TIME_STRUCT(time,mjd);
+    CHECK_NEGATIVE_TIME_STRUCT(time, mjd);
 
     // Modified Julian date conversion courtesy of Eugene Magnier
-    mjd = time.tv_sec/SEC_PER_DAY + time.tv_usec/USEC_PER_DAY + 40587.0;
+    mjd = time.tv_sec / SEC_PER_DAY + time.tv_usec / USEC_PER_DAY + 40587.0;
 
     return mjd;
@@ -297,8 +287,8 @@
     double jd = 0.0;
 
-    CHECK_NEGATIVE_TIME_STRUCT(time,jd);
+    CHECK_NEGATIVE_TIME_STRUCT(time, jd);
 
     // Julian date conversion courtesy of Eugene Magnier
-    jd = time.tv_sec/SEC_PER_DAY + time.tv_usec/USEC_PER_DAY + 2440587.5;
+    jd = time.tv_sec / SEC_PER_DAY + time.tv_usec / USEC_PER_DAY + 2440587.5;
 
     return jd;
@@ -309,5 +299,5 @@
     struct timeval timevalTime;
 
-    CHECK_NEGATIVE_TIME_STRUCT(time,timevalTime);
+    CHECK_NEGATIVE_TIME_STRUCT(time, timevalTime);
     timevalTime.tv_sec = time.tv_sec;
     timevalTime.tv_usec = time.tv_usec;
@@ -316,9 +306,9 @@
 }
 
-struct tm* psTimeToTM(psTime time)
+struct tm *psTimeToTM(psTime time)
 {
     struct tm *tmTime = NULL;
 
-    CHECK_NEGATIVE_TIME_STRUCT(time,tmTime);
+    CHECK_NEGATIVE_TIME_STRUCT(time, tmTime);
     tmTime = gmtime(&time.tv_sec);
 
@@ -343,42 +333,42 @@
     // Convert YYYY/MM/DD,HH:MM:SS.SSS in string form to tm time
     year = atoi(strtok(tempString, "/"));
-    if(year < 1900) {
-        psError(__func__,"Years less than 1900 not allowed. Value: %d", year);
+    if (year < 1900) {
+        psError(__func__, "Years less than 1900 not allowed. Value: %d", year);
         return outTime;
     }
 
     month = atoi(strtok(NULL, "/"));
-    if(month<1 || month>12) {
-        psError(__func__,"Month must have a value from 1 to 12. Value: %d", month);
+    if (month < 1 || month > 12) {
+        psError(__func__, "Month must have a value from 1 to 12. Value: %d", month);
         return outTime;
     }
 
     day = atoi(strtok(NULL, ","));
-    if(day<1 || day>31) {
-        psError(__func__,"Day must have a value from 1 to 31. Value: %d", day);
+    if (day < 1 || day > 31) {
+        psError(__func__, "Day must have a value from 1 to 31. Value: %d", day);
         return outTime;
     }
 
     hour = atoi(strtok(NULL, ":"));
-    if(hour<0 || hour>23) {
-        psError(__func__,"Hour must have a value from 0 to 23. Value: %d", hour);
+    if (hour < 0 || hour > 23) {
+        psError(__func__, "Hour must have a value from 0 to 23. Value: %d", hour);
         return outTime;
     }
 
     minute = atoi(strtok(NULL, ":"));
-    if(minute<0 || minute>59) {
-        psError(__func__,"Minute must have a value from 0 to 59. Value: %d", minute);
+    if (minute < 0 || minute > 59) {
+        psError(__func__, "Minute must have a value from 0 to 59. Value: %d", minute);
         return outTime;
     }
 
     second = atoi(strtok(NULL, "."));
-    if(second<0 || second>59) {
-        psError(__func__,"Second must have a value from 0 to 59. Value: %d", second);
+    if (second < 0 || second > 59) {
+        psError(__func__, "Second must have a value from 0 to 59. Value: %d", second);
         return outTime;
     }
 
     millisecond = atoi(strtok(NULL, "X"));
-    if(millisecond<0 || millisecond>1000) {
-        psError(__func__,"Millisecond must have a value from 0 to 999. Value: %d", millisecond);
+    if (millisecond < 0 || millisecond > 1000) {
+        psError(__func__, "Millisecond must have a value from 0 to 999. Value: %d", millisecond);
         return outTime;
     }
@@ -394,5 +384,5 @@
     // Convert tm time to psTime
     outTime = psTMToTime(&tmTime);
-    outTime.tv_usec = millisecond*1000;
+    outTime.tv_usec = millisecond * 1000;
 
     return outTime;
@@ -403,10 +393,10 @@
     psTime outTime;
 
-    CHECK_NEGATIVE_TIME_STRUCT(time,outTime);
+    CHECK_NEGATIVE_TIME_STRUCT(time, outTime);
 
     // Convert UTC time to psTime/TAI
-    outTime.tv_sec = time.tv_sec + leapseconds[NUM_LEAPSECOND_UPDATES-1][1];
+    outTime.tv_sec = time.tv_sec + leapseconds[NUM_LEAPSECOND_UPDATES - 1][1];
     outTime.tv_usec = time.tv_usec;
-    CHECK_NEGATIVE_TIME_STRUCT(outTime,outTime);
+    CHECK_NEGATIVE_TIME_STRUCT(outTime, outTime);
 
     return outTime;
@@ -419,5 +409,5 @@
     double seconds = 0.0;
 
-    CHECK_NEGATIVE_TIME(time,outTime);
+    CHECK_NEGATIVE_TIME(time, outTime);
 
     // Modified Julian date conversion courtesy of Eugene Magnier
@@ -425,9 +415,9 @@
 
     // Convert to psTime/TAI
-    seconds = days*SEC_PER_DAY;
-    outTime.tv_usec = (seconds -(long)seconds)*1000000.0;
+    seconds = days * SEC_PER_DAY;
+    outTime.tv_usec = (seconds - (long)seconds) * 1000000.0;
     outTime.tv_sec = seconds;
 
-    CHECK_NEGATIVE_TIME_STRUCT(outTime,outTime);
+    CHECK_NEGATIVE_TIME_STRUCT(outTime, outTime);
 
     return outTime;
@@ -440,5 +430,5 @@
     psTime outTime;
 
-    CHECK_NEGATIVE_TIME(time,outTime);
+    CHECK_NEGATIVE_TIME(time, outTime);
 
     // Julian date conversion courtesy of Eugene Magnier
@@ -446,106 +436,96 @@
 
     // Convert to psTime/TAI
-    seconds = days*SEC_PER_DAY;
+    seconds = days * SEC_PER_DAY;
     outTime.tv_sec = seconds;
-    outTime.tv_usec = (seconds -(long)seconds)*1000000.0;
-
-    CHECK_NEGATIVE_TIME_STRUCT(outTime,outTime);
-
-    return outTime;
-}
-
-psTime psTimevalToTime(struct timeval *time)
-{
-    psTime outTime;
-    if(time == NULL)
-    {
-        psError(__func__,"Null value for timeval arg not allowed");
-        return outTime;
-    } else
-        if(time->tv_sec < 0)
-        {
-            psError(__func__,"Negative seconds are not allowed: %ld", time->tv_sec);
-            return outTime;
-        } else
-            if(time->tv_usec<0)
-            {
-                psError(__func__,"Negative microseconds are not allowed: %ld", time->tv_usec);
-                return outTime;
-            }
-
+    outTime.tv_usec = (seconds - (long)seconds) * 1000000.0;
+
+    CHECK_NEGATIVE_TIME_STRUCT(outTime, outTime);
+
+    return outTime;
+}
+
+psTime psTimevalToTime(struct timeval * time)
+{
+    psTime outTime;
+
+    if (time == NULL)
+    {
+        psError(__func__, "Null value for timeval arg not allowed");
+        return outTime;
+    } else if (time->tv_sec < 0)
+    {
+        psError(__func__, "Negative seconds are not allowed: %ld", time->tv_sec);
+        return outTime;
+    } else if (time->tv_usec < 0)
+    {
+        psError(__func__, "Negative microseconds are not allowed: %ld", time->tv_usec);
+        return outTime;
+    }
     // Convert to psTime/TAI
     outTime.tv_sec = time->tv_sec;
     outTime.tv_usec = time->tv_usec;
 
-    CHECK_NEGATIVE_TIME_STRUCT(outTime,outTime);
-
-    return outTime;
-}
-
-
-psTime psTMToTime(struct tm *time)
+    CHECK_NEGATIVE_TIME_STRUCT(outTime, outTime);
+
+    return outTime;
+}
+
+psTime psTMToTime(struct tm * time)
 {
     int i;
     int n;
     int y;
-    int mon [] =
-        {
-            31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
-        };
+    int mon[] = {
+                    31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
+                };
     long epoch;
     psTime outTime;
 
-    i= 0;
+    i = 0;
     n = 0;
     y = 0;
     epoch = 0;
 
-    if(time == NULL)
-    {
-        psError(__func__,"Null value for tm arg not allowed");
-        return outTime;
-    } else
-        if(time->tm_year < 70)
-        {
-            psError(__func__,"Input times earlier than 1970 not allowed. Value: %d", time->tm_year+1900);
-            return outTime;
-        } else
-            if(time->tm_mon<0 || time->tm_mon>11)
-            {
-                psError(__func__,"Month must have a value from 0 to 11. Value: %d", time->tm_mon);
-                return outTime;
-            } else
-                if(time->tm_mday<1 || time->tm_mday>31)
-                {
-                    psError(__func__,"Day must have a value from 1 to 31. Value: %d", time->tm_mday);
-                    return outTime;
-                } else
-                    if(time->tm_hour<0 || time->tm_hour>23)
-                    {
-                        psError(__func__,"Hour must have a value from 0 to 23. Value: %d", time->tm_hour);
-                        return outTime;
-                    } else
-                        if(time->tm_min<0 || time->tm_min>59)
-                        {
-                            psError(__func__,"Minute must have a value from 0 to 59. Value: %d", time->tm_min);
-                            return outTime;
-                        } else
-                            if(time->tm_sec<0 || time->tm_sec>59)
-                            {
-                                psError(__func__,"Second must have a value from 0 to 59. Value: %d", time->tm_sec);
-                                return outTime;
-                            }
+    if (time == NULL)
+    {
+        psError(__func__, "Null value for tm arg not allowed");
+        return outTime;
+    } else if (time->tm_year < 70)
+    {
+        psError(__func__, "Input times earlier than 1970 not allowed. Value: %d", time->tm_year + 1900);
+        return outTime;
+    } else if (time->tm_mon < 0 || time->tm_mon > 11)
+    {
+        psError(__func__, "Month must have a value from 0 to 11. Value: %d", time->tm_mon);
+        return outTime;
+    } else if (time->tm_mday < 1 || time->tm_mday > 31)
+    {
+        psError(__func__, "Day must have a value from 1 to 31. Value: %d", time->tm_mday);
+        return outTime;
+    } else if (time->tm_hour < 0 || time->tm_hour > 23)
+    {
+        psError(__func__, "Hour must have a value from 0 to 23. Value: %d", time->tm_hour);
+        return outTime;
+    } else if (time->tm_min < 0 || time->tm_min > 59)
+    {
+        psError(__func__, "Minute must have a value from 0 to 59. Value: %d", time->tm_min);
+        return outTime;
+    } else if (time->tm_sec < 0 || time->tm_sec > 59)
+    {
+        psError(__func__, "Second must have a value from 0 to 59. Value: %d", time->tm_sec);
+        return outTime;
+    }
 
     n = time->tm_year + 1900 - 1;
-    epoch = (time->tm_year - 70) * SEC_PER_YEAR + ((n/4 - n/100 + n/400) -
-            (1969/4 - 1969/100 + 1969/400)) * SEC_PER_DAY;
+    epoch = (time->tm_year - 70) * SEC_PER_YEAR + ((n / 4 - n / 100 + n / 400) -
+            (1969 / 4 - 1969 / 100 + 1969 / 400)) * SEC_PER_DAY;
 
     y = time->tm_year + 1900;
 
     // Adjust for leap years
-    for(i = 0; i<time->tm_mon; i++)
-    {
-        epoch += mon [i] * SEC_PER_DAY;
-        if(i == 1 && y % 4 == 0 && (y % 100 != 0 || y % 400 == 0)) {
+    for (i = 0; i < time->tm_mon; i++)
+    {
+        epoch += mon[i] * SEC_PER_DAY;
+        if (i == 1 && y % 4 == 0 && (y % 100 != 0 || y % 400 == 0)) {
             epoch += SEC_PER_DAY;
         }
@@ -554,5 +534,5 @@
     // Add everything
     epoch += (time->tm_mday - 1) * SEC_PER_DAY;
-    epoch += time->tm_hour *SEC_PER_HOUR + time->tm_min * SEC_PER_MINUTE + time->tm_sec;
+    epoch += time->tm_hour * SEC_PER_HOUR + time->tm_min * SEC_PER_MINUTE + time->tm_sec;
 
     // Create psTime
@@ -560,6 +540,6 @@
     outTime.tv_sec = epoch;
 
-    CHECK_NEGATIVE_TIME_STRUCT(outTime,outTime);
-
-    return outTime;
-}
+    CHECK_NEGATIVE_TIME_STRUCT(outTime, outTime);
+
+    return outTime;
+}
Index: /trunk/psLib/src/astro/psTime.h
===================================================================
--- /trunk/psLib/src/astro/psTime.h	(revision 1406)
+++ /trunk/psLib/src/astro/psTime.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psTime.h
  *
@@ -12,6 +13,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -19,11 +20,11 @@
 
 #ifndef PSTIME_H
-#define PSTIME_H
-
-#include <time.h>
-#include <sys/types.h>
-#include <sys/time.h>
-
-#include "psType.h"
+#    define PSTIME_H
+
+#    include <time.h>
+#    include <sys/types.h>
+#    include <sys/time.h>
+
+#    include "psType.h"
 
 /// @addtogroup Time
@@ -31,5 +32,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -42,11 +45,15 @@
 typedef struct
 {
-    time_t        tv_sec;    /**< Seconds since epoch, Jan 1, 1970. */
-    suseconds_t   tv_usec;   /**< Microseconds since last second. */
+
+    time_t tv_sec;           /**< Seconds since epoch, Jan 1, 1970. */
+
+    suseconds_t tv_usec;     /**< Microseconds since last second. */
 }
 psTime;
 
 /*****************************************************************************/
+
 /* FUNCTION PROTOTYPES                                                       */
+
 /*****************************************************************************/
 
@@ -57,7 +64,8 @@
  *  @return  psTime: Struct with current time.
  */
-psTime psTimeGetTime(
-    void   /** No argument. */
-);
+
+psTime psTimeGetTime(void
+                     /** No argument. */
+                    );
 
 /** Convert psTime to ISO time in TAI units.
@@ -68,7 +76,8 @@
  *  @return  char*: Pointer null terminated array of chars in ISO time.
  */
-char* psTimeToISO(
-    psTime time     /** Input time to be converted. */
-);
+
+char *psTimeToISO(psTime time
+                  /** Input time to be converted. */
+                 );
 
 /** Convert psTime to UTC time.
@@ -80,7 +89,8 @@
  *  @return  psTime: UTC time psTime format.
  */
-psTime psTimeToUTC(
-    psTime time    /** Input time to be converted. */
-);
+
+psTime psTimeToUTC(psTime time
+                   /** Input time to be converted. */
+                  );
 
 /** Convert psTime to modified Julian date time.
@@ -91,7 +101,8 @@
  *  @return  double: Modified Julian Days (MJD) time.
  */
-double psTimeToMJD(
-    psTime time    /** Input time to be converted. */
-);
+
+double psTimeToMJD(psTime time
+                   /** Input time to be converted. */
+                  );
 
 /** Convert psTime to Julian date time.
@@ -102,7 +113,8 @@
  *  @return  double: Julian Date (JD) time.
  */
-double psTimeToJD(
-    psTime time    /** Input time to be converted. */
-);
+
+double psTimeToJD(psTime time
+                  /** Input time to be converted. */
+                 );
 
 /** Convert psTime to timeval time.
@@ -113,7 +125,8 @@
  *  @return  timeval: timeval struct time.
  */
-struct timeval psTimeToTimeval(
-                psTime time    /** Input time to be converted. */
-            );
+
+struct timeval psTimeToTimeval(psTime time
+                                           /** Input time to be converted. */
+                                          );
 
 /** Convert psTime to tm time.
@@ -124,7 +137,8 @@
  *  @return  tm: tm struct time.
  */
-struct tm* psTimeToTM(
-                psTime time    /** Input time to be converted. */
-            );
+
+struct tm *psTimeToTM(psTime time
+                                  /** Input time to be converted. */
+                                 );
 
 /** Convert ISO to psTime.
@@ -135,7 +149,8 @@
  *  @return  psTime: time
  */
-psTime psISOToTime(
-    char *time  /** Input time to be converted. */
-);
+
+psTime psISOToTime(char *time
+                   /** Input time to be converted. */
+                  );
 
 /** Convert UTC to psTime.
@@ -146,7 +161,8 @@
  *  @return  psTime: time in TAI units.
  */
-psTime psUTCToTime(
-    psTime time /** Input time to be converted. */
-);
+
+psTime psUTCToTime(psTime time
+                   /** Input time to be converted. */
+                  );
 
 /** Convert MJD to psTime.
@@ -157,7 +173,8 @@
  *  @return  psTime: time.
  */
-psTime psMJDToTime(
-    double time /** Input time to be converted. */
-);
+
+psTime psMJDToTime(double time
+                   /** Input time to be converted. */
+                  );
 
 /** Convert JD to psTime.
@@ -168,7 +185,8 @@
  *  @return  psTime: time.
  */
-psTime psJDToTime(
-    double time /** Input time to be converted. */
-);
+
+psTime psJDToTime(double time
+                  /** Input time to be converted. */
+                 );
 
 /** Convert timeval to psTime.
@@ -179,7 +197,8 @@
  *  @return  psTime: time.
  */
-psTime psTimevalToTime(
-    struct timeval *time    /** Input time to be converted. */
-);
+
+psTime psTimevalToTime(struct timeval *time
+                       /** Input time to be converted. */
+                      );
 
 /** Convert tm time to psTime.
@@ -190,7 +209,9 @@
  *  @return  psTime: time.
  */
-psTime psTMToTime(
-    struct tm *time /** Input time to be converted. */
-);
+
+psTime psTMToTime(struct tm *time
+                  /** Input time to be converted. */
+                 );
+
 /// @}
 
Index: /trunk/psLib/src/astronomy/psAstrometry.c
===================================================================
--- /trunk/psLib/src/astronomy/psAstrometry.c	(revision 1406)
+++ /trunk/psLib/src/astronomy/psAstrometry.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psAstrometry.c
 *
@@ -8,6 +9,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 22:34:05 $
+*  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -20,27 +21,27 @@
 #include "psMemory.h"
 
-static void grommitFree( psGrommit *grommit );
-static int checkValidChipCoords( double x, double y, psChip *tmpChip );
-static int checkValidImageCoords( double x, double y, psImage *tmpImage );
-
-psExposure* psExposureAlloc( double ra, double dec, double hourAngle,
-                             double zenith, double azimuth, double localTime, float date,
-                             float rotAngle, float temperature, float pressure, float humidity,
-                             float exposureTime )
-{
-    psExposure * exp = psAlloc( sizeof( psExposure ) );
-
-    *( double* ) & exp->ra = ra;
-    *( double* ) & exp->dec = dec;
-    *( double* ) & exp->hourAngle = hourAngle;
-    *( double* ) & exp->zenith = zenith;
-    *( double* ) & exp->azimuth = azimuth;
-    *( double* ) & exp->localTime = localTime;
-    *( float* ) & exp->date = date;
-    *( float* ) & exp->rotAngle = rotAngle;
-    *( float* ) & exp->temperature = temperature;
-    *( float* ) & exp->pressure = pressure;
-    *( float* ) & exp->humidity = humidity;
-    *( float* ) & exp->exposureTime = exposureTime;
+static void grommitFree(psGrommit * grommit);
+static int checkValidChipCoords(double x, double y, psChip * tmpChip);
+static int checkValidImageCoords(double x, double y, psImage * tmpImage);
+
+psExposure *psExposureAlloc(double ra, double dec, double hourAngle,
+                            double zenith, double azimuth, double localTime, float date,
+                            float rotAngle, float temperature, float pressure, float humidity,
+                            float exposureTime)
+{
+    psExposure *exp = psAlloc(sizeof(psExposure));
+
+    *(double *)&exp->ra = ra;
+    *(double *)&exp->dec = dec;
+    *(double *)&exp->hourAngle = hourAngle;
+    *(double *)&exp->zenith = zenith;
+    *(double *)&exp->azimuth = azimuth;
+    *(double *)&exp->localTime = localTime;
+    *(float *)&exp->date = date;
+    *(float *)&exp->rotAngle = rotAngle;
+    *(float *)&exp->temperature = temperature;
+    *(float *)&exp->pressure = pressure;
+    *(float *)&exp->humidity = humidity;
+    *(float *)&exp->exposureTime = exposureTime;
 
     return exp;
@@ -48,103 +49,82 @@
 }
 
-psGrommit* psGrommitAlloc( const psExposure *exp )
-{
-    double * slaGrommit = ( double * ) psAlloc( 14 * sizeof( double ) );
-    psGrommit *grommit = ( psGrommit * ) psAlloc( sizeof( psGrommit ) );
+psGrommit *psGrommitAlloc(const psExposure * exp)
+{
+    double *slaGrommit = (double *)psAlloc(14 * sizeof(double));
+    psGrommit *grommit = (psGrommit *) psAlloc(sizeof(psGrommit));
+
     /*
-        extern void sla_aoppa(double date,
-                              double dut,
-                              double elongm,
-                              double phim,
-                              double him,
-                              double xp,
-                              double yp,
-                              double tdk,
-                              double pmb,
-                              double rh,
-                              double wl,
-                              double tlr,
-                              double *AOPRMS);
-     
-        sla_aoppa(date, deltaUT, meanLongitude, meanLatitude, height, xp, yp,
-                  exp->temperature, exp->pressure, exp->humidity, wavelength,
-                  tlr);
-    */
-    *( double* ) & grommit->latitude = exp->dec;              // XXX Is this correct?
-    *( double* ) & grommit->sinLat = sin( grommit->latitude );
-    *( double* ) & grommit->cosLat = cos( grommit->latitude );
-    *( double* ) & grommit->abberationMag = 0.0;
-    *( double* ) & grommit->height = 0.0;
-    *( double* ) & grommit->temperature = exp->temperature;
-    *( double* ) & grommit->pressure = exp->pressure;
-    *( double* ) & grommit->humidity = exp->humidity;
-    *( double* ) & grommit->wavelength = 0.0;
-    *( double* ) & grommit->lapseRate = 0.0;
-    *( double* ) & grommit->refractA = 0.0;
-    *( double* ) & grommit->refractB = 0.0;
-    *( double* ) & grommit->longitudeOffset = exp->ra;             // XXX Is this correct?
-    *( double* ) & grommit->siderealTime = 0.0;
-
-    psFree( slaGrommit );
-    return ( grommit );
-}
-
-void p_psGrommitFree( psGrommit *grommit )
-{
-    psFree( grommit );
-}
-
-psCell *psCellinFPA( psCell *out,
-                     const psPlane *coord,
-                     const psFPA *FPA )
-{
-    psChip * tmpChip = NULL;
+     * extern void sla_aoppa(double date, double dut, double elongm, double phim, double him, double xp,
+     * double yp, double tdk, double pmb, double rh, double wl, double tlr, double *AOPRMS);
+     * 
+     * sla_aoppa(date, deltaUT, meanLongitude, meanLatitude, height, xp, yp, exp->temperature, exp->pressure, 
+     * exp->humidity, wavelength, tlr); */
+    *(double *)&grommit->latitude = exp->dec;   // XXX Is this correct?
+    *(double *)&grommit->sinLat = sin(grommit->latitude);
+    *(double *)&grommit->cosLat = cos(grommit->latitude);
+    *(double *)&grommit->abberationMag = 0.0;
+    *(double *)&grommit->height = 0.0;
+    *(double *)&grommit->temperature = exp->temperature;
+    *(double *)&grommit->pressure = exp->pressure;
+    *(double *)&grommit->humidity = exp->humidity;
+    *(double *)&grommit->wavelength = 0.0;
+    *(double *)&grommit->lapseRate = 0.0;
+    *(double *)&grommit->refractA = 0.0;
+    *(double *)&grommit->refractB = 0.0;
+    *(double *)&grommit->longitudeOffset = exp->ra;     // XXX Is this correct?
+    *(double *)&grommit->siderealTime = 0.0;
+
+    psFree(slaGrommit);
+    return (grommit);
+}
+
+void p_psGrommitFree(psGrommit * grommit)
+{
+    psFree(grommit);
+}
+
+psCell *psCellinFPA(psCell * out, const psPlane * coord, const psFPA * FPA)
+{
+    psChip *tmpChip = NULL;
     psCell *tmpCell = NULL;
 
-    tmpChip = psChipinFPA( tmpChip, coord, FPA );
-    tmpCell = psCellinChip( tmpCell, coord, tmpChip );
-    return ( tmpCell );
-}
-
-
-int checkValidChipCoords( double x, double y, psChip *tmpChip )
-{
-    return ( 0 );
-}
-
-psChip *psChipinFPA( psChip *out,
-                     const psPlane *coord,
-                     const psFPA *FPA )
-{
-    psArray * chips = FPA->chips;
+    tmpChip = psChipinFPA(tmpChip, coord, FPA);
+    tmpCell = psCellinChip(tmpCell, coord, tmpChip);
+    return (tmpCell);
+}
+
+int checkValidChipCoords(double x, double y, psChip * tmpChip)
+{
+    return (0);
+}
+
+psChip *psChipinFPA(psChip * out, const psPlane * coord, const psFPA * FPA)
+{
+    psArray *chips = FPA->chips;
     int nChips = chips->n;
-    psPlane* tmpCoord = NULL;
-
-    for ( int i = 0; i < nChips; i++ ) {
-        psChip* tmpChip = chips->data[ i ];
-        tmpCoord = psPlaneTransformApply( tmpCoord, tmpChip->fromFPA, coord );
-        if ( checkValidChipCoords( tmpCoord->x, tmpCoord->y,
-                                   tmpChip ) ) {
-            psFree( tmpCoord );
+    psPlane *tmpCoord = NULL;
+
+    for (int i = 0; i < nChips; i++) {
+        psChip *tmpChip = chips->data[i];
+
+        tmpCoord = psPlaneTransformApply(tmpCoord, tmpChip->fromFPA, coord);
+        if (checkValidChipCoords(tmpCoord->x, tmpCoord->y, tmpChip)) {
+            psFree(tmpCoord);
             // XXX: George, you didn't use the out parameter!
-            return ( tmpChip );
+            return (tmpChip);
         }
-        psFree( tmpCoord );
-    }
-    psFree( tmpCoord );
-    return ( NULL );
-}
-
-int checkValidImageCoords( double x, double y, psImage *tmpImage )
-{
-    if ( ( x < 0.0 ) ||
-            ( x > ( double ) tmpImage->numCols ) ||
-            ( y < 0.0 ) ||
-            ( y > ( double ) tmpImage->numRows ) ) {
-        return ( 0 );
-    }
-    return ( 1 );
-}
-
+        psFree(tmpCoord);
+    }
+    psFree(tmpCoord);
+    return (NULL);
+}
+
+int checkValidImageCoords(double x, double y, psImage * tmpImage)
+{
+    if ((x < 0.0) || (x > (double)tmpImage->numCols) || (y < 0.0) || (y > (double)tmpImage->numRows)) {
+        return (0);
+    }
+    return (1);
+}
 
 /*****************************************************************************
@@ -160,12 +140,10 @@
 XXX: must deallocate memory.
  *****************************************************************************/
-psCell *psCellinChip( psCell *out,
-                      const psPlane *coord,
-                      const psChip *chip )
-{
-    psPlane * tmpCoord = NULL;
-    psArray* cells;
-
-    if ( chip == NULL ) {
+psCell *psCellinChip(psCell * out, const psPlane * coord, const psChip * chip)
+{
+    psPlane *tmpCoord = NULL;
+    psArray *cells;
+
+    if (chip == NULL) {
         return NULL;
     }
@@ -173,120 +151,101 @@
     cells = chip->cells;
 
-    if ( cells == NULL ) {
+    if (cells == NULL) {
         return NULL;
     }
 
-    for ( int i = 0; i < cells->n; i++ ) {
-        psCell* tmpCell = ( psCell* ) cells->data[ i ];
-        psArray* readouts = tmpCell->readouts;
-        if ( readouts != NULL ) {
-            for ( int j = 0; j < readouts->n; j++ ) {
-                psReadout* tmpReadout = readouts->data[ j ];
-                tmpCoord = psPlaneTransformApply( tmpCoord, tmpCell->fromChip, coord );
-                if ( checkValidImageCoords( tmpCoord->x, tmpCoord->y,
-                                            tmpReadout->image ) ) {
-                    return ( tmpCell );
+    for (int i = 0; i < cells->n; i++) {
+        psCell *tmpCell = (psCell *) cells->data[i];
+        psArray *readouts = tmpCell->readouts;
+
+        if (readouts != NULL) {
+            for (int j = 0; j < readouts->n; j++) {
+                psReadout *tmpReadout = readouts->data[j];
+
+                tmpCoord = psPlaneTransformApply(tmpCoord, tmpCell->fromChip, coord);
+                if (checkValidImageCoords(tmpCoord->x, tmpCoord->y, tmpReadout->image)) {
+                    return (tmpCell);
                 }
             }
         }
     }
-    return ( NULL );
-}
-
-psPlane *psCoordCelltoChip( psPlane *out,
-                            const psPlane *in,
-                            const psCell *cell )
-{
-    return ( psPlaneTransformApply( out, cell->toChip, in ) );
-}
-
-psPlane *psCoordChipToFPA( psPlane *out,
-                           const psPlane *in,
-                           const psChip *chip )
-{
-    return ( psPlaneTransformApply( out, chip->toFPA, in ) );
-}
-
-psPlane *psCoordFPAtoTP( psPlane *out,
-                         const psPlane *in,
-                         const psFPA *fpa )
+    return (NULL);
+}
+
+psPlane *psCoordCelltoChip(psPlane * out, const psPlane * in, const psCell * cell)
+{
+    return (psPlaneTransformApply(out, cell->toChip, in));
+}
+
+psPlane *psCoordChipToFPA(psPlane * out, const psPlane * in, const psChip * chip)
+{
+    return (psPlaneTransformApply(out, chip->toFPA, in));
+}
+
+psPlane *psCoordFPAtoTP(psPlane * out, const psPlane * in, const psFPA * fpa)
 {
     // XXX: This code doesn't work; fpa->toTangentPlane is of the wrong type.
     // return(psPlaneTransformApply(out, fpa->toTangentPlane, in));
-    return ( NULL );
+    return (NULL);
 }
 
 // XXX: must wrap SLA_QAPQK here.
-psSphere *psCoordTPtoSky( psSphere *out,
-                          const psPlane *in,
-                          const psGrommit *grommit )
+psSphere *psCoordTPtoSky(psSphere * out, const psPlane * in, const psGrommit * grommit)
 {
     /*
-        double RAP;
-        double DAP;
-     
-        extern void sla_OAPQK(TYPE, OB1, OB2, AOPRMS, RAP, DAP);
-        sla_OAPQK(TYPE, OB1, OB2, *grommit, &RAP, &DAP);
-    */
-
-    return ( out );
-}
-
-
-psPlane *psCoordCellToFPA( psPlane *out,
-                           const psPlane *in,
-                           const psCell *cell )
-{
-    return ( psPlaneTransformApply( out, cell->toFPA, in ) );
-}
-
+     * double RAP; double DAP;
+     * 
+     * extern void sla_OAPQK(TYPE, OB1, OB2, AOPRMS, RAP, DAP); sla_OAPQK(TYPE, OB1, OB2, *grommit, &RAP,
+     * &DAP); */
+
+    return (out);
+}
+
+psPlane *psCoordCellToFPA(psPlane * out, const psPlane * in, const psCell * cell)
+{
+    return (psPlaneTransformApply(out, cell->toFPA, in));
+}
 
 // XXX: This implementation requires a new psGrommit be created for each
 // transformation, as well as a few psPlane structs.  Can this be implemented
 // better?
-psSphere *psCoordCelltoSky( psSphere *out,
-                            const psPlane *in,
-                            const psCell *cell )
-{
-    psPlane * tmp1 = NULL;
+psSphere *psCoordCelltoSky(psSphere * out, const psPlane * in, const psCell * cell)
+{
+    psPlane *tmp1 = NULL;
     psPlane *tmp2 = NULL;
-    psFPA *parFPA = ( cell->parent ) ->parent;
+    psFPA *parFPA = (cell->parent)->parent;
     psGrommit *tmpGrommit = NULL;
 
-    tmp1 = psPlaneTransformApply( tmp1, cell->toFPA, in );
-    tmp2 = psPlaneTransformApply( tmp2, parFPA->toTangentPlane, tmp1 );
-    tmpGrommit = psGrommitAlloc( parFPA->exposure );
-    tmp3 = psCoordTPtoSky( out, tmp2, psGrommit );
-
-    psFree( tmp1 );
-    psFree( tmp2 );
-    psFree( tmpGrommit );
-
-    return ( psCoordTPtoSky( out, tmp2, psGrommit ) );
-
-}
-
-psSphere *psCoordCelltoSkyQuick( psSphere *out,
-                                 const psPlane *in,
-                                 const psCell *cell )
-{
-    psPlane * tmp1 = NULL;
-
-    tmp1 = psPlaneTransformApply( tmp1, cell->toSky, in );
-
-    //XXX: Do something to convert the linear coords in tmp1 to spherical
+    tmp1 = psPlaneTransformApply(tmp1, cell->toFPA, in);
+    tmp2 = psPlaneTransformApply(tmp2, parFPA->toTangentPlane, tmp1);
+    tmpGrommit = psGrommitAlloc(parFPA->exposure);
+    tmp3 = psCoordTPtoSky(out, tmp2, psGrommit);
+
+    psFree(tmp1);
+    psFree(tmp2);
+    psFree(tmpGrommit);
+
+    return (psCoordTPtoSky(out, tmp2, psGrommit));
+
+}
+
+psSphere *psCoordCelltoSkyQuick(psSphere * out, const psPlane * in, const psCell * cell)
+{
+    psPlane *tmp1 = NULL;
+
+    tmp1 = psPlaneTransformApply(tmp1, cell->toSky, in);
+
+    // XXX: Do something to convert the linear coords in tmp1 to spherical
     // coords in out.
 
-    psFree( tmp1 );
-
-    return ( out );
+    psFree(tmp1);
+
+    return (out);
 }
 
 // XXX: must wrap SLA_AOPQK here.
-psPlane *psCoordSkytoTP( psPlane *out,
-                         const psSphere *in,
-                         const psGrommit *grommit )
-{
-    extern void sla_AOPQK ( RAP, DAP, AOPRMS, AOB, ZOB, HOB, DOB, ROB );
+psPlane *psCoordSkytoTP(psPlane * out, const psSphere * in, const psGrommit * grommit)
+{
+    extern void sla_AOPQK(RAP, DAP, AOPRMS, AOB, ZOB, HOB, DOB, ROB);
     double AOB;
     double ZOB;
@@ -295,60 +254,45 @@
     double ROB;
 
-    if ( out == NULL ) {
-        out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
-    }
-
-    sla_AOPQK( psSphere->r, psSphere->d, *grommit, &AOB, &ZOB, &HOB, &DOB, &ROB );
+    if (out == NULL) {
+        out = (psPlane *) psAlloc(sizeof(psPlane));
+    }
+
+    sla_AOPQK(psSphere->r, psSphere->d, *grommit, &AOB, &ZOB, &HOB, &DOB, &ROB);
     out->x = XXX;
     out->y = XXX;
-    return ( out );
-}
-
-psPlane *psCoordTPtoFPA( psPlane *out,
-                         const psPlane *in,
-                         const psFPA *fpa )
-{
-    return ( psPlaneTransformApply( out, fpa->fromTangentPlane, in ) );
-}
-
-psPlane *psCoordFPAtoChip( psPlane *out,
-                           const psPlane *in,
-                           const psChip *chip )
-{
-    return ( psPlaneTransformApply( out, chip->fromFPA, in ) );
-}
-
-
-psPlane *psCoordChiptoCell( psPlane *out,
-                            const psPlane *in,
-                            const psCell *cell )
-{
-    return ( psPlaneTransformApply( out, cell->fromChip, in ) );
-}
-
-psPlane *psCoordSkytoCell( psPlane *out,
-                           const psSphere *in,
-                           const psCell *cell )
-{
-    out = psCoordSkytoTP( out, in, tmpGrommit );
-    out = psCoordTPtoFPA( out, out, whichFPA );
-    out = psCoordFPAtoChip( out, out, whichChip );
-    out = psCoordChiptoCell( out, out, whichCell );
-
-    return ( out );
-}
-
-psPlane *psCoordSkytoCellQuick( psPlane *out,
-                                const psSphere *in,
-                                const psCell *cell )
-{
-    if ( out == NULL ) {
-        out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
-    }
-
-    return ( out );
-}
-
-
-
-
+    return (out);
+}
+
+psPlane *psCoordTPtoFPA(psPlane * out, const psPlane * in, const psFPA * fpa)
+{
+    return (psPlaneTransformApply(out, fpa->fromTangentPlane, in));
+}
+
+psPlane *psCoordFPAtoChip(psPlane * out, const psPlane * in, const psChip * chip)
+{
+    return (psPlaneTransformApply(out, chip->fromFPA, in));
+}
+
+psPlane *psCoordChiptoCell(psPlane * out, const psPlane * in, const psCell * cell)
+{
+    return (psPlaneTransformApply(out, cell->fromChip, in));
+}
+
+psPlane *psCoordSkytoCell(psPlane * out, const psSphere * in, const psCell * cell)
+{
+    out = psCoordSkytoTP(out, in, tmpGrommit);
+    out = psCoordTPtoFPA(out, out, whichFPA);
+    out = psCoordFPAtoChip(out, out, whichChip);
+    out = psCoordChiptoCell(out, out, whichCell);
+
+    return (out);
+}
+
+psPlane *psCoordSkytoCellQuick(psPlane * out, const psSphere * in, const psCell * cell)
+{
+    if (out == NULL) {
+        out = (psPlane *) psAlloc(sizeof(psPlane));
+    }
+
+    return (out);
+}
Index: /trunk/psLib/src/astronomy/psAstrometry.h
===================================================================
--- /trunk/psLib/src/astronomy/psAstrometry.h	(revision 1406)
+++ /trunk/psLib/src/astronomy/psAstrometry.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psAstrometry.h
 *
@@ -8,21 +9,21 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 22:34:05 $
+*  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
 */
 
-# ifndef PS_ASTROMETRY_H
-# define PS_ASTROMETRY_H
-
-#include "psType.h"
-#include "psImage.h"
-#include "psArray.h"
-#include "psList.h"
-#include "psFunctions.h"
-#include "psMetadata.h"
-#include "psCoord.h"
-#include "psPhotometry.h"
+#ifndef PS_ASTROMETRY_H
+#    define PS_ASTROMETRY_H
+
+#    include "psType.h"
+#    include "psImage.h"
+#    include "psArray.h"
+#    include "psList.h"
+#    include "psFunctions.h"
+#    include "psMetadata.h"
+#    include "psCoord.h"
+#    include "psPhotometry.h"
 
 struct psCell;
@@ -44,18 +45,18 @@
 typedef struct
 {
-    const double latitude;             ///< geodetic latitude (radians)
-    const double sinLat;               ///< sine of geodetic latitude
-    const double cosLat;               ///< cosine of geodetic latitude
-    const double abberationMag;        ///< magnitude of diurnal aberration vector
-    const double height;               ///< height (HM)
-    const double temperature;          ///< ambient temperature (TDK)
-    const double pressure;             ///< pressure (PMB)
-    const double humidity;             ///< relative humidity (RH)
-    const double wavelength;           ///< wavelength (WL)
-    const double lapseRate;            ///< lapse rate (TLR)
-    const double refractA;             ///< refraction constant A (radians)
-    const double refractB;             ///< refraction constant B (radians)
-    const double longitudeOffset;      ///< longitude + ... (radians)
-    const double siderealTime;         ///< local apparent sidereal time (radians)
+    const double latitude;      // /< geodetic latitude (radians)
+    const double sinLat;        // /< sine of geodetic latitude
+    const double cosLat;        // /< cosine of geodetic latitude
+    const double abberationMag; // /< magnitude of diurnal aberration vector
+    const double height;        // /< height (HM)
+    const double temperature;   // /< ambient temperature (TDK)
+    const double pressure;      // /< pressure (PMB)
+    const double humidity;      // /< relative humidity (RH)
+    const double wavelength;    // /< wavelength (WL)
+    const double lapseRate;     // /< lapse rate (TLR)
+    const double refractA;      // /< refraction constant A (radians)
+    const double refractB;      // /< refraction constant B (radians)
+    const double longitudeOffset;       // /< longitude + ... (radians)
+    const double siderealTime;  // /< local apparent sidereal time (radians)
 }
 psGrommit;
@@ -72,12 +73,12 @@
 typedef struct
 {
-    int nX;                            ///< Number of elements in x direction
-    int nY;                            ///< Number of elements in y direction
-    double x0;                         ///< X Position of 0,0 corner on focal plane
-    double y0;                         ///< Y Position of 0,0 corner on focal plane
-    double xScale;                     ///< Scale of the grid in x direction
-    double yScale;                     ///< Scale of the grid in x direction
-    double **x;                        ///< The grid of offsets in x
-    double **y;                        ///< The grid of offsets in y
+    int nX;                     // /< Number of elements in x direction
+    int nY;                     // /< Number of elements in y direction
+    double x0;                  // /< X Position of 0,0 corner on focal plane
+    double y0;                  // /< Y Position of 0,0 corner on focal plane
+    double xScale;              // /< Scale of the grid in x direction
+    double yScale;              // /< Scale of the grid in x direction
+    double **x;                 // /< The grid of offsets in x
+    double **y;                 // /< The grid of offsets in y
 }
 psFixedPattern;
@@ -94,12 +95,12 @@
 typedef struct
 {
-    const unsigned int colBins;        ///< Amount of binning in x-dimension
-    const unsigned int rowBins;        ///< Amount of binning in y-dimension
-    const int col0;                    ///< Offset from the left of chip.
-    const int row0;                    ///< Offset from the bottom of chip.
-
-    psImage* image;                    ///< imaging area of Readout
-    psList* objects;                   ///< objects derived from Readout
-    psMetadata* metadata;              ///< readout-level metadata
+    const unsigned int colBins; // /< Amount of binning in x-dimension
+    const unsigned int rowBins; // /< Amount of binning in y-dimension
+    const int col0;             // /< Offset from the left of chip.
+    const int row0;             // /< Offset from the bottom of chip.
+
+    psImage *image;             // /< imaging area of Readout
+    psList *objects;            // /< objects derived from Readout
+    psMetadata *metadata;       // /< readout-level metadata
 }
 psReadout;
@@ -116,13 +117,13 @@
 typedef struct psCell
 {
-    psArray* readouts;                 ///< readouts from the cell
-    psMetadata* metadata;              ///< cell-level metadata
-
-    psPlaneTransform* toChip;          ///< transformations from cell to chip coordinates
-    psPlaneTransform* fromChip;        ///< transformations from chip to cell coordinates
-    psPlaneTransform* toFPA;           ///< transformations from cell to FPA coordinates
-    psPlaneTransform* toSky;           ///< transformations from cell to sky coordinates
-
-    struct psChip* parent;             ///< chip in which contains this cell
+    psArray *readouts;          // /< readouts from the cell
+    psMetadata *metadata;       // /< cell-level metadata
+
+    psPlaneTransform *toChip;   // /< transformations from cell to chip coordinates
+    psPlaneTransform *fromChip; // /< transformations from chip to cell coordinates
+    psPlaneTransform *toFPA;    // /< transformations from cell to FPA coordinates
+    psPlaneTransform *toSky;    // /< transformations from cell to sky coordinates
+
+    struct psChip *parent;      // /< chip in which contains this cell
 }
 psCell;
@@ -138,11 +139,11 @@
 typedef struct psChip
 {
-    psArray* cells;                    ///< cells in the chip
-    psMetadata* metadata;              ///< chip-level metadata
-
-    psPlaneTransform* toFPA;           ///< transformation from chip to FPA coordinates
-    psPlaneTransform* fromFPA;         ///< transformation from FPA to chip coordinates
-
-    struct psFPA* parent;              ///< FPA which contains this chip
+    psArray *cells;             // /< cells in the chip
+    psMetadata *metadata;       // /< chip-level metadata
+
+    psPlaneTransform *toFPA;    // /< transformation from chip to FPA coordinates
+    psPlaneTransform *fromFPA;  // /< transformation from FPA to chip coordinates
+
+    struct psFPA *parent;       // /< FPA which contains this chip
 }
 psChip;
@@ -163,19 +164,19 @@
 typedef struct psFPA
 {
-    psArray* chips;                    ///< chips in the focal plane array
-    psMetadata* metadata;              ///< focal-plane's metadata
-
-    psPlaneDistort* fromTangentPlane;  ///< transformation from tangent plane to focal plane
-    psPlaneDistort* toTangentPlane;    ///< transformation from focal plane to tangent plane
-    psFixedPattern* pattern;           ///< fixed pattern residual offsets
-
-    const struct psExposure* exposure; ///< information about this exposure
-
-    psPhotSystem* colorPlus;           ///< Color reference
-    psPhotSystem* colorMinus;          ///< Color reference
-
-    float rmsX;                        ///< RMS for x transformation fits
-    float rmsY;                        ///< RMS for y transformation fits
-    float chi2;                        ///< chi^2 of astrometric solution
+    psArray *chips;             // /< chips in the focal plane array
+    psMetadata *metadata;       // /< focal-plane's metadata
+
+    psPlaneDistort *fromTangentPlane;   // /< transformation from tangent plane to focal plane
+    psPlaneDistort *toTangentPlane;     // /< transformation from focal plane to tangent plane
+    psFixedPattern *pattern;    // /< fixed pattern residual offsets
+
+    const struct psExposure *exposure;  // /< information about this exposure
+
+    psPhotSystem *colorPlus;    // /< Color reference
+    psPhotSystem *colorMinus;   // /< Color reference
+
+    float rmsX;                 // /< RMS for x transformation fits
+    float rmsY;                 // /< RMS for y transformation fits
+    float chi2;                 // /< chi^2 of astrometric solution
 }
 psFPA;
@@ -190,41 +191,40 @@
 typedef struct psExposure
 {
-    const double ra;                  ///< Telescope boresight, right ascention
-    const double dec;                 ///< Telescope boresight, declination
-    const double hourAngle;           ///< Hour angle
-    const double zenith;              ///< Zenith distance
-    const double azimuth;             ///< Azimuth
-    const double localTime;           ///< Local Sidereal Time
-    const float date;                 ///< Modified Jullian Date of observation
-    const float rotAngle;             ///< Rotator position angle
-    const float temperature;          ///< Air temperature, for estimating refraction
-    const float pressure;             ///< Air pressure, for calculating refraction
-    const float humidity;             ///< Relative humidity, for refraction
-    const float exposureTime;         ///< Exposure time
+    const double ra;            // /< Telescope boresight, right ascention
+    const double dec;           // /< Telescope boresight, declination
+    const double hourAngle;     // /< Hour angle
+    const double zenith;        // /< Zenith distance
+    const double azimuth;       // /< Azimuth
+    const double localTime;     // /< Local Sidereal Time
+    const float date;           // /< Modified Jullian Date of observation
+    const float rotAngle;       // /< Rotator position angle
+    const float temperature;    // /< Air temperature, for estimating refraction
+    const float pressure;       // /< Air pressure, for calculating refraction
+    const float humidity;       // /< Relative humidity, for refraction
+    const float exposureTime;   // /< Exposure time
 
     /* Derived quantities */
-    const float positionAngle;        ///< Position angle
-    const float parallacticAngle;     ///< Parallactic angle
-    const float airmass;              ///< Airmass, calculated from zenith distance
-    const float parallacticFactor;    ///< Parallactic factor
-    const char *cameraName;           ///< name of camera which provided exposure
-    const char *telescopeName;        ///< name of telescope which provided exposure
+    const float positionAngle;  // /< Position angle
+    const float parallacticAngle;       // /< Parallactic angle
+    const float airmass;        // /< Airmass, calculated from zenith distance
+    const float parallacticFactor;      // /< Parallactic factor
+    const char *cameraName;     // /< name of camera which provided exposure
+    const char *telescopeName;  // /< name of telescope which provided exposure
 }
 psExposure;
 
-psExposure* psExposureAlloc(
-    double ra,                           ///< Telescope boresight, right ascention
-    double dec,                          ///< Telescope boresight, declination
-    double hourAngle,                    ///< Hour angle
-    double zenith,                       ///< Zenith distance
-    double azimuth,                      ///< Azimuth
-    double localTime,                    ///< Local Sidereal Time
-    float date,                          ///< MJD
-    float rotAngle,                      ///< Rotator position angle
-    float temperature,                   ///< Temperature
-    float pressure,                      ///< Pressure
-    float humidity,                      ///< Relative humidity
-    float exposureTime                 ///< Exposure time
-);
+psExposure *psExposureAlloc(double ra,  // /< Telescope boresight, right ascention
+                            double dec, // /< Telescope boresight, declination
+                            double hourAngle,   // /< Hour angle
+                            double zenith,      // /< Zenith distance
+                            double azimuth,     // /< Azimuth
+                            double localTime,   // /< Local Sidereal Time
+                            float date, // /< MJD
+                            float rotAngle,     // /< Rotator position angle
+                            float temperature,  // /< Temperature
+                            float pressure,     // /< Pressure
+                            float humidity,     // /< Relative humidity
+                            float exposureTime  // /< Exposure time
+                           );
 
 /** Allocates a Wallace's Grommit structure.
@@ -235,103 +235,38 @@
  *  @return psGrommit*     New grommit structure.
  */
-psGrommit* psGrommitAlloc(
-    const psExposure* exp              ///< the cooresponding exposure structure.
-);
-
-psCell *psCellinFPA(
-    psCell *out,
-    const psPlane *coord,
-    const psFPA *FPA
-);
-
-psChip *psChipinFPA(
-    psChip *out,
-    const psPlane *coord,
-    const psFPA *FPA
-);
-
-psCell *psCellinChip(
-    psCell *out,
-    const psPlane *coord,
-    const psChip *chip
-);
-
-psPlane *psCoordCelltoChip(
-    psPlane *out,
-    const psPlane *in,
-    const psCell *cell
-);
-
-psPlane *psCoordChipToFPA(
-    psPlane *out,
-    const psPlane *in,
-    const psChip *chip
-);
-
-psPlane *psCoordFPAtoTP(
-    psPlane *out,
-    const psPlane *in,
-    const psFPA *fpa
-);
-
-psSphere *psCoordTPtoSky(
-    psSphere *out,
-    const psPlane *in,
-    const psGrommit *grommit
-);
-
-psPlane *psCoordCellToFPA(
-    psPlane *out,
-    const psPlane *in,
-    const psCell *cell
-);
-
-psSphere *psCoordCelltoSky(
-    psSphere *out,
-    const psPlane *in,
-    const psCell *cell
-);
-
-psSphere *psCoordCelltoSkyQuick(
-    psSphere *out,
-    const psPlane *in,
-    const psCell *cell
-);
-
-psPlane *psCoordSkytoTP(
-    psPlane *out,
-    const psSphere *in,
-    const psGrommit *grommit
-);
-
-psPlane *psCoordTPtoFPA(
-    psPlane *out,
-    const psPlane *in,
-    const psFPA *fpa
-);
-
-psPlane *psCoordFPAtoChip(
-    psPlane *out,
-    const psPlane *in,
-    const psChip *chip
-);
-
-psPlane *psCoordChiptoCell(
-    psPlane *out,
-    const psPlane *in,
-    const psCell *cell
-);
-
-psPlane *psCoordSkytoCell(
-    psPlane *out,
-    const psSphere *in,
-    const psCell *cell
-);
-
-psPlane *psCoordSkytoCellQuick(
-    psPlane *out,
-    const psSphere *in,
-    const psCell *cell
-);
+psGrommit *psGrommitAlloc(const psExposure * exp        // /< the cooresponding exposure structure.
+                         );
+
+psCell *psCellinFPA(psCell * out, const psPlane * coord, const psFPA * FPA);
+
+psChip *psChipinFPA(psChip * out, const psPlane * coord, const psFPA * FPA);
+
+psCell *psCellinChip(psCell * out, const psPlane * coord, const psChip * chip);
+
+psPlane *psCoordCelltoChip(psPlane * out, const psPlane * in, const psCell * cell);
+
+psPlane *psCoordChipToFPA(psPlane * out, const psPlane * in, const psChip * chip);
+
+psPlane *psCoordFPAtoTP(psPlane * out, const psPlane * in, const psFPA * fpa);
+
+psSphere *psCoordTPtoSky(psSphere * out, const psPlane * in, const psGrommit * grommit);
+
+psPlane *psCoordCellToFPA(psPlane * out, const psPlane * in, const psCell * cell);
+
+psSphere *psCoordCelltoSky(psSphere * out, const psPlane * in, const psCell * cell);
+
+psSphere *psCoordCelltoSkyQuick(psSphere * out, const psPlane * in, const psCell * cell);
+
+psPlane *psCoordSkytoTP(psPlane * out, const psSphere * in, const psGrommit * grommit);
+
+psPlane *psCoordTPtoFPA(psPlane * out, const psPlane * in, const psFPA * fpa);
+
+psPlane *psCoordFPAtoChip(psPlane * out, const psPlane * in, const psChip * chip);
+
+psPlane *psCoordChiptoCell(psPlane * out, const psPlane * in, const psCell * cell);
+
+psPlane *psCoordSkytoCell(psPlane * out, const psSphere * in, const psCell * cell);
+
+psPlane *psCoordSkytoCellQuick(psPlane * out, const psSphere * in, const psCell * cell);
 
 #endif
Index: /trunk/psLib/src/astronomy/psCoord.c
===================================================================
--- /trunk/psLib/src/astronomy/psCoord.c	(revision 1406)
+++ /trunk/psLib/src/astronomy/psCoord.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psCoord.c
 *
@@ -10,6 +11,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 22:34:05 $
+*  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -27,68 +28,56 @@
 #include <float.h>
 
-static float cot( float x );
-static float arg( float x, float y );
+static float cot(float x);
+static float arg(float x, float y);
 
 // This is the only function in this file which I understand.
-psPlane *psPlaneTransformApply( psPlane *out,
-                                const psPlaneTransform *transform,
-                                const psPlane *coords )
-{
-    if ( out == NULL ) {
-        out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
-    }
-    out->x = transform->x->coeff[ 0 ][ 0 ] +
-             ( transform->x->coeff[ 1 ][ 0 ] * coords->x ) +
-             ( transform->x->coeff[ 0 ][ 1 ] * coords->y );
-
-    out->y = transform->y->coeff[ 0 ][ 0 ] +
-             ( transform->y->coeff[ 1 ][ 0 ] * coords->x ) +
-             ( transform->y->coeff[ 0 ][ 1 ] * coords->y );
-
-    return ( out );
-}
-
+psPlane *psPlaneTransformApply(psPlane * out, const psPlaneTransform * transform, const psPlane * coords)
+{
+    if (out == NULL) {
+        out = (psPlane *) psAlloc(sizeof(psPlane));
+    }
+    out->x = transform->x->coeff[0][0] +
+             (transform->x->coeff[1][0] * coords->x) + (transform->x->coeff[0][1] * coords->y);
+
+    out->y = transform->y->coeff[0][0] +
+             (transform->y->coeff[1][0] * coords->x) + (transform->y->coeff[0][1] * coords->y);
+
+    return (out);
+}
 
 // This transformation takes into account parameters beyond an objects
 // spatial coordinates: term3 and term4.
-psPlane *psPlaneDistortApply( psPlane *out,
-                              const psPlaneDistort *transform,
-                              const psPlane *coords,
-                              float term3,
-                              float term4 )
-{
-    if ( out == NULL ) {
-        out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
-    }
-
-    out->x = transform->x->coeff[ 0 ][ 0 ][ 0 ][ 0 ] +
-             ( transform->x->coeff[ 1 ][ 0 ][ 0 ][ 0 ] * coords->x ) +
-             ( transform->x->coeff[ 0 ][ 1 ][ 0 ][ 0 ] * coords->y ) +
-             ( transform->x->coeff[ 0 ][ 0 ][ 1 ][ 0 ] * term3 ) +
-             ( transform->x->coeff[ 0 ][ 0 ][ 0 ][ 1 ] * term4 );
-
-    out->y = transform->y->coeff[ 0 ][ 0 ][ 0 ][ 0 ] +
-             ( transform->y->coeff[ 1 ][ 0 ][ 0 ][ 0 ] * coords->x ) +
-             ( transform->y->coeff[ 0 ][ 1 ][ 0 ][ 0 ] * coords->y ) +
-             ( transform->y->coeff[ 0 ][ 0 ][ 1 ][ 0 ] * term3 ) +
-             ( transform->y->coeff[ 0 ][ 0 ][ 0 ][ 1 ] * term4 );
-
-    return ( out );
-}
-
+psPlane *psPlaneDistortApply(psPlane * out,
+                             const psPlaneDistort * transform,
+                             const psPlane * coords, float term3, float term4)
+{
+    if (out == NULL) {
+        out = (psPlane *) psAlloc(sizeof(psPlane));
+    }
+
+    out->x = transform->x->coeff[0][0][0][0] +
+             (transform->x->coeff[1][0][0][0] * coords->x) +
+             (transform->x->coeff[0][1][0][0] * coords->y) +
+             (transform->x->coeff[0][0][1][0] * term3) + (transform->x->coeff[0][0][0][1] * term4);
+
+    out->y = transform->y->coeff[0][0][0][0] +
+             (transform->y->coeff[1][0][0][0] * coords->x) +
+             (transform->y->coeff[0][1][0][0] * coords->y) +
+             (transform->y->coeff[0][0][1][0] * term3) + (transform->y->coeff[0][0][0][1] * term4);
+
+    return (out);
+}
 
 // This function prototype has been modified since the SDRS.
-psSphereTransform *psSphereTransformAlloc( double NPlat,
-        double Xo,
-        double xo )
-{
-    psSphereTransform * tmp = ( psSphereTransform * ) psAlloc( sizeof( psSphereTransform ) );
-
-    tmp->sinPhi = sin( NPlat );
-    tmp->cosPhi = cos( NPlat );
+psSphereTransform *psSphereTransformAlloc(double NPlat, double Xo, double xo)
+{
+    psSphereTransform *tmp = (psSphereTransform *) psAlloc(sizeof(psSphereTransform));
+
+    tmp->sinPhi = sin(NPlat);
+    tmp->cosPhi = cos(NPlat);
     tmp->Xo = Xo;
     tmp->xo = xo;
 
-    return ( tmp );
+    return (tmp);
 }
 
@@ -100,7 +89,5 @@
 // there are no typo's.
 
-psSphere *psSphereTransformApply( psSphere *out,
-                                  const psSphereTransform *transform,
-                                  const psSphere *coord )
+psSphere *psSphereTransformApply(psSphere * out, const psSphereTransform * transform, const psSphere * coord)
 {
     double sinY = 0.0;
@@ -112,6 +99,6 @@
     double dx = 0.0;
 
-    if ( out == NULL ) {
-        out = ( psSphere * ) psAlloc( sizeof( psSphere ) );
+    if (out == NULL) {
+        out = (psSphere *) psAlloc(sizeof(psSphere));
     }
 
@@ -119,20 +106,19 @@
     y = coord->d;
     dx = x - transform->xo;
-    sinY = cos( y ) * sin( dx ) * transform->sinPhi + sin( y ) * transform->cosPhi;
-    cosY = sqrt( 1.0 - sinY * sinY );
-    sinX = ( cos( y ) * sin( dx ) * transform->cosPhi - sin( y ) * transform->sinPhi ) /
-           cos( y );
-    cosX = cos( y ) * cos( dx ) / cos( y );
-
-    out->r = atan2( sinX, cosX ) + transform->Xo;
-    out->d = atan2( sinY, cosY );
-
-    return ( out );
-}
-
-psSphereTransform *psSphereTransformICRStoEcliptic( psTime time )
-{
-    struct tm * tmTime = psTimeToTM( time );
-    double year = ( double ) ( 1900 + tmTime->tm_year );
+    sinY = cos(y) * sin(dx) * transform->sinPhi + sin(y) * transform->cosPhi;
+    cosY = sqrt(1.0 - sinY * sinY);
+    sinX = (cos(y) * sin(dx) * transform->cosPhi - sin(y) * transform->sinPhi) / cos(y);
+    cosX = cos(y) * cos(dx) / cos(y);
+
+    out->r = atan2(sinX, cosX) + transform->Xo;
+    out->d = atan2(sinY, cosY);
+
+    return (out);
+}
+
+psSphereTransform *psSphereTransformICRStoEcliptic(psTime time)
+{
+    struct tm *tmTime = psTimeToTM(time);
+    double year = (double)(1900 + tmTime->tm_year);
     double T = year / 100.0;
     double phi = -23.452294 + 0.013013 * T + 0.000001639 * T * T - 0.000000503 * T * T * T;
@@ -140,112 +126,99 @@
     double xo = 0.0;
 
-    return ( psSphereTransformAlloc( phi, Xo, xo ) );
-}
-
-psSphereTransform *psSphereTransformEcliptictoICRS( psTime time )
-{
-    struct tm * tmTime = psTimeToTM( time );
-    double year = ( double ) ( 1900 + tmTime->tm_year );
+    return (psSphereTransformAlloc(phi, Xo, xo));
+}
+
+psSphereTransform *psSphereTransformEcliptictoICRS(psTime time)
+{
+    struct tm *tmTime = psTimeToTM(time);
+    double year = (double)(1900 + tmTime->tm_year);
     double T = year / 100.0;
-    double phi = + 23.452294 - 0.013013 * T - 0.000001639 * T * T + 0.000000503 * T * T * T;
+    double phi = +23.452294 - 0.013013 * T - 0.000001639 * T * T + 0.000000503 * T * T * T;
     double Xo = 0.0;
     double xo = 0.0;
 
-    return ( psSphereTransformAlloc( phi, Xo, xo ) );
-}
-
-psSphereTransform *psSphereTransformICRStoGalatic( void )
-{
-    return ( psSphereTransformAlloc( 62.6, 282.25, 33.0 ) );
-}
-
-psSphereTransform *psSphereTransformGalatictoICRS( void )
-{
-    return ( psSphereTransformAlloc( -62.6, 33.0, 282.25 ) );
+    return (psSphereTransformAlloc(phi, Xo, xo));
+}
+
+psSphereTransform *psSphereTransformICRStoGalatic(void)
+{
+    return (psSphereTransformAlloc(62.6, 282.25, 33.0));
+}
+
+psSphereTransform *psSphereTransformGalatictoICRS(void)
+{
+    return (psSphereTransformAlloc(-62.6, 33.0, 282.25));
 }
 
 // XXX: Is this the correct way to calculate this?
-float cot( float x )
-{
-    return ( 1.0 / atan( x ) );
+float cot(float x)
+{
+    return (1.0 / atan(x));
 }
 
 // This is some kind of arc tan function.
-float arg( float x, float y )
-{
-    if ( x > 0 ) {
-        return ( atan( y / x ) );
-    } else
-        if ( ( x == 0 ) && ( y == 0 ) ) {
-            return ( 0.5 * M_PI );
-        } else
-            if ( ( x == 0 ) && ( y == 0 ) ) {
-                return ( -0.5 * M_PI );
-            } else
-                if ( ( x == 0 ) && ( y == 0 ) ) {
-                    return ( M_PI + atan( y / x ) );
-                } else
-                    if ( ( x == 0 ) && ( y == 0 ) ) {
-                        return ( -M_PI + atan( y / x ) );
-                    }
-
-    psAbort( __func__, "Unacceptable range for (arg(%f, %f).\n", x, y );
-    return ( 0.0 );
+float arg(float x, float y)
+{
+    if (x > 0) {
+        return (atan(y / x));
+    } else if ((x == 0) && (y == 0)) {
+        return (0.5 * M_PI);
+    } else if ((x == 0) && (y == 0)) {
+        return (-0.5 * M_PI);
+    } else if ((x == 0) && (y == 0)) {
+        return (M_PI + atan(y / x));
+    } else if ((x == 0) && (y == 0)) {
+        return (-M_PI + atan(y / x));
+    }
+
+    psAbort(__func__, "Unacceptable range for (arg(%f, %f).\n", x, y);
+    return (0.0);
 }
 
 // XXX: Waiting for the definition of the PS_PROJ_PAR projection.
 // XXX: Waiting for the definition of the PS_PROJ_GLS projection.
-psPlane *psProject( const psSphere *coord,
-                    const psProjection *projection )
+psPlane *psProject(const psSphere * coord, const psProjection * projection)
 {
     float R = 0.0;
     float alpha = 0.0;
-    psPlane *tmp = ( psPlane * ) psAlloc( sizeof( psPlane ) );
-
-    if ( projection->type == PS_PROJ_TAN ) {
-        R = cot( coord->r ) * ( 180.0 / M_PI );
-        tmp->x = R * sin( coord->d );
-        tmp->y = R * cos( coord->d );
-
-    } else
-        if ( projection->type == PS_PROJ_SIN ) {
-            R = cos( coord->r ) * ( 180.0 / M_PI );
-            tmp->x = R * sin( coord->d );
-            tmp->y = R * cos( coord->d );
-
-        } else
-            if ( projection->type == PS_PROJ_CAR ) {
-                tmp->x = coord->d;
-                tmp->y = coord->r;
-
-            } else
-                if ( projection->type == PS_PROJ_MER ) {
-                    tmp->x = coord->d;
-                    tmp->y = log( tan( 45.0 + ( 0.5 * coord->r ) ) ) * 180.0 / M_PI;
-
-                } else
-                    if ( projection->type == PS_PROJ_AIT ) {
-                        alpha = 1.0 / ( ( 180.0 / M_PI ) *
-                                        sqrt( 1.0 + ( cos( coord->r ) * cos( 0.5 * coord->d ) * 0.5 ) ) );
-
-                        tmp->x = 2.0 * alpha * cos( coord->r ) * sin( 0.5 * coord->d );
-                        tmp->y = alpha * sin( coord->d );
-
-                    } else
-                        if ( projection->type == PS_PROJ_PAR ) {
-                            psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" );
-
-                        } else
-                            if ( projection->type == PS_PROJ_GLS ) {
-                                psAbort( __func__, "The projection type PS_PROJ_GLS is undefined.\n" );
-                            }
-
-    return ( tmp );
+    psPlane *tmp = (psPlane *) psAlloc(sizeof(psPlane));
+
+    if (projection->type == PS_PROJ_TAN) {
+        R = cot(coord->r) * (180.0 / M_PI);
+        tmp->x = R * sin(coord->d);
+        tmp->y = R * cos(coord->d);
+
+    } else if (projection->type == PS_PROJ_SIN) {
+        R = cos(coord->r) * (180.0 / M_PI);
+        tmp->x = R * sin(coord->d);
+        tmp->y = R * cos(coord->d);
+
+    } else if (projection->type == PS_PROJ_CAR) {
+        tmp->x = coord->d;
+        tmp->y = coord->r;
+
+    } else if (projection->type == PS_PROJ_MER) {
+        tmp->x = coord->d;
+        tmp->y = log(tan(45.0 + (0.5 * coord->r))) * 180.0 / M_PI;
+
+    } else if (projection->type == PS_PROJ_AIT) {
+        alpha = 1.0 / ((180.0 / M_PI) * sqrt(1.0 + (cos(coord->r) * cos(0.5 * coord->d) * 0.5)));
+
+        tmp->x = 2.0 * alpha * cos(coord->r) * sin(0.5 * coord->d);
+        tmp->y = alpha * sin(coord->d);
+
+    } else if (projection->type == PS_PROJ_PAR) {
+        psAbort(__func__, "The projection type PS_PROJ_PAR is undefined.\n");
+
+    } else if (projection->type == PS_PROJ_GLS) {
+        psAbort(__func__, "The projection type PS_PROJ_GLS is undefined.\n");
+    }
+
+    return (tmp);
 }
 
 // XXX: Waiting for the definition of the PS_PROJ_PAR projection.
 // XXX: Waiting for the definition of the PS_PROJ_GLS projection.
-psSphere *psDeproject( const psPlane *coord,
-                       const psProjection *projection )
+psSphere *psDeproject(const psPlane * coord, const psProjection * projection)
 {
     float R = 0.0;
@@ -253,58 +226,50 @@
     float chu1 = 0.0;
     float chu2 = 0.0;
-    psSphere *tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) );
-
-    if ( projection->type == PS_PROJ_TAN ) {
-        R = sqrt( ( coord->x * coord->x ) + ( coord->y * coord->y ) );
-        tmp->d = arg( -coord->y, coord->x );
-        tmp->r = atan( 180.0 / ( R * M_PI ) );
-
-    } else
-        if ( projection->type == PS_PROJ_SIN ) {
-            R = sqrt( ( coord->x * coord->x ) + ( coord->y * coord->y ) );
-            tmp->d = arg( -coord->y, coord->x );
-            tmp->r = acos( ( R * M_PI ) / 180.0 );
-
-        } else
-            if ( projection->type == PS_PROJ_CAR ) {
-                tmp->d = coord->x;
-                tmp->r = coord->y;
-
-            } else
-                if ( projection->type == PS_PROJ_MER ) {
-                    tmp->d = coord->x;
-                    tmp->r = ( 2.0 * atan( exp( ( coord->y * M_PI / 180.0 ) ) ) ) - 180.0;
-
-                } else
-                    if ( projection->type == PS_PROJ_AIT ) {
-                        chu1 = ( coord->x * M_PI ) / 720.0;
-                        chu1 *= chu1;
-                        chu2 = ( coord->y * M_PI ) / 360.0;
-                        chu2 *= chu2;
-                        chu = sqrt( 1.0 - chu1 - chu2 );
-                        tmp->d = 2.0 * arg( ( 2.0 * chu * chu ) - 1.0,
-                                            ( coord->x * chu * M_PI ) / 360.0 );
-                        tmp->r = asin( ( coord->y * chu * M_PI ) / 180.0 );
-
-                    } else
-                        if ( projection->type == PS_PROJ_PAR ) {
-                            psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" );
-
-                        } else
-                            if ( projection->type == PS_PROJ_GLS ) {
-                                psAbort( __func__, "The projection type PS_PROJ_GLG is undefined.\n" );
-                            }
-
-    return ( tmp );
+    psSphere *tmp = (psSphere *) psAlloc(sizeof(psSphere));
+
+    if (projection->type == PS_PROJ_TAN) {
+        R = sqrt((coord->x * coord->x) + (coord->y * coord->y));
+        tmp->d = arg(-coord->y, coord->x);
+        tmp->r = atan(180.0 / (R * M_PI));
+
+    } else if (projection->type == PS_PROJ_SIN) {
+        R = sqrt((coord->x * coord->x) + (coord->y * coord->y));
+        tmp->d = arg(-coord->y, coord->x);
+        tmp->r = acos((R * M_PI) / 180.0);
+
+    } else if (projection->type == PS_PROJ_CAR) {
+        tmp->d = coord->x;
+        tmp->r = coord->y;
+
+    } else if (projection->type == PS_PROJ_MER) {
+        tmp->d = coord->x;
+        tmp->r = (2.0 * atan(exp((coord->y * M_PI / 180.0)))) - 180.0;
+
+    } else if (projection->type == PS_PROJ_AIT) {
+        chu1 = (coord->x * M_PI) / 720.0;
+        chu1 *= chu1;
+        chu2 = (coord->y * M_PI) / 360.0;
+        chu2 *= chu2;
+        chu = sqrt(1.0 - chu1 - chu2);
+        tmp->d = 2.0 * arg((2.0 * chu * chu) - 1.0, (coord->x * chu * M_PI) / 360.0);
+        tmp->r = asin((coord->y * chu * M_PI) / 180.0);
+
+    } else if (projection->type == PS_PROJ_PAR) {
+        psAbort(__func__, "The projection type PS_PROJ_PAR is undefined.\n");
+
+    } else if (projection->type == PS_PROJ_GLS) {
+        psAbort(__func__, "The projection type PS_PROJ_GLG is undefined.\n");
+    }
+
+    return (tmp);
 }
 
 // XXX: Do I need to check for unacceptable transformation parameters?
 // Maybe, if the points are on the North/South Pole, etc?
-psSphere *psSphereGetOffset( const psSphere *restrict position1,
-                             const psSphere *restrict position2,
-                             psSphereOffsetMode mode,
-                             psSphereOffsetUnit unit )
-{
-    //    psPlane *lin;
+psSphere *psSphereGetOffset(const psSphere * restrict position1,
+                            const psSphere * restrict position2,
+                            psSphereOffsetMode mode, psSphereOffsetUnit unit)
+{
+    // psPlane *lin;
     psProjection proj;
     psSphere *tmp;
@@ -312,5 +277,5 @@
     double tmpD = 0.0;
 
-    if ( mode == PS_LINEAR ) {
+    if (mode == PS_LINEAR) {
         // XXX: I have no idea how to construct this.  Maybe project both
         // sperical positions onto the plane, set the origin at one of the
@@ -318,5 +283,5 @@
 
         // XXX: Do I need to somehow scale this projection?
-        // project position1?  Will it project to (0.0, 0.0)?
+        // project position1? Will it project to (0.0, 0.0)?
         proj.R = position1->r;
         proj.D = position1->d;
@@ -325,51 +290,45 @@
         proj.type = PS_PROJ_TAN;
 
-        //        lin = psProject(position2, proj);
-        //        tmp = psDeproject(lin, proj);
+        // lin = psProject(position2, proj);
+        // tmp = psDeproject(lin, proj);
 
         // XXX: Do we need to convert units in tmp?
-        return ( tmp );
-    } else
-        if ( mode == PS_SPHERICAL ) {
-            tmpR = position2->r - position1->r;
-            tmpD = position2->d - position1->d;
-
-            if ( unit == PS_ARCSEC ) {
-                tmpR = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI;
-                tmpD = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI;
-            } else
-                if ( unit == PS_ARCMIN ) {
-                    tmpR = ( tmpR * 180.0 * 60.0 ) / M_PI;
-                    tmpD = ( tmpR * 180.0 * 60.0 ) / M_PI;
-                } else
-                    if ( unit == PS_DEGREE ) {
-                        tmpR = ( tmpR * 180.0 ) / M_PI;
-                        tmpD = ( tmpR * 180.0 ) / M_PI;
-                    } else
-                    if ( unit == PS_RADIAN ) {}
-                        else {
-                            psAbort( __func__, "Unknown offset unit: 0x%x\n", unit );
-                        }
-
-            tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) );
-            tmp->r = tmpR;
-            tmp->d = tmpD;
-            tmp->rErr = 0.0;
-            tmp->dErr = 0.0;
-            // XXX: Do we need to wrap these to an acceptable range?
-            return ( tmp );
+        return (tmp);
+    } else if (mode == PS_SPHERICAL) {
+        tmpR = position2->r - position1->r;
+        tmpD = position2->d - position1->d;
+
+        if (unit == PS_ARCSEC) {
+            tmpR = (tmpR * 180.0 * 60.0 * 60.0) / M_PI;
+            tmpD = (tmpR * 180.0 * 60.0 * 60.0) / M_PI;
+        } else if (unit == PS_ARCMIN) {
+            tmpR = (tmpR * 180.0 * 60.0) / M_PI;
+            tmpD = (tmpR * 180.0 * 60.0) / M_PI;
+        } else if (unit == PS_DEGREE) {
+            tmpR = (tmpR * 180.0) / M_PI;
+            tmpD = (tmpR * 180.0) / M_PI;
+        } else if (unit == PS_RADIAN) {}
+        else {
+            psAbort(__func__, "Unknown offset unit: 0x%x\n", unit);
         }
-    psAbort( __func__, "Unrecognized offset mode\n" );
-    return ( NULL );
-}
-
+
+        tmp = (psSphere *) psAlloc(sizeof(psSphere));
+        tmp->r = tmpR;
+        tmp->d = tmpD;
+        tmp->rErr = 0.0;
+        tmp->dErr = 0.0;
+        // XXX: Do we need to wrap these to an acceptable range?
+        return (tmp);
+    }
+    psAbort(__func__, "Unrecognized offset mode\n");
+    return (NULL);
+}
 
 // XXX: Do I need to check for unacceptable transformation parameters?
 // Maybe, if the points are on the North/South Pole, etc?
 // XXX: I copied the algorithm from the ADD exactly.
-psSphere *psSphereSetOffset( const psSphere *restrict position,
-                             const psSphere *restrict offset,
-                             psSphereOffsetMode mode,
-                             psSphereOffsetUnit unit )
+psSphere *psSphereSetOffset(const psSphere * restrict position,
+                            const psSphere * restrict offset,
+                            psSphereOffsetMode mode, psSphereOffsetUnit unit)
 {
     psPlane lin;
@@ -379,5 +338,5 @@
     double tmpD = 0.0;
 
-    if ( mode == PS_LINEAR ) {
+    if (mode == PS_LINEAR) {
         proj.R = position->r;
         proj.D = position->d;
@@ -389,39 +348,35 @@
         lin.y = offset->d;
 
-        tmp = psDeproject( &lin, &proj );
-        return ( tmp );
-
-    } else
-        if ( mode == PS_SPHERICAL ) {
-            if ( unit == PS_ARCSEC ) {
-                tmpR = ( M_PI * offset->r ) / ( 180.0 * 60.0 * 60.0 );
-                tmpD = ( M_PI * offset->d ) / ( 180.0 * 60.0 * 60.0 );
-            } else
-                if ( unit == PS_ARCMIN ) {
-                    tmpR = ( M_PI * offset->r ) / ( 180.0 * 60.0 );
-                    tmpD = ( M_PI * offset->d ) / ( 180.0 * 60.0 );
-                } else
-                    if ( unit == PS_DEGREE ) {
-                        tmpR = ( M_PI * offset->r ) / ( 180.0 );
-                        tmpD = ( M_PI * offset->d ) / ( 180.0 );
-                    } else
-                        if ( unit == PS_RADIAN ) {
-                            tmpR = offset->r;
-                            tmpD = offset->d;
-                        } else {
-                            psAbort( __func__, "Unknown offset unit: 0x%x\n", unit );
-                        }
-
-            tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) );
-            tmp->r = position->r + tmpR;
-            tmp->r = position->d + tmpD;
-            tmp->rErr = 0.0;
-            tmp->dErr = 0.0;
-
-            // XXX: wrap tmp->r and tmp->d to the allowed range (-PI to PI)
-            // and (0 to 2*PI).
-            return ( tmp );
+        tmp = psDeproject(&lin, &proj);
+        return (tmp);
+
+    } else if (mode == PS_SPHERICAL) {
+        if (unit == PS_ARCSEC) {
+            tmpR = (M_PI * offset->r) / (180.0 * 60.0 * 60.0);
+            tmpD = (M_PI * offset->d) / (180.0 * 60.0 * 60.0);
+        } else if (unit == PS_ARCMIN) {
+            tmpR = (M_PI * offset->r) / (180.0 * 60.0);
+            tmpD = (M_PI * offset->d) / (180.0 * 60.0);
+        } else if (unit == PS_DEGREE) {
+            tmpR = (M_PI * offset->r) / (180.0);
+            tmpD = (M_PI * offset->d) / (180.0);
+        } else if (unit == PS_RADIAN) {
+            tmpR = offset->r;
+            tmpD = offset->d;
+        } else {
+            psAbort(__func__, "Unknown offset unit: 0x%x\n", unit);
         }
-    psAbort( __func__, "Unrecognized offset mode\n" );
-    return ( NULL );
-}
+
+        tmp = (psSphere *) psAlloc(sizeof(psSphere));
+        tmp->r = position->r + tmpR;
+        tmp->r = position->d + tmpD;
+        tmp->rErr = 0.0;
+        tmp->dErr = 0.0;
+
+        // XXX: wrap tmp->r and tmp->d to the allowed range (-PI to PI)
+        // and (0 to 2*PI).
+        return (tmp);
+    }
+    psAbort(__func__, "Unrecognized offset mode\n");
+    return (NULL);
+}
Index: /trunk/psLib/src/astronomy/psCoord.h
===================================================================
--- /trunk/psLib/src/astronomy/psCoord.h	(revision 1406)
+++ /trunk/psLib/src/astronomy/psCoord.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psCoord.h
 *
@@ -10,19 +11,19 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-05 19:38:51 $
+*  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
 */
 
-# ifndef PS_COORD_H
-# define PS_COORD_H
-
-#include "psType.h"
-#include "psImage.h"
-#include "psArray.h"
-#include "psList.h"
-#include "psFunctions.h"
-#include "psTime.h"
+#ifndef PS_COORD_H
+#    define PS_COORD_H
+
+#    include "psType.h"
+#    include "psImage.h"
+#    include "psArray.h"
+#    include "psList.h"
+#    include "psFunctions.h"
+#    include "psTime.h"
 
 /// @addtogroup CoordinateTransform
@@ -38,8 +39,8 @@
 typedef struct
 {
-    double x;      ///< x position
-    double y;      ///< y position
-    double xErr;   ///< Error in x position
-    double yErr;   ///< Error in y position
+    double x;                   // /< x position
+    double y;                   // /< y position
+    double xErr;                // /< Error in x position
+    double yErr;                // /< Error in y position
 }
 psPlane;
@@ -54,8 +55,8 @@
 typedef struct
 {
-    double r;      ///< RA
-    double d;      ///< Dec
-    double rErr;   ///< Error in RA
-    double dErr;   ///< Error in Dec
+    double r;                   // /< RA
+    double d;                   // /< Dec
+    double rErr;                // /< Error in RA
+    double dErr;                // /< Error in Dec
 }
 psSphere;
@@ -71,6 +72,6 @@
 typedef struct
 {
-    psDPolynomial2D *x;                ///< 2D polynomial transform of X coordinates
-    psDPolynomial2D *y;                ///< 2D polynomial transform of Y coordinates
+    psDPolynomial2D *x;         // /< 2D polynomial transform of X coordinates
+    psDPolynomial2D *y;         // /< 2D polynomial transform of Y coordinates
 }
 psPlaneTransform;
@@ -90,6 +91,6 @@
 typedef struct
 {
-    psDPolynomial4D *x;                ///< 4D polynomial transform of X coordinates
-    psDPolynomial4D *y;                ///< 4D polynomial transform of Y coordinates
+    psDPolynomial4D *x;         // /< 4D polynomial transform of X coordinates
+    psDPolynomial4D *y;         // /< 4D polynomial transform of Y coordinates
 }
 psPlaneDistort;
@@ -107,8 +108,8 @@
 typedef struct
 {
-    double sinPhi;                    ///< sin of North Pole lattitude
-    double cosPhi;                    ///< cos of North Pole lattitude
-    double Xo;                        ///< First PT of Ares lon
-    double xo;                        ///< First PT of Ares equiv lon
+    double sinPhi;              // /< sin of North Pole lattitude
+    double cosPhi;              // /< cos of North Pole lattitude
+    double Xo;                  // /< First PT of Ares lon
+    double xo;                  // /< First PT of Ares equiv lon
 }
 psSphereTransform;
@@ -120,12 +121,12 @@
  */
 typedef enum {
-    PS_PROJ_TAN,        ///< Tangent projection
-    PS_PROJ_SIN,        ///< Sine projection
-    PS_PROJ_AIT,        ///< Aitoff projection
-    PS_PROJ_PAR,        ///< Par projection
-    PS_PROJ_GLS,        ///< GLS projection
-    PS_PROJ_CAR,        ///< CAR projection
-    PS_PROJ_MER,        ///< MER projection
-    PS_PROJ_NTYPE      ///< Number of types; must be last.
+    PS_PROJ_TAN,                // /< Tangent projection
+    PS_PROJ_SIN,                // /< Sine projection
+    PS_PROJ_AIT,                // /< Aitoff projection
+    PS_PROJ_PAR,                // /< Par projection
+    PS_PROJ_GLS,                // /< GLS projection
+    PS_PROJ_CAR,                // /< CAR projection
+    PS_PROJ_MER,                // /< MER projection
+    PS_PROJ_NTYPE               // /< Number of types; must be last.
 } psProjectionType;
 
@@ -137,9 +138,9 @@
 typedef struct
 {
-    double R;     ///< Coordinates of projection center
-    double D;     ///< Coordinates of projection center
-    double Xs;    ///< plate-scale in X direction
-    double Ys;    ///< plate-scale in Y direction
-    psProjectionType type;  ///< Projection type
+    double R;                   // /< Coordinates of projection center
+    double D;                   // /< Coordinates of projection center
+    double Xs;                  // /< plate-scale in X direction
+    double Ys;                  // /< plate-scale in Y direction
+    psProjectionType type;      // /< Projection type
 }
 psProjection;
@@ -151,6 +152,6 @@
  */
 typedef enum {
-    PS_SPHERICAL,                      ///< offset corresponds to an angular offset
-    PS_LINEAR                          ///< offset corresponds to a linear offset
+    PS_SPHERICAL,               // /< offset corresponds to an angular offset
+    PS_LINEAR                   // /< offset corresponds to a linear offset
 } psSphereOffsetMode;
 
@@ -161,8 +162,8 @@
  */
 typedef enum {
-    PS_ARCSEC,                         ///< Arcseconds
-    PS_ARCMIN,                         ///< Arcminutes
-    PS_DEGREE,                         ///< Degrees
-    PS_RADIAN                          ///< Radians
+    PS_ARCSEC,                  // /< Arcseconds
+    PS_ARCMIN,                  // /< Arcminutes
+    PS_DEGREE,                  // /< Degrees
+    PS_RADIAN                   // /< Radians
 } psSphereOffsetUnit;
 
@@ -170,75 +171,55 @@
  *
  */
-psPlane *psPlaneTransformApply(
-    psPlane *out,                      ///< a psPlane to recycle.  If NULL, a new one is generated.
-    const psPlaneTransform *transform, ///< the transform to apply
-    const psPlane *coords              ///< the coordinate to apply the transform above.
-);
+psPlane *psPlaneTransformApply(psPlane * out,   // /< a psPlane to recycle.  If NULL, a new one is generated.
+                               const psPlaneTransform * transform,      // /< the transform to apply
+                               const psPlane * coords   // /< the coordinate to apply the transform above.
+                              );
 
 /** Applies the psPlaneDistort transform to a specified coordinate
  *
  */
-psPlane *psPlaneDistortApply(
-    psPlane *out,                      ///< a psPlane to recycle.  If NULL, a new one is generated.
-    const psPlaneDistort *transform,   ///< the transform to apply
-    const psPlane *coords,             ///< the coordinate to apply the transform above.
-    float term3,                       ///< third term -- maybe magnitude
-    float term4                        ///< forth term -- maybe color
-);
+psPlane *psPlaneDistortApply(psPlane * out,     // /< a psPlane to recycle.  If NULL, a new one is generated.
+                             const psPlaneDistort * transform,  // /< the transform to apply
+                             const psPlane * coords,    // /< the coordinate to apply the transform above.
+                             float term3,       // /< third term -- maybe magnitude
+                             float term4        // /< forth term -- maybe color
+                            );
 
 /** Allocator for psSphereTransform
  *
  */
-psSphereTransform *psSphereTransformAlloc(
-    double NPlat,                      ///< north pole latitude
-    double Xo,                         ///< First PT of Ares lon
-    double xo                          ///< First PT of Ares equiv lon
-);
-
+psSphereTransform *psSphereTransformAlloc(double NPlat, // /< north pole latitude
+        double Xo,    // /< First PT of Ares lon
+        double xo     // /< First PT of Ares equiv lon
+                                         );
 
 /** Applies the psSphereTransform transform for a specified coordinate
  *
  */
-psSphere *psSphereTransformApply(
-    psSphere *out,                     ///< a psSphere to recycle.  If NULL, a new one is generated.
-    const psSphereTransform *transform,///< the transform to apply
-    const psSphere *coord              ///< the coordinate to apply the transform above.x
-);
-
-psSphereTransform *psSphereTransformICRStoEcliptic(
-    psTime time
-);
-
-psSphereTransform *psSphereTransformEcliptictoICRS(
-    psTime time
-);
-
-psSphereTransform *psSphereTransformICRStoGalatic( void );
-
-psSphereTransform *psSphereTransformGalatictoICRS( void );
-
-psPlane *psProject(
-    const psSphere *coord,
-    const psProjection *projection
-);
-
-psSphere *psDeproject(
-    const psPlane *coord,
-    const psProjection *projection
-);
-
-psSphere *psSphereGetOffset(
-    const psSphere *restrict position1,
-    const psSphere *restrict position2,
-    psSphereOffsetMode mode,
-    psSphereOffsetUnit unit
-);
-
-psSphere *psSphereSetOffset(
-    const psSphere *restrict position,
-    const psSphere *restrict offset,
-    psSphereOffsetMode mode,
-    psSphereOffsetUnit unit
-);
+psSphere *psSphereTransformApply(psSphere * out,        // /< a psSphere to recycle.  If NULL, a new one is
+                                 // generated.
+                                 const psSphereTransform * transform,   // /< the transform to apply
+                                 const psSphere * coord // /< the coordinate to apply the transform above.x
+                                );
+
+psSphereTransform *psSphereTransformICRStoEcliptic(psTime time);
+
+psSphereTransform *psSphereTransformEcliptictoICRS(psTime time);
+
+psSphereTransform *psSphereTransformICRStoGalatic(void);
+
+psSphereTransform *psSphereTransformGalatictoICRS(void);
+
+psPlane *psProject(const psSphere * coord, const psProjection * projection);
+
+psSphere *psDeproject(const psPlane * coord, const psProjection * projection);
+
+psSphere *psSphereGetOffset(const psSphere * restrict position1,
+                            const psSphere * restrict position2,
+                            psSphereOffsetMode mode, psSphereOffsetUnit unit);
+
+psSphere *psSphereSetOffset(const psSphere * restrict position,
+                            const psSphere * restrict offset,
+                            psSphereOffsetMode mode, psSphereOffsetUnit unit);
 
 /// @}
Index: /trunk/psLib/src/astronomy/psMetadata.c
===================================================================
--- /trunk/psLib/src/astronomy/psMetadata.c	(revision 1406)
+++ /trunk/psLib/src/astronomy/psMetadata.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psMetadata.c
 *
@@ -11,6 +12,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 22:34:05 $
+*  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -18,5 +19,7 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 #include<stdio.h>
@@ -34,7 +37,8 @@
 #include "psString.h"
 
-
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
@@ -56,5 +60,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -62,5 +68,7 @@
 
 /*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
+
 /*****************************************************************************/
 
@@ -68,5 +76,7 @@
 
 /*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
+
 /*****************************************************************************/
 
@@ -74,7 +84,9 @@
 
 /*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
-/*****************************************************************************/
-static void metadataItemFree( psMetadataItem *metadataItem )
+
+/*****************************************************************************/
+static void metadataItemFree(psMetadataItem * metadataItem)
 {
     psMetadataType type;
@@ -82,36 +94,35 @@
     type = metadataItem->type;
 
-    if(metadataItem == NULL) {
-        return ;
-    }
-
-    psFree( metadataItem->name );
-    psFree( metadataItem->comment );
-    psFree( metadataItem->items );
-
-    if(type == PS_META_STR ||
+    if (metadataItem == NULL) {
+        return;
+    }
+
+    psFree(metadataItem->name);
+    psFree(metadataItem->comment);
+    psFree(metadataItem->items);
+
+    if (type == PS_META_STR ||
             type == PS_META_IMG ||
-            type == PS_META_JPEG ||
-            type == PS_META_PNG ||
-            type == PS_META_ASTROM ||
-            type == PS_META_UNKNOWN) {
-        psFree( metadataItem->data.V );
-    }
-}
-
-static void metadataFree( psMetadata *metadata )
-{
-    if(metadata == NULL) {
-        return ;
-    }
-    psFree( metadata->list );
-    psFree( metadata->table );
-}
-
-/*****************************************************************************/
+            type == PS_META_JPEG || type == PS_META_PNG || type == PS_META_ASTROM || type == PS_META_UNKNOWN) {
+        psFree(metadataItem->data.V);
+    }
+}
+
+static void metadataFree(psMetadata * metadata)
+{
+    if (metadata == NULL) {
+        return;
+    }
+    psFree(metadata->list);
+    psFree(metadata->table);
+}
+
+/*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
-/*****************************************************************************/
-
-psMetadataItem *psMetadataItemAlloc( const char *name, psMetadataType type, const char *comment, ... )
+
+/*****************************************************************************/
+
+psMetadataItem *psMetadataItemAlloc(const char *name, psMetadataType type, const char *comment, ...)
 {
     va_list argPtr;
@@ -119,44 +130,43 @@
 
     // Get the variable list parameters to pass to allocation function
-    va_start( argPtr, comment );
+    va_start(argPtr, comment);
 
     // Call metadata item allocation
-    metadataItem = psMetadataItemAllocV( name, type, comment, argPtr );
+    metadataItem = psMetadataItemAllocV(name, type, comment, argPtr);
 
     // Clean up stack after variable arguement has been used
-    va_end( argPtr );
+    va_end(argPtr);
 
     return metadataItem;
 }
 
-psMetadataItem *psMetadataItemAllocV( const char *name, psMetadataType type, const char *comment, va_list argPtr )
-{
-    psMetadataItem * metadataItem = NULL;
-
-    if(name == NULL) {
-        psError( __func__, "Null value for name not allowed" );
-        return NULL;
-    }
-
+psMetadataItem *psMetadataItemAllocV(const char *name, psMetadataType type, const char *comment,
+                                     va_list argPtr)
+{
+    psMetadataItem *metadataItem = NULL;
+
+    if (name == NULL) {
+        psError(__func__, "Null value for name not allowed");
+        return NULL;
+    }
     // Allocate metadata item
-    metadataItem = ( psMetadataItem * ) psAlloc( sizeof( psMetadataItem ) );
-    if(metadataItem == NULL) {
-        psAbort( __func__, "Failed to allocate memory" );
-    }
-
+    metadataItem = (psMetadataItem *) psAlloc(sizeof(psMetadataItem));
+    if (metadataItem == NULL) {
+        psAbort(__func__, "Failed to allocate memory");
+    }
     // Set deallocator
-    p_psMemSetDeallocator( metadataItem, ( psFreeFcn ) metadataItemFree );
+    p_psMemSetDeallocator(metadataItem, (psFreeFcn) metadataItemFree);
 
     // Allocate and set metadata item comment
-    metadataItem->comment = ( char * ) psAlloc( sizeof( char ) * MAX_STRING_LENGTH );
-    if(comment == NULL) {
+    metadataItem->comment = (char *)psAlloc(sizeof(char) * MAX_STRING_LENGTH);
+    if (comment == NULL) {
         // Per SDRS, null isn't allowed, must use "" instead
-        strncpy( metadataItem->comment, "", MAX_STRING_LENGTH );
+        strncpy(metadataItem->comment, "", MAX_STRING_LENGTH);
     } else {
-        strncpy( metadataItem->comment, comment, MAX_STRING_LENGTH );
+        strncpy(metadataItem->comment, comment, MAX_STRING_LENGTH);
     }
 
     // Set metadata item unique id
-    *( int* ) ( &metadataItem->id ) = ++metadataId;
+    *(int *)(&metadataItem->id) = ++metadataId;
 
     // Set metadata item type
@@ -164,19 +174,21 @@
 
     // Set metadata item value
-    switch(type) {
+    switch (type) {
     case PS_META_BOOL:
-        metadataItem->data.B = ( bool ) va_arg( argPtr, int );
+        metadataItem->data.B = (bool) va_arg(argPtr, int);
+
         break;
     case PS_META_S32:
-        metadataItem->data.S32 = va_arg( argPtr, psS32 );
+        metadataItem->data.S32 = va_arg(argPtr, psS32);
         break;
     case PS_META_F32:
-        metadataItem->data.F32 = ( psF32 ) va_arg( argPtr, psF64 );
+        metadataItem->data.F32 = (psF32) va_arg(argPtr, psF64);
         break;
     case PS_META_F64:
-        metadataItem->data.F64 = va_arg( argPtr, psF64 );
+        metadataItem->data.F64 = va_arg(argPtr, psF64);
         break;
     case PS_META_STR:
-        metadataItem->data.V = psStringNCopy( va_arg( argPtr, char* ), MAX_STRING_LENGTH );
+        metadataItem->data.V = psStringNCopy(va_arg(argPtr, char *), MAX_STRING_LENGTH);
+
         break;
     case PS_META_IMG:
@@ -186,41 +198,40 @@
     case PS_META_UNKNOWN:
     default:
-        psError( __func__, "Invalid psMetadataType: %d", type );
+        psError(__func__, "Invalid psMetadataType: %d", type);
     }
 
     // Allocate and set metadata item name
-    metadataItem->name = ( char * ) psAlloc( sizeof( char ) * MAX_STRING_LENGTH );
-    vsprintf( metadataItem->name, name, argPtr );
+    metadataItem->name = (char *)psAlloc(sizeof(char) * MAX_STRING_LENGTH);
+    vsprintf(metadataItem->name, name, argPtr);
 
     // Allocate metadata items with same name.
-    metadataItem->items = psListAlloc( NULL );
+    metadataItem->items = psListAlloc(NULL);
 
     return metadataItem;
 }
 
-psMetadata *psMetadataAlloc( void )
-{
-    psList * list = NULL;
+psMetadata *psMetadataAlloc(void)
+{
+    psList *list = NULL;
     psHash *table = NULL;
     psMetadata *metadata = NULL;
 
     // Allocate metadata
-    metadata = ( psMetadata * ) psAlloc( sizeof( psMetadata ) );
-    if(metadata == NULL) {
-        psAbort( __func__, "Failed to allocate metadata" );
-    }
-
+    metadata = (psMetadata *) psAlloc(sizeof(psMetadata));
+    if (metadata == NULL) {
+        psAbort(__func__, "Failed to allocate metadata");
+    }
     // Set deallocator
-    p_psMemSetDeallocator( metadata, ( psFreeFcn ) metadataFree );
+    p_psMemSetDeallocator(metadata, (psFreeFcn) metadataFree);
 
     // Allocate metadata's internal containers
-    list = ( psList * ) psListAlloc( NULL );
-    if(list == NULL) {
-        psAbort( __func__, "Failed to allocate list" );
-    }
-
-    table = ( psHash * ) psHashAlloc( 10 );
-    if(table == NULL) {
-        psAbort( __func__, "Failed to allocate table" );
+    list = (psList *) psListAlloc(NULL);
+    if (list == NULL) {
+        psAbort(__func__, "Failed to allocate list");
+    }
+
+    table = (psHash *) psHashAlloc(10);
+    if (table == NULL) {
+        psAbort(__func__, "Failed to allocate table");
     }
 
@@ -231,7 +242,7 @@
 }
 
-bool psMetadataAddItem( psMetadata *restrict md, int where, psMetadataItem *restrict metadataItem )
-{
-    char * key = NULL;
+bool psMetadataAddItem(psMetadata * restrict md, int where, psMetadataItem * restrict metadataItem)
+{
+    char *key = NULL;
     psHash *mdTable = NULL;
     psList *mdList = NULL;
@@ -239,11 +250,11 @@
     psMetadataType type = PS_META_ITEM_SET;
 
-    if(md == NULL) {
-        psError( __func__, "Null metadata collection not allowed" );
-        return false;
-    }
-
-    if(metadataItem == NULL) {
-        psError( __func__, "Null metadata item not allowed" );
+    if (md == NULL) {
+        psError(__func__, "Null metadata collection not allowed");
+        return false;
+    }
+
+    if (metadataItem == NULL) {
+        psError(__func__, "Null metadata item not allowed");
         return false;
     }
@@ -252,54 +263,51 @@
 
     mdTable = md->table;
-    if(mdTable == NULL) {
-        psError( __func__, "Null metadata table not allowed" );
-        return false;
-    }
-
-    mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
+    if (mdTable == NULL) {
+        psError(__func__, "Null metadata table not allowed");
+        return false;
+    }
+
+    mdList = md->list;
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
         return false;
     }
 
     key = metadataItem->name;
-    if(key == NULL) {
-        psError( __func__, "Null key item not allowed" );
-        return false;
-    }
-
+    if (key == NULL) {
+        psError(__func__, "Null key item not allowed");
+        return false;
+    }
     // Check if key is already in table
-    value = ( psMetadataItem* ) psHashLookup( mdTable, key );
-    if(value != NULL && type != PS_META_ITEM_SET) {
+    value = (psMetadataItem *) psHashLookup(mdTable, key);
+    if (value != NULL && type != PS_META_ITEM_SET) {
 
         // The key was found and the new metadata item is a leaf node (its type isn't PS_META_ITEM_SET), so
         // add the new metadata item to hash as a child of the existing metadata item folder node.
-        if(!psListAdd( value->items, metadataItem, where )) {
-            psError( __func__, "Couldn't add metadata item to items list. Name: %s",
-                     metadataItem->name );
+        if (!psListAdd(value->items, metadataItem, where)) {
+            psError(__func__, "Couldn't add metadata item to items list. Name: %s", metadataItem->name);
             return false;
         }
-    } else
-        if(value != NULL) {
-
-            // The key was found and the new metadata item is a folder node. Don't add new metadata item, since
-            // it will wipe out existing node.
-            psError( __func__, "Metadata already exists in metadata collection. Item not added. Name: %s",
-                     metadataItem->name );
+    } else if (value != NULL) {
+
+        // The key was found and the new metadata item is a folder node. Don't add new metadata item, since
+        // it will wipe out existing node.
+        psError(__func__, "Metadata already exists in metadata collection. Item not added. Name: %s",
+                metadataItem->name);
+        return false;
+    } else {
+
+        // Duplicate key not found. Add new metadata item to metadata collection's hash
+        if (!psHashAdd(mdTable, key, metadataItem)) {
+            psError(__func__, "Couldn't add metadata item to metadata collection table. Name: %s",
+                    metadataItem->name);
             return false;
-        } else {
-
-            // Duplicate key not found. Add new metadata item to metadata collection's hash
-            if(!psHashAdd( mdTable, key, metadataItem )) {
-                psError( __func__, "Couldn't add metadata item to metadata collection table. Name: %s",
-                         metadataItem->name );
-                return false;
-            }
-        }
+        }
+    }
 
     // Add all items to metadata collection's list, even if they have the same metadata item names
-    if(!psListAdd( md->list, metadataItem, where )) {
-        psError( __func__, "Couldn't add metadata item to metadata collection list. Name: %s",
-                 metadataItem->name );
+    if (!psListAdd(md->list, metadataItem, where)) {
+        psError(__func__, "Couldn't add metadata item to metadata collection list. Name: %s",
+                metadataItem->name);
         return false;
     }
@@ -308,28 +316,28 @@
 }
 
-bool psMetadataAdd( psMetadata *restrict md, int where, const char *name, psMetadataType type,
-                    const char *comment, ... )
+bool psMetadataAdd(psMetadata * restrict md, int where, const char *name, psMetadataType type,
+                   const char *comment, ...)
 {
     va_list argPtr;
     psMetadataItem *metadataItem = NULL;
 
-    va_start( argPtr, comment );
-    metadataItem = psMetadataItemAllocV( name, type, comment, argPtr );
-    va_end( argPtr );
-
-    if(!psMetadataAddItem( md, where, metadataItem )) {
-        psError( __func__, "Couldn't add metadata item to metadata collection list. Name: %s",
-                 metadataItem->name );
-        psFree( metadataItem );
-        return false;
-    }
-
-    // Decrement reference count, since the metadata item is now in metadata collection and no longer needed here
-    psMemDecrRefCounter( metadataItem );
+    va_start(argPtr, comment);
+    metadataItem = psMetadataItemAllocV(name, type, comment, argPtr);
+    va_end(argPtr);
+
+    if (!psMetadataAddItem(md, where, metadataItem)) {
+        psError(__func__, "Couldn't add metadata item to metadata collection list. Name: %s",
+                metadataItem->name);
+        psFree(metadataItem);
+        return false;
+    }
+    // Decrement reference count, since the metadata item is now in metadata collection and no longer needed
+    // here
+    psMemDecrRefCounter(metadataItem);
 
     return true;
 }
 
-bool psMetadataRemove( psMetadata *restrict md, int where, const char *restrict key )
+bool psMetadataRemove(psMetadata * restrict md, int where, const char *restrict key)
 {
     int numChildren = 0;
@@ -340,49 +348,46 @@
 
     mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
         return false;
     }
 
     mdTable = md->table;
-    if(mdTable == NULL) {
-        psError( __func__, "Null metadata table not allowed" );
-        return false;
-    }
-
+    if (mdTable == NULL) {
+        psError(__func__, "Null metadata table not allowed");
+        return false;
+    }
     // Select removal by key or index
-    if(key != NULL) {
+    if (key != NULL) {
 
         // Remove by key name
-        entry = ( psMetadataItem* ) psHashLookup( mdTable, key );
-        if(entry == NULL) {
-            psError( __func__, "Couldn't find metadata item remove. Name: %s", key );
+        entry = (psMetadataItem *) psHashLookup(mdTable, key);
+        if (entry == NULL) {
+            psError(__func__, "Couldn't find metadata item remove. Name: %s", key);
             return false;
         }
 
         numChildren = entry->items->size;
-        if(entry->type == PS_META_ITEM_SET && numChildren > 0) {
+        if (entry->type == PS_META_ITEM_SET && numChildren > 0) {
 
             // Table entry has children. Entry and children must be removed from metadata collection's list
-            psListSetIterator( mdList, PS_LIST_HEAD );
-            entryChild = psListGetCurrent( mdList );
-            while(entryChild != NULL) {
-                if(!psListRemove( entry->items, entryChild, PS_LIST_UNKNOWN )) {
-                    psError( __func__, "Couldn't remove metadata item from list. Name: %s", key );
+            psListSetIterator(mdList, PS_LIST_HEAD);
+            entryChild = psListGetCurrent(mdList);
+            while (entryChild != NULL) {
+                if (!psListRemove(entry->items, entryChild, PS_LIST_UNKNOWN)) {
+                    psError(__func__, "Couldn't remove metadata item from list. Name: %s", key);
                     return false;
                 }
-                entryChild = psListGetNext( entry->items );
+                entryChild = psListGetNext(entry->items);
             }
         }
-
         // Remove entry from metadata collection's list
-        if(!psListRemove( mdList, entry, PS_LIST_UNKNOWN )) {
-            psError( __func__, "Couldn't remove metadata item from list. Name: %s", key );
+        if (!psListRemove(mdList, entry, PS_LIST_UNKNOWN)) {
+            psError(__func__, "Couldn't remove metadata item from list. Name: %s", key);
             return false;
         }
-
         // Remove entry from metadata collection's table
-        if(!psHashRemove( mdTable, key )) {
-            psError( __func__, "Couldn't remove metadata item from table. Name: %s", key );
+        if (!psHashRemove(mdTable, key)) {
+            psError(__func__, "Couldn't remove metadata item from table. Name: %s", key);
             return false;
         }
@@ -390,18 +395,17 @@
 
         // Remove by index
-        entry = psListGet( mdList, where );
-        if(entry == NULL) {
-            psError( __func__, "Couldn't find metadata item from list. Index: %d", where );
+        entry = psListGet(mdList, where);
+        if (entry == NULL) {
+            psError(__func__, "Couldn't find metadata item from list. Index: %d", where);
             return false;
         }
 
         key = entry->name;
-        if(key == NULL) {
-            psError( __func__, "Null key name not allowed. Index: %d", where );
+        if (key == NULL) {
+            psError(__func__, "Null key name not allowed. Index: %d", where);
             return false;
         }
-
         // Use recursive remove, now that key is known
-        psMetadataRemove( md, PS_LIST_UNKNOWN, key );
+        psMetadataRemove(md, PS_LIST_UNKNOWN, key);
     }
 
@@ -409,23 +413,23 @@
 }
 
-psMetadataItem *psMetadataLookup( psMetadata *restrict md, const char *restrict key )
-{
-    psHash * mdTable = NULL;
+psMetadataItem *psMetadataLookup(psMetadata * restrict md, const char *restrict key)
+{
+    psHash *mdTable = NULL;
     psMetadataItem *entry = NULL;
 
     mdTable = md->table;
-    if(mdTable == NULL) {
-        psError( __func__, "Null metadata table not allowed" );
-        return NULL;
-    }
-
-    if(key == NULL) {
-        psError( __func__, "Null key name not allowed" );
-        return NULL;
-    }
-
-    entry = ( psMetadataItem* ) psHashLookup( mdTable, key );
-    if(entry == NULL) {
-        psError( __func__, "Could not find metadata item with given key. Key: %s", key );
+    if (mdTable == NULL) {
+        psError(__func__, "Null metadata table not allowed");
+        return NULL;
+    }
+
+    if (key == NULL) {
+        psError(__func__, "Null key name not allowed");
+        return NULL;
+    }
+
+    entry = (psMetadataItem *) psHashLookup(mdTable, key);
+    if (entry == NULL) {
+        psError(__func__, "Could not find metadata item with given key. Key: %s", key);
         return NULL;
     }
@@ -434,18 +438,18 @@
 }
 
-psMetadataItem *psMetadataGet( psMetadata *restrict md, int where )
-{
-    psList * mdList = NULL;
+psMetadataItem *psMetadataGet(psMetadata * restrict md, int where)
+{
+    psList *mdList = NULL;
     psMetadataItem *entry = NULL;
 
     mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
-        return NULL;
-    }
-
-    entry = ( psMetadataItem* ) psListGet( mdList, where );
-    if(entry == NULL) {
-        psError( __func__, "Couldn't find metadata item with given index. Index: %d", where );
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
+        return NULL;
+    }
+
+    entry = (psMetadataItem *) psListGet(mdList, where);
+    if (entry == NULL) {
+        psError(__func__, "Couldn't find metadata item with given index. Index: %d", where);
         return NULL;
     }
@@ -454,50 +458,50 @@
 }
 
-bool psMetadataSetIterator( psMetadata *restrict md, int where )
-{
-    psList * mdList = NULL;
-
-    mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
-        return false;
-    }
-
-    psListSetIterator( mdList, where );
+bool psMetadataSetIterator(psMetadata * restrict md, int where)
+{
+    psList *mdList = NULL;
+
+    mdList = md->list;
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
+        return false;
+    }
+
+    psListSetIterator(mdList, where);
 
     return true;
 }
 
-psMetadataItem *psMetadataGetNext( psMetadata *restrict md, const char *restrict match, int which )
-{
-    psList * mdList = NULL;
+psMetadataItem *psMetadataGetNext(psMetadata * restrict md, const char *restrict match, int which)
+{
+    psList *mdList = NULL;
     psMetadataItem *entry = NULL;
 
     mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
-        return NULL;
-    }
-
-    mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
-        return NULL;
-    }
-
-    psListSetIterator( mdList, which );
-    entry = psListGetCurrent( mdList );
-    while(entry != NULL) {
-        if(!strncmp( match, entry->name, strlen( match ) )) {
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
+        return NULL;
+    }
+
+    mdList = md->list;
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
+        return NULL;
+    }
+
+    psListSetIterator(mdList, which);
+    entry = psListGetCurrent(mdList);
+    while (entry != NULL) {
+        if (!strncmp(match, entry->name, strlen(match))) {
 
             // Match found
             return entry;
         }
-        entry = psListGetNext( mdList );
+        entry = psListGetNext(mdList);
     }
 
     // Match not found
-    if(entry == NULL) {
-        psError( __func__, "Couldn't find metadata item with given match. Match: %s", match );
+    if (entry == NULL) {
+        psError(__func__, "Couldn't find metadata item with given match. Match: %s", match);
     }
 
@@ -505,35 +509,35 @@
 }
 
-psMetadataItem *psMetadataGetPrevious( psMetadata *restrict md, const char *restrict match, int which )
-{
-    psList * mdList = NULL;
+psMetadataItem *psMetadataGetPrevious(psMetadata * restrict md, const char *restrict match, int which)
+{
+    psList *mdList = NULL;
     psMetadataItem *entry = NULL;
 
     mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
-        return NULL;
-    }
-
-    mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
-        return NULL;
-    }
-
-    psListSetIterator( mdList, which );
-    entry = psListGetCurrent( mdList );
-    while(entry != NULL) {
-        if(!strncmp( match, entry->name, strlen( match ) )) {
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
+        return NULL;
+    }
+
+    mdList = md->list;
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
+        return NULL;
+    }
+
+    psListSetIterator(mdList, which);
+    entry = psListGetCurrent(mdList);
+    while (entry != NULL) {
+        if (!strncmp(match, entry->name, strlen(match))) {
 
             // Match found
             return entry;
         }
-        entry = psListGetPrevious( mdList );
+        entry = psListGetPrevious(mdList);
     }
 
     // Match not found
-    if(entry == NULL) {
-        psError( __func__, "Couldn't find metadata item with given match. Match: %s", match );
+    if (entry == NULL) {
+        psError(__func__, "Couldn't find metadata item with given match. Match: %s", match);
     }
 
@@ -541,40 +545,40 @@
 }
 
-void psMetadataItemPrint( FILE *fd, const char *format, const psMetadataItem *restrict metadataItem )
+void psMetadataItemPrint(FILE * fd, const char *format, const psMetadataItem * restrict metadataItem)
 {
     psMetadataType type;
 
-    if(fd == NULL) {
-        psError( __func__, "Null file descriptor not allowed" );
-        return ;
-    }
-
-    if(format == NULL) {
-        psError( __func__, "Null format not allowed" );
-        return ;
-    }
-
-    if(metadataItem == NULL) {
-        psError( __func__, "Null metadata not allowed" );
-        return ;
+    if (fd == NULL) {
+        psError(__func__, "Null file descriptor not allowed");
+        return;
+    }
+
+    if (format == NULL) {
+        psError(__func__, "Null format not allowed");
+        return;
+    }
+
+    if (metadataItem == NULL) {
+        psError(__func__, "Null metadata not allowed");
+        return;
     }
 
     type = metadataItem->type;
 
-    switch(type) {
+    switch (type) {
     case PS_META_BOOL:
-        fprintf( fd, format, metadataItem->data.B );
+        fprintf(fd, format, metadataItem->data.B);
         break;
     case PS_META_S32:
-        fprintf( fd, format, metadataItem->data.S32 );
+        fprintf(fd, format, metadataItem->data.S32);
         break;
     case PS_META_F32:
-        fprintf( fd, format, metadataItem->data.F32 );
+        fprintf(fd, format, metadataItem->data.F32);
         break;
     case PS_META_F64:
-        fprintf( fd, format, metadataItem->data.F64 );
+        fprintf(fd, format, metadataItem->data.F64);
         break;
     case PS_META_STR:
-        fprintf( fd, format, metadataItem->data.V );
+        fprintf(fd, format, metadataItem->data.V);
         break;
     case PS_META_ITEM_SET:
@@ -585,17 +589,17 @@
     case PS_META_UNKNOWN:
     default:
-        psError( __func__, " Invalid psMetadataType to print: %d", type );
-    }
-}
-
-psMetadata *psMetadataFReadHeader( psMetadata *output, char *extName, int extNum, fitsfile *fd )
+        psError(__func__, " Invalid psMetadataType to print: %d", type);
+    }
+}
+
+psMetadata *psMetadataFReadHeader(psMetadata * output, char *extName, int extNum, fitsfile * fd)
 {
     bool tempBool;
     bool success;
     char keyType;
-    char keyName[ FITS_LINE_SIZE ];
-    char keyValue[ FITS_LINE_SIZE ];
-    char keyComment[ FITS_LINE_SIZE ];
-    char fitsErr[ MAX_STRING_LENGTH ];
+    char keyName[FITS_LINE_SIZE];
+    char keyValue[FITS_LINE_SIZE];
+    char keyComment[FITS_LINE_SIZE];
+    char fitsErr[MAX_STRING_LENGTH];
     int i;
     int hduType = 0;
@@ -605,30 +609,27 @@
     psMetadataType metadataItemType;
 
-    if(fd == NULL) {
-        psError( __func__, "Null FITS file descriptor not allowed" );
-        return NULL;
-    }
-
-    if(extName == NULL && extNum == 0) {
-        psError( __func__, "Null extName and extNum = 0 not allowed" );
-        return NULL;
-    } else
-        if(extName && extNum) {
-            psError( __func__, "Both extName and extNum arguments should not have non zero values." );
-            return NULL;
-        }
-
+    if (fd == NULL) {
+        psError(__func__, "Null FITS file descriptor not allowed");
+        return NULL;
+    }
+
+    if (extName == NULL && extNum == 0) {
+        psError(__func__, "Null extName and extNum = 0 not allowed");
+        return NULL;
+    } else if (extName && extNum) {
+        psError(__func__, "Both extName and extNum arguments should not have non zero values.");
+        return NULL;
+    }
     // Allocate metadata if user didn't
-    if(output == NULL) {
+    if (output == NULL) {
         output = psMetadataAlloc();
     }
-
     // Move to user designated HDU number or HDU name in FITS file. HDU numbers starts at one.
-    if(extName != NULL) {
-        if(fits_movnam_hdu( fd, ANY_HDU, extName, 0, &status ) != 0) {
+    if (extName != NULL) {
+        if (fits_movnam_hdu(fd, ANY_HDU, extName, 0, &status) != 0) {
             FITS_ERROR("FITS error while locating header %s: %s", extName);
         }
     } else {
-        if(fits_movabs_hdu( fd, extNum, &hduType, &status ) != 0) {
+        if (fits_movabs_hdu(fd, extNum, &hduType, &status) != 0) {
             FITS_ERROR("FITS error while locating header %d: %s", extNum);
         }
@@ -636,19 +637,19 @@
 
     // Get number of key names
-    if(fits_get_hdrpos( fd, &numKeys, &keyNum, &status ) != 0) {
+    if (fits_get_hdrpos(fd, &numKeys, &keyNum, &status) != 0) {
         FITS_ERROR("FITS error while reading key %d: %s", keyNum);
     }
-
     // Get each key name. Keywords start at one.
-    for(i = 1; i <= numKeys; i++) {
-        if(fits_read_keyn( fd, i, keyName, keyValue, keyComment, &status ) != 0) {
+    for (i = 1; i <= numKeys; i++) {
+        if (fits_read_keyn(fd, i, keyName, keyValue, keyComment, &status) != 0) {
             FITS_ERROR("FITS error while reading key %d: %s", keyNum);
         }
-        if(fits_get_keytype( keyValue, &keyType, &status ) != 0) {
-            fits_get_errstatus( status, fitsErr );
-            if(status != VALUE_UNDEFINED) {
+        if (fits_get_keytype(keyValue, &keyType, &status) != 0) {
+            fits_get_errstatus(status, fitsErr);
+            if (status != VALUE_UNDEFINED) {
                 FITS_ERROR("FITS error while determining key %d type: %s", keyNum);
             } else {
-                // Some keywords are still valid even though they don't have a type, like COMMENTS and HISTORY
+                // Some keywords are still valid even though they don't have a type, like COMMENTS and
+                // HISTORY
                 keyType = 'C';
                 status = 0;
@@ -656,31 +657,37 @@
         }
 
-        switch(keyType) {
+        switch (keyType) {
         case 'I':
             metadataItemType = PS_META_S32;
-            success = psMetadataAdd( output, PS_LIST_TAIL, keyName, metadataItemType, keyComment, atoi( keyValue ) );
+            success =
+                psMetadataAdd(output, PS_LIST_TAIL, keyName, metadataItemType, keyComment,
+                              atoi(keyValue));
             break;
         case 'F':
             metadataItemType = PS_META_F64;
-            success = psMetadataAdd( output, PS_LIST_TAIL, keyName, metadataItemType, keyComment, atof( keyValue ) );
+            success =
+                psMetadataAdd(output, PS_LIST_TAIL, keyName, metadataItemType, keyComment,
+                              atof(keyValue));
             break;
         case 'C':
             metadataItemType = PS_META_STR;
-            success = psMetadataAdd( output, PS_LIST_TAIL, keyName, metadataItemType, keyComment, keyValue );
+            success =
+                psMetadataAdd(output, PS_LIST_TAIL, keyName, metadataItemType, keyComment, keyValue);
             break;
         case 'L':
             metadataItemType = PS_META_BOOL;
-            tempBool = ( keyValue[ 0 ] == 'T' ) ? 1 : 0;
-            success = psMetadataAdd( output, PS_LIST_TAIL, keyName, metadataItemType, keyComment, tempBool );
+            tempBool = (keyValue[0] == 'T') ? 1 : 0;
+            success =
+                psMetadataAdd(output, PS_LIST_TAIL, keyName, metadataItemType, keyComment, tempBool);
             break;
         case 'U':
         case 'X':
         default:
-            psError( __func__, "Invalid psMetadataType: %c", keyType );
+            psError(__func__, "Invalid psMetadataType: %c", keyType);
             return output;
         }
 
-        if(!success) {
-            psError( __func__, "Failed to add metadata item. Name: %s", keyName );
+        if (!success) {
+            psError(__func__, "Failed to add metadata item. Name: %s", keyName);
             return output;
         }
Index: /trunk/psLib/src/astronomy/psMetadata.h
===================================================================
--- /trunk/psLib/src/astronomy/psMetadata.h	(revision 1406)
+++ /trunk/psLib/src/astronomy/psMetadata.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psMetadata.h
 *
@@ -10,18 +11,18 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-05 20:55:22 $
+*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
 */
 #ifndef PS_METADATA_H
-#define PS_METADATA_H
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <fitsio.h>
-
-#include "psHash.h"
-#include "psList.h"
+#    define PS_METADATA_H
+
+#    include <stdarg.h>
+#    include <stdio.h>
+#    include <fitsio.h>
+
+#    include "psHash.h"
+#    include "psList.h"
 
 /// @addtogroup Metadata
@@ -33,16 +34,16 @@
  */
 typedef enum {
-    PS_META_ITEM_SET = 0,                   ///< Null. Metadata is in psMetadataItem.items
-    PS_META_BOOL,                           ///< Boolean data.
-    PS_META_S32,                            ///< Signed 32-bit integer data.
-    PS_META_F32,                            ///< Single-precision float data.
-    PS_META_F64,                            ///< Double-precision float data.
-    PS_META_STR,                            ///< String data (Stored in as void *).
-    PS_META_IMG,                            ///< Image data (Stored in as void *).
-    PS_META_JPEG,                           ///< JPEG data (Stored in as void .
-    PS_META_PNG,                            ///< PNG data (Stored in as void *).
-    PS_META_ASTROM,                         ///< Astrometric coefficients (Stored in as void *).
-    PS_META_UNKNOWN,                        ///< Other data (Stored in as void *).
-    PS_META_NTYPE                         ///< Number of types. Must be last.
+    PS_META_ITEM_SET = 0,       // /< Null. Metadata is in psMetadataItem.items
+    PS_META_BOOL,                          // /< Boolean data.
+    PS_META_S32,                           // /< Signed 32-bit integer data.
+    PS_META_F32,                           // /< Single-precision float data.
+    PS_META_F64,                           // /< Double-precision float data.
+    PS_META_STR,                           // /< String data (Stored in as void *).
+    PS_META_IMG,                           // /< Image data (Stored in as void *).
+    PS_META_JPEG,                          // /< JPEG data (Stored in as void .
+    PS_META_PNG,                           // /< PNG data (Stored in as void *).
+    PS_META_ASTROM,                        // /< Astrometric coefficients (Stored in as void *).
+    PS_META_UNKNOWN,                       // /< Other data (Stored in as void *).
+    PS_META_NTYPE                          // /< Number of types. Must be last.
 } psMetadataType;
 
@@ -54,17 +55,16 @@
 typedef struct psMetadataItem
 {
-    const int id;                       ///< Unique ID for metadata item.
-    char *restrict name;                ///< Name of metadata item.
-    psMetadataType type;                ///< Type of metadata item.
-    union
-    {
+    const int id;               // /< Unique ID for metadata item.
+    char *restrict name;        // /< Name of metadata item.
+    psMetadataType type;        // /< Type of metadata item.
+    union {
         bool B;
-        psS32 S32;                  ///< Signed 32-bit integer data.
-        psF32 F32;                  ///< Single-precision float data.
-        psF64 F64;                  ///< Double-precision float data.
-        psPTR V;                    ///< Pointer to other type of data.
-    }data;                          ///< Union for data types.
-    char *comment;                      ///< Optional comment ("", not NULL).
-    psList *restrict items;             ///< List of psMetadataItems with same name.
+        psS32 S32;              // /< Signed 32-bit integer data.
+        psF32 F32;              // /< Single-precision float data.
+        psF64 F64;              // /< Double-precision float data.
+        psPTR V;                // /< Pointer to other type of data.
+    } data;                     // /< Union for data types.
+    char *comment;              // /< Optional comment ("", not NULL).
+    psList *restrict items;     // /< List of psMetadataItems with same name.
 }
 psMetadataItem;
@@ -78,12 +78,13 @@
 typedef struct psMetadata
 {
-    psList* restrict list;
-    psHash* restrict table;
+    psList *restrict list;
+    psHash *restrict table;
 }
 psMetadata;
 
-
 /*****************************************************************************/
+
 /* FUNCTION PROTOTYPES                                                       */
+
 /*****************************************************************************/
 
@@ -101,10 +102,9 @@
  * @return psMetadataItem*: Pointer metadata item.
  */
-psMetadataItem *psMetadataItemAlloc(
-    const char *name,                       ///< Name of metadata item.
-    psMetadataType type,                    ///< Type of metadata item.
-    const char *comment,                    ///< Comment for metadata item.
-    ...                                 ///< Arguments for name formatting and metadata item data.
-);
+psMetadataItem *psMetadataItemAlloc(const char *name,   // /< Name of metadata item.
+                                    psMetadataType type,        // /< Type of metadata item.
+                                    const char *comment,        // /< Comment for metadata item.
+                                    ... // /< Arguments for name formatting and metadata item data.
+                                   );
 
 /** Create a metadata item with va_list.
@@ -121,10 +121,10 @@
  * @return psMetadataItem*: Pointer metadata item.
  */
-psMetadataItem *psMetadataItemAllocV(
-    const char *name,                       ///< Name of metadata item.
-    psMetadataType type,                    ///< Type of metadata item.
-    const char *comment,                    ///< Comment for metadata item.
-    va_list list                        ///< Arguments for name formatting and metadata item data.
-);
+psMetadataItem *psMetadataItemAllocV(const char *name,  // /< Name of metadata item.
+                                     psMetadataType type,       // /< Type of metadata item.
+                                     const char *comment,       // /< Comment for metadata item.
+                                     va_list list       // /< Arguments for name formatting and metadata item
+                                     // data.
+                                    );
 
 /** Create a metadata collection.
@@ -134,7 +134,6 @@
  * @return psMetadata*: Pointer metadata.
  */
-psMetadata *psMetadataAlloc(
-    void                                ///< Void.
-);
+psMetadata *psMetadataAlloc(void        // /< Void.
+                           );
 
 /** Add existing metadata item to metadata collection.
@@ -144,9 +143,8 @@
  * @return bool: True for success, false for failure.
  */
-bool psMetadataAddItem(
-    psMetadata *restrict md,                ///< Metadata collection to insert metadat item.
-    int where,                              ///< Location to be added.
-    psMetadataItem *restrict item       ///< Metadata item to be added.
-);
+bool psMetadataAddItem(psMetadata * restrict md,        // /< Metadata collection to insert metadat item.
+                       int where,       // /< Location to be added.
+                       psMetadataItem * restrict item   // /< Metadata item to be added.
+                      );
 
 /** Create and add a metadata item to metadata collection.
@@ -156,12 +154,11 @@
  * @return bool: True for success, false for failure.
  */
-bool psMetadataAdd(
-    psMetadata *restrict md,                ///< Metadata collection to insert metadat item.
-    int where,                              ///< Location to be added.
-    const char *name,                       ///< Name of metadata item.
-    psMetadataType type,                    ///< Type of metadata item.
-    const char *comment,                    ///< Comment for metadata item.
-    ...                                 ///< Arguments for name formatting and metadata item data.
-);
+bool psMetadataAdd(psMetadata * restrict md,    // /< Metadata collection to insert metadat item.
+                   int where,   // /< Location to be added.
+                   const char *name,    // /< Name of metadata item.
+                   psMetadataType type, // /< Type of metadata item.
+                   const char *comment, // /< Comment for metadata item.
+                   ...          // /< Arguments for name formatting and metadata item data.
+                  );
 
 /** Remove an item from metadata collection.
@@ -174,9 +171,8 @@
  * @return bool: True for success, false for failure.
  */
-bool psMetadataRemove(
-    psMetadata *restrict md,                ///< Metadata collection to insert metadat item.
-    int where,                              ///< Location to be removed.
-    const char *restrict key            ///< Name of metadata key.
-);
+bool psMetadataRemove(psMetadata * restrict md, // /< Metadata collection to insert metadat item.
+                      int where,        // /< Location to be removed.
+                      const char *restrict key  // /< Name of metadata key.
+                     );
 
 /** Find an item in the metadata collection based on key name.
@@ -187,8 +183,8 @@
  * @return psMetadataItem*: Pointer metadata item.
  */
-psMetadataItem *psMetadataLookup(
-    psMetadata *restrict md,                ///< Metadata collection to insert metadat item.
-    const char *restrict key            ///< Name of metadata key.
-);
+psMetadataItem *psMetadataLookup(psMetadata * restrict md,      // /< Metadata collection to insert metadat
+                                 // item.
+                                 const char *restrict key       // /< Name of metadata key.
+                                );
 
 /** Find an item in the metadata collection based on list index.
@@ -198,8 +194,7 @@
  * @return psMetadataItem*: Pointer metadata item.
  */
-psMetadataItem *psMetadataGet(
-    psMetadata *restrict md,                ///< Metadata collection to insert metadat item.
-    int where                           ///< Location to be retrieved.
-);
+psMetadataItem *psMetadataGet(psMetadata * restrict md, // /< Metadata collection to insert metadat item.
+                              int where // /< Location to be retrieved.
+                             );
 
 /** Set or reset metadata iterator.
@@ -209,8 +204,7 @@
  * @return void: void.
  */
-bool psMetadataSetIterator(
-    psMetadata *restrict md,                ///< Metadata collection to iterate.
-    int where                           ///< Location of iterator.
-);
+bool psMetadataSetIterator(psMetadata * restrict md,    // /< Metadata collection to iterate.
+                           int where    // /< Location of iterator.
+                          );
 
 /** Get next metadata item.
@@ -220,9 +214,8 @@
  * @return psMetadataItem*: Pointer metadata item.
  */
-psMetadataItem *psMetadataGetNext(
-    psMetadata *restrict md,                ///< Metadata collection to iterate.
-    const char *restrict match,             ///< Beginning of key name.
-    int which                           ///< Iterator to be used.
-);
+psMetadataItem *psMetadataGetNext(psMetadata * restrict md,     // /< Metadata collection to iterate.
+                                  const char *restrict match,   // /< Beginning of key name.
+                                  int which     // /< Iterator to be used.
+                                 );
 
 /** Get previous metadata item.
@@ -232,9 +225,8 @@
  * @return psMetadataItem*: Pointer metadata item.
  */
-psMetadataItem *psMetadataGetPrevious(
-    psMetadata *restrict md,                ///< Metadata collection to iterate.
-    const char *restrict match,             ///< Beginning of key name.
-    int which                           ///< Iterator to be used.
-);
+psMetadataItem *psMetadataGetPrevious(psMetadata * restrict md, // /< Metadata collection to iterate.
+                                      const char *restrict match,       // /< Beginning of key name.
+                                      int which // /< Iterator to be used.
+                                     );
 
 /** Print metadata item to file.
@@ -248,9 +240,8 @@
  * @return psMetadataItem*: Pointer metadata item.
  */
-void psMetadataItemPrint(
-    FILE *fd,                                       ///< Pointer to file to write metadata item.
-    const char *format,                             ///< Format to print metadata item.
-    const psMetadataItem *restrict metadataItem     ///< Metadata item to print.
-);
+void psMetadataItemPrint(FILE * fd,     // /< Pointer to file to write metadata item.
+                         const char *format,    // /< Format to print metadata item.
+                         const psMetadataItem * restrict metadataItem   // /< Metadata item to print.
+                        );
 
 /** Read metadata header.
@@ -261,10 +252,9 @@
  * @return psMetadata*: Pointer metadata.
  */
-psMetadata *psMetadataReadHeader(
-    psMetadata *output,                     ///< Resulting metadata from read.
-    char *extname,                          ///< File name extension string.
-    int extnum,                             ///< File name extension number. Starts at 1.
-    char *filename                          ///< Name of file to read.
-);
+psMetadata *psMetadataReadHeader(psMetadata * output,   // /< Resulting metadata from read.
+                                 char *extname, // /< File name extension string.
+                                 int extnum,    // /< File name extension number. Starts at 1.
+                                 char *filename // /< Name of file to read.
+                                );
 
 /** Read metadata header.
@@ -274,10 +264,10 @@
  * @return psMetadata*: Pointer metadata.
  */
-psMetadata *psMetadataFReadHeader(
-    psMetadata *output,                     ///< Resulting metadata from read.
-    char *extName,                          ///< File name extension string.
-    int extNum,                             ///< File name extension number.
-    fitsfile *fd                            ///< Pointer to file to read.
-);
+psMetadata *psMetadataFReadHeader(psMetadata * output,  // /< Resulting metadata from read.
+                                  char *extName,        // /< File name extension string.
+                                  int extNum,   // /< File name extension number.
+                                  fitsfile * fd // /< Pointer to file to read.
+                                 );
+
 /// @}
 
Index: /trunk/psLib/src/astronomy/psPhotometry.h
===================================================================
--- /trunk/psLib/src/astronomy/psPhotometry.h	(revision 1406)
+++ /trunk/psLib/src/astronomy/psPhotometry.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psPhotometry.h
 *
@@ -9,18 +10,18 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 23:37:39 $
+*  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
 */
 
-# ifndef PS_PHOTOMETRIC_H
-# define PS_PHOTOMETRIC_H
+#ifndef PS_PHOTOMETRIC_H
+#    define PS_PHOTOMETRIC_H
 
-#include "psType.h"
-#include "psImage.h"
-#include "psArray.h"
-#include "psList.h"
-#include "psFunctions.h"
+#    include "psType.h"
+#    include "psImage.h"
+#    include "psArray.h"
+#    include "psList.h"
+#    include "psFunctions.h"
 
 /// @addtogroup Photometry
@@ -42,9 +43,9 @@
 typedef struct
 {
-    const int ID;                  ///< ID number for this photometric system
-    const char *name;              ///< Name of photometric system
-    const char *camera;            ///< Camera for photometric system
-    const char *filter;            ///< Filter used for photometric system
-    const char *detector;          ///< Detector used for photometric system
+    const int ID;               // /< ID number for this photometric system
+    const char *name;           // /< Name of photometric system
+    const char *camera;         // /< Camera for photometric system
+    const char *filter;         // /< Filter used for photometric system
+    const char *detector;       // /< Detector used for photometric system
 }
 psPhotSystem;
@@ -58,13 +59,13 @@
 typedef struct
 {
-    psPhotSystem src;                  ///< Source photometric system
-    psPhotSystem dst;                  ///< Destination photometric system
-    psPhotSystem pP;                   ///< Primary color reference
-    psPhotSystem pM;                   ///< Primary color reference
-    psPhotSystem sP;                   ///< Secondary color reference
-    psPhotSystem sM;                   ///< Secondary color reference
-    float pA;                          ///< Color offset for references
-    float sA;                          ///< Color offset for references
-    psPolynomial3D transform;          ///< Transformation from source to destination
+    psPhotSystem src;           // /< Source photometric system
+    psPhotSystem dst;           // /< Destination photometric system
+    psPhotSystem pP;            // /< Primary color reference
+    psPhotSystem pM;            // /< Primary color reference
+    psPhotSystem sP;            // /< Secondary color reference
+    psPhotSystem sM;            // /< Secondary color reference
+    float pA;                   // /< Color offset for references
+    float sA;                   // /< Color offset for references
+    psPolynomial3D transform;   // /< Transformation from source to destination
 }
 psPhotTransform;
Index: /trunk/psLib/src/astronomy/psTime.c
===================================================================
--- /trunk/psLib/src/astronomy/psTime.c	(revision 1406)
+++ /trunk/psLib/src/astronomy/psTime.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psTime.c
  *
@@ -12,13 +13,14 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
 
-
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 
@@ -32,5 +34,7 @@
 
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
@@ -73,6 +77,9 @@
 }                                                                                                            \
 
+
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -80,5 +87,7 @@
 
 /*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
+
 /*****************************************************************************/
 
@@ -86,5 +95,7 @@
 
 /*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
+
 /*****************************************************************************/
 
@@ -119,79 +130,57 @@
 
 // Table for Julian date of leapsecond update and current total number of leapseconds at that date
-static double leapseconds[NUM_LEAPSECOND_UPDATES][2] =
-    {
-        {
-            2441317.5, 10.0
-        },
-        {
-            2441499.5, 11.0
-        },
-        {
-            2441683.5, 12.0
-        },
-        {
-            2442048.5, 13.0
-        },
-        {
-            2442413.5, 14.0
-        },
-        {
-            2442778.5, 15.0
-        },
-        {
-            2443144.5, 16.0
-        },
-        {
-            2443509.5, 17.0
-        },
-        {
-            2443874.5, 18.0
-        },
-        {
-            2444239.5, 19.0
-        },
-        {
-            2444786.5, 20.0
-        },
-        {
-            2445151.5, 21.0
-        },
-        {
-            2445516.5, 22.0
-        },
-        {
-            2446247.5, 23.0
-        },
-        {
-            2447161.5, 24.0
-        },
-        {
-            2447892.5, 25.0
-        },
-        {
-            2448257.5, 26.0
-        },
-        {
-            2448804.5, 27.0
-        },
-        {
-            2449169.5, 28.0
-        },
-        {
-            2449534.5, 29.0
-        },
-        {
-            2450083.5, 30.0
-        },
-        {
-            2450630.5, 31.0
-        },
-        {
-            2451179.5, 32.0
-        }
-    };
-
-/*****************************************************************************/
+static double leapseconds[NUM_LEAPSECOND_UPDATES][2] = {
+            {
+                2441317.5, 10.0},
+            {
+                2441499.5, 11.0},
+            {
+                2441683.5, 12.0},
+            {
+                2442048.5, 13.0},
+            {
+                2442413.5, 14.0},
+            {
+                2442778.5, 15.0},
+            {
+                2443144.5, 16.0},
+            {
+                2443509.5, 17.0},
+            {
+                2443874.5, 18.0},
+            {
+                2444239.5, 19.0},
+            {
+                2444786.5, 20.0},
+            {
+                2445151.5, 21.0},
+            {
+                2445516.5, 22.0},
+            {
+                2446247.5, 23.0},
+            {
+                2447161.5, 24.0},
+            {
+                2447892.5, 25.0},
+            {
+                2448257.5, 26.0},
+            {
+                2448804.5, 27.0},
+            {
+                2449169.5, 28.0},
+            {
+                2449534.5, 29.0},
+            {
+                2450083.5, 30.0},
+            {
+                2450630.5, 31.0},
+            {
+                2451179.5, 32.0}
+        };
+
+/*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
+
 /*****************************************************************************/
 
@@ -199,5 +188,7 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
+
 /*****************************************************************************/
 
@@ -210,9 +201,8 @@
     time.tv_usec = 0;
 
-    if(gettimeofday(&now,(struct timezone *) 0) == -1) {
+    if (gettimeofday(&now, (struct timezone *)0) == -1) {
         psError(__func__, " : Line %d - Failed to get time", __LINE__);
         return time;
     }
-
     // Convert timeval time to psTime
     time.tv_sec = now.tv_sec;
@@ -220,10 +210,10 @@
 
     // Add most current leapseconds value to UTC time to get TAI time
-    time.tv_sec += leapseconds[NUM_LEAPSECOND_UPDATES-1][1];
+    time.tv_sec += leapseconds[NUM_LEAPSECOND_UPDATES - 1][1];
 
     return time;
 }
 
-char* psTimeToISO(psTime time)
+char *psTimeToISO(psTime time)
 {
     int ms = 0;
@@ -232,5 +222,5 @@
     struct tm *tmTime = NULL;
 
-    CHECK_NEGATIVE_TIME_STRUCT(time,NULL);
+    CHECK_NEGATIVE_TIME_STRUCT(time, NULL);
 
     tempString = psAlloc(MAX_TIME_STRING_LENGTH);
@@ -238,13 +228,13 @@
 
     // Converts psTime to YYYY/MM/DD,HH:MM:SS.SSS in string form
-    ms = time.tv_usec/1000;
+    ms = time.tv_usec / 1000;
 
     // tmTime variable is statically allocated, no need to free
     tmTime = gmtime(&time.tv_sec);
-    if(!strftime(tempString, MAX_TIME_STRING_LENGTH, "%Y/%m/%d,%H:%M:%S", tmTime)) {
+    if (!strftime(tempString, MAX_TIME_STRING_LENGTH, "%Y/%m/%d,%H:%M:%S", tmTime)) {
         psError(__func__, " : Line %d - Failed strftime conversion", __LINE__);
     }
 
-    if(snprintf(timeString,MAX_TIME_STRING_LENGTH,"%s.%3.3d", tempString, ms) < 0) {
+    if (snprintf(timeString, MAX_TIME_STRING_LENGTH, "%s.%3.3d", tempString, ms) < 0) {
         psError(__func__, " : Line %d - Failed snprintf conversion", __LINE__);
     }
@@ -262,11 +252,11 @@
     psTime outTime;
 
-    CHECK_NEGATIVE_TIME_STRUCT(time,outTime);
+    CHECK_NEGATIVE_TIME_STRUCT(time, outTime);
 
     // Find leapseconds to subtract from psTime to get UTC time
     jd = psTimeToJD(time);
     jdTable = leapseconds[0];
-    for(i=0; i<NUM_LEAPSECOND_UPDATES; i++, jdTable+=2) {
-        if(jd > *jdTable) {
+    for (i = 0; i < NUM_LEAPSECOND_UPDATES; i++, jdTable += 2) {
+        if (jd > *jdTable) {
             ls = *(jdTable + 1);
         }
@@ -276,5 +266,5 @@
     outTime.tv_usec = time.tv_usec;
 
-    CHECK_NEGATIVE_TIME_STRUCT(outTime,outTime);
+    CHECK_NEGATIVE_TIME_STRUCT(outTime, outTime);
 
     return outTime;
@@ -285,8 +275,8 @@
     double mjd = 0.0;
 
-    CHECK_NEGATIVE_TIME_STRUCT(time,mjd);
+    CHECK_NEGATIVE_TIME_STRUCT(time, mjd);
 
     // Modified Julian date conversion courtesy of Eugene Magnier
-    mjd = time.tv_sec/SEC_PER_DAY + time.tv_usec/USEC_PER_DAY + 40587.0;
+    mjd = time.tv_sec / SEC_PER_DAY + time.tv_usec / USEC_PER_DAY + 40587.0;
 
     return mjd;
@@ -297,8 +287,8 @@
     double jd = 0.0;
 
-    CHECK_NEGATIVE_TIME_STRUCT(time,jd);
+    CHECK_NEGATIVE_TIME_STRUCT(time, jd);
 
     // Julian date conversion courtesy of Eugene Magnier
-    jd = time.tv_sec/SEC_PER_DAY + time.tv_usec/USEC_PER_DAY + 2440587.5;
+    jd = time.tv_sec / SEC_PER_DAY + time.tv_usec / USEC_PER_DAY + 2440587.5;
 
     return jd;
@@ -309,5 +299,5 @@
     struct timeval timevalTime;
 
-    CHECK_NEGATIVE_TIME_STRUCT(time,timevalTime);
+    CHECK_NEGATIVE_TIME_STRUCT(time, timevalTime);
     timevalTime.tv_sec = time.tv_sec;
     timevalTime.tv_usec = time.tv_usec;
@@ -316,9 +306,9 @@
 }
 
-struct tm* psTimeToTM(psTime time)
+struct tm *psTimeToTM(psTime time)
 {
     struct tm *tmTime = NULL;
 
-    CHECK_NEGATIVE_TIME_STRUCT(time,tmTime);
+    CHECK_NEGATIVE_TIME_STRUCT(time, tmTime);
     tmTime = gmtime(&time.tv_sec);
 
@@ -343,42 +333,42 @@
     // Convert YYYY/MM/DD,HH:MM:SS.SSS in string form to tm time
     year = atoi(strtok(tempString, "/"));
-    if(year < 1900) {
-        psError(__func__,"Years less than 1900 not allowed. Value: %d", year);
+    if (year < 1900) {
+        psError(__func__, "Years less than 1900 not allowed. Value: %d", year);
         return outTime;
     }
 
     month = atoi(strtok(NULL, "/"));
-    if(month<1 || month>12) {
-        psError(__func__,"Month must have a value from 1 to 12. Value: %d", month);
+    if (month < 1 || month > 12) {
+        psError(__func__, "Month must have a value from 1 to 12. Value: %d", month);
         return outTime;
     }
 
     day = atoi(strtok(NULL, ","));
-    if(day<1 || day>31) {
-        psError(__func__,"Day must have a value from 1 to 31. Value: %d", day);
+    if (day < 1 || day > 31) {
+        psError(__func__, "Day must have a value from 1 to 31. Value: %d", day);
         return outTime;
     }
 
     hour = atoi(strtok(NULL, ":"));
-    if(hour<0 || hour>23) {
-        psError(__func__,"Hour must have a value from 0 to 23. Value: %d", hour);
+    if (hour < 0 || hour > 23) {
+        psError(__func__, "Hour must have a value from 0 to 23. Value: %d", hour);
         return outTime;
     }
 
     minute = atoi(strtok(NULL, ":"));
-    if(minute<0 || minute>59) {
-        psError(__func__,"Minute must have a value from 0 to 59. Value: %d", minute);
+    if (minute < 0 || minute > 59) {
+        psError(__func__, "Minute must have a value from 0 to 59. Value: %d", minute);
         return outTime;
     }
 
     second = atoi(strtok(NULL, "."));
-    if(second<0 || second>59) {
-        psError(__func__,"Second must have a value from 0 to 59. Value: %d", second);
+    if (second < 0 || second > 59) {
+        psError(__func__, "Second must have a value from 0 to 59. Value: %d", second);
         return outTime;
     }
 
     millisecond = atoi(strtok(NULL, "X"));
-    if(millisecond<0 || millisecond>1000) {
-        psError(__func__,"Millisecond must have a value from 0 to 999. Value: %d", millisecond);
+    if (millisecond < 0 || millisecond > 1000) {
+        psError(__func__, "Millisecond must have a value from 0 to 999. Value: %d", millisecond);
         return outTime;
     }
@@ -394,5 +384,5 @@
     // Convert tm time to psTime
     outTime = psTMToTime(&tmTime);
-    outTime.tv_usec = millisecond*1000;
+    outTime.tv_usec = millisecond * 1000;
 
     return outTime;
@@ -403,10 +393,10 @@
     psTime outTime;
 
-    CHECK_NEGATIVE_TIME_STRUCT(time,outTime);
+    CHECK_NEGATIVE_TIME_STRUCT(time, outTime);
 
     // Convert UTC time to psTime/TAI
-    outTime.tv_sec = time.tv_sec + leapseconds[NUM_LEAPSECOND_UPDATES-1][1];
+    outTime.tv_sec = time.tv_sec + leapseconds[NUM_LEAPSECOND_UPDATES - 1][1];
     outTime.tv_usec = time.tv_usec;
-    CHECK_NEGATIVE_TIME_STRUCT(outTime,outTime);
+    CHECK_NEGATIVE_TIME_STRUCT(outTime, outTime);
 
     return outTime;
@@ -419,5 +409,5 @@
     double seconds = 0.0;
 
-    CHECK_NEGATIVE_TIME(time,outTime);
+    CHECK_NEGATIVE_TIME(time, outTime);
 
     // Modified Julian date conversion courtesy of Eugene Magnier
@@ -425,9 +415,9 @@
 
     // Convert to psTime/TAI
-    seconds = days*SEC_PER_DAY;
-    outTime.tv_usec = (seconds -(long)seconds)*1000000.0;
+    seconds = days * SEC_PER_DAY;
+    outTime.tv_usec = (seconds - (long)seconds) * 1000000.0;
     outTime.tv_sec = seconds;
 
-    CHECK_NEGATIVE_TIME_STRUCT(outTime,outTime);
+    CHECK_NEGATIVE_TIME_STRUCT(outTime, outTime);
 
     return outTime;
@@ -440,5 +430,5 @@
     psTime outTime;
 
-    CHECK_NEGATIVE_TIME(time,outTime);
+    CHECK_NEGATIVE_TIME(time, outTime);
 
     // Julian date conversion courtesy of Eugene Magnier
@@ -446,106 +436,96 @@
 
     // Convert to psTime/TAI
-    seconds = days*SEC_PER_DAY;
+    seconds = days * SEC_PER_DAY;
     outTime.tv_sec = seconds;
-    outTime.tv_usec = (seconds -(long)seconds)*1000000.0;
-
-    CHECK_NEGATIVE_TIME_STRUCT(outTime,outTime);
-
-    return outTime;
-}
-
-psTime psTimevalToTime(struct timeval *time)
-{
-    psTime outTime;
-    if(time == NULL)
-    {
-        psError(__func__,"Null value for timeval arg not allowed");
-        return outTime;
-    } else
-        if(time->tv_sec < 0)
-        {
-            psError(__func__,"Negative seconds are not allowed: %ld", time->tv_sec);
-            return outTime;
-        } else
-            if(time->tv_usec<0)
-            {
-                psError(__func__,"Negative microseconds are not allowed: %ld", time->tv_usec);
-                return outTime;
-            }
-
+    outTime.tv_usec = (seconds - (long)seconds) * 1000000.0;
+
+    CHECK_NEGATIVE_TIME_STRUCT(outTime, outTime);
+
+    return outTime;
+}
+
+psTime psTimevalToTime(struct timeval * time)
+{
+    psTime outTime;
+
+    if (time == NULL)
+    {
+        psError(__func__, "Null value for timeval arg not allowed");
+        return outTime;
+    } else if (time->tv_sec < 0)
+    {
+        psError(__func__, "Negative seconds are not allowed: %ld", time->tv_sec);
+        return outTime;
+    } else if (time->tv_usec < 0)
+    {
+        psError(__func__, "Negative microseconds are not allowed: %ld", time->tv_usec);
+        return outTime;
+    }
     // Convert to psTime/TAI
     outTime.tv_sec = time->tv_sec;
     outTime.tv_usec = time->tv_usec;
 
-    CHECK_NEGATIVE_TIME_STRUCT(outTime,outTime);
-
-    return outTime;
-}
-
-
-psTime psTMToTime(struct tm *time)
+    CHECK_NEGATIVE_TIME_STRUCT(outTime, outTime);
+
+    return outTime;
+}
+
+psTime psTMToTime(struct tm * time)
 {
     int i;
     int n;
     int y;
-    int mon [] =
-        {
-            31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
-        };
+    int mon[] = {
+                    31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
+                };
     long epoch;
     psTime outTime;
 
-    i= 0;
+    i = 0;
     n = 0;
     y = 0;
     epoch = 0;
 
-    if(time == NULL)
-    {
-        psError(__func__,"Null value for tm arg not allowed");
-        return outTime;
-    } else
-        if(time->tm_year < 70)
-        {
-            psError(__func__,"Input times earlier than 1970 not allowed. Value: %d", time->tm_year+1900);
-            return outTime;
-        } else
-            if(time->tm_mon<0 || time->tm_mon>11)
-            {
-                psError(__func__,"Month must have a value from 0 to 11. Value: %d", time->tm_mon);
-                return outTime;
-            } else
-                if(time->tm_mday<1 || time->tm_mday>31)
-                {
-                    psError(__func__,"Day must have a value from 1 to 31. Value: %d", time->tm_mday);
-                    return outTime;
-                } else
-                    if(time->tm_hour<0 || time->tm_hour>23)
-                    {
-                        psError(__func__,"Hour must have a value from 0 to 23. Value: %d", time->tm_hour);
-                        return outTime;
-                    } else
-                        if(time->tm_min<0 || time->tm_min>59)
-                        {
-                            psError(__func__,"Minute must have a value from 0 to 59. Value: %d", time->tm_min);
-                            return outTime;
-                        } else
-                            if(time->tm_sec<0 || time->tm_sec>59)
-                            {
-                                psError(__func__,"Second must have a value from 0 to 59. Value: %d", time->tm_sec);
-                                return outTime;
-                            }
+    if (time == NULL)
+    {
+        psError(__func__, "Null value for tm arg not allowed");
+        return outTime;
+    } else if (time->tm_year < 70)
+    {
+        psError(__func__, "Input times earlier than 1970 not allowed. Value: %d", time->tm_year + 1900);
+        return outTime;
+    } else if (time->tm_mon < 0 || time->tm_mon > 11)
+    {
+        psError(__func__, "Month must have a value from 0 to 11. Value: %d", time->tm_mon);
+        return outTime;
+    } else if (time->tm_mday < 1 || time->tm_mday > 31)
+    {
+        psError(__func__, "Day must have a value from 1 to 31. Value: %d", time->tm_mday);
+        return outTime;
+    } else if (time->tm_hour < 0 || time->tm_hour > 23)
+    {
+        psError(__func__, "Hour must have a value from 0 to 23. Value: %d", time->tm_hour);
+        return outTime;
+    } else if (time->tm_min < 0 || time->tm_min > 59)
+    {
+        psError(__func__, "Minute must have a value from 0 to 59. Value: %d", time->tm_min);
+        return outTime;
+    } else if (time->tm_sec < 0 || time->tm_sec > 59)
+    {
+        psError(__func__, "Second must have a value from 0 to 59. Value: %d", time->tm_sec);
+        return outTime;
+    }
 
     n = time->tm_year + 1900 - 1;
-    epoch = (time->tm_year - 70) * SEC_PER_YEAR + ((n/4 - n/100 + n/400) -
-            (1969/4 - 1969/100 + 1969/400)) * SEC_PER_DAY;
+    epoch = (time->tm_year - 70) * SEC_PER_YEAR + ((n / 4 - n / 100 + n / 400) -
+            (1969 / 4 - 1969 / 100 + 1969 / 400)) * SEC_PER_DAY;
 
     y = time->tm_year + 1900;
 
     // Adjust for leap years
-    for(i = 0; i<time->tm_mon; i++)
-    {
-        epoch += mon [i] * SEC_PER_DAY;
-        if(i == 1 && y % 4 == 0 && (y % 100 != 0 || y % 400 == 0)) {
+    for (i = 0; i < time->tm_mon; i++)
+    {
+        epoch += mon[i] * SEC_PER_DAY;
+        if (i == 1 && y % 4 == 0 && (y % 100 != 0 || y % 400 == 0)) {
             epoch += SEC_PER_DAY;
         }
@@ -554,5 +534,5 @@
     // Add everything
     epoch += (time->tm_mday - 1) * SEC_PER_DAY;
-    epoch += time->tm_hour *SEC_PER_HOUR + time->tm_min * SEC_PER_MINUTE + time->tm_sec;
+    epoch += time->tm_hour * SEC_PER_HOUR + time->tm_min * SEC_PER_MINUTE + time->tm_sec;
 
     // Create psTime
@@ -560,6 +540,6 @@
     outTime.tv_sec = epoch;
 
-    CHECK_NEGATIVE_TIME_STRUCT(outTime,outTime);
-
-    return outTime;
-}
+    CHECK_NEGATIVE_TIME_STRUCT(outTime, outTime);
+
+    return outTime;
+}
Index: /trunk/psLib/src/astronomy/psTime.h
===================================================================
--- /trunk/psLib/src/astronomy/psTime.h	(revision 1406)
+++ /trunk/psLib/src/astronomy/psTime.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psTime.h
  *
@@ -12,6 +13,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -19,11 +20,11 @@
 
 #ifndef PSTIME_H
-#define PSTIME_H
-
-#include <time.h>
-#include <sys/types.h>
-#include <sys/time.h>
-
-#include "psType.h"
+#    define PSTIME_H
+
+#    include <time.h>
+#    include <sys/types.h>
+#    include <sys/time.h>
+
+#    include "psType.h"
 
 /// @addtogroup Time
@@ -31,5 +32,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -42,11 +45,15 @@
 typedef struct
 {
-    time_t        tv_sec;    /**< Seconds since epoch, Jan 1, 1970. */
-    suseconds_t   tv_usec;   /**< Microseconds since last second. */
+
+    time_t tv_sec;           /**< Seconds since epoch, Jan 1, 1970. */
+
+    suseconds_t tv_usec;     /**< Microseconds since last second. */
 }
 psTime;
 
 /*****************************************************************************/
+
 /* FUNCTION PROTOTYPES                                                       */
+
 /*****************************************************************************/
 
@@ -57,7 +64,8 @@
  *  @return  psTime: Struct with current time.
  */
-psTime psTimeGetTime(
-    void   /** No argument. */
-);
+
+psTime psTimeGetTime(void
+                     /** No argument. */
+                    );
 
 /** Convert psTime to ISO time in TAI units.
@@ -68,7 +76,8 @@
  *  @return  char*: Pointer null terminated array of chars in ISO time.
  */
-char* psTimeToISO(
-    psTime time     /** Input time to be converted. */
-);
+
+char *psTimeToISO(psTime time
+                  /** Input time to be converted. */
+                 );
 
 /** Convert psTime to UTC time.
@@ -80,7 +89,8 @@
  *  @return  psTime: UTC time psTime format.
  */
-psTime psTimeToUTC(
-    psTime time    /** Input time to be converted. */
-);
+
+psTime psTimeToUTC(psTime time
+                   /** Input time to be converted. */
+                  );
 
 /** Convert psTime to modified Julian date time.
@@ -91,7 +101,8 @@
  *  @return  double: Modified Julian Days (MJD) time.
  */
-double psTimeToMJD(
-    psTime time    /** Input time to be converted. */
-);
+
+double psTimeToMJD(psTime time
+                   /** Input time to be converted. */
+                  );
 
 /** Convert psTime to Julian date time.
@@ -102,7 +113,8 @@
  *  @return  double: Julian Date (JD) time.
  */
-double psTimeToJD(
-    psTime time    /** Input time to be converted. */
-);
+
+double psTimeToJD(psTime time
+                  /** Input time to be converted. */
+                 );
 
 /** Convert psTime to timeval time.
@@ -113,7 +125,8 @@
  *  @return  timeval: timeval struct time.
  */
-struct timeval psTimeToTimeval(
-                psTime time    /** Input time to be converted. */
-            );
+
+struct timeval psTimeToTimeval(psTime time
+                                           /** Input time to be converted. */
+                                          );
 
 /** Convert psTime to tm time.
@@ -124,7 +137,8 @@
  *  @return  tm: tm struct time.
  */
-struct tm* psTimeToTM(
-                psTime time    /** Input time to be converted. */
-            );
+
+struct tm *psTimeToTM(psTime time
+                                  /** Input time to be converted. */
+                                 );
 
 /** Convert ISO to psTime.
@@ -135,7 +149,8 @@
  *  @return  psTime: time
  */
-psTime psISOToTime(
-    char *time  /** Input time to be converted. */
-);
+
+psTime psISOToTime(char *time
+                   /** Input time to be converted. */
+                  );
 
 /** Convert UTC to psTime.
@@ -146,7 +161,8 @@
  *  @return  psTime: time in TAI units.
  */
-psTime psUTCToTime(
-    psTime time /** Input time to be converted. */
-);
+
+psTime psUTCToTime(psTime time
+                   /** Input time to be converted. */
+                  );
 
 /** Convert MJD to psTime.
@@ -157,7 +173,8 @@
  *  @return  psTime: time.
  */
-psTime psMJDToTime(
-    double time /** Input time to be converted. */
-);
+
+psTime psMJDToTime(double time
+                   /** Input time to be converted. */
+                  );
 
 /** Convert JD to psTime.
@@ -168,7 +185,8 @@
  *  @return  psTime: time.
  */
-psTime psJDToTime(
-    double time /** Input time to be converted. */
-);
+
+psTime psJDToTime(double time
+                  /** Input time to be converted. */
+                 );
 
 /** Convert timeval to psTime.
@@ -179,7 +197,8 @@
  *  @return  psTime: time.
  */
-psTime psTimevalToTime(
-    struct timeval *time    /** Input time to be converted. */
-);
+
+psTime psTimevalToTime(struct timeval *time
+                       /** Input time to be converted. */
+                      );
 
 /** Convert tm time to psTime.
@@ -190,7 +209,9 @@
  *  @return  psTime: time.
  */
-psTime psTMToTime(
-    struct tm *time /** Input time to be converted. */
-);
+
+psTime psTMToTime(struct tm *time
+                  /** Input time to be converted. */
+                 );
+
 /// @}
 
Index: /trunk/psLib/src/collections/psArray.c
===================================================================
--- /trunk/psLib/src/collections/psArray.c	(revision 1406)
+++ /trunk/psLib/src/collections/psArray.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psArray.c
  *
@@ -8,6 +9,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -15,7 +16,9 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
-#include<stdlib.h>            // for qsort, etc.
+#include<stdlib.h>                         // for qsort, etc.
 
 #include "psMemory.h"
@@ -24,26 +27,28 @@
 #include "psLogMsg.h"
 
+/*****************************************************************************/
+
+/*  FUNCTION IMPLEMENTATION - LOCAL                                          */
 
 /*****************************************************************************/
-/*  FUNCTION IMPLEMENTATION - LOCAL                                          */
-/*****************************************************************************/
-static void arrayFree(psArray *restrict psArr);
+static void arrayFree(psArray * restrict psArr);
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
+
 /*****************************************************************************/
-psArray* psArrayAlloc(unsigned int nalloc)
+psArray *psArrayAlloc(unsigned int nalloc)
 {
     psArray *psArr = NULL;
 
     // Invalid nalloc
-    if(nalloc < 1) {
+    if (nalloc < 1) {
         psError(__func__, "Invalid value for nalloc. nalloc: %d\n", nalloc);
         return NULL;
     }
-
     // Create vector struct
-    psArr = (psArray *)psAlloc(sizeof(psArray));
-    p_psMemSetDeallocator(psArr,(psFreeFcn)arrayFree);
+    psArr = (psArray *) psAlloc(sizeof(psArray));
+    p_psMemSetDeallocator(psArr, (psFreeFcn) arrayFree);
 
     psArr->nalloc = nalloc;
@@ -51,38 +56,36 @@
 
     // Create vector data array
-    psArr->data = psAlloc(nalloc*sizeof(psPTR));
+    psArr->data = psAlloc(nalloc * sizeof(psPTR));
 
     return psArr;
 }
 
-psArray *psArrayRealloc(unsigned int nalloc, psArray *restrict in)
+psArray *psArrayRealloc(unsigned int nalloc, psArray * restrict in)
 {
     // Invalid nalloc
-    if(nalloc < 1) {
+    if (nalloc < 1) {
         psError(__func__, "Invalid value for realloc (%d)\n", nalloc);
         return NULL;
     }
 
-    if(in == NULL) {
+    if (in == NULL) {
         psError(__func__, "Null input vector\n");
         return NULL;
-    } else
-        if(in->nalloc != nalloc) {                    // No need to realloc to same size
-            if(nalloc < in->n) {
-                for (int i = nalloc; i < in->n; i++) {   // For reduction in vector size
-                    psFree(in->data[i]);
-                }
-                in->n = nalloc;
+    } else if (in->nalloc != nalloc) {     // No need to realloc to same size
+        if (nalloc < in->n) {
+            for (int i = nalloc; i < in->n; i++) {      // For reduction in vector size
+                psFree(in->data[i]);
             }
-
-            // Realloc after decrementation to avoid accessing freed array elements
-            in->data = psRealloc(in->data,nalloc*sizeof(psPTR));
-            in->nalloc = nalloc;
+            in->n = nalloc;
         }
+        // Realloc after decrementation to avoid accessing freed array elements
+        in->data = psRealloc(in->data, nalloc * sizeof(psPTR));
+        in->nalloc = nalloc;
+    }
 
     return in;
 }
 
-static void arrayFree(psArray *restrict psArr)
+static void arrayFree(psArray * restrict psArr)
 {
     if (psArr == NULL) {
@@ -95,12 +98,12 @@
 }
 
-void psArrayElementFree(psArray *restrict psArr)
+void psArrayElementFree(psArray * restrict psArr)
 {
 
-    if(psArr == NULL) {
+    if (psArr == NULL) {
         return;
     }
 
-    for(int i = 0; i < psArr->n; i++) {
+    for (int i = 0; i < psArr->n; i++) {
         psFree(psArr->data[i]);
         psArr->data[i] = NULL;
@@ -108,5 +111,5 @@
 }
 
-psArray* psArraySort(psArray* in, psComparePtrFcn compare)
+psArray *psArraySort(psArray * in, psComparePtrFcn compare)
 {
     if (in == NULL) {
@@ -114,7 +117,5 @@
     }
 
-    qsort(in->data, in->n, sizeof(psPTR),
-          (int(*)(const void *, const void *))compare);
-
+    qsort(in->data, in->n, sizeof(psPTR), (int (*)(const void *, const void *))compare);
 
     return in;
Index: /trunk/psLib/src/collections/psArray.h
===================================================================
--- /trunk/psLib/src/collections/psArray.h	(revision 1406)
+++ /trunk/psLib/src/collections/psArray.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psArray.h
  *
@@ -11,6 +12,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-15 22:18:02 $
+ *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -18,8 +19,8 @@
 
 #ifndef PS_ARRAY_H
-#define PS_ARRAY_H
+#    define PS_ARRAY_H
 
-#include "psType.h"
-#include "psCompare.h"
+#    include "psType.h"
+#    include "psCompare.h"
 
 /// @addtogroup Array
@@ -33,12 +34,14 @@
 typedef struct
 {
-    unsigned int nalloc;                ///< Total number of elements available.
-    unsigned int n;                     ///< Number of elements in use.
-    psPTR* data;                        ///< An Array of pointer elements
+    unsigned int nalloc;        // /< Total number of elements available.
+    unsigned int n;             // /< Number of elements in use.
+    psPTR *data;                // /< An Array of pointer elements
 }
 psArray;
 
 /*****************************************************************************/
+
 /* FUNCTION PROTOTYPES                                                       */
+
 /*****************************************************************************/
 
@@ -51,7 +54,6 @@
  *
  */
-psArray *psArrayAlloc(
-    unsigned int nalloc                 ///< Total number of elements to make available.
-);
+psArray *psArrayAlloc(unsigned int nalloc       // /< Total number of elements to make available.
+                     );
 
 /** Reallocate an array.
@@ -63,8 +65,7 @@
  *
  */
-psArray *psArrayRealloc(
-    unsigned int nalloc,                ///< Total number of elements to make available.
-    psArray *restrict psArr            ///< array to reallocate.
-);
+psArray *psArrayRealloc(unsigned int nalloc,    // /< Total number of elements to make available.
+                        psArray * restrict psArr        // /< array to reallocate.
+                       );
 
 /** Deallocate/Dereference elements of an array.
@@ -75,7 +76,6 @@
  *
  */
-void psArrayElementFree(
-    psArray *restrict psArr    ///< Void pointer array to destroy.
-);
+void psArrayElementFree(psArray * restrict psArr        // /< Void pointer array to destroy.
+                       );
 
 /** Sort the array according to an external compare function.
@@ -86,5 +86,5 @@
  *  @return psArray*       The sorted array.
  */
-psArray* psArraySort(psArray* in, psComparePtrFcn compare);
+psArray *psArraySort(psArray * in, psComparePtrFcn compare);
 
 /// @}
Index: /trunk/psLib/src/collections/psBitSet.c
===================================================================
--- /trunk/psLib/src/collections/psBitSet.c	(revision 1406)
+++ /trunk/psLib/src/collections/psBitSet.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psBitSet.c
  *
@@ -10,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -17,5 +18,7 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 #include <string.h>
@@ -31,32 +34,41 @@
 
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
-/******************************************************************************/
-
-// None
-
-/******************************************************************************/
+
+/******************************************************************************/
+
+// None
+
+/******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
-/******************************************************************************/
-
-// None
-
-/*****************************************************************************/
+
+/******************************************************************************/
+
+// None
+
+/*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
-/*****************************************************************************/
-
-// None
-
-/*****************************************************************************/
+
+/*****************************************************************************/
+
+// None
+
+/*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
-/*****************************************************************************/
-
-// None
-
-/*****************************************************************************/
+
+/*****************************************************************************/
+
+// None
+
+/*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
-/*****************************************************************************/
-static void psBitSetFree(psBitSet *restrict inBitSet);
-
+
+/*****************************************************************************/
+static void psBitSetFree(psBitSet * restrict inBitSet);
 
 /** Private function to create a mask.
@@ -70,7 +82,8 @@
 {
     char mask = (char)0x01;
+
     // Ignore splint warning about negative bit shifts
-    /*@i@*/
-    mask = mask << (bit%8);
+    /* @i@ */
+    mask = mask << (bit % 8);
 
     return mask;
@@ -78,29 +91,31 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
-/*****************************************************************************/
-psBitSet* psBitSetAlloc(int n)
+
+/*****************************************************************************/
+psBitSet *psBitSetAlloc(int n)
 {
     int numBytes = 0;
     psBitSet *newObj = NULL;
 
-    if(n <= 0) {
+    if (n <= 0) {
         psError(__func__, " : Line %d - Allocation size must be > 0: size = %d", __LINE__, n);
         return 0;
     }
 
-    numBytes = ceil(n/8.0);
+    numBytes = ceil(n / 8.0);
     newObj = psAlloc(sizeof(psBitSet));
-    if(newObj == NULL) {
-        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
-    }
-    p_psMemSetDeallocator(newObj,(psFreeFcn)psBitSetFree);
+    if (newObj == NULL) {
+        psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
+    }
+    p_psMemSetDeallocator(newObj, (psFreeFcn) psBitSetFree);
     newObj->n = numBytes;
 
     // Ignore splint warning about releasing pointer members, since they've not been allocated yet
-    /*@i@*/
-    newObj->bits = psAlloc(sizeof(char)*numBytes);
-    if(newObj->bits == NULL) {
-        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
+    /* @i@ */
+    newObj->bits = psAlloc(sizeof(char) * numBytes);
+    if (newObj->bits == NULL) {
+        psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
     }
 
@@ -110,7 +125,7 @@
 }
 
-static void psBitSetFree(psBitSet *restrict inBitSet)
-{
-    if(inBitSet == NULL) {
+static void psBitSetFree(psBitSet * restrict inBitSet)
+{
+    if (inBitSet == NULL) {
         psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__);
         return;
@@ -119,23 +134,20 @@
 }
 
-psBitSet* psBitSetSet(psBitSet *inBitSet, int bit)
-{
-    char* byte = NULL;
-
-    if(inBitSet == NULL) {
+psBitSet *psBitSetSet(psBitSet * inBitSet, int bit)
+{
+    char *byte = NULL;
+
+    if (inBitSet == NULL) {
         psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__);
         return inBitSet;
-    } else
-        if(bit < 0) {
-            psError(__func__, " : Line %d - Bit position too small: %d", __LINE__, bit);
-            return inBitSet;
-        } else
-            if(bit > inBitSet->n*8-1) {
-                psError(__func__, " : Line %d - Bit position too large: %d", __LINE__, bit);
-                return inBitSet;
-            }
-
+    } else if (bit < 0) {
+        psError(__func__, " : Line %d - Bit position too small: %d", __LINE__, bit);
+        return inBitSet;
+    } else if (bit > inBitSet->n * 8 - 1) {
+        psError(__func__, " : Line %d - Bit position too large: %d", __LINE__, bit);
+        return inBitSet;
+    }
     // Variable byte is the byte in the array that contains the bit to be set
-    byte = inBitSet->bits+bit/8;
+    byte = inBitSet->bits + bit / 8;
     *byte |= mask(bit);
 
@@ -143,24 +155,21 @@
 }
 
-bool psBitSetTest(const psBitSet *inBitSet, int bit)
-{
-    char* byte = NULL;
-
-    if(inBitSet == NULL) {
-        psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__);
-        return 0;
-    } else
-        if(bit < 0) {
-            psError(__func__, " : Line %d - Bit position too small: %d", __LINE__, bit);
-            return 0;
-        } else
-            if(bit > inBitSet->n*8-1) {
-                psError(__func__, " : Line %d - Bit position too large: %d", __LINE__, bit);
-                return 0;
-            }
-
+bool psBitSetTest(const psBitSet * inBitSet, int bit)
+{
+    char *byte = NULL;
+
+    if (inBitSet == NULL) {
+        psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__);
+        return 0;
+    } else if (bit < 0) {
+        psError(__func__, " : Line %d - Bit position too small: %d", __LINE__, bit);
+        return 0;
+    } else if (bit > inBitSet->n * 8 - 1) {
+        psError(__func__, " : Line %d - Bit position too large: %d", __LINE__, bit);
+        return 0;
+    }
     // Variable byte is the byte in the array that contains the bit to be tested
-    byte = inBitSet->bits+bit/8;
-    if((int)(*byte&mask(bit)) == 0) {
+    byte = inBitSet->bits + bit / 8;
+    if ((int)(*byte & mask(bit)) == 0) {
         return 0;
     }
@@ -169,6 +178,6 @@
 }
 
-psBitSet* psBitSetOp(psBitSet *outBitSet, const psBitSet *restrict inBitSet1, char *operator,
-                     const psBitSet *restrict inBitSet2)
+psBitSet *psBitSetOp(psBitSet * outBitSet, const psBitSet * restrict inBitSet1, char *operator,
+                     const psBitSet * restrict inBitSet2)
 {
     int i = 0;
@@ -179,24 +188,24 @@
     char *inBits2 = NULL;
 
-    if(inBitSet1 == NULL) {
+    if (inBitSet1 == NULL) {
         psError(__func__, " : Line %d - Null psBitSet for inBitSet1 argument", __LINE__);
         return outBitSet;
     }
 
-    if(operator == NULL) {
+    if (operator == NULL) {
         psError(__func__, " : Line %d - Null input operator\n", __LINE__);
         return outBitSet;
     }
 
-    if(inBitSet2 == NULL) {
+    if (inBitSet2 == NULL) {
         psError(__func__, " : Line %d - Null psBitSet for inBitSet2 argument", __LINE__);
         return outBitSet;
     }
 
-    if(outBitSet == NULL) {
-        outBitSet = psBitSetAlloc(inBitSet1->n*8);
-    }
-
-    if(inBitSet1->n != inBitSet2->n || outBitSet->n != inBitSet1->n) {
+    if (outBitSet == NULL) {
+        outBitSet = psBitSetAlloc(inBitSet1->n * 8);
+    }
+
+    if (inBitSet1->n != inBitSet2->n || outBitSet->n != inBitSet1->n) {
         psError(__func__, " : Line %d - psBitSet sizes not the same", __LINE__);
         return outBitSet;
@@ -209,17 +218,17 @@
 
     tempChar = toupper(operator[0]);
-    switch(tempChar) {
+    switch (tempChar) {
     case 'A':
-        for(i=0; i<n; i++) {
+        for (i = 0; i < n; i++) {
             outBits[i] = inBits1[i] & inBits2[i];
         }
         break;
     case 'O':
-        for(i=0; i<n; i++) {
+        for (i = 0; i < n; i++) {
             outBits[i] = inBits1[i] | inBits2[i];
         }
         break;
     case 'X':
-        for(i=0; i<n; i++) {
+        for (i = 0; i < n; i++) {
             outBits[i] = inBits1[i] ^ inBits2[i];
         }
@@ -232,5 +241,5 @@
 }
 
-psBitSet* psBitSetNot(psBitSet *outBitSet, const psBitSet *restrict inBitSet)
+psBitSet *psBitSetNot(psBitSet * outBitSet, const psBitSet * restrict inBitSet)
 {
     int i = 0;
@@ -239,5 +248,5 @@
     char *inBits = NULL;
 
-    if(inBitSet == NULL) {
+    if (inBitSet == NULL) {
         psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__);
         return outBitSet;
@@ -245,14 +254,14 @@
 
     n = inBitSet->n;
-    if(n == 0) {
+    if (n == 0) {
         psError(__func__, " : Line %d - No elements in inBitSet", __LINE__);
         return outBitSet;
     }
 
-    if(outBitSet == NULL) {
-        outBitSet = psBitSetAlloc(n*8);
-    }
-
-    if(inBitSet->n != outBitSet->n) {
+    if (outBitSet == NULL) {
+        outBitSet = psBitSetAlloc(n * 8);
+    }
+
+    if (inBitSet->n != outBitSet->n) {
         psError(__func__, " : Line %d - psBitSet sizes not the same", __LINE__);
         return outBitSet;
@@ -262,5 +271,5 @@
     inBits = inBitSet->bits;
 
-    for(i=0; i<n; i++) {
+    for (i = 0; i < n; i++) {
         outBits[i] = ~inBits[i];
     }
@@ -269,15 +278,16 @@
 }
 
-char *psBitSetToString(const psBitSet *restrict inBitSet)
+char *psBitSetToString(const psBitSet * restrict inBitSet)
 {
     int i = 0;
-    int numBits = inBitSet->n*8;
-    char* outString = psAlloc((size_t)numBits+1);
-    if(outString == NULL) {
-        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
-    }
-
-    for(i=0; i<numBits; i++) {
-        outString[numBits-i-1] = (psBitSetTest(inBitSet, i) == 1)?'1':'0';
+    int numBits = inBitSet->n * 8;
+    char *outString = psAlloc((size_t) numBits + 1);
+
+    if (outString == NULL) {
+        psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
+    }
+
+    for (i = 0; i < numBits; i++) {
+        outString[numBits - i - 1] = (psBitSetTest(inBitSet, i) == 1) ? '1' : '0';
     }
 
Index: /trunk/psLib/src/collections/psBitSet.h
===================================================================
--- /trunk/psLib/src/collections/psBitSet.h	(revision 1406)
+++ /trunk/psLib/src/collections/psBitSet.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psBitSet.h
  *
@@ -12,6 +13,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-01 21:48:11 $
+ *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -19,5 +20,5 @@
 
 #ifndef PSBITSET_H
-#define PSBITSET_H
+#    define PSBITSET_H
 
 /// @addtogroup BitSet
@@ -25,5 +26,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -35,5 +38,7 @@
 typedef struct
 {
+
     int n;      /**< Number of bytes in the array */
+
     char *bits; /**< Aray of bytes holding bits */
 }
@@ -41,5 +46,7 @@
 
 /*****************************************************************************/
+
 /* FUNCTION PROTOTYPES                                                       */
+
 /*****************************************************************************/
 
@@ -51,8 +58,10 @@
  *  @return  psBitSet*: Pointer to struct containing array of bits and size of array.
  */
+
 /*@null@*/
-psBitSet* psBitSetAlloc(
-    int n   /**< Number of bits in psBitSet array */
-);
+
+psBitSet *psBitSetAlloc(int n
+                        /**< Number of bits in psBitSet array */
+                       );
 
 /** Set a bit.
@@ -64,7 +73,10 @@
  *  @return  psBitSet*: Pointer to struct containing psBitSet.
  */
-psBitSet* psBitSetSet(
-    /*@returned@*/psBitSet *restrict inMask,  /**< Pointer to psBitSet to be set. */
-    int bit                     /**< Bit to be set. */
+psBitSet *psBitSetSet(
+
+    /* @returned@ */ psBitSet * restrict inMask,
+    /**< Pointer to psBitSet to be set. */
+
+    int bit/**< Bit to be set. */
 );
 
@@ -78,8 +90,10 @@
  *  @return  int: Value of bit, either one or zero.
  */
-bool psBitSetTest(
-    const psBitSet *restrict inMask,    /**< Pointer psBitSet to be tested. */
-    int bit                             /**< Bit to be tested. */
-);
+
+bool psBitSetTest(const psBitSet * restrict inMask,
+                  /**< Pointer psBitSet to be tested. */
+
+                  int bit               /**< Bit to be tested. */
+                 );
 
 /** Perform a binary operation on two psBitSets
@@ -90,9 +104,16 @@
  *  @return  psBitSet*: Pointer to struct containing result of binary operation.
  */
-psBitSet* psBitSetOp(
-    /*@returned@*/psBitSet *restrict outMask,   /**< Resulting psBitSet from binary operation */
-    const psBitSet *restrict inMask1,           /**< First psBitSet on which to operate */
-    char *operator,                             /**< Bit operation */
-    const psBitSet *restrict inMask2            /**< First psBitSet on which to operate */
+psBitSet *psBitSetOp(
+
+    /* @returned@ */ psBitSet * restrict outMask,
+    /**< Resulting psBitSet from binary operation */
+
+    const psBitSet * restrict inMask1,
+    /**< First psBitSet on which to operate */
+
+    char *operator,         /**< Bit operation */
+
+    const psBitSet * restrict inMask2
+    /**< First psBitSet on which to operate */
 );
 
@@ -103,8 +124,11 @@
  *  @return  psBitSet*: Pointer to struct containing result of operation.
  */
-psBitSet* psBitSetNot(
-    psBitSet *outBitSet,                /**< Resulting psBitSet from operation */
-    const psBitSet *restrict inBitSet   /**< Input psBitSet */
-);
+
+psBitSet *psBitSetNot(psBitSet * outBitSet,
+                      /**< Resulting psBitSet from operation */
+
+                      const psBitSet * restrict inBitSet
+                      /**< Input psBitSet */
+                     );
 
 /** Convert the psBitSet to a string of ones and zeros.
@@ -115,7 +139,8 @@
  *  @return  char*: Pointer to character array containing string data.
  */
-char *psBitSetToString(
-    const psBitSet *restrict inMask /**< psBitSet to convert */
-);
+
+char *psBitSetToString(const psBitSet * restrict inMask
+                       /**< psBitSet to convert */
+                      );
 
 /// @}
Index: /trunk/psLib/src/collections/psCompare.c
===================================================================
--- /trunk/psLib/src/collections/psCompare.c	(revision 1406)
+++ /trunk/psLib/src/collections/psCompare.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file psCompare.c
  *  @brief Comparison functions for sorting routines
@@ -6,6 +7,6 @@
  *  @author Robert Daniel DeSonia, MHPCC
  *
- *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-05 19:38:52 $
+ *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/collections/psCompare.h
===================================================================
--- /trunk/psLib/src/collections/psCompare.h	(revision 1406)
+++ /trunk/psLib/src/collections/psCompare.h	(revision 1407)
@@ -1,4 +1,4 @@
 #if !defined(PS_COMPARE_H)
-#define PS_COMPARE_H
+#    define PS_COMPARE_H
 
 /** @file psCompare.h
@@ -9,6 +9,6 @@
  *  @ingroup Compare
  *
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-28 20:36:37 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -26,5 +26,5 @@
  *                   than, equal to, or greater than the second. 
  */
-typedef int (*psComparePtrFcn)(const void** a, const void** b);
+typedef int (*psComparePtrFcn) (const void **a, const void **b);
 
 /** A comparison function for sorting.
@@ -34,5 +34,5 @@
  *                   than, equal to, or greater than the second. 
  */
-typedef int (*psCompareFcn)(const void* a, const void* b);
+typedef int (*psCompareFcn) (const void *a, const void *b);
 
 /** Compare function of psS8 data.  For use with psListSort.
@@ -42,5 +42,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareS8Ptr(const void** a, const void** b);
+int psCompareS8Ptr(const void **a, const void **b);
 
 /** Compare function of psS16 data.  For use with psListSort.
@@ -50,5 +50,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareS16Ptr(const void** a, const void** b);
+int psCompareS16Ptr(const void **a, const void **b);
 
 /** Compare function of psS32 data.  For use with psListSort.
@@ -58,5 +58,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareS32Ptr(const void** a, const void** b);
+int psCompareS32Ptr(const void **a, const void **b);
 
 /** Compare function of psS64 data.  For use with psListSort.
@@ -66,5 +66,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareS64Ptr(const void** a, const void** b);
+int psCompareS64Ptr(const void **a, const void **b);
 
 /** Compare function of psU8 data.  For use with psListSort.
@@ -74,5 +74,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareU8Ptr(const void** a, const void** b);
+int psCompareU8Ptr(const void **a, const void **b);
 
 /** Compare function of psU16 data.  For use with psListSort.
@@ -82,5 +82,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareU16Ptr(const void** a, const void** b);
+int psCompareU16Ptr(const void **a, const void **b);
 
 /** Compare function of psU32 data.  For use with psListSort.
@@ -90,5 +90,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareU32Ptr(const void** a, const void** b);
+int psCompareU32Ptr(const void **a, const void **b);
 
 /** Compare function of psU64 data.  For use with psListSort.
@@ -98,5 +98,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareU64Ptr(const void** a, const void** b);
+int psCompareU64Ptr(const void **a, const void **b);
 
 /** Compare function of psF32 data.  For use with psListSort.
@@ -106,5 +106,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareF32Ptr(const void** a, const void** b);
+int psCompareF32Ptr(const void **a, const void **b);
 
 /** Compare function of psF64 data.  For use with psListSort.
@@ -114,5 +114,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareF64Ptr(const void** a, const void** b);
+int psCompareF64Ptr(const void **a, const void **b);
 
 /** Compare function of psS8 data.  For use with psListSort for descending ordering.
@@ -122,5 +122,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingS8Ptr(const void** a, const void** b);
+int psCompareDescendingS8Ptr(const void **a, const void **b);
 
 /** Compare function of psS16 data.  For use with psListSort for descending ordering.
@@ -130,5 +130,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingS16Ptr(const void** a, const void** b);
+int psCompareDescendingS16Ptr(const void **a, const void **b);
 
 /** Compare function of psS32 data.  For use with psListSort for descending ordering.
@@ -138,5 +138,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingS32Ptr(const void** a, const void** b);
+int psCompareDescendingS32Ptr(const void **a, const void **b);
 
 /** Compare function of psS64 data.  For use with psListSort for descending ordering.
@@ -146,5 +146,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingS64Ptr(const void** a, const void** b);
+int psCompareDescendingS64Ptr(const void **a, const void **b);
 
 /** Compare function of psU8 data.  For use with psListSort for descending ordering.
@@ -154,5 +154,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingU8Ptr(const void** a, const void** b);
+int psCompareDescendingU8Ptr(const void **a, const void **b);
 
 /** Compare function of psU16 data.  For use with psListSort for descending ordering.
@@ -162,5 +162,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingU16Ptr(const void** a, const void** b);
+int psCompareDescendingU16Ptr(const void **a, const void **b);
 
 /** Compare function of psU32 data.  For use with psListSort for descending ordering.
@@ -170,5 +170,5 @@
  *                   than, equal to, or lessg than the second. 
  */
-int psCompareDescendingU32Ptr(const void** a, const void** b);
+int psCompareDescendingU32Ptr(const void **a, const void **b);
 
 /** Compare function of psU64 data.  For use with psListSort for descending ordering.
@@ -178,5 +178,5 @@
  *                   than, equal to, or lessg than the second. 
  */
-int psCompareDescendingU64Ptr(const void** a, const void** b);
+int psCompareDescendingU64Ptr(const void **a, const void **b);
 
 /** Compare function of psF32 data.  For use with psListSort for descending ordering.
@@ -186,5 +186,5 @@
  *                   than, equal to, or lessg than the second. 
  */
-int psCompareDescendingF32Ptr(const void** a, const void** b);
+int psCompareDescendingF32Ptr(const void **a, const void **b);
 
 /** Compare function of psF64 data.  For use with psListSort for descending ordering.
@@ -194,5 +194,5 @@
  *                   than, equal to, or lessg than the second. 
  */
-int psCompareDescendingF64Ptr(const void** a, const void** b);
+int psCompareDescendingF64Ptr(const void **a, const void **b);
 
 /** Compare function of psS8 data.
@@ -202,5 +202,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareS8(const void* a, const void* b);
+int psCompareS8(const void *a, const void *b);
 
 /** Compare function of psS16 data.
@@ -210,5 +210,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareS16(const void* a, const void* b);
+int psCompareS16(const void *a, const void *b);
 
 /** Compare function of psS32 data.
@@ -218,5 +218,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareS32(const void* a, const void* b);
+int psCompareS32(const void *a, const void *b);
 
 /** Compare function of psS64 data.
@@ -226,5 +226,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareS64(const void* a, const void* b);
+int psCompareS64(const void *a, const void *b);
 
 /** Compare function of psU8 data.
@@ -234,5 +234,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareU8(const void* a, const void* b);
+int psCompareU8(const void *a, const void *b);
 
 /** Compare function of psU16 data.
@@ -242,5 +242,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareU16(const void* a, const void* b);
+int psCompareU16(const void *a, const void *b);
 
 /** Compare function of psU32 data.
@@ -250,5 +250,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareU32(const void* a, const void* b);
+int psCompareU32(const void *a, const void *b);
 
 /** Compare function of psU64 data.
@@ -258,5 +258,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareU64(const void* a, const void* b);
+int psCompareU64(const void *a, const void *b);
 
 /** Compare function of psF32 data.
@@ -266,5 +266,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareF32(const void* a, const void* b);
+int psCompareF32(const void *a, const void *b);
 
 /** Compare function of psF64 data.
@@ -274,5 +274,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareF64(const void* a, const void* b);
+int psCompareF64(const void *a, const void *b);
 
 /** Compare function of psS8 data.
@@ -282,5 +282,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingS8(const void* a, const void* b);
+int psCompareDescendingS8(const void *a, const void *b);
 
 /** Compare function of psS16 data.
@@ -290,5 +290,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingS16(const void* a, const void* b);
+int psCompareDescendingS16(const void *a, const void *b);
 
 /** Compare function of psS32 data.
@@ -298,5 +298,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingS32(const void* a, const void* b);
+int psCompareDescendingS32(const void *a, const void *b);
 
 /** Compare function of psS64 data.
@@ -306,5 +306,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingS64(const void* a, const void* b);
+int psCompareDescendingS64(const void *a, const void *b);
 
 /** Compare function of psU8 data.
@@ -314,5 +314,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingU8(const void* a, const void* b);
+int psCompareDescendingU8(const void *a, const void *b);
 
 /** Compare function of psU16 data.
@@ -322,5 +322,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingU16(const void* a, const void* b);
+int psCompareDescendingU16(const void *a, const void *b);
 
 /** Compare function of psU32 data.
@@ -330,5 +330,5 @@
  *                   than, equal to, or lessg than the second. 
  */
-int psCompareDescendingU32(const void* a, const void* b);
+int psCompareDescendingU32(const void *a, const void *b);
 
 /** Compare function of psU64 data.
@@ -338,5 +338,5 @@
  *                   than, equal to, or lessg than the second. 
  */
-int psCompareDescendingU64(const void* a, const void* b);
+int psCompareDescendingU64(const void *a, const void *b);
 
 /** Compare function of psF32 data.
@@ -346,5 +346,5 @@
  *                   than, equal to, or lessg than the second. 
  */
-int psCompareDescendingF32(const void* a, const void* b);
+int psCompareDescendingF32(const void *a, const void *b);
 
 /** Compare function of psF64 data.
@@ -354,7 +354,5 @@
  *                   than, equal to, or lessg than the second. 
  */
-int psCompareDescendingF64(const void* a, const void* b);
-
-
+int psCompareDescendingF64(const void *a, const void *b);
 
 /// @}
Index: /trunk/psLib/src/collections/psList.c
===================================================================
--- /trunk/psLib/src/collections/psList.c	(revision 1406)
+++ /trunk/psLib/src/collections/psList.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file psList.c
  *  @brief Support for doubly linked lists
@@ -6,6 +7,6 @@
  *  @author Robert Daniel DeSonia, MHPCC
  *
- *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -15,5 +16,5 @@
 #include <stdbool.h>
 #include <stdio.h>
-#include <pthread.h>                   // we need a mutex to make this stuff thread safe.
+#include <pthread.h>                       // we need a mutex to make this stuff thread safe.
 
 #include "psError.h"
@@ -24,18 +25,18 @@
 #include "psLogMsg.h"
 
-#define ITER_INIT_HEAD ((void *)1) // next iteration should return head
-#define ITER_INIT_TAIL ((void *)2) // next iteration should return tail
+#define ITER_INIT_HEAD ((void *)1)         // next iteration should return head
+#define ITER_INIT_TAIL ((void *)2)         // next iteration should return tail
 
 // private functions.
-static psListElem* listGetIterator(psList* list);
-static int listGetIteratorIndex(psList* list);
-static void listSetIterator(psList *list, int where, bool lockList);
-static void listFree(psList *list);
-
+static psListElem *listGetIterator(psList * list);
+static int listGetIteratorIndex(psList * list);
+static void listSetIterator(psList * list, int where, bool lockList);
+static void listFree(psList * list);
 
 psList *psListAlloc(void *data)
 {
     psList *list = psAlloc(sizeof(psList));
-    p_psMemSetDeallocator(list,(psFreeFcn)listFree);
+
+    p_psMemSetDeallocator(list, (psFreeFcn) listFree);
 
     list->size = 0;
@@ -44,5 +45,5 @@
     list->iterIndex = PS_LIST_HEAD;
 
-    pthread_mutex_init(&(list->lock),NULL)
+    pthread_mutex_init(&(list->lock), NULL)
     ;
 
@@ -54,5 +55,5 @@
 }
 
-static void listFree(psList *list)
+static void listFree(psList * list)
 {
     if (list == NULL) {
@@ -63,5 +64,5 @@
     ;
 
-    for(psListElem *ptr = list->head; ptr != NULL; ) {
+    for (psListElem * ptr = list->head; ptr != NULL;) {
         psListElem *next = ptr->next;
 
@@ -80,8 +81,8 @@
 }
 
-bool psListAdd(psList *list, void *data, int where)
-{
-    psListElem* position;
-    psListElem* elem;
+bool psListAdd(psList * list, void *data, int where)
+{
+    psListElem *position;
+    psListElem *elem;
     int cursorIndex = 0;
 
@@ -95,8 +96,6 @@
 
     if (where <= PS_LIST_UNKNOWN) {
-        /// XXX What is the better way to communicate this failure to the caller?
-        psLogMsg(__func__,PS_LOG_WARN,
-                 "The given insert location (%i) for psListAdd is invalid.",
-                 where);
+        // / XXX What is the better way to communicate this failure to the caller?
+        psLogMsg(__func__, PS_LOG_WARN, "The given insert location (%i) for psListAdd is invalid.", where);
         return false;
     }
@@ -108,7 +107,6 @@
 
     if (where > 0 && where > list->size) {
-        psLogMsg(__func__,PS_LOG_WARN,
-                 "Invalid index %d (only %d elements in psList); assuming tail.",
-                 where, list->size);
+        psLogMsg(__func__, PS_LOG_WARN,
+                 "Invalid index %d (only %d elements in psList); assuming tail.", where, list->size);
         where = PS_LIST_TAIL;
     }
@@ -138,8 +136,7 @@
 
         if (position == NULL) {
-            psError(__func__,"%s failed to move cursor to specified location (%d)",__func__,where);
-            position = list->head; // since we no list->size != 0, this must be non-NULL
-        }
-
+            psError(__func__, "%s failed to move cursor to specified location (%d)", __func__, where);
+            position = list->head;         // since we no list->size != 0, this must be non-NULL
+        }
         // insert our new element in front of the given position
         elem->prev = position->prev;
@@ -147,5 +144,5 @@
         position->prev = elem;
 
-        if (elem->prev == NULL) { // must be front of list
+        if (elem->prev == NULL) {          // must be front of list
             list->head = elem;
         } else {
@@ -167,17 +164,17 @@
 
 /*****************************************************************************/
+
 /*
  * Remove an element from a list
  */
-bool psListRemove(psList *list, void *data,  int which)
-{
-    psListElem *elem = NULL;  // element to remove
+bool psListRemove(psList * list, void *data, int which)
+{
+    psListElem *elem = NULL;    // element to remove
     int cursorIndex = 0;
 
     if (list == NULL) {
-        psError(__func__,"list parameter found to be NULL in %s",__func__);
+        psError(__func__, "list parameter found to be NULL in %s", __func__);
         return false;
     }
-
     // get exclusive access to list so that other threads will not get in the way.
     pthread_mutex_lock(&list->lock)
@@ -187,6 +184,7 @@
         // search list for the data item.
 
-        int i = 0;   // index
-        for (psListElem *ptr = list->head; ptr != NULL; ptr = ptr->next) {
+        int i = 0;              // index
+
+        for (psListElem * ptr = list->head; ptr != NULL; ptr = ptr->next) {
             if (ptr->data == data) {
                 which = i;
@@ -201,12 +199,11 @@
         }
     }
-
     // position the list's cursor to the desired location
-    listSetIterator(list,which,false);
+    listSetIterator(list, which, false);
     elem = listGetIterator(list);
     cursorIndex = listGetIteratorIndex(list);
 
     if (elem == NULL) {
-        psError(__func__, "Couldn't position to given index (%d) to remove element from list.",which);
+        psError(__func__, "Couldn't position to given index (%d) to remove element from list.", which);
         return false;
     }
@@ -214,5 +211,5 @@
     list->size--;
 
-    if (elem->prev == NULL) { // head of list?
+    if (elem->prev == NULL) {              // head of list?
         list->head = elem->next;
     } else {
@@ -220,5 +217,5 @@
     }
 
-    if (elem->next == NULL) { // tail of list?
+    if (elem->next == NULL) {              // tail of list?
         list->tail = elem->prev;
 
@@ -246,16 +243,16 @@
 }
 
-void psListSetIterator(psList *list, int where)
-{
-    listSetIterator(list,where,true);
-}
-
-void listSetIterator(psList* list, int where, bool lockList)
-{
-    psListElem* cursor;
+void psListSetIterator(psList * list, int where)
+{
+    listSetIterator(list, where, true);
+}
+
+void listSetIterator(psList * list, int where, bool lockList)
+{
+    psListElem *cursor;
     int position;
 
     if (list == NULL) {
-        psError(__func__,"Unexpected null pointer for psList parameter (%s:%d).",__FILE__,__LINE__);
+        psError(__func__, "Unexpected null pointer for psList parameter (%s:%d).", __FILE__, __LINE__);
         return;
     }
@@ -291,5 +288,5 @@
         if (cursor != NULL) {
             list->iter = cursor->prev;
-            list->iterIndex = position-1;
+            list->iterIndex = position - 1;
         }
         break;
@@ -301,5 +298,5 @@
         if (cursor != NULL) {
             list->iter = cursor->next;
-            list->iterIndex = position+1;
+            list->iterIndex = position + 1;
         }
         break;
@@ -309,9 +306,9 @@
 
     default:
-        if (where <= PS_LIST_HEAD) { // bascially same as PS_LIST_UNKNOWN above
-            psError(__func__,"Can't move to an unknown position.  Not moving the iterator position.");
+        if (where <= PS_LIST_HEAD) {   // bascially same as PS_LIST_UNKNOWN above
+            psError(__func__, "Can't move to an unknown position.  Not moving the iterator position.");
         } else {
             cursor = listGetIterator(list);
-            if (cursor == NULL) { // reset the iterator if it is invalid
+            if (cursor == NULL) {      // reset the iterator if it is invalid
                 list->iter = ITER_INIT_HEAD;
                 list->iterIndex = 0;
@@ -321,12 +318,14 @@
 
             if (where < position) {
-                int diff = position-where;
-                for (int count=0;count < diff; count++) {
-                    listSetIterator(list,PS_LIST_PREVIOUS,false);
+                int diff = position - where;
+
+                for (int count = 0; count < diff; count++) {
+                    listSetIterator(list, PS_LIST_PREVIOUS, false);
                 }
             } else {
-                int diff = where-position;
-                for (int count=0;count < diff; count++) {
-                    listSetIterator(list,PS_LIST_NEXT,false);
+                int diff = where - position;
+
+                for (int count = 0; count < diff; count++) {
+                    listSetIterator(list, PS_LIST_NEXT, false);
                 }
             }
@@ -341,5 +340,5 @@
 }
 
-psListElem* listGetIterator(psList* list)
+psListElem *listGetIterator(psList * list)
 {
     if (list == NULL) {
@@ -349,29 +348,27 @@
     if (list->iter == ITER_INIT_HEAD) {
         return list->head;
-    } else
-        if (list->iter == ITER_INIT_TAIL) {
-            return list->tail;
-        } else {
-            return list->iter;
-        }
-}
-
-int listGetIteratorIndex(psList* list)
+    } else if (list->iter == ITER_INIT_TAIL) {
+        return list->tail;
+    } else {
+        return list->iter;
+    }
+}
+
+int listGetIteratorIndex(psList * list)
 {
     if (list->iter == ITER_INIT_HEAD) {
         return 0;
-    } else
-        if (list->iter == ITER_INIT_TAIL) {
-            return list->size-1;
-        } else {
-            return list->iterIndex;
-        }
-}
-
-void* psListGet(psList* list,int which)
-{
-    psListElem* element;
-
-    psListSetIterator(list,which);
+    } else if (list->iter == ITER_INIT_TAIL) {
+        return list->size - 1;
+    } else {
+        return list->iterIndex;
+    }
+}
+
+void *psListGet(psList * list, int which)
+{
+    psListElem *element;
+
+    psListSetIterator(list, which);
     element = listGetIterator(list);
 
@@ -382,18 +379,19 @@
     }
 }
+
 /*
  * and now return the previous/next element of the list
  */
-void *psListGetNext(psList *list)
+void *psListGetNext(psList * list)
 {
     return psListGet(list, PS_LIST_NEXT);
 }
 
-void *psListGetPrevious(psList *list)
+void *psListGetPrevious(psList * list)
 {
     return psListGet(list, PS_LIST_PREVIOUS);
 }
 
-void *psListGetCurrent(psList *list)
+void *psListGetCurrent(psList * list)
 {
     return psListGet(list, PS_LIST_CURRENT);
@@ -403,9 +401,9 @@
  * Convert a psList to/from a psVoidPtrArray
  */
-psArray* psListToArray(psList* restrict list)
-{
-    psListElem* ptr;
+psArray *psListToArray(psList * restrict list)
+{
+    psListElem *ptr;
     unsigned int n;
-    psArray* restrict arr;
+    psArray *restrict arr;
 
     if (list == NULL) {
@@ -431,8 +429,8 @@
 }
 
-psList* psArrayToList(psArray* arr)
+psList *psArrayToList(psArray * arr)
 {
     unsigned int n;
-    psList* list; // list of elements
+    psList *list;               // list of elements
 
     if (arr == NULL) {
@@ -443,5 +441,5 @@
     n = arr->n;
     for (int i = 0; i < n; i++) {
-        psListAdd(list,arr->data[i],PS_LIST_TAIL);
+        psListAdd(list, arr->data[i], PS_LIST_TAIL);
     }
 
@@ -449,17 +447,16 @@
 }
 
-
-psList* psListSort(psList* list, psComparePtrFcn compare)
-{
-    psArray* arr;
+psList *psListSort(psList * list, psComparePtrFcn compare)
+{
+    psArray *arr;
+
     if (list == NULL) {
         return NULL;
     }
-
     // convert to indexable vector for use by qsort.
     arr = psListToArray(list);
     psFree(list);
 
-    arr = psArraySort(arr,compare);
+    arr = psArraySort(arr, compare);
 
     // convert back to linked list
Index: /trunk/psLib/src/collections/psList.h
===================================================================
--- /trunk/psLib/src/collections/psList.h	(revision 1406)
+++ /trunk/psLib/src/collections/psList.h	(revision 1407)
@@ -1,4 +1,4 @@
 #if !defined(PS_LIST_H)
-#define PS_LIST_H
+#    define PS_LIST_H
 
 /** @file psList.h
@@ -10,15 +10,15 @@
  *  @ingroup LinkedList
  *
- *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-15 22:18:02 $
+ *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
 
-#include <pthread.h>                   // we need a mutex to make this stuff thread safe.
-#include <stdbool.h>                   // we use the bool type.
+#    include <pthread.h>                   // we need a mutex to make this stuff thread safe.
+#    include <stdbool.h>                   // we use the bool type.
 
-#include "psCompare.h"
-#include "psArray.h"
+#    include "psCompare.h"
+#    include "psArray.h"
 
 /** @addtogroup LinkedList
@@ -33,10 +33,10 @@
  */
 enum {
-    PS_LIST_HEAD = 0,                  ///< at head
-    PS_LIST_TAIL = -1,                 ///< at tail
-    PS_LIST_PREVIOUS = -2,             ///< previous element
-    PS_LIST_CURRENT = -3,              ///< current element
-    PS_LIST_NEXT = -4,                 ///< next element
-    PS_LIST_UNKNOWN = -5               ///< unknown position (should be last in enum list)
+    PS_LIST_HEAD = 0,           // /< at head
+    PS_LIST_TAIL = -1,                     // /< at tail
+    PS_LIST_PREVIOUS = -2,                 // /< previous element
+    PS_LIST_CURRENT = -3,                  // /< current element
+    PS_LIST_NEXT = -4,                     // /< next element
+    PS_LIST_UNKNOWN = -5                   // /< unknown position (should be last in enum list)
 };
 
@@ -44,7 +44,7 @@
 typedef struct psListElem
 {
-    struct psListElem *prev;            ///< previous link in list
-    struct psListElem *next;            ///< next link in list
-    void *data;                         ///< real data item
+    struct psListElem *prev;    // /< previous link in list
+    struct psListElem *next;    // /< next link in list
+    void *data;                 // /< real data item
 }
 psListElem;
@@ -57,10 +57,10 @@
 typedef struct
 {
-    unsigned int size;                  ///< number of elements on list
-    psListElem* head;                   ///< first element on list (may be NULL)
-    psListElem* tail;                   ///< last element on list (may be NULL)
-    psListElem* iter;                   ///< iteration cursor
-    unsigned int iterIndex;             ///< the numeric position of the iteration cursor in the list
-    pthread_mutex_t lock;               ///< mutex to lock a node during changes
+    unsigned int size;          // /< number of elements on list
+    psListElem *head;           // /< first element on list (may be NULL)
+    psListElem *tail;           // /< last element on list (may be NULL)
+    psListElem *iter;           // /< iteration cursor
+    unsigned int iterIndex;     // /< the numeric position of the iteration cursor in the list
+    pthread_mutex_t lock;       // /< mutex to lock a node during changes
 }
 psList;
@@ -70,8 +70,7 @@
  *  @return psList*     A new psList object.
  */
-psList* psListAlloc(
-    void *data
-    ///< initial data item; may be NULL if no an empty psList is desired
-)
+psList *psListAlloc(void *data
+                    // /< initial data item; may be NULL if no an empty psList is desired
+                   )
 ;
 
@@ -81,9 +80,8 @@
  *                      NULL, the return value will also be NULL.
  */
-bool psListAdd(
-    psList* restrict list,              ///< list to add to (if NULL, nothing is done)
-    void* data,                         ///< data item to add.  If NULL, list is not modified.
-    int where                           ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location.
-);
+bool psListAdd(psList * restrict list,  // /< list to add to (if NULL, nothing is done)
+               void *data,      // /< data item to add.  If NULL, list is not modified.
+               int where        // /< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location.
+              );
 
 /** Remove an item from a list.  If which parameter is PS_LIST_UNKNOWN,
@@ -91,12 +89,11 @@
  *  @return bool        TRUE if element is successfully removed, otherwise FALSE.
  */
-bool psListRemove(
-    psList* restrict list,
-    ///< list to remove element from
-    void *data,
-    ///< if which is PS_LIST_UNKNOWN, data item to find and remove, otherwise this is ignored.
-    int which
-    ///< index of item, or PS_LIST_UNKNOWN, PS_LIST_NEXT, PS_LIST_PREV, or numbered location.
-);
+bool psListRemove(psList * restrict list,
+                  // /< list to remove element from
+                  void *data,
+                  // /< if which is PS_LIST_UNKNOWN, data item to find and remove, otherwise this is ignored.
+                  int which
+                  // /< index of item, or PS_LIST_UNKNOWN, PS_LIST_NEXT, PS_LIST_PREV, or numbered location.
+                 );
 
 /** Retrieve an item from a list.
@@ -107,8 +104,7 @@
  *                      NULL is returned.
  */
-void* psListGet(
-    psList* restrict list,             ///< list to retrieve element from
-    int which                          ///< index number, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN
-);
+void *psListGet(psList * restrict list, // /< list to retrieve element from
+                int which       // /< index number, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN
+               );
 
 /** Set the iterator of the list to a given position.  If where is invalid the
@@ -116,8 +112,7 @@
  *
  */
-void psListSetIterator(
-    psList* restrict list,             ///< list to retrieve element from
-    int where                           ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL
-);
+void psListSetIterator(psList * restrict list,  // /< list to retrieve element from
+                       int where        // /< index number, PS_LIST_HEAD, or PS_LIST_TAIL
+                      );
 
 /** Get next element relative to the iterator.  This also moves the iterator to
@@ -128,7 +123,6 @@
  *                      parameter was NULL.
  */
-void* psListGetNext(
-    psList* restrict list              ///< list to retrieve element from
-);
+void *psListGetNext(psList * restrict list      // /< list to retrieve element from
+                   );
 
 /** Get current element according to the psList's iterator cursor.  This does
@@ -139,7 +133,6 @@
  *                      iterator is not valid or list parameter was NULL.
  */
-void* psListGetCurrent(
-    psList* restrict list              ///< list to retrieve element from
-);
+void *psListGetCurrent(psList * restrict list   // /< list to retrieve element from
+                      );
 
 /** Get previous element relative to list's iterator. This also moves the
@@ -150,7 +143,6 @@
  *                      parameter was NULL.
  */
-void* psListGetPrevious(
-    psList* restrict list              ///< list to retrieve element from
-);
+void *psListGetPrevious(psList * restrict list  // /< list to retrieve element from
+                       );
 
 /** Convert a linked list to an array
@@ -159,7 +151,6 @@
  *                      or NULL if the given dlist parameter is NULL.
  */
-psArray* psListToArray(
-    psList *dlist                      ///< List to convert
-);
+psArray *psListToArray(psList * dlist   // /< List to convert
+                      );
 
 /** Convert array to a doubly-linked list
@@ -168,12 +159,10 @@
  *                      or NULL is the given arr parameter is NULL.
  */
-psList* psArrayToList(
-    psArray* arr                      ///< vector to convert
-);
+psList *psArrayToList(psArray * arr     // /< vector to convert
+                     );
 
-psList* psListSort(psList* list, psComparePtrFcn compare);
+psList *psListSort(psList * list, psComparePtrFcn compare);
 
 /// @} End of DataGroup Functions
 
 #endif
-
Index: /trunk/psLib/src/collections/psMetadata.c
===================================================================
--- /trunk/psLib/src/collections/psMetadata.c	(revision 1406)
+++ /trunk/psLib/src/collections/psMetadata.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psMetadata.c
 *
@@ -11,6 +12,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 22:34:05 $
+*  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -18,5 +19,7 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 #include<stdio.h>
@@ -34,7 +37,8 @@
 #include "psString.h"
 
-
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
@@ -56,5 +60,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -62,5 +68,7 @@
 
 /*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
+
 /*****************************************************************************/
 
@@ -68,5 +76,7 @@
 
 /*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
+
 /*****************************************************************************/
 
@@ -74,7 +84,9 @@
 
 /*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
-/*****************************************************************************/
-static void metadataItemFree( psMetadataItem *metadataItem )
+
+/*****************************************************************************/
+static void metadataItemFree(psMetadataItem * metadataItem)
 {
     psMetadataType type;
@@ -82,36 +94,35 @@
     type = metadataItem->type;
 
-    if(metadataItem == NULL) {
-        return ;
-    }
-
-    psFree( metadataItem->name );
-    psFree( metadataItem->comment );
-    psFree( metadataItem->items );
-
-    if(type == PS_META_STR ||
+    if (metadataItem == NULL) {
+        return;
+    }
+
+    psFree(metadataItem->name);
+    psFree(metadataItem->comment);
+    psFree(metadataItem->items);
+
+    if (type == PS_META_STR ||
             type == PS_META_IMG ||
-            type == PS_META_JPEG ||
-            type == PS_META_PNG ||
-            type == PS_META_ASTROM ||
-            type == PS_META_UNKNOWN) {
-        psFree( metadataItem->data.V );
-    }
-}
-
-static void metadataFree( psMetadata *metadata )
-{
-    if(metadata == NULL) {
-        return ;
-    }
-    psFree( metadata->list );
-    psFree( metadata->table );
-}
-
-/*****************************************************************************/
+            type == PS_META_JPEG || type == PS_META_PNG || type == PS_META_ASTROM || type == PS_META_UNKNOWN) {
+        psFree(metadataItem->data.V);
+    }
+}
+
+static void metadataFree(psMetadata * metadata)
+{
+    if (metadata == NULL) {
+        return;
+    }
+    psFree(metadata->list);
+    psFree(metadata->table);
+}
+
+/*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
-/*****************************************************************************/
-
-psMetadataItem *psMetadataItemAlloc( const char *name, psMetadataType type, const char *comment, ... )
+
+/*****************************************************************************/
+
+psMetadataItem *psMetadataItemAlloc(const char *name, psMetadataType type, const char *comment, ...)
 {
     va_list argPtr;
@@ -119,44 +130,43 @@
 
     // Get the variable list parameters to pass to allocation function
-    va_start( argPtr, comment );
+    va_start(argPtr, comment);
 
     // Call metadata item allocation
-    metadataItem = psMetadataItemAllocV( name, type, comment, argPtr );
+    metadataItem = psMetadataItemAllocV(name, type, comment, argPtr);
 
     // Clean up stack after variable arguement has been used
-    va_end( argPtr );
+    va_end(argPtr);
 
     return metadataItem;
 }
 
-psMetadataItem *psMetadataItemAllocV( const char *name, psMetadataType type, const char *comment, va_list argPtr )
-{
-    psMetadataItem * metadataItem = NULL;
-
-    if(name == NULL) {
-        psError( __func__, "Null value for name not allowed" );
-        return NULL;
-    }
-
+psMetadataItem *psMetadataItemAllocV(const char *name, psMetadataType type, const char *comment,
+                                     va_list argPtr)
+{
+    psMetadataItem *metadataItem = NULL;
+
+    if (name == NULL) {
+        psError(__func__, "Null value for name not allowed");
+        return NULL;
+    }
     // Allocate metadata item
-    metadataItem = ( psMetadataItem * ) psAlloc( sizeof( psMetadataItem ) );
-    if(metadataItem == NULL) {
-        psAbort( __func__, "Failed to allocate memory" );
-    }
-
+    metadataItem = (psMetadataItem *) psAlloc(sizeof(psMetadataItem));
+    if (metadataItem == NULL) {
+        psAbort(__func__, "Failed to allocate memory");
+    }
     // Set deallocator
-    p_psMemSetDeallocator( metadataItem, ( psFreeFcn ) metadataItemFree );
+    p_psMemSetDeallocator(metadataItem, (psFreeFcn) metadataItemFree);
 
     // Allocate and set metadata item comment
-    metadataItem->comment = ( char * ) psAlloc( sizeof( char ) * MAX_STRING_LENGTH );
-    if(comment == NULL) {
+    metadataItem->comment = (char *)psAlloc(sizeof(char) * MAX_STRING_LENGTH);
+    if (comment == NULL) {
         // Per SDRS, null isn't allowed, must use "" instead
-        strncpy( metadataItem->comment, "", MAX_STRING_LENGTH );
+        strncpy(metadataItem->comment, "", MAX_STRING_LENGTH);
     } else {
-        strncpy( metadataItem->comment, comment, MAX_STRING_LENGTH );
+        strncpy(metadataItem->comment, comment, MAX_STRING_LENGTH);
     }
 
     // Set metadata item unique id
-    *( int* ) ( &metadataItem->id ) = ++metadataId;
+    *(int *)(&metadataItem->id) = ++metadataId;
 
     // Set metadata item type
@@ -164,19 +174,21 @@
 
     // Set metadata item value
-    switch(type) {
+    switch (type) {
     case PS_META_BOOL:
-        metadataItem->data.B = ( bool ) va_arg( argPtr, int );
+        metadataItem->data.B = (bool) va_arg(argPtr, int);
+
         break;
     case PS_META_S32:
-        metadataItem->data.S32 = va_arg( argPtr, psS32 );
+        metadataItem->data.S32 = va_arg(argPtr, psS32);
         break;
     case PS_META_F32:
-        metadataItem->data.F32 = ( psF32 ) va_arg( argPtr, psF64 );
+        metadataItem->data.F32 = (psF32) va_arg(argPtr, psF64);
         break;
     case PS_META_F64:
-        metadataItem->data.F64 = va_arg( argPtr, psF64 );
+        metadataItem->data.F64 = va_arg(argPtr, psF64);
         break;
     case PS_META_STR:
-        metadataItem->data.V = psStringNCopy( va_arg( argPtr, char* ), MAX_STRING_LENGTH );
+        metadataItem->data.V = psStringNCopy(va_arg(argPtr, char *), MAX_STRING_LENGTH);
+
         break;
     case PS_META_IMG:
@@ -186,41 +198,40 @@
     case PS_META_UNKNOWN:
     default:
-        psError( __func__, "Invalid psMetadataType: %d", type );
+        psError(__func__, "Invalid psMetadataType: %d", type);
     }
 
     // Allocate and set metadata item name
-    metadataItem->name = ( char * ) psAlloc( sizeof( char ) * MAX_STRING_LENGTH );
-    vsprintf( metadataItem->name, name, argPtr );
+    metadataItem->name = (char *)psAlloc(sizeof(char) * MAX_STRING_LENGTH);
+    vsprintf(metadataItem->name, name, argPtr);
 
     // Allocate metadata items with same name.
-    metadataItem->items = psListAlloc( NULL );
+    metadataItem->items = psListAlloc(NULL);
 
     return metadataItem;
 }
 
-psMetadata *psMetadataAlloc( void )
-{
-    psList * list = NULL;
+psMetadata *psMetadataAlloc(void)
+{
+    psList *list = NULL;
     psHash *table = NULL;
     psMetadata *metadata = NULL;
 
     // Allocate metadata
-    metadata = ( psMetadata * ) psAlloc( sizeof( psMetadata ) );
-    if(metadata == NULL) {
-        psAbort( __func__, "Failed to allocate metadata" );
-    }
-
+    metadata = (psMetadata *) psAlloc(sizeof(psMetadata));
+    if (metadata == NULL) {
+        psAbort(__func__, "Failed to allocate metadata");
+    }
     // Set deallocator
-    p_psMemSetDeallocator( metadata, ( psFreeFcn ) metadataFree );
+    p_psMemSetDeallocator(metadata, (psFreeFcn) metadataFree);
 
     // Allocate metadata's internal containers
-    list = ( psList * ) psListAlloc( NULL );
-    if(list == NULL) {
-        psAbort( __func__, "Failed to allocate list" );
-    }
-
-    table = ( psHash * ) psHashAlloc( 10 );
-    if(table == NULL) {
-        psAbort( __func__, "Failed to allocate table" );
+    list = (psList *) psListAlloc(NULL);
+    if (list == NULL) {
+        psAbort(__func__, "Failed to allocate list");
+    }
+
+    table = (psHash *) psHashAlloc(10);
+    if (table == NULL) {
+        psAbort(__func__, "Failed to allocate table");
     }
 
@@ -231,7 +242,7 @@
 }
 
-bool psMetadataAddItem( psMetadata *restrict md, int where, psMetadataItem *restrict metadataItem )
-{
-    char * key = NULL;
+bool psMetadataAddItem(psMetadata * restrict md, int where, psMetadataItem * restrict metadataItem)
+{
+    char *key = NULL;
     psHash *mdTable = NULL;
     psList *mdList = NULL;
@@ -239,11 +250,11 @@
     psMetadataType type = PS_META_ITEM_SET;
 
-    if(md == NULL) {
-        psError( __func__, "Null metadata collection not allowed" );
-        return false;
-    }
-
-    if(metadataItem == NULL) {
-        psError( __func__, "Null metadata item not allowed" );
+    if (md == NULL) {
+        psError(__func__, "Null metadata collection not allowed");
+        return false;
+    }
+
+    if (metadataItem == NULL) {
+        psError(__func__, "Null metadata item not allowed");
         return false;
     }
@@ -252,54 +263,51 @@
 
     mdTable = md->table;
-    if(mdTable == NULL) {
-        psError( __func__, "Null metadata table not allowed" );
-        return false;
-    }
-
-    mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
+    if (mdTable == NULL) {
+        psError(__func__, "Null metadata table not allowed");
+        return false;
+    }
+
+    mdList = md->list;
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
         return false;
     }
 
     key = metadataItem->name;
-    if(key == NULL) {
-        psError( __func__, "Null key item not allowed" );
-        return false;
-    }
-
+    if (key == NULL) {
+        psError(__func__, "Null key item not allowed");
+        return false;
+    }
     // Check if key is already in table
-    value = ( psMetadataItem* ) psHashLookup( mdTable, key );
-    if(value != NULL && type != PS_META_ITEM_SET) {
+    value = (psMetadataItem *) psHashLookup(mdTable, key);
+    if (value != NULL && type != PS_META_ITEM_SET) {
 
         // The key was found and the new metadata item is a leaf node (its type isn't PS_META_ITEM_SET), so
         // add the new metadata item to hash as a child of the existing metadata item folder node.
-        if(!psListAdd( value->items, metadataItem, where )) {
-            psError( __func__, "Couldn't add metadata item to items list. Name: %s",
-                     metadataItem->name );
+        if (!psListAdd(value->items, metadataItem, where)) {
+            psError(__func__, "Couldn't add metadata item to items list. Name: %s", metadataItem->name);
             return false;
         }
-    } else
-        if(value != NULL) {
-
-            // The key was found and the new metadata item is a folder node. Don't add new metadata item, since
-            // it will wipe out existing node.
-            psError( __func__, "Metadata already exists in metadata collection. Item not added. Name: %s",
-                     metadataItem->name );
+    } else if (value != NULL) {
+
+        // The key was found and the new metadata item is a folder node. Don't add new metadata item, since
+        // it will wipe out existing node.
+        psError(__func__, "Metadata already exists in metadata collection. Item not added. Name: %s",
+                metadataItem->name);
+        return false;
+    } else {
+
+        // Duplicate key not found. Add new metadata item to metadata collection's hash
+        if (!psHashAdd(mdTable, key, metadataItem)) {
+            psError(__func__, "Couldn't add metadata item to metadata collection table. Name: %s",
+                    metadataItem->name);
             return false;
-        } else {
-
-            // Duplicate key not found. Add new metadata item to metadata collection's hash
-            if(!psHashAdd( mdTable, key, metadataItem )) {
-                psError( __func__, "Couldn't add metadata item to metadata collection table. Name: %s",
-                         metadataItem->name );
-                return false;
-            }
-        }
+        }
+    }
 
     // Add all items to metadata collection's list, even if they have the same metadata item names
-    if(!psListAdd( md->list, metadataItem, where )) {
-        psError( __func__, "Couldn't add metadata item to metadata collection list. Name: %s",
-                 metadataItem->name );
+    if (!psListAdd(md->list, metadataItem, where)) {
+        psError(__func__, "Couldn't add metadata item to metadata collection list. Name: %s",
+                metadataItem->name);
         return false;
     }
@@ -308,28 +316,28 @@
 }
 
-bool psMetadataAdd( psMetadata *restrict md, int where, const char *name, psMetadataType type,
-                    const char *comment, ... )
+bool psMetadataAdd(psMetadata * restrict md, int where, const char *name, psMetadataType type,
+                   const char *comment, ...)
 {
     va_list argPtr;
     psMetadataItem *metadataItem = NULL;
 
-    va_start( argPtr, comment );
-    metadataItem = psMetadataItemAllocV( name, type, comment, argPtr );
-    va_end( argPtr );
-
-    if(!psMetadataAddItem( md, where, metadataItem )) {
-        psError( __func__, "Couldn't add metadata item to metadata collection list. Name: %s",
-                 metadataItem->name );
-        psFree( metadataItem );
-        return false;
-    }
-
-    // Decrement reference count, since the metadata item is now in metadata collection and no longer needed here
-    psMemDecrRefCounter( metadataItem );
+    va_start(argPtr, comment);
+    metadataItem = psMetadataItemAllocV(name, type, comment, argPtr);
+    va_end(argPtr);
+
+    if (!psMetadataAddItem(md, where, metadataItem)) {
+        psError(__func__, "Couldn't add metadata item to metadata collection list. Name: %s",
+                metadataItem->name);
+        psFree(metadataItem);
+        return false;
+    }
+    // Decrement reference count, since the metadata item is now in metadata collection and no longer needed
+    // here
+    psMemDecrRefCounter(metadataItem);
 
     return true;
 }
 
-bool psMetadataRemove( psMetadata *restrict md, int where, const char *restrict key )
+bool psMetadataRemove(psMetadata * restrict md, int where, const char *restrict key)
 {
     int numChildren = 0;
@@ -340,49 +348,46 @@
 
     mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
         return false;
     }
 
     mdTable = md->table;
-    if(mdTable == NULL) {
-        psError( __func__, "Null metadata table not allowed" );
-        return false;
-    }
-
+    if (mdTable == NULL) {
+        psError(__func__, "Null metadata table not allowed");
+        return false;
+    }
     // Select removal by key or index
-    if(key != NULL) {
+    if (key != NULL) {
 
         // Remove by key name
-        entry = ( psMetadataItem* ) psHashLookup( mdTable, key );
-        if(entry == NULL) {
-            psError( __func__, "Couldn't find metadata item remove. Name: %s", key );
+        entry = (psMetadataItem *) psHashLookup(mdTable, key);
+        if (entry == NULL) {
+            psError(__func__, "Couldn't find metadata item remove. Name: %s", key);
             return false;
         }
 
         numChildren = entry->items->size;
-        if(entry->type == PS_META_ITEM_SET && numChildren > 0) {
+        if (entry->type == PS_META_ITEM_SET && numChildren > 0) {
 
             // Table entry has children. Entry and children must be removed from metadata collection's list
-            psListSetIterator( mdList, PS_LIST_HEAD );
-            entryChild = psListGetCurrent( mdList );
-            while(entryChild != NULL) {
-                if(!psListRemove( entry->items, entryChild, PS_LIST_UNKNOWN )) {
-                    psError( __func__, "Couldn't remove metadata item from list. Name: %s", key );
+            psListSetIterator(mdList, PS_LIST_HEAD);
+            entryChild = psListGetCurrent(mdList);
+            while (entryChild != NULL) {
+                if (!psListRemove(entry->items, entryChild, PS_LIST_UNKNOWN)) {
+                    psError(__func__, "Couldn't remove metadata item from list. Name: %s", key);
                     return false;
                 }
-                entryChild = psListGetNext( entry->items );
+                entryChild = psListGetNext(entry->items);
             }
         }
-
         // Remove entry from metadata collection's list
-        if(!psListRemove( mdList, entry, PS_LIST_UNKNOWN )) {
-            psError( __func__, "Couldn't remove metadata item from list. Name: %s", key );
+        if (!psListRemove(mdList, entry, PS_LIST_UNKNOWN)) {
+            psError(__func__, "Couldn't remove metadata item from list. Name: %s", key);
             return false;
         }
-
         // Remove entry from metadata collection's table
-        if(!psHashRemove( mdTable, key )) {
-            psError( __func__, "Couldn't remove metadata item from table. Name: %s", key );
+        if (!psHashRemove(mdTable, key)) {
+            psError(__func__, "Couldn't remove metadata item from table. Name: %s", key);
             return false;
         }
@@ -390,18 +395,17 @@
 
         // Remove by index
-        entry = psListGet( mdList, where );
-        if(entry == NULL) {
-            psError( __func__, "Couldn't find metadata item from list. Index: %d", where );
+        entry = psListGet(mdList, where);
+        if (entry == NULL) {
+            psError(__func__, "Couldn't find metadata item from list. Index: %d", where);
             return false;
         }
 
         key = entry->name;
-        if(key == NULL) {
-            psError( __func__, "Null key name not allowed. Index: %d", where );
+        if (key == NULL) {
+            psError(__func__, "Null key name not allowed. Index: %d", where);
             return false;
         }
-
         // Use recursive remove, now that key is known
-        psMetadataRemove( md, PS_LIST_UNKNOWN, key );
+        psMetadataRemove(md, PS_LIST_UNKNOWN, key);
     }
 
@@ -409,23 +413,23 @@
 }
 
-psMetadataItem *psMetadataLookup( psMetadata *restrict md, const char *restrict key )
-{
-    psHash * mdTable = NULL;
+psMetadataItem *psMetadataLookup(psMetadata * restrict md, const char *restrict key)
+{
+    psHash *mdTable = NULL;
     psMetadataItem *entry = NULL;
 
     mdTable = md->table;
-    if(mdTable == NULL) {
-        psError( __func__, "Null metadata table not allowed" );
-        return NULL;
-    }
-
-    if(key == NULL) {
-        psError( __func__, "Null key name not allowed" );
-        return NULL;
-    }
-
-    entry = ( psMetadataItem* ) psHashLookup( mdTable, key );
-    if(entry == NULL) {
-        psError( __func__, "Could not find metadata item with given key. Key: %s", key );
+    if (mdTable == NULL) {
+        psError(__func__, "Null metadata table not allowed");
+        return NULL;
+    }
+
+    if (key == NULL) {
+        psError(__func__, "Null key name not allowed");
+        return NULL;
+    }
+
+    entry = (psMetadataItem *) psHashLookup(mdTable, key);
+    if (entry == NULL) {
+        psError(__func__, "Could not find metadata item with given key. Key: %s", key);
         return NULL;
     }
@@ -434,18 +438,18 @@
 }
 
-psMetadataItem *psMetadataGet( psMetadata *restrict md, int where )
-{
-    psList * mdList = NULL;
+psMetadataItem *psMetadataGet(psMetadata * restrict md, int where)
+{
+    psList *mdList = NULL;
     psMetadataItem *entry = NULL;
 
     mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
-        return NULL;
-    }
-
-    entry = ( psMetadataItem* ) psListGet( mdList, where );
-    if(entry == NULL) {
-        psError( __func__, "Couldn't find metadata item with given index. Index: %d", where );
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
+        return NULL;
+    }
+
+    entry = (psMetadataItem *) psListGet(mdList, where);
+    if (entry == NULL) {
+        psError(__func__, "Couldn't find metadata item with given index. Index: %d", where);
         return NULL;
     }
@@ -454,50 +458,50 @@
 }
 
-bool psMetadataSetIterator( psMetadata *restrict md, int where )
-{
-    psList * mdList = NULL;
-
-    mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
-        return false;
-    }
-
-    psListSetIterator( mdList, where );
+bool psMetadataSetIterator(psMetadata * restrict md, int where)
+{
+    psList *mdList = NULL;
+
+    mdList = md->list;
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
+        return false;
+    }
+
+    psListSetIterator(mdList, where);
 
     return true;
 }
 
-psMetadataItem *psMetadataGetNext( psMetadata *restrict md, const char *restrict match, int which )
-{
-    psList * mdList = NULL;
+psMetadataItem *psMetadataGetNext(psMetadata * restrict md, const char *restrict match, int which)
+{
+    psList *mdList = NULL;
     psMetadataItem *entry = NULL;
 
     mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
-        return NULL;
-    }
-
-    mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
-        return NULL;
-    }
-
-    psListSetIterator( mdList, which );
-    entry = psListGetCurrent( mdList );
-    while(entry != NULL) {
-        if(!strncmp( match, entry->name, strlen( match ) )) {
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
+        return NULL;
+    }
+
+    mdList = md->list;
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
+        return NULL;
+    }
+
+    psListSetIterator(mdList, which);
+    entry = psListGetCurrent(mdList);
+    while (entry != NULL) {
+        if (!strncmp(match, entry->name, strlen(match))) {
 
             // Match found
             return entry;
         }
-        entry = psListGetNext( mdList );
+        entry = psListGetNext(mdList);
     }
 
     // Match not found
-    if(entry == NULL) {
-        psError( __func__, "Couldn't find metadata item with given match. Match: %s", match );
+    if (entry == NULL) {
+        psError(__func__, "Couldn't find metadata item with given match. Match: %s", match);
     }
 
@@ -505,35 +509,35 @@
 }
 
-psMetadataItem *psMetadataGetPrevious( psMetadata *restrict md, const char *restrict match, int which )
-{
-    psList * mdList = NULL;
+psMetadataItem *psMetadataGetPrevious(psMetadata * restrict md, const char *restrict match, int which)
+{
+    psList *mdList = NULL;
     psMetadataItem *entry = NULL;
 
     mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
-        return NULL;
-    }
-
-    mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
-        return NULL;
-    }
-
-    psListSetIterator( mdList, which );
-    entry = psListGetCurrent( mdList );
-    while(entry != NULL) {
-        if(!strncmp( match, entry->name, strlen( match ) )) {
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
+        return NULL;
+    }
+
+    mdList = md->list;
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
+        return NULL;
+    }
+
+    psListSetIterator(mdList, which);
+    entry = psListGetCurrent(mdList);
+    while (entry != NULL) {
+        if (!strncmp(match, entry->name, strlen(match))) {
 
             // Match found
             return entry;
         }
-        entry = psListGetPrevious( mdList );
+        entry = psListGetPrevious(mdList);
     }
 
     // Match not found
-    if(entry == NULL) {
-        psError( __func__, "Couldn't find metadata item with given match. Match: %s", match );
+    if (entry == NULL) {
+        psError(__func__, "Couldn't find metadata item with given match. Match: %s", match);
     }
 
@@ -541,40 +545,40 @@
 }
 
-void psMetadataItemPrint( FILE *fd, const char *format, const psMetadataItem *restrict metadataItem )
+void psMetadataItemPrint(FILE * fd, const char *format, const psMetadataItem * restrict metadataItem)
 {
     psMetadataType type;
 
-    if(fd == NULL) {
-        psError( __func__, "Null file descriptor not allowed" );
-        return ;
-    }
-
-    if(format == NULL) {
-        psError( __func__, "Null format not allowed" );
-        return ;
-    }
-
-    if(metadataItem == NULL) {
-        psError( __func__, "Null metadata not allowed" );
-        return ;
+    if (fd == NULL) {
+        psError(__func__, "Null file descriptor not allowed");
+        return;
+    }
+
+    if (format == NULL) {
+        psError(__func__, "Null format not allowed");
+        return;
+    }
+
+    if (metadataItem == NULL) {
+        psError(__func__, "Null metadata not allowed");
+        return;
     }
 
     type = metadataItem->type;
 
-    switch(type) {
+    switch (type) {
     case PS_META_BOOL:
-        fprintf( fd, format, metadataItem->data.B );
+        fprintf(fd, format, metadataItem->data.B);
         break;
     case PS_META_S32:
-        fprintf( fd, format, metadataItem->data.S32 );
+        fprintf(fd, format, metadataItem->data.S32);
         break;
     case PS_META_F32:
-        fprintf( fd, format, metadataItem->data.F32 );
+        fprintf(fd, format, metadataItem->data.F32);
         break;
     case PS_META_F64:
-        fprintf( fd, format, metadataItem->data.F64 );
+        fprintf(fd, format, metadataItem->data.F64);
         break;
     case PS_META_STR:
-        fprintf( fd, format, metadataItem->data.V );
+        fprintf(fd, format, metadataItem->data.V);
         break;
     case PS_META_ITEM_SET:
@@ -585,17 +589,17 @@
     case PS_META_UNKNOWN:
     default:
-        psError( __func__, " Invalid psMetadataType to print: %d", type );
-    }
-}
-
-psMetadata *psMetadataFReadHeader( psMetadata *output, char *extName, int extNum, fitsfile *fd )
+        psError(__func__, " Invalid psMetadataType to print: %d", type);
+    }
+}
+
+psMetadata *psMetadataFReadHeader(psMetadata * output, char *extName, int extNum, fitsfile * fd)
 {
     bool tempBool;
     bool success;
     char keyType;
-    char keyName[ FITS_LINE_SIZE ];
-    char keyValue[ FITS_LINE_SIZE ];
-    char keyComment[ FITS_LINE_SIZE ];
-    char fitsErr[ MAX_STRING_LENGTH ];
+    char keyName[FITS_LINE_SIZE];
+    char keyValue[FITS_LINE_SIZE];
+    char keyComment[FITS_LINE_SIZE];
+    char fitsErr[MAX_STRING_LENGTH];
     int i;
     int hduType = 0;
@@ -605,30 +609,27 @@
     psMetadataType metadataItemType;
 
-    if(fd == NULL) {
-        psError( __func__, "Null FITS file descriptor not allowed" );
-        return NULL;
-    }
-
-    if(extName == NULL && extNum == 0) {
-        psError( __func__, "Null extName and extNum = 0 not allowed" );
-        return NULL;
-    } else
-        if(extName && extNum) {
-            psError( __func__, "Both extName and extNum arguments should not have non zero values." );
-            return NULL;
-        }
-
+    if (fd == NULL) {
+        psError(__func__, "Null FITS file descriptor not allowed");
+        return NULL;
+    }
+
+    if (extName == NULL && extNum == 0) {
+        psError(__func__, "Null extName and extNum = 0 not allowed");
+        return NULL;
+    } else if (extName && extNum) {
+        psError(__func__, "Both extName and extNum arguments should not have non zero values.");
+        return NULL;
+    }
     // Allocate metadata if user didn't
-    if(output == NULL) {
+    if (output == NULL) {
         output = psMetadataAlloc();
     }
-
     // Move to user designated HDU number or HDU name in FITS file. HDU numbers starts at one.
-    if(extName != NULL) {
-        if(fits_movnam_hdu( fd, ANY_HDU, extName, 0, &status ) != 0) {
+    if (extName != NULL) {
+        if (fits_movnam_hdu(fd, ANY_HDU, extName, 0, &status) != 0) {
             FITS_ERROR("FITS error while locating header %s: %s", extName);
         }
     } else {
-        if(fits_movabs_hdu( fd, extNum, &hduType, &status ) != 0) {
+        if (fits_movabs_hdu(fd, extNum, &hduType, &status) != 0) {
             FITS_ERROR("FITS error while locating header %d: %s", extNum);
         }
@@ -636,19 +637,19 @@
 
     // Get number of key names
-    if(fits_get_hdrpos( fd, &numKeys, &keyNum, &status ) != 0) {
+    if (fits_get_hdrpos(fd, &numKeys, &keyNum, &status) != 0) {
         FITS_ERROR("FITS error while reading key %d: %s", keyNum);
     }
-
     // Get each key name. Keywords start at one.
-    for(i = 1; i <= numKeys; i++) {
-        if(fits_read_keyn( fd, i, keyName, keyValue, keyComment, &status ) != 0) {
+    for (i = 1; i <= numKeys; i++) {
+        if (fits_read_keyn(fd, i, keyName, keyValue, keyComment, &status) != 0) {
             FITS_ERROR("FITS error while reading key %d: %s", keyNum);
         }
-        if(fits_get_keytype( keyValue, &keyType, &status ) != 0) {
-            fits_get_errstatus( status, fitsErr );
-            if(status != VALUE_UNDEFINED) {
+        if (fits_get_keytype(keyValue, &keyType, &status) != 0) {
+            fits_get_errstatus(status, fitsErr);
+            if (status != VALUE_UNDEFINED) {
                 FITS_ERROR("FITS error while determining key %d type: %s", keyNum);
             } else {
-                // Some keywords are still valid even though they don't have a type, like COMMENTS and HISTORY
+                // Some keywords are still valid even though they don't have a type, like COMMENTS and
+                // HISTORY
                 keyType = 'C';
                 status = 0;
@@ -656,31 +657,37 @@
         }
 
-        switch(keyType) {
+        switch (keyType) {
         case 'I':
             metadataItemType = PS_META_S32;
-            success = psMetadataAdd( output, PS_LIST_TAIL, keyName, metadataItemType, keyComment, atoi( keyValue ) );
+            success =
+                psMetadataAdd(output, PS_LIST_TAIL, keyName, metadataItemType, keyComment,
+                              atoi(keyValue));
             break;
         case 'F':
             metadataItemType = PS_META_F64;
-            success = psMetadataAdd( output, PS_LIST_TAIL, keyName, metadataItemType, keyComment, atof( keyValue ) );
+            success =
+                psMetadataAdd(output, PS_LIST_TAIL, keyName, metadataItemType, keyComment,
+                              atof(keyValue));
             break;
         case 'C':
             metadataItemType = PS_META_STR;
-            success = psMetadataAdd( output, PS_LIST_TAIL, keyName, metadataItemType, keyComment, keyValue );
+            success =
+                psMetadataAdd(output, PS_LIST_TAIL, keyName, metadataItemType, keyComment, keyValue);
             break;
         case 'L':
             metadataItemType = PS_META_BOOL;
-            tempBool = ( keyValue[ 0 ] == 'T' ) ? 1 : 0;
-            success = psMetadataAdd( output, PS_LIST_TAIL, keyName, metadataItemType, keyComment, tempBool );
+            tempBool = (keyValue[0] == 'T') ? 1 : 0;
+            success =
+                psMetadataAdd(output, PS_LIST_TAIL, keyName, metadataItemType, keyComment, tempBool);
             break;
         case 'U':
         case 'X':
         default:
-            psError( __func__, "Invalid psMetadataType: %c", keyType );
+            psError(__func__, "Invalid psMetadataType: %c", keyType);
             return output;
         }
 
-        if(!success) {
-            psError( __func__, "Failed to add metadata item. Name: %s", keyName );
+        if (!success) {
+            psError(__func__, "Failed to add metadata item. Name: %s", keyName);
             return output;
         }
Index: /trunk/psLib/src/collections/psMetadata.h
===================================================================
--- /trunk/psLib/src/collections/psMetadata.h	(revision 1406)
+++ /trunk/psLib/src/collections/psMetadata.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psMetadata.h
 *
@@ -10,18 +11,18 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-05 20:55:22 $
+*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
 */
 #ifndef PS_METADATA_H
-#define PS_METADATA_H
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <fitsio.h>
-
-#include "psHash.h"
-#include "psList.h"
+#    define PS_METADATA_H
+
+#    include <stdarg.h>
+#    include <stdio.h>
+#    include <fitsio.h>
+
+#    include "psHash.h"
+#    include "psList.h"
 
 /// @addtogroup Metadata
@@ -33,16 +34,16 @@
  */
 typedef enum {
-    PS_META_ITEM_SET = 0,                   ///< Null. Metadata is in psMetadataItem.items
-    PS_META_BOOL,                           ///< Boolean data.
-    PS_META_S32,                            ///< Signed 32-bit integer data.
-    PS_META_F32,                            ///< Single-precision float data.
-    PS_META_F64,                            ///< Double-precision float data.
-    PS_META_STR,                            ///< String data (Stored in as void *).
-    PS_META_IMG,                            ///< Image data (Stored in as void *).
-    PS_META_JPEG,                           ///< JPEG data (Stored in as void .
-    PS_META_PNG,                            ///< PNG data (Stored in as void *).
-    PS_META_ASTROM,                         ///< Astrometric coefficients (Stored in as void *).
-    PS_META_UNKNOWN,                        ///< Other data (Stored in as void *).
-    PS_META_NTYPE                         ///< Number of types. Must be last.
+    PS_META_ITEM_SET = 0,       // /< Null. Metadata is in psMetadataItem.items
+    PS_META_BOOL,                          // /< Boolean data.
+    PS_META_S32,                           // /< Signed 32-bit integer data.
+    PS_META_F32,                           // /< Single-precision float data.
+    PS_META_F64,                           // /< Double-precision float data.
+    PS_META_STR,                           // /< String data (Stored in as void *).
+    PS_META_IMG,                           // /< Image data (Stored in as void *).
+    PS_META_JPEG,                          // /< JPEG data (Stored in as void .
+    PS_META_PNG,                           // /< PNG data (Stored in as void *).
+    PS_META_ASTROM,                        // /< Astrometric coefficients (Stored in as void *).
+    PS_META_UNKNOWN,                       // /< Other data (Stored in as void *).
+    PS_META_NTYPE                          // /< Number of types. Must be last.
 } psMetadataType;
 
@@ -54,17 +55,16 @@
 typedef struct psMetadataItem
 {
-    const int id;                       ///< Unique ID for metadata item.
-    char *restrict name;                ///< Name of metadata item.
-    psMetadataType type;                ///< Type of metadata item.
-    union
-    {
+    const int id;               // /< Unique ID for metadata item.
+    char *restrict name;        // /< Name of metadata item.
+    psMetadataType type;        // /< Type of metadata item.
+    union {
         bool B;
-        psS32 S32;                  ///< Signed 32-bit integer data.
-        psF32 F32;                  ///< Single-precision float data.
-        psF64 F64;                  ///< Double-precision float data.
-        psPTR V;                    ///< Pointer to other type of data.
-    }data;                          ///< Union for data types.
-    char *comment;                      ///< Optional comment ("", not NULL).
-    psList *restrict items;             ///< List of psMetadataItems with same name.
+        psS32 S32;              // /< Signed 32-bit integer data.
+        psF32 F32;              // /< Single-precision float data.
+        psF64 F64;              // /< Double-precision float data.
+        psPTR V;                // /< Pointer to other type of data.
+    } data;                     // /< Union for data types.
+    char *comment;              // /< Optional comment ("", not NULL).
+    psList *restrict items;     // /< List of psMetadataItems with same name.
 }
 psMetadataItem;
@@ -78,12 +78,13 @@
 typedef struct psMetadata
 {
-    psList* restrict list;
-    psHash* restrict table;
+    psList *restrict list;
+    psHash *restrict table;
 }
 psMetadata;
 
-
 /*****************************************************************************/
+
 /* FUNCTION PROTOTYPES                                                       */
+
 /*****************************************************************************/
 
@@ -101,10 +102,9 @@
  * @return psMetadataItem*: Pointer metadata item.
  */
-psMetadataItem *psMetadataItemAlloc(
-    const char *name,                       ///< Name of metadata item.
-    psMetadataType type,                    ///< Type of metadata item.
-    const char *comment,                    ///< Comment for metadata item.
-    ...                                 ///< Arguments for name formatting and metadata item data.
-);
+psMetadataItem *psMetadataItemAlloc(const char *name,   // /< Name of metadata item.
+                                    psMetadataType type,        // /< Type of metadata item.
+                                    const char *comment,        // /< Comment for metadata item.
+                                    ... // /< Arguments for name formatting and metadata item data.
+                                   );
 
 /** Create a metadata item with va_list.
@@ -121,10 +121,10 @@
  * @return psMetadataItem*: Pointer metadata item.
  */
-psMetadataItem *psMetadataItemAllocV(
-    const char *name,                       ///< Name of metadata item.
-    psMetadataType type,                    ///< Type of metadata item.
-    const char *comment,                    ///< Comment for metadata item.
-    va_list list                        ///< Arguments for name formatting and metadata item data.
-);
+psMetadataItem *psMetadataItemAllocV(const char *name,  // /< Name of metadata item.
+                                     psMetadataType type,       // /< Type of metadata item.
+                                     const char *comment,       // /< Comment for metadata item.
+                                     va_list list       // /< Arguments for name formatting and metadata item
+                                     // data.
+                                    );
 
 /** Create a metadata collection.
@@ -134,7 +134,6 @@
  * @return psMetadata*: Pointer metadata.
  */
-psMetadata *psMetadataAlloc(
-    void                                ///< Void.
-);
+psMetadata *psMetadataAlloc(void        // /< Void.
+                           );
 
 /** Add existing metadata item to metadata collection.
@@ -144,9 +143,8 @@
  * @return bool: True for success, false for failure.
  */
-bool psMetadataAddItem(
-    psMetadata *restrict md,                ///< Metadata collection to insert metadat item.
-    int where,                              ///< Location to be added.
-    psMetadataItem *restrict item       ///< Metadata item to be added.
-);
+bool psMetadataAddItem(psMetadata * restrict md,        // /< Metadata collection to insert metadat item.
+                       int where,       // /< Location to be added.
+                       psMetadataItem * restrict item   // /< Metadata item to be added.
+                      );
 
 /** Create and add a metadata item to metadata collection.
@@ -156,12 +154,11 @@
  * @return bool: True for success, false for failure.
  */
-bool psMetadataAdd(
-    psMetadata *restrict md,                ///< Metadata collection to insert metadat item.
-    int where,                              ///< Location to be added.
-    const char *name,                       ///< Name of metadata item.
-    psMetadataType type,                    ///< Type of metadata item.
-    const char *comment,                    ///< Comment for metadata item.
-    ...                                 ///< Arguments for name formatting and metadata item data.
-);
+bool psMetadataAdd(psMetadata * restrict md,    // /< Metadata collection to insert metadat item.
+                   int where,   // /< Location to be added.
+                   const char *name,    // /< Name of metadata item.
+                   psMetadataType type, // /< Type of metadata item.
+                   const char *comment, // /< Comment for metadata item.
+                   ...          // /< Arguments for name formatting and metadata item data.
+                  );
 
 /** Remove an item from metadata collection.
@@ -174,9 +171,8 @@
  * @return bool: True for success, false for failure.
  */
-bool psMetadataRemove(
-    psMetadata *restrict md,                ///< Metadata collection to insert metadat item.
-    int where,                              ///< Location to be removed.
-    const char *restrict key            ///< Name of metadata key.
-);
+bool psMetadataRemove(psMetadata * restrict md, // /< Metadata collection to insert metadat item.
+                      int where,        // /< Location to be removed.
+                      const char *restrict key  // /< Name of metadata key.
+                     );
 
 /** Find an item in the metadata collection based on key name.
@@ -187,8 +183,8 @@
  * @return psMetadataItem*: Pointer metadata item.
  */
-psMetadataItem *psMetadataLookup(
-    psMetadata *restrict md,                ///< Metadata collection to insert metadat item.
-    const char *restrict key            ///< Name of metadata key.
-);
+psMetadataItem *psMetadataLookup(psMetadata * restrict md,      // /< Metadata collection to insert metadat
+                                 // item.
+                                 const char *restrict key       // /< Name of metadata key.
+                                );
 
 /** Find an item in the metadata collection based on list index.
@@ -198,8 +194,7 @@
  * @return psMetadataItem*: Pointer metadata item.
  */
-psMetadataItem *psMetadataGet(
-    psMetadata *restrict md,                ///< Metadata collection to insert metadat item.
-    int where                           ///< Location to be retrieved.
-);
+psMetadataItem *psMetadataGet(psMetadata * restrict md, // /< Metadata collection to insert metadat item.
+                              int where // /< Location to be retrieved.
+                             );
 
 /** Set or reset metadata iterator.
@@ -209,8 +204,7 @@
  * @return void: void.
  */
-bool psMetadataSetIterator(
-    psMetadata *restrict md,                ///< Metadata collection to iterate.
-    int where                           ///< Location of iterator.
-);
+bool psMetadataSetIterator(psMetadata * restrict md,    // /< Metadata collection to iterate.
+                           int where    // /< Location of iterator.
+                          );
 
 /** Get next metadata item.
@@ -220,9 +214,8 @@
  * @return psMetadataItem*: Pointer metadata item.
  */
-psMetadataItem *psMetadataGetNext(
-    psMetadata *restrict md,                ///< Metadata collection to iterate.
-    const char *restrict match,             ///< Beginning of key name.
-    int which                           ///< Iterator to be used.
-);
+psMetadataItem *psMetadataGetNext(psMetadata * restrict md,     // /< Metadata collection to iterate.
+                                  const char *restrict match,   // /< Beginning of key name.
+                                  int which     // /< Iterator to be used.
+                                 );
 
 /** Get previous metadata item.
@@ -232,9 +225,8 @@
  * @return psMetadataItem*: Pointer metadata item.
  */
-psMetadataItem *psMetadataGetPrevious(
-    psMetadata *restrict md,                ///< Metadata collection to iterate.
-    const char *restrict match,             ///< Beginning of key name.
-    int which                           ///< Iterator to be used.
-);
+psMetadataItem *psMetadataGetPrevious(psMetadata * restrict md, // /< Metadata collection to iterate.
+                                      const char *restrict match,       // /< Beginning of key name.
+                                      int which // /< Iterator to be used.
+                                     );
 
 /** Print metadata item to file.
@@ -248,9 +240,8 @@
  * @return psMetadataItem*: Pointer metadata item.
  */
-void psMetadataItemPrint(
-    FILE *fd,                                       ///< Pointer to file to write metadata item.
-    const char *format,                             ///< Format to print metadata item.
-    const psMetadataItem *restrict metadataItem     ///< Metadata item to print.
-);
+void psMetadataItemPrint(FILE * fd,     // /< Pointer to file to write metadata item.
+                         const char *format,    // /< Format to print metadata item.
+                         const psMetadataItem * restrict metadataItem   // /< Metadata item to print.
+                        );
 
 /** Read metadata header.
@@ -261,10 +252,9 @@
  * @return psMetadata*: Pointer metadata.
  */
-psMetadata *psMetadataReadHeader(
-    psMetadata *output,                     ///< Resulting metadata from read.
-    char *extname,                          ///< File name extension string.
-    int extnum,                             ///< File name extension number. Starts at 1.
-    char *filename                          ///< Name of file to read.
-);
+psMetadata *psMetadataReadHeader(psMetadata * output,   // /< Resulting metadata from read.
+                                 char *extname, // /< File name extension string.
+                                 int extnum,    // /< File name extension number. Starts at 1.
+                                 char *filename // /< Name of file to read.
+                                );
 
 /** Read metadata header.
@@ -274,10 +264,10 @@
  * @return psMetadata*: Pointer metadata.
  */
-psMetadata *psMetadataFReadHeader(
-    psMetadata *output,                     ///< Resulting metadata from read.
-    char *extName,                          ///< File name extension string.
-    int extNum,                             ///< File name extension number.
-    fitsfile *fd                            ///< Pointer to file to read.
-);
+psMetadata *psMetadataFReadHeader(psMetadata * output,  // /< Resulting metadata from read.
+                                  char *extName,        // /< File name extension string.
+                                  int extNum,   // /< File name extension number.
+                                  fitsfile * fd // /< Pointer to file to read.
+                                 );
+
 /// @}
 
Index: /trunk/psLib/src/collections/psScalar.c
===================================================================
--- /trunk/psLib/src/collections/psScalar.c	(revision 1406)
+++ /trunk/psLib/src/collections/psScalar.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psScalar.c
  *
@@ -8,6 +9,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -15,5 +16,7 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 #include "psMemory.h"
@@ -24,5 +27,7 @@
 
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
@@ -30,5 +35,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -36,5 +43,7 @@
 
 /*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
+
 /*****************************************************************************/
 
@@ -42,5 +51,7 @@
 
 /*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
+
 /*****************************************************************************/
 
@@ -48,5 +59,7 @@
 
 /*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
+
 /*****************************************************************************/
 
@@ -54,5 +67,7 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
+
 /*****************************************************************************/
 psScalar *psScalarAlloc(psC64 value, psElemType dataType)
@@ -61,7 +76,7 @@
 
     // Create scalar
-    scalar = (psScalar *)psAlloc(sizeof(psScalar));
-    if(scalar == NULL) {
-        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
+    scalar = (psScalar *) psAlloc(sizeof(psScalar));
+    if (scalar == NULL) {
+        psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
     }
 
@@ -71,38 +86,38 @@
     switch (dataType) {
     case PS_TYPE_S8:
-        scalar->data.S8 = (psS8)value;
+        scalar->data.S8 = (psS8) value;
         break;
     case PS_TYPE_U8:
-        scalar->data.U8 = (psU8)value;
+        scalar->data.U8 = (psU8) value;
         break;
     case PS_TYPE_S16:
-        scalar->data.S16 = (psS16)value;
+        scalar->data.S16 = (psS16) value;
         break;
     case PS_TYPE_U16:
-        scalar->data.U16 = (psU16)value;
+        scalar->data.U16 = (psU16) value;
         break;
     case PS_TYPE_S32:
-        scalar->data.S32 = (psS32)value;
+        scalar->data.S32 = (psS32) value;
         break;
     case PS_TYPE_U32:
-        scalar->data.U32 = (psU32)value;
+        scalar->data.U32 = (psU32) value;
         break;
     case PS_TYPE_S64:
-        scalar->data.S64 = (psS64)value;
+        scalar->data.S64 = (psS64) value;
         break;
     case PS_TYPE_U64:
-        scalar->data.U64 = (psU64)value;
+        scalar->data.U64 = (psU64) value;
         break;
     case PS_TYPE_F32:
-        scalar->data.F32 = (psF32)value;
+        scalar->data.F32 = (psF32) value;
         break;
     case PS_TYPE_F64:
-        scalar->data.F64 = (psF64)value;
+        scalar->data.F64 = (psF64) value;
         break;
     case PS_TYPE_C32:
-        scalar->data.C32 = (psC32)value;
+        scalar->data.C32 = (psC32) value;
         break;
     case PS_TYPE_C64:
-        scalar->data.C64 = (psC64)value;
+        scalar->data.C64 = (psC64) value;
         break;
     default:
@@ -110,9 +125,8 @@
     }
 
-
     return scalar;
 }
 
-void psScalarFree(psScalar *restrict scalar)
+void psScalarFree(psScalar * restrict scalar)
 {
     if (scalar == NULL) {
@@ -122,4 +136,2 @@
     psFree(scalar);
 }
-
-
Index: /trunk/psLib/src/collections/psScalar.h
===================================================================
--- /trunk/psLib/src/collections/psScalar.h	(revision 1406)
+++ /trunk/psLib/src/collections/psScalar.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psScalar.h
  *
@@ -10,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -17,7 +18,7 @@
 
 #ifndef PS_SCALAR_H
-#define PS_SCALAR_H
+#    define PS_SCALAR_H
 
-#include "psType.h"
+#    include "psType.h"
 
 /// @addtogroup Scalar
@@ -31,25 +32,27 @@
 typedef struct
 {
-    psType type;                       ///< Type of data.
+    psType type;                // /< Type of data.
 
     union {
-        psU8    U8;                    ///< Unsigned 8-bit integer data.
-        psU16   U16;                   ///< Unsigned 16-bit integer data.
-        psU32   U32;                   ///< Unsigned 32-bit integer data.
-        psU64   U64;                   ///< Unsigned 64-bit integer data.
-        psS8    S8;                    ///< Signed 8-bit integer data.
-        psS16   S16;                   ///< Signed 16-bit integer data.
-        psS32   S32;                   ///< Signed 32-bit integer data.
-        psS64   S64;                   ///< Signed 64-bit integer data.
-        psF32   F32;                   ///< Single-precision float data.
-        psF64   F64;                   ///< Double-precision float data.
-        psC32   C32;                   ///< Single-precision complex data.
-        psC64   C64;                   ///< Double-precision complex data.
-    } data;                            ///< Union for data types.
+        psU8 U8;                // /< Unsigned 8-bit integer data.
+        psU16 U16;              // /< Unsigned 16-bit integer data.
+        psU32 U32;              // /< Unsigned 32-bit integer data.
+        psU64 U64;              // /< Unsigned 64-bit integer data.
+        psS8 S8;                // /< Signed 8-bit integer data.
+        psS16 S16;              // /< Signed 16-bit integer data.
+        psS32 S32;              // /< Signed 32-bit integer data.
+        psS64 S64;              // /< Signed 64-bit integer data.
+        psF32 F32;              // /< Single-precision float data.
+        psF64 F64;              // /< Double-precision float data.
+        psC32 C32;              // /< Single-precision complex data.
+        psC64 C64;              // /< Double-precision complex data.
+    } data;                     // /< Union for data types.
 }
 psScalar;
 
 /*****************************************************************************/
+
 /* FUNCTION PROTOTYPES                                                       */
+
 /*****************************************************************************/
 
@@ -62,9 +65,7 @@
  *
  */
-psScalar *psScalarAlloc(
-    psC64 value,            ///< Data to be put into psScalar.
-    psElemType dataType     ///< Type of data to be held by psScalar.
-);
-
+psScalar *psScalarAlloc(psC64 value,    // /< Data to be put into psScalar.
+                        psElemType dataType     // /< Type of data to be held by psScalar.
+                       );
 
 /** Deallocate a scalar.
@@ -75,7 +76,6 @@
  *
  */
-void psScalarFree(
-    psScalar *restrict scalar  ///< Scalar to free.
-);
+void psScalarFree(psScalar * restrict scalar    // /< Scalar to free.
+                 );
 
 /// @}
Index: /trunk/psLib/src/collections/psVector.c
===================================================================
--- /trunk/psLib/src/collections/psVector.c	(revision 1406)
+++ /trunk/psLib/src/collections/psVector.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psVector.c
 *
@@ -8,6 +9,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 22:34:05 $
+*  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -15,7 +16,9 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
-/******************************************************************************/
-#include <string.h>        // for memcpy
+
+/******************************************************************************/
+#include <string.h>                        // for memcpy
 #include <stdlib.h>
 #include <math.h>
@@ -28,5 +31,7 @@
 
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
@@ -34,5 +39,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -40,5 +47,7 @@
 
 /*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
+
 /*****************************************************************************/
 
@@ -46,5 +55,7 @@
 
 /*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
+
 /*****************************************************************************/
 
@@ -52,27 +63,31 @@
 
 /*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
-/*****************************************************************************/
-static void vectorFree( psVector *restrict psVec );
-
-/*****************************************************************************/
+
+/*****************************************************************************/
+static void vectorFree(psVector * restrict psVec);
+
+/*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
-/*****************************************************************************/
-psVector* psVectorAlloc( unsigned int nalloc, psElemType elemType )
-{
-    psVector * psVec = NULL;
+
+/*****************************************************************************/
+psVector *psVectorAlloc(unsigned int nalloc, psElemType elemType)
+{
+    psVector *psVec = NULL;
     int elementSize = 0;
 
     // Invalid nalloc
-    if ( nalloc < 1 ) {
-        psError( __func__, "Invalid value for nalloc. nalloc: %d\n", nalloc );
+    if (nalloc < 1) {
+        psError(__func__, "Invalid value for nalloc. nalloc: %d\n", nalloc);
         return NULL;
     }
 
-    elementSize = PSELEMTYPE_SIZEOF( elemType );
+    elementSize = PSELEMTYPE_SIZEOF(elemType);
 
     // Create vector struct
-    psVec = ( psVector * ) psAlloc( sizeof( psVector ) );
-    p_psMemSetDeallocator( psVec, ( psFreeFcn ) vectorFree );
+    psVec = (psVector *) psAlloc(sizeof(psVector));
+    p_psMemSetDeallocator(psVec, (psFreeFcn) vectorFree);
 
     psVec->type.dimen = PS_DIMEN_VECTOR;
@@ -82,10 +97,10 @@
 
     // Create vector data array
-    psVec->data.V = psAlloc( nalloc * elementSize );
+    psVec->data.V = psAlloc(nalloc * elementSize);
 
     return psVec;
 }
 
-psVector *psVectorRealloc( unsigned int nalloc, psVector *restrict in )
+psVector *psVectorRealloc(unsigned int nalloc, psVector * restrict in)
 {
     int elementSize = 0;
@@ -93,52 +108,48 @@
 
     // Invalid nalloc
-    if ( nalloc < 1 ) {
-        psError( __func__, "Invalid value for realloc (%d)\n", nalloc );
+    if (nalloc < 1) {
+        psError(__func__, "Invalid value for realloc (%d)\n", nalloc);
         return NULL;
     }
 
-    if ( in == NULL ) {
-        psError( __func__, "Null input vector\n" );
+    if (in == NULL) {
+        psError(__func__, "Null input vector\n");
         return NULL;
-    } else
-        if ( in->nalloc != nalloc ) {                    // No need to realloc to same size
-            elemType = in->type.type;
-            elementSize = PSELEMTYPE_SIZEOF( elemType );
-            if ( nalloc < in->n ) {
-                in->n = nalloc;
-            }
-
-            // Realloc after decrementation to avoid accessing freed array elements
-            in->data.V = psRealloc( in->data.V, nalloc * elementSize );
-            in->nalloc = nalloc;
+    } else if (in->nalloc != nalloc) {     // No need to realloc to same size
+        elemType = in->type.type;
+        elementSize = PSELEMTYPE_SIZEOF(elemType);
+        if (nalloc < in->n) {
+            in->n = nalloc;
         }
+        // Realloc after decrementation to avoid accessing freed array elements
+        in->data.V = psRealloc(in->data.V, nalloc * elementSize);
+        in->nalloc = nalloc;
+    }
 
     return in;
 }
 
-psVector *psVectorRecycle( psVector *restrict in, unsigned int nalloc, psElemType type )
+psVector *psVectorRecycle(psVector * restrict in, unsigned int nalloc, psElemType type)
 {
     psElemType elemType;
 
-    if ( in == NULL ) {
-        return psVectorAlloc( nalloc, type );
+    if (in == NULL) {
+        return psVectorAlloc(nalloc, type);
     }
 
     elemType = in->type.type;
 
-    if ( in->nalloc == nalloc && elemType == type ) {
+    if (in->nalloc == nalloc && elemType == type) {
         // it is proper size/type already
         return in;
     }
-
     // Invalid nalloc
-    if ( nalloc < 1 ) {
-        psError( __func__, "Invalid value for nalloc (%d)\n", nalloc );
-        psFree( in );
+    if (nalloc < 1) {
+        psError(__func__, "Invalid value for nalloc (%d)\n", nalloc);
+        psFree(in);
         return NULL;
     }
 
-
-    in->data.V = psRealloc( in->data.V, nalloc * PSELEMTYPE_SIZEOF( type ) );
+    in->data.V = psRealloc(in->data.V, nalloc * PSELEMTYPE_SIZEOF(type));
 
     in->type.type = type;
@@ -149,5 +160,5 @@
 }
 
-psVector *psVectorSort( psVector *restrict outVector, const psVector *restrict inVector )
+psVector *psVectorSort(psVector * restrict outVector, const psVector * restrict inVector)
 {
     int inN = 0;
@@ -158,6 +169,6 @@
     psElemType inType = 0;
 
-    if ( inVector == NULL ) {
-        psError( __func__, " : Line %d - Null input vector\n", __LINE__ );
+    if (inVector == NULL) {
+        psError(__func__, " : Line %d - Null input vector\n", __LINE__);
         return outVector;
     }
@@ -166,8 +177,8 @@
     inN = inVector->n;
     inVec = inVector->data.V;
-    elSize = PSELEMTYPE_SIZEOF( inType );
-
-    if ( outVector == NULL ) {
-        outVector = psVectorAlloc( inN, inType );
+    elSize = PSELEMTYPE_SIZEOF(inType);
+
+    if (outVector == NULL) {
+        outVector = psVectorAlloc(inN, inType);
         outVector->n = inVector->n;
     }
@@ -176,63 +187,62 @@
     outVec = outVector->data.V;
 
-    if ( inN != outN ) {
-        psError( __func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n", __LINE__,
-                 inN, outN );
-        return outVector;
-    }
-
-    if ( inType != outVector->type.type ) {
-        psError( __func__, " : Line %d - Input and output vectors are not same type: in=%d out=%d\n", __LINE__,
-                 inType, outVector->type.type );
-        return outVector;
-    }
-
-    if ( inN == 0 ) {
-        psError( __func__, " : Line %d - No elements in use for input vector\n", __LINE__ );
-        return outVector;
-    }
-
-    if ( outN == 0 ) {
-        psError( __func__, " : Line %d - No elements in use for output vector\n", __LINE__ );
-        return outVector;
-    }
-
+    if (inN != outN) {
+        psError(__func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n",
+                __LINE__, inN, outN);
+        return outVector;
+    }
+
+    if (inType != outVector->type.type) {
+        psError(__func__, " : Line %d - Input and output vectors are not same type: in=%d out=%d\n", __LINE__,
+                inType, outVector->type.type);
+        return outVector;
+    }
+
+    if (inN == 0) {
+        psError(__func__, " : Line %d - No elements in use for input vector\n", __LINE__);
+        return outVector;
+    }
+
+    if (outN == 0) {
+        psError(__func__, " : Line %d - No elements in use for output vector\n", __LINE__);
+        return outVector;
+    }
     // Copy input vector values into output vector
-    memcpy( outVec, inVec, elSize * outN );
+    memcpy(outVec, inVec, elSize * outN);
 
     // Sort output vector
-    switch ( inType ) {
+    switch (inType) {
     case PS_TYPE_U8:
-        qsort( outVec, inN, elSize, psCompareU8 );
+        qsort(outVec, inN, elSize, psCompareU8);
         break;
     case PS_TYPE_U16:
-        qsort( outVec, inN, elSize, psCompareU16 );
+        qsort(outVec, inN, elSize, psCompareU16);
         break;
     case PS_TYPE_U32:
-        qsort( outVec, inN, elSize, psCompareU32 );
+        qsort(outVec, inN, elSize, psCompareU32);
         break;
     case PS_TYPE_U64:
-        qsort( outVec, inN, elSize, psCompareU64 );
+        qsort(outVec, inN, elSize, psCompareU64);
         break;
     case PS_TYPE_S8:
-        qsort( outVec, inN, elSize, psCompareS8 );
+        qsort(outVec, inN, elSize, psCompareS8);
         break;
     case PS_TYPE_S16:
-        qsort( outVec, inN, elSize, psCompareS16 );
+        qsort(outVec, inN, elSize, psCompareS16);
         break;
     case PS_TYPE_S32:
-        qsort( outVec, inN, elSize, psCompareS32 );
+        qsort(outVec, inN, elSize, psCompareS32);
         break;
     case PS_TYPE_S64:
-        qsort( outVec, inN, elSize, psCompareS64 );
+        qsort(outVec, inN, elSize, psCompareS64);
         break;
     case PS_TYPE_F32:
-        qsort( outVec, inN, elSize, psCompareF32 );
+        qsort(outVec, inN, elSize, psCompareF32);
         break;
     case PS_TYPE_F64:
-        qsort( outVec, inN, elSize, psCompareF64 );
+        qsort(outVec, inN, elSize, psCompareF64);
         break;
     default:
-        psError( __func__, " : Line %d - Invalid psType\n", __LINE__ );
+        psError(__func__, " : Line %d - Invalid psType\n", __LINE__);
     }
 
@@ -251,5 +261,5 @@
 }
 
-psVector *psVectorSortIndex( psVector *restrict outVector, const psVector *restrict inVector )
+psVector *psVectorSortIndex(psVector * restrict outVector, const psVector * restrict inVector)
 {
     int inN = 0;
@@ -263,6 +273,6 @@
     psElemType inType = 0;
 
-    if ( inVector == NULL ) {
-        psError( __func__, " : Line %d - Null input vector\n", __LINE__ );
+    if (inVector == NULL) {
+        psError(__func__, " : Line %d - Null input vector\n", __LINE__);
         return outVector;
     }
@@ -272,6 +282,6 @@
     inType = inVector->type.type;
 
-    if ( outVector == NULL ) {
-        outVector = psVectorAlloc( inN, PS_TYPE_U32 );
+    if (outVector == NULL) {
+        outVector = psVectorAlloc(inN, PS_TYPE_U32);
         outVector->n = inN;
     }
@@ -280,68 +290,68 @@
     outVec = outVector->data.V;
 
-    if ( inN != outN ) {
-        psError( __func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n",
-                 __LINE__, inN, outN );
-        return outVector;
-    }
-
-    if ( outVector->type.type != PS_TYPE_U32 ) {
-        psError( __func__, " : Line %d - Output vector is not of type U32: out=%d\n",
-                 __LINE__, outVector->type.type );
-        return outVector;
-    }
-
-    tmpVector = psVectorAlloc( inN, inType );
+    if (inN != outN) {
+        psError(__func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n",
+                __LINE__, inN, outN);
+        return outVector;
+    }
+
+    if (outVector->type.type != PS_TYPE_U32) {
+        psError(__func__, " : Line %d - Output vector is not of type U32: out=%d\n",
+                __LINE__, outVector->type.type);
+        return outVector;
+    }
+
+    tmpVector = psVectorAlloc(inN, inType);
     tmpVector->n = inN;
-    tmpVector = psVectorSort( tmpVector, inVector );
+    tmpVector = psVectorSort(tmpVector, inVector);
 
     // Sort output vector
-    switch ( inType ) {
+    switch (inType) {
     case PS_TYPE_U8:
-        SORT_INDICES( U8 );
+        SORT_INDICES(U8);
         break;
     case PS_TYPE_U16:
-        SORT_INDICES( U16 );
+        SORT_INDICES(U16);
         break;
     case PS_TYPE_U32:
-        SORT_INDICES( U32 );
+        SORT_INDICES(U32);
         break;
     case PS_TYPE_U64:
-        SORT_INDICES( U64 );
+        SORT_INDICES(U64);
         break;
     case PS_TYPE_S8:
-        SORT_INDICES( S8 );
+        SORT_INDICES(S8);
         break;
     case PS_TYPE_S16:
-        SORT_INDICES( S16 );
+        SORT_INDICES(S16);
         break;
     case PS_TYPE_S32:
-        SORT_INDICES( S32 );
+        SORT_INDICES(S32);
         break;
     case PS_TYPE_S64:
-        SORT_INDICES( S64 );
+        SORT_INDICES(S64);
         break;
     case PS_TYPE_F32:
-        SORT_INDICES( F32 );
+        SORT_INDICES(F32);
         break;
     case PS_TYPE_F64:
-        SORT_INDICES( F64 );
+        SORT_INDICES(F64);
         break;
     default:
-        psError( __func__, " : Line %d - Invalid psType\n", __LINE__ );
+        psError(__func__, " : Line %d - Invalid psType\n", __LINE__);
     }
 
     // Free temp memory
-    psFree( tmpVector );
+    psFree(tmpVector);
 
     return outVector;
 }
 
-static void vectorFree( psVector *restrict psVec )
-{
-    if ( psVec == NULL ) {
-        return ;
-    }
-
-    psFree( psVec->data.V );
-}
+static void vectorFree(psVector * restrict psVec)
+{
+    if (psVec == NULL) {
+        return;
+    }
+
+    psFree(psVec->data.V);
+}
Index: /trunk/psLib/src/collections/psVector.h
===================================================================
--- /trunk/psLib/src/collections/psVector.h	(revision 1406)
+++ /trunk/psLib/src/collections/psVector.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psVector.h
  *
@@ -11,6 +12,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -18,7 +19,7 @@
 
 #ifndef PS_VECTOR_H
-#define PS_VECTOR_H
+#    define PS_VECTOR_H
 
-#include "psType.h"
+#    include "psType.h"
 
 /// @addtogroup Vector
@@ -32,28 +33,30 @@
 typedef struct
 {
-    psType type;                        ///< Type of data.
-    unsigned int nalloc;                ///< Total number of elements available.
-    unsigned int n;                     ///< Number of elements in use.
+    psType type;                // /< Type of data.
+    unsigned int nalloc;        // /< Total number of elements available.
+    unsigned int n;             // /< Number of elements in use.
 
     union {
-        psU8    *U8;                    ///< Unsigned 8-bit integer data.
-        psU16   *U16;                   ///< Unsigned 16-bit integer data.
-        psU32   *U32;                   ///< Unsigned 32-bit integer data.
-        psU64   *U64;                   ///< Unsigned 64-bit integer data.
-        psS8    *S8;                    ///< Signed 8-bit integer data.
-        psS16   *S16;                   ///< Signed 16-bit integer data.
-        psS32   *S32;                   ///< Signed 32-bit integer data.
-        psS64   *S64;                   ///< Signed 64-bit integer data.
-        psF32   *F32;                   ///< Single-precision float data.
-        psF64   *F64;                   ///< Double-precision float data.
-        psC32   *C32;                   ///< Single-precision complex data.
-        psC64   *C64;                   ///< Double-precision complex data.
-        psPTR    V;                     ///< Pointer to data.
-    } data;                             ///< Union for data types.
+        psU8 *U8;               // /< Unsigned 8-bit integer data.
+        psU16 *U16;             // /< Unsigned 16-bit integer data.
+        psU32 *U32;             // /< Unsigned 32-bit integer data.
+        psU64 *U64;             // /< Unsigned 64-bit integer data.
+        psS8 *S8;               // /< Signed 8-bit integer data.
+        psS16 *S16;             // /< Signed 16-bit integer data.
+        psS32 *S32;             // /< Signed 32-bit integer data.
+        psS64 *S64;             // /< Signed 64-bit integer data.
+        psF32 *F32;             // /< Single-precision float data.
+        psF64 *F64;             // /< Double-precision float data.
+        psC32 *C32;             // /< Single-precision complex data.
+        psC64 *C64;             // /< Double-precision complex data.
+        psPTR V;                // /< Pointer to data.
+    } data;                     // /< Union for data types.
 }
 psVector;
 
 /*****************************************************************************/
+
 /* FUNCTION PROTOTYPES                                                       */
+
 /*****************************************************************************/
 
@@ -65,8 +68,7 @@
  *
  */
-psVector *psVectorAlloc(
-    unsigned int nalloc,                ///< Total number of elements to make available.
-    psElemType dataType                 ///< Type of data to be held by vector.
-);
+psVector *psVectorAlloc(unsigned int nalloc,    // /< Total number of elements to make available.
+                        psElemType dataType     // /< Type of data to be held by vector.
+                       );
 
 /** Reallocate a vector.
@@ -78,8 +80,7 @@
  *
  */
-psVector *psVectorRealloc(
-    unsigned int nalloc,                ///< Total number of elements to make available.
-    psVector *restrict psVec            ///< Vector to reallocate.
-);
+psVector *psVectorRealloc(unsigned int nalloc,  // /< Total number of elements to make available.
+                          psVector * restrict psVec     // /< Vector to reallocate.
+                         );
 
 /** Recycle a vector.
@@ -91,11 +92,10 @@
  *
  */
-psVector *psVectorRecycle(
-    psVector *restrict psVec,
-    ///< Vector to recycle.  If NULL, a new vector is created.  No effort taken to preserve the values.
-
-    unsigned int nalloc,                ///< Total number of elements to make available.
-    psElemType type                     ///< the datatype of the returned vector
-);
+psVector *psVectorRecycle(psVector * restrict psVec,
+                          // /< Vector to recycle.  If NULL, a new vector is created.  No effort taken to
+                          // preserve the values.
+                          unsigned int nalloc,  // /< Total number of elements to make available.
+                          psElemType type       // /< the datatype of the returned vector
+                         );
 
 /** Sort an array of floats.
@@ -107,8 +107,8 @@
  */
 
-psVector *psVectorSort(
-    psVector *restrict outVector,  ///< the output vector to recycle, or NULL if new vector desired.
-    const psVector *restrict inVector ///< the vector to sort.
-);
+psVector *psVectorSort(psVector * restrict outVector,   // /< the output vector to recycle, or NULL if new
+                       // vector desired.
+                       const psVector * restrict inVector       // /< the vector to sort.
+                      );
 
 /** Creates an array of indices based on sort odred of float array.
@@ -120,9 +120,5 @@
  */
 
-psVector *psVectorSortIndex(
-    psVector *restrict outVector,
-    const psVector *restrict inVector
-);
-
+psVector *psVectorSortIndex(psVector * restrict outVector, const psVector * restrict inVector);
 
 /// @}
Index: /trunk/psLib/src/dataManip/psFFT.c
===================================================================
--- /trunk/psLib/src/dataManip/psFFT.c	(revision 1406)
+++ /trunk/psLib/src/dataManip/psFFT.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psFFT.c
 *
@@ -5,6 +6,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 22:34:05 $
+*  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -27,5 +28,5 @@
 static bool p_fftwWisdomImported = false;
 
-psImage* psImageFFT( psImage* out, const psImage* in, psFftDirection direction )
+psImage *psImageFFT(psImage * out, const psImage * in, psFftDirection direction)
 {
     unsigned int numCols;
@@ -35,35 +36,32 @@
 
     /* got good image data? */
-    if ( in == NULL ) {
-        psFree( out );
-        return NULL;
-    }
-
-    type = in->type.type;
-
-    if ( ( type != PS_TYPE_F32 ) && ( type != PS_TYPE_C32 ) ) {
-        psError( __func__, "Input image must be a 32-bit float or complex image (type=%d)",
-                 type );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( type != PS_TYPE_C32 && direction == PS_FFT_REVERSE ) {
-        psError( __func__, "Input image must be complex image for reverse FFT (type=%d).",
-                 type );
-        psFree( out );
-        return NULL;
-
-    }
-
-    if ( type != PS_TYPE_F32 && direction == PS_FFT_FORWARD ) {
-        psError( __func__, "Input image must be real image for forward FFT (type=%d).",
-                 type );
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
+        return NULL;
+    }
+
+    type = in->type.type;
+
+    if ((type != PS_TYPE_F32) && (type != PS_TYPE_C32)) {
+        psError(__func__, "Input image must be a 32-bit float or complex image (type=%d)", type);
+        psFree(out);
+        return NULL;
+    }
+
+    if (type != PS_TYPE_C32 && direction == PS_FFT_REVERSE) {
+        psError(__func__, "Input image must be complex image for reverse FFT (type=%d).", type);
+        psFree(out);
+        return NULL;
+
+    }
+
+    if (type != PS_TYPE_F32 && direction == PS_FFT_FORWARD) {
+        psError(__func__, "Input image must be real image for forward FFT (type=%d).", type);
+        psFree(out);
         return NULL;
     }
 
     /* make sure the system-level wisdom information is imported. */
-    if ( ! p_fftwWisdomImported ) {
+    if (!p_fftwWisdomImported) {
         fftwf_import_system_wisdom();
         p_fftwWisdomImported = true;
@@ -73,30 +71,27 @@
     numCols = in->numCols;
 
-    out = psImageCopy( out, in, PS_TYPE_C32 );
-
-    plan = fftwf_plan_dft_2d( numCols, numRows,
-                              ( fftwf_complex* ) out->data.C32[ 0 ],
-                              ( fftwf_complex* ) out->data.C32[ 0 ],
-                              direction,
-                              P_FFTW_PLAN_RIGOR );
-
-    /* check if a plan exists now*/
-    if ( plan == NULL ) {
-        psError( __func__, "Failed to create FFTW plan." );
-        psFree( out );
+    out = psImageCopy(out, in, PS_TYPE_C32);
+
+    plan = fftwf_plan_dft_2d(numCols, numRows,
+                             (fftwf_complex *) out->data.C32[0],
+                             (fftwf_complex *) out->data.C32[0], direction, P_FFTW_PLAN_RIGOR);
+
+    /* check if a plan exists now */
+    if (plan == NULL) {
+        psError(__func__, "Failed to create FFTW plan.");
+        psFree(out);
         return NULL;
     }
 
     /* finally, call FFTW with the plan made above */
-    fftwf_execute( plan );
-
-    fftwf_destroy_plan( plan );
-
-    return out;
-
-}
-
-
-psImage *psImageReal( psImage *out, const psImage* in )
+    fftwf_execute(plan);
+
+    fftwf_destroy_plan(plan);
+
+    return out;
+
+}
+
+psImage *psImageReal(psImage * out, const psImage * in)
 {
     psElemType type;
@@ -104,7 +99,6 @@
     unsigned int numRows;
 
-
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -115,49 +109,47 @@
 
     /* if not a complex number, this is logically just a copy */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
         // Warn user, as this is probably not expected
-        psLogMsg( __func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
-                  "Just an image copy was performed." );
-        return psImageCopy( out, in, type );
-    }
-
-    if ( type == PS_TYPE_C32 ) {
-        psF32 * outRow;
-        psC32* inRow;
-
-        out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
-        for ( unsigned int row = 0;row < numRows;row++ ) {
-            outRow = out->data.F32[ row ];
-            inRow = in->data.C32[ row ];
-
-            for ( unsigned int col = 0;col < numCols;col++ ) {
-                outRow[ col ] = crealf( inRow[ col ] );
-            }
-        }
-    } else
-        if ( type == PS_TYPE_C64 ) {
-            psF64 * outRow;
-            psC64* inRow;
-
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_F64 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                outRow = out->data.F64[ row ];
-                inRow = in->data.C64[ row ];
-
-                for ( unsigned int col = 0;col < numCols;col++ ) {
-                    outRow[ col ] = creal( inRow[ col ] );
-                }
-            }
-        } else {
-            psError( __func__, "Can not extract real component from given image type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-
-    return out;
-}
-
-psImage *psImageImaginary( psImage *out, const psImage* in )
+        psLogMsg(__func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
+                 "Just an image copy was performed.");
+        return psImageCopy(out, in, type);
+    }
+
+    if (type == PS_TYPE_C32) {
+        psF32 *outRow;
+        psC32 *inRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.F32[row];
+            inRow = in->data.C32[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = crealf(inRow[col]);
+            }
+        }
+    } else if (type == PS_TYPE_C64) {
+        psF64 *outRow;
+        psC64 *inRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.F64[row];
+            inRow = in->data.C64[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = creal(inRow[col]);
+            }
+        }
+    } else {
+        psError(__func__, "Can not extract real component from given image type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psImage *psImageImaginary(psImage * out, const psImage * in)
 {
     psElemType type;
@@ -165,7 +157,6 @@
     unsigned int numRows;
 
-
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -176,51 +167,49 @@
 
     /* if not a complex number, this is logically just zeroed image of same size */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
         // Warn user, as this is probably not expected
-        psLogMsg( __func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
-                  "A zero image was returned." );
-        out = psImageRecycle( out, numCols, numRows, type );
-        memset( out->data.V[ 0 ], 0, PSELEMTYPE_SIZEOF( type ) * numCols * numRows );
+        psLogMsg(__func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
+                 "A zero image was returned.");
+        out = psImageRecycle(out, numCols, numRows, type);
+        memset(out->data.V[0], 0, PSELEMTYPE_SIZEOF(type) * numCols * numRows);
         return out;
     }
 
-    if ( type == PS_TYPE_C32 ) {
-        psF32 * outRow;
-        psC32* inRow;
-
-        out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
-        for ( unsigned int row = 0;row < numRows;row++ ) {
-            outRow = out->data.F32[ row ];
-            inRow = in->data.C32[ row ];
-
-            for ( unsigned int col = 0;col < numCols;col++ ) {
-                outRow[ col ] = cimagf( inRow[ col ] );
-            }
-        }
-    } else
-        if ( type == PS_TYPE_C64 ) {
-            psF64 * outRow;
-            psC64* inRow;
-
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_F64 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                outRow = out->data.F64[ row ];
-                inRow = in->data.C64[ row ];
-
-                for ( unsigned int col = 0;col < numCols;col++ ) {
-                    outRow[ col ] = cimag( inRow[ col ] );
-                }
-            }
-        } else {
-            psError( __func__, "Can not extract imaginary component from given image type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-
-    return out;
-}
-
-psImage *psImageComplex( psImage* out, psImage *real, const psImage *imag )
+    if (type == PS_TYPE_C32) {
+        psF32 *outRow;
+        psC32 *inRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.F32[row];
+            inRow = in->data.C32[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = cimagf(inRow[col]);
+            }
+        }
+    } else if (type == PS_TYPE_C64) {
+        psF64 *outRow;
+        psC64 *inRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.F64[row];
+            inRow = in->data.C64[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = cimag(inRow[col]);
+            }
+        }
+    } else {
+        psError(__func__, "Can not extract imaginary component from given image type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psImage *psImageComplex(psImage * out, psImage * real, const psImage * imag)
 {
     psElemType type;
@@ -228,7 +217,6 @@
     unsigned int numRows;
 
-
-    if ( real == NULL || imag == NULL ) {
-        psFree( out );
+    if (real == NULL || imag == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -238,72 +226,69 @@
     numRows = real->numRows;
 
-    if ( imag->type.type != type ) {
-        psError( __func__, "The inputs to psImageComplex must be the same type." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( imag->numCols != numCols ||
-            imag->numRows != numRows ) {
-        psError( __func__, "The inputs to psImageComplex must be the same dimensions." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-        psError( __func__, "The inputs to psImageComplex can not be complex." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( type != PS_TYPE_F32 && type != PS_TYPE_F64 ) {
-        psError( __func__, "The input type to psImageComplex must be a floating point." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( type == PS_TYPE_F32 ) {
-        psC32 * outRow;
-        psF32* realRow;
-        psF32* imagRow;
-
-        out = psImageRecycle( out, numCols, numRows, PS_TYPE_C32 );
-
-        for ( unsigned int row = 0;row < numRows;row++ ) {
-            outRow = out->data.C32[ row ];
-            realRow = real->data.F32[ row ];
-            imagRow = imag->data.F32[ row ];
-
-            for ( unsigned int col = 0;col < numCols;col++ ) {
-                outRow[ col ] = realRow[ col ] + I * imagRow[ col ];
-            }
-        }
-    } else
-        if ( type == PS_TYPE_F64 ) {
-            psC64 * outRow;
-            psF64* realRow;
-            psF64* imagRow;
-
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_C64 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                outRow = out->data.C64[ row ];
-                realRow = real->data.F64[ row ];
-                imagRow = imag->data.F64[ row ];
-
-                for ( unsigned int col = 0;col < numCols;col++ ) {
-                    outRow[ col ] = realRow[ col ] + I * imagRow[ col ];
-                }
-            }
-        } else {
-            psError( __func__, "Can not merge real and imaginary portions for given image type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-
-    return out;
-}
-
-psImage *psImageConjugate( psImage *out, const psImage *in )
+    if (imag->type.type != type) {
+        psError(__func__, "The inputs to psImageComplex must be the same type.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (imag->numCols != numCols || imag->numRows != numRows) {
+        psError(__func__, "The inputs to psImageComplex must be the same dimensions.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
+        psError(__func__, "The inputs to psImageComplex can not be complex.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (type != PS_TYPE_F32 && type != PS_TYPE_F64) {
+        psError(__func__, "The input type to psImageComplex must be a floating point.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (type == PS_TYPE_F32) {
+        psC32 *outRow;
+        psF32 *realRow;
+        psF32 *imagRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32);
+
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.C32[row];
+            realRow = real->data.F32[row];
+            imagRow = imag->data.F32[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = realRow[col] + I * imagRow[col];
+            }
+        }
+    } else if (type == PS_TYPE_F64) {
+        psC64 *outRow;
+        psF64 *realRow;
+        psF64 *imagRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.C64[row];
+            realRow = real->data.F64[row];
+            imagRow = imag->data.F64[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = realRow[col] + I * imagRow[col];
+            }
+        }
+    } else {
+        psError(__func__, "Can not merge real and imaginary portions for given image type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psImage *psImageConjugate(psImage * out, const psImage * in)
 {
     psElemType type;
@@ -311,7 +296,6 @@
     unsigned int numRows;
 
-
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -322,49 +306,47 @@
 
     /* if not a complex number, this is logically just a image copy */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
         // Warn user, as this is probably not expected
-        psLogMsg( __func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
-                  "Image copy was performed instead." );
-        return psImageCopy( out, in, type );
-    }
-
-    if ( type == PS_TYPE_C32 ) {
-        psC32 * outRow;
-        psC32* inRow;
-
-        out = psImageRecycle( out, numCols, numRows, PS_TYPE_C32 );
-        for ( unsigned int row = 0;row < numRows;row++ ) {
-            outRow = out->data.C32[ row ];
-            inRow = in->data.C32[ row ];
-
-            for ( unsigned int col = 0;col < numCols;col++ ) {
-                outRow[ col ] = crealf( inRow[ col ] ) - I * cimagf( inRow[ col ] );
-            }
-        }
-    } else
-        if ( type == PS_TYPE_C64 ) {
-            psC64 * outRow;
-            psC64* inRow;
-
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_C64 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                outRow = out->data.C64[ row ];
-                inRow = in->data.C64[ row ];
-
-                for ( unsigned int col = 0;col < numCols;col++ ) {
-                    outRow[ col ] = creal( inRow[ col ] ) - I * cimag( inRow[ col ] );
-                }
-            }
-        } else {
-            psError( __func__, "Can not compute complex conjugate for given image type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-
-    return out;
-}
-
-psImage *psImagePowerSpectrum( psImage* out, const psImage* in )
+        psLogMsg(__func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
+                 "Image copy was performed instead.");
+        return psImageCopy(out, in, type);
+    }
+
+    if (type == PS_TYPE_C32) {
+        psC32 *outRow;
+        psC32 *inRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.C32[row];
+            inRow = in->data.C32[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = crealf(inRow[col]) - I * cimagf(inRow[col]);
+            }
+        }
+    } else if (type == PS_TYPE_C64) {
+        psC64 *outRow;
+        psC64 *inRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.C64[row];
+            inRow = in->data.C64[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = creal(inRow[col]) - I * cimag(inRow[col]);
+            }
+        }
+    } else {
+        psError(__func__, "Can not compute complex conjugate for given image type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psImage *psImagePowerSpectrum(psImage * out, const psImage * in)
 {
     psElemType type;
@@ -373,6 +355,6 @@
     int numElementsSquared;
 
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -384,53 +366,49 @@
 
     /* if not a complex number, this is not implemented */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-        psError( __func__, "Power Spectrum for non-complex inputs is not implemented." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( type == PS_TYPE_C32 ) {
-        psF32 * outRow;
-        psC32* inRow;
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
+        psError(__func__, "Power Spectrum for non-complex inputs is not implemented.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (type == PS_TYPE_C32) {
+        psF32 *outRow;
+        psC32 *inRow;
         psF32 real;
         psF32 imag;
 
-
-        out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
-        for ( unsigned int row = 0;row < numRows;row++ ) {
-            outRow = out->data.F32[ row ];
-            inRow = in->data.C32[ row ];
-
-            for ( unsigned int col = 0;col < numCols;col++ ) {
-                real = crealf( inRow[ col ] );
-                imag = cimagf( inRow[ col ] );
-                outRow[ col ] = ( real * real + imag * imag ) / numElementsSquared;
-            }
-        }
-    } else
-        if ( type == PS_TYPE_C64 ) {
-            psF64 * outRow;
-            psC64* inRow;
-            psF64 real;
-            psF64 imag;
-
-
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_F64 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                outRow = out->data.F64[ row ];
-                inRow = in->data.C64[ row ];
-
-                for ( unsigned int col = 0;col < numCols;col++ ) {
-                    real = crealf( inRow[ col ] );
-                    imag = cimagf( inRow[ col ] );
-                    outRow[ col ] = real * real + imag * imag / numElementsSquared;
-                }
-            }
-        } else {
-            psError( __func__, "Can not power spectrum for given image type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.F32[row];
+            inRow = in->data.C32[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                real = crealf(inRow[col]);
+                imag = cimagf(inRow[col]);
+                outRow[col] = (real * real + imag * imag) / numElementsSquared;
+            }
+        }
+    } else if (type == PS_TYPE_C64) {
+        psF64 *outRow;
+        psC64 *inRow;
+        psF64 real;
+        psF64 imag;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.F64[row];
+            inRow = in->data.C64[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                real = crealf(inRow[col]);
+                imag = cimagf(inRow[col]);
+                outRow[col] = real * real + imag * imag / numElementsSquared;
+            }
+        }
+    } else {
+        psError(__func__, "Can not power spectrum for given image type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
 
     return out;
@@ -440,5 +418,5 @@
 /************************************** Vector Functions ***************************************/
 
-psVector* psVectorFFT( psVector* out, const psVector* in, psFftDirection direction )
+psVector *psVectorFFT(psVector * out, const psVector * in, psFftDirection direction)
 {
     unsigned int numElements;
@@ -447,35 +425,32 @@
 
     /* got good image data? */
-    if ( in == NULL ) {
-        psFree( out );
-        return NULL;
-    }
-
-    type = in->type.type;
-
-    if ( ( type != PS_TYPE_F32 ) && ( type != PS_TYPE_C32 ) ) {
-        psError( __func__, "Input image must be a 32-bit float or complex image (type=%d)",
-                 type );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( ( type != PS_TYPE_C32 ) && ( direction == PS_FFT_REVERSE ) ) {
-        psError( __func__, "Input image must be complex image for reverse FFT (type=%d).",
-                 type );
-        psFree( out );
-        return NULL;
-
-    }
-
-    if ( ( type != PS_TYPE_F32 ) && ( direction == PS_FFT_FORWARD ) ) {
-        psError( __func__, "Input image must be real image for forward FFT (type=%d).",
-                 type );
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
+        return NULL;
+    }
+
+    type = in->type.type;
+
+    if ((type != PS_TYPE_F32) && (type != PS_TYPE_C32)) {
+        psError(__func__, "Input image must be a 32-bit float or complex image (type=%d)", type);
+        psFree(out);
+        return NULL;
+    }
+
+    if ((type != PS_TYPE_C32) && (direction == PS_FFT_REVERSE)) {
+        psError(__func__, "Input image must be complex image for reverse FFT (type=%d).", type);
+        psFree(out);
+        return NULL;
+
+    }
+
+    if ((type != PS_TYPE_F32) && (direction == PS_FFT_FORWARD)) {
+        psError(__func__, "Input image must be real image for forward FFT (type=%d).", type);
+        psFree(out);
         return NULL;
     }
 
     /* make sure the system-level wisdom information is imported. */
-    if ( ! p_fftwWisdomImported ) {
+    if (!p_fftwWisdomImported) {
         fftwf_import_system_wisdom();
         p_fftwWisdomImported = true;
@@ -484,51 +459,50 @@
     numElements = in->n;
 
-    out = psVectorRecycle( out, numElements, PS_TYPE_C32 );
+    out = psVectorRecycle(out, numElements, PS_TYPE_C32);
     out->n = numElements;
 
-    if ( type == PS_TYPE_F32 ) {
+    if (type == PS_TYPE_F32) {
         // need to convert to complex
-        psC32 * outVec = out->data.C32;
-        psF32* inVec = in->data.F32;
-        for ( unsigned int i = 0;i < numElements;i++ ) {
-            outVec[ i ] = inVec[ i ];
-        }
-    } else {
-        psC32* outVec = out->data.C32;
-        psC32* inVec = in->data.C32;
-        for ( unsigned int i = 0;i < numElements;i++ ) {
-            outVec[ i ] = inVec[ i ];
-        }
-    }
-
-    plan = fftwf_plan_dft_1d( numElements,
-                              ( fftwf_complex* ) out->data.C32,
-                              ( fftwf_complex* ) out->data.C32,
-                              direction,
-                              P_FFTW_PLAN_RIGOR );
-
-    /* check if a plan exists now*/
-    if ( plan == NULL ) {
-        psError( __func__, "Failed to create FFTW plan." );
-        psFree( out );
+        psC32 *outVec = out->data.C32;
+        psF32 *inVec = in->data.F32;
+
+        for (unsigned int i = 0; i < numElements; i++) {
+            outVec[i] = inVec[i];
+        }
+    } else {
+        psC32 *outVec = out->data.C32;
+        psC32 *inVec = in->data.C32;
+
+        for (unsigned int i = 0; i < numElements; i++) {
+            outVec[i] = inVec[i];
+        }
+    }
+
+    plan = fftwf_plan_dft_1d(numElements,
+                             (fftwf_complex *) out->data.C32,
+                             (fftwf_complex *) out->data.C32, direction, P_FFTW_PLAN_RIGOR);
+
+    /* check if a plan exists now */
+    if (plan == NULL) {
+        psError(__func__, "Failed to create FFTW plan.");
+        psFree(out);
         return NULL;
     }
 
     /* finally, call FFTW with the plan made above */
-    fftwf_execute( plan );
-
-    fftwf_destroy_plan( plan );
-
-    return out;
-}
-
-
-psVector *psVectorReal( psVector *out, const psVector* in )
+    fftwf_execute(plan);
+
+    fftwf_destroy_plan(plan);
+
+    return out;
+}
+
+psVector *psVectorReal(psVector * out, const psVector * in)
 {
     psElemType type;
     unsigned int numElements;
 
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -538,43 +512,41 @@
 
     /* if not a complex number, this is logically just a copy */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
         // Warn user, as this is probably not expected
-        psLogMsg( __func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
-                  "Just a vector copy was performed." );
-        out = psVectorRecycle( out, numElements, type );
+        psLogMsg(__func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
+                 "Just a vector copy was performed.");
+        out = psVectorRecycle(out, numElements, type);
         out->n = numElements;
-        memcpy( out->data.V, in->data.V, numElements * PSELEMTYPE_SIZEOF( type ) );
+        memcpy(out->data.V, in->data.V, numElements * PSELEMTYPE_SIZEOF(type));
         return out;
     }
 
-    if ( type == PS_TYPE_C32 ) {
-        psF32 * outVec;
-        psC32* inVec = in->data.C32;
-
-        out = psVectorRecycle( out, numElements, PS_TYPE_F32 );
+    if (type == PS_TYPE_C32) {
+        psF32 *outVec;
+        psC32 *inVec = in->data.C32;
+
+        out = psVectorRecycle(out, numElements, PS_TYPE_F32);
         out->n = numElements;
         outVec = out->data.F32;
 
-        for ( unsigned int i = 0;i < numElements;i++ ) {
-            outVec[ i ] = crealf( inVec[ i ] );
-        }
-    } else {
-        psError( __func__, "Can not extract real component from given vector type (%d).",
-                 type );
-        psFree( out );
-        return NULL;
-    }
-
-    return out;
-}
-
-psVector *psVectorImaginary( psVector *out, const psVector* in )
+        for (unsigned int i = 0; i < numElements; i++) {
+            outVec[i] = crealf(inVec[i]);
+        }
+    } else {
+        psError(__func__, "Can not extract real component from given vector type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psVector *psVectorImaginary(psVector * out, const psVector * in)
 {
     psElemType type;
     unsigned int numElements;
 
-
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -584,48 +556,46 @@
 
     /* if not a complex number, this is logically just zeroed image of same size */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
         // Warn user, as this is probably not expected
-        psLogMsg( __func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
-                  "A zeroed vector was returned." );
-        out = psVectorRecycle( out, numElements, type );
+        psLogMsg(__func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
+                 "A zeroed vector was returned.");
+        out = psVectorRecycle(out, numElements, type);
         out->n = numElements;
-        memset( out->data.V, 0, PSELEMTYPE_SIZEOF( type ) * numElements );
+        memset(out->data.V, 0, PSELEMTYPE_SIZEOF(type) * numElements);
         return out;
     }
 
-    if ( type == PS_TYPE_C32 ) {
-        psF32 * outVec;
-        psC32* inVec = in->data.C32;
-
-        out = psVectorRecycle( out, numElements, PS_TYPE_F32 );
+    if (type == PS_TYPE_C32) {
+        psF32 *outVec;
+        psC32 *inVec = in->data.C32;
+
+        out = psVectorRecycle(out, numElements, PS_TYPE_F32);
         out->n = numElements;
         outVec = out->data.F32;
 
-        for ( unsigned int i = 0;i < numElements;i++ ) {
-            outVec[ i ] = cimagf( inVec[ i ] );
-        }
-    } else {
-        psError( __func__, "Can not extract imaginary component from given vector type (%d).",
-                 type );
-        psFree( out );
-        return NULL;
-    }
-
-    return out;
-}
-
-psVector *psVectorComplex( psVector* out, psVector *real, const psVector *imag )
+        for (unsigned int i = 0; i < numElements; i++) {
+            outVec[i] = cimagf(inVec[i]);
+        }
+    } else {
+        psError(__func__, "Can not extract imaginary component from given vector type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psVector *psVectorComplex(psVector * out, psVector * real, const psVector * imag)
 {
     psElemType type;
     unsigned int numElements;
 
-
-    if ( real == NULL || imag == NULL ) {
-        psFree( out );
+    if (real == NULL || imag == NULL) {
+        psFree(out);
         return NULL;
     }
 
     type = real->type.type;
-    if ( real->n < imag->n ) {
+    if (real->n < imag->n) {
         numElements = real->n;
     } else {
@@ -633,46 +603,44 @@
     }
 
-    if ( imag->type.type != type ) {
-        psError( __func__, "The inputs to psVectorComplex must be the same type." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-        psError( __func__, "The inputs to psVectorComplex can not be complex." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( type == PS_TYPE_F32 ) {
-        psC32 * outVec;
-        psF32* realVec = real->data.F32;
-        psF32* imagVec = imag->data.F32;
-
-        out = psVectorRecycle( out, numElements, PS_TYPE_C32 );
+    if (imag->type.type != type) {
+        psError(__func__, "The inputs to psVectorComplex must be the same type.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
+        psError(__func__, "The inputs to psVectorComplex can not be complex.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (type == PS_TYPE_F32) {
+        psC32 *outVec;
+        psF32 *realVec = real->data.F32;
+        psF32 *imagVec = imag->data.F32;
+
+        out = psVectorRecycle(out, numElements, PS_TYPE_C32);
         out->n = numElements;
         outVec = out->data.C32;
 
-        for ( unsigned int i = 0;i < numElements;i++ ) {
-            outVec[ i ] = realVec[ i ] + I * imagVec[ i ];
-        }
-    } else {
-        psError( __func__, "Can not merge real and imaginary portions for given vector type (%d).",
-                 type );
-        psFree( out );
-        return NULL;
-    }
-
-    return out;
-}
-
-psVector *psVectorConjugate( psVector *out, const psVector *in )
+        for (unsigned int i = 0; i < numElements; i++) {
+            outVec[i] = realVec[i] + I * imagVec[i];
+        }
+    } else {
+        psError(__func__, "Can not merge real and imaginary portions for given vector type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psVector *psVectorConjugate(psVector * out, const psVector * in)
 {
     psElemType type;
     unsigned int numElements;
 
-
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -682,37 +650,36 @@
 
     /* if not a complex number, this is logically just a image copy */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
         // Warn user, as this is probably not expected
-        psLogMsg( __func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
-                  "Vector copy was performed instead." );
-
-        out = psVectorRecycle( out, numElements, type );
+        psLogMsg(__func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
+                 "Vector copy was performed instead.");
+
+        out = psVectorRecycle(out, numElements, type);
         out->n = numElements;
-        memcpy( out->data.V, in->data.V, PSELEMTYPE_SIZEOF( type ) * numElements );
+        memcpy(out->data.V, in->data.V, PSELEMTYPE_SIZEOF(type) * numElements);
         return out;
     }
 
-    if ( type == PS_TYPE_C32 ) {
-        psC32 * outVec;
-        psC32* inVec = in->data.C32;
-
-        out = psVectorRecycle( out, numElements, PS_TYPE_C32 );
+    if (type == PS_TYPE_C32) {
+        psC32 *outVec;
+        psC32 *inVec = in->data.C32;
+
+        out = psVectorRecycle(out, numElements, PS_TYPE_C32);
         out->n = numElements;
         outVec = out->data.C32;
 
-        for ( unsigned int i = 0;i < numElements;i++ ) {
-            outVec[ i ] = crealf( inVec[ i ] ) - I * cimagf( inVec[ i ] );
-        }
-    } else {
-        psError( __func__, "Can not compute complex conjugate for given vector type (%d).",
-                 type );
-        psFree( out );
-        return NULL;
-    }
-
-    return out;
-}
-
-psVector *psVectorPowerSpectrum( psVector* out, const psVector* in )
+        for (unsigned int i = 0; i < numElements; i++) {
+            outVec[i] = crealf(inVec[i]) - I * cimagf(inVec[i]);
+        }
+    } else {
+        psError(__func__, "Can not compute complex conjugate for given vector type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psVector *psVectorPowerSpectrum(psVector * out, const psVector * in)
 {
     psElemType type;
@@ -722,6 +689,6 @@
     unsigned int inNumElementsSquared;
 
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -734,42 +701,41 @@
 
     /* if not a complex number, this is not implemented */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-        psError( __func__, "Power Spectrum for non-complex inputs is not implemented." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( type == PS_TYPE_C32 ) {
-        psF32 * outVec;
-        psC32* inVec = in->data.C32;
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
+        psError(__func__, "Power Spectrum for non-complex inputs is not implemented.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (type == PS_TYPE_C32) {
+        psF32 *outVec;
+        psC32 *inVec = in->data.C32;
         psF32 inAbs1;
         psF32 inAbs2;
 
-        out = psVectorRecycle( out, outNumElements, PS_TYPE_F32 );
+        out = psVectorRecycle(out, outNumElements, PS_TYPE_F32);
         out->n = outNumElements;
         outVec = out->data.F32;
 
         // from ADD: P_0 = |C_0|^2/N^2
-        inAbs1 = cabsf( inVec[ 0 ] );
-        outVec[ 0 ] = inAbs1 * inAbs1 / inNumElementsSquared;
+        inAbs1 = cabsf(inVec[0]);
+        outVec[0] = inAbs1 * inAbs1 / inNumElementsSquared;
 
         // from ADD: P_j = (|C_j|^2+|C_N-j|^2)/N^2, where j = 1,2,...,(N/2-1)
-        for ( unsigned int i = 1;i < inHalfNumElements;i++ ) {
-            inAbs1 = cabsf( inVec[ i ] );
-            inAbs2 = cabsf( inVec[ inNumElements - i ] );
-            outVec[ i ] = ( inAbs1 * inAbs1 + inAbs2 * inAbs2 ) / inNumElementsSquared;
+        for (unsigned int i = 1; i < inHalfNumElements; i++) {
+            inAbs1 = cabsf(inVec[i]);
+            inAbs2 = cabsf(inVec[inNumElements - i]);
+            outVec[i] = (inAbs1 * inAbs1 + inAbs2 * inAbs2) / inNumElementsSquared;
         }
 
         // from ADD: P_N/2 = |C_N/2|^2/N^2
-        inAbs1 = cabsf( inVec[ inHalfNumElements ] );
-        outVec[ inHalfNumElements ] = inAbs1 * inAbs1 / inNumElementsSquared;
-    } else {
-        psError( __func__, "Can not power spectrum for given vector type (%d).",
-                 type );
-        psFree( out );
-        return NULL;
-    }
-
-    return out;
-
-}
+        inAbs1 = cabsf(inVec[inHalfNumElements]);
+        outVec[inHalfNumElements] = inAbs1 * inAbs1 / inNumElementsSquared;
+    } else {
+        psError(__func__, "Can not power spectrum for given vector type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+
+}
Index: /trunk/psLib/src/dataManip/psFFT.h
===================================================================
--- /trunk/psLib/src/dataManip/psFFT.h	(revision 1406)
+++ /trunk/psLib/src/dataManip/psFFT.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psFFT.h
  *
@@ -7,6 +8,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -14,8 +15,8 @@
 
 #ifndef PS_FFT_H
-#define PS_FFT_H
+#    define PS_FFT_H
 
-#include "psImage.h"
-#include "psVector.h"
+#    include "psImage.h"
+#    include "psVector.h"
 
 /// @addtogroup Transform
@@ -24,29 +25,27 @@
 /** Details on FFT implementation (private). */
 
-
 typedef enum {
-    /// psImageFFT/psVectorFFT should perform a forward FFT.
+    // / psImageFFT/psVectorFFT should perform a forward FFT.
     PS_FFT_FORWARD = (-1),
 
-    ///< psImageFFT/psVectorFFT should perform a reverse FFT.
+    // /< psImageFFT/psVectorFFT should perform a reverse FFT.
     PS_FFT_REVERSE = (+1)
 } psFftDirection;
 
-psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction);
-psImage* psImageReal(psImage *out, const psImage* in);
-psImage* psImageImaginary(psImage *out, const psImage* in);
-psImage* psImageComplex(psImage* out, psImage *real, const psImage *imag);
-psImage* psImageConjugate(psImage *out, const psImage *in);
-psImage* psImagePowerSpectrum(psImage* out, const psImage* in);
+psImage *psImageFFT(psImage * out, const psImage * in, psFftDirection direction);
+psImage *psImageReal(psImage * out, const psImage * in);
+psImage *psImageImaginary(psImage * out, const psImage * in);
+psImage *psImageComplex(psImage * out, psImage * real, const psImage * imag);
+psImage *psImageConjugate(psImage * out, const psImage * in);
+psImage *psImagePowerSpectrum(psImage * out, const psImage * in);
 
-psVector* psVectorFFT(psVector* out, const psVector* in, psFftDirection direction);
-psVector* psVectorReal(psVector* out, const psVector* in);
-psVector* psVectorImaginary(psVector* out, const psVector* in);
-psVector* psVectorComplex(psVector* out, psVector* real, const psVector* imag);
-psVector* psVectorConjugate(psVector* out, const psVector* in);
-psVector* psVectorPowerSpectrum(psVector* out, const psVector* in);
+psVector *psVectorFFT(psVector * out, const psVector * in, psFftDirection direction);
+psVector *psVectorReal(psVector * out, const psVector * in);
+psVector *psVectorImaginary(psVector * out, const psVector * in);
+psVector *psVectorComplex(psVector * out, psVector * real, const psVector * imag);
+psVector *psVectorConjugate(psVector * out, const psVector * in);
+psVector *psVectorPowerSpectrum(psVector * out, const psVector * in);
 
 /// @}
 
 #endif
-
Index: /trunk/psLib/src/dataManip/psFunctions.c
===================================================================
--- /trunk/psLib/src/dataManip/psFunctions.c	(revision 1406)
+++ /trunk/psLib/src/dataManip/psFunctions.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psFunctions.c
  *
@@ -7,11 +8,14 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
-/*****************************************************************************/
+
+/*****************************************************************************/
+
 /*  INCLUDE FILES                                                            */
+
 /*****************************************************************************/
 #include <stdlib.h>
@@ -31,6 +35,9 @@
 #include <gsl/gsl_rng.h>
 #include <gsl/gsl_randist.h>
-/*****************************************************************************/
+
+/*****************************************************************************/
+
 /* DEFINE STATEMENTS                                                         */
+
 /*****************************************************************************/
 
@@ -38,17 +45,21 @@
 
 /*****************************************************************************/
+
 /* TYPE DEFINITIONS                                                          */
-/*****************************************************************************/
-static void polynomial1DFree(psPolynomial1D *myPoly);
-static void polynomial2DFree(psPolynomial2D *myPoly);
-static void polynomial3DFree(psPolynomial3D *myPoly);
-static void polynomial4DFree(psPolynomial4D *myPoly);
-static void dPolynomial1DFree(psDPolynomial1D *myPoly);
-static void dPolynomial2DFree(psDPolynomial2D *myPoly);
-static void dPolynomial3DFree(psDPolynomial3D *myPoly);
-static void dPolynomial4DFree(psDPolynomial4D *myPoly);
-
-/*****************************************************************************/
+
+/*****************************************************************************/
+static void polynomial1DFree(psPolynomial1D * myPoly);
+static void polynomial2DFree(psPolynomial2D * myPoly);
+static void polynomial3DFree(psPolynomial3D * myPoly);
+static void polynomial4DFree(psPolynomial4D * myPoly);
+static void dPolynomial1DFree(psDPolynomial1D * myPoly);
+static void dPolynomial2DFree(psDPolynomial2D * myPoly);
+static void dPolynomial3DFree(psDPolynomial3D * myPoly);
+static void dPolynomial4DFree(psDPolynomial4D * myPoly);
+
+/*****************************************************************************/
+
 /* GLOBAL VARIABLES                                                          */
+
 /*****************************************************************************/
 
@@ -56,5 +67,7 @@
 
 /*****************************************************************************/
+
 /* FILE STATIC VARIABLES                                                     */
+
 /*****************************************************************************/
 
@@ -62,5 +75,7 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - LOCAL                                           */
+
 /*****************************************************************************/
 
@@ -68,5 +83,7 @@
 
 /*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - PUBLIC                                         */
+
 /*****************************************************************************/
 
@@ -76,9 +93,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, bool normal)
 {
     float tmp = 1.0;
@@ -94,5 +107,5 @@
     }
 
-    return(tmp * exp(-((x-mean) * (x-mean)) / (2.0 * sigma * sigma)));
+    return (tmp * exp(-((x - mean) * (x - mean)) / (2.0 * sigma * sigma)));
 }
 
@@ -107,7 +120,5 @@
  NOTE: There is no way to seed the random generator.
  *****************************************************************************/
-psVector *psGaussianDev(float mean,
-                        float sigma,
-                        int Npts)
+psVector *psGaussianDev(float mean, float sigma, int Npts)
 {
     psVector *gauss = NULL;
@@ -127,7 +138,6 @@
 
     // NOTE: Should I free r as well?
-    return(gauss);
-}
-
+    return (gauss);
+}
 
 /*****************************************************************************
@@ -140,10 +150,10 @@
 
     newPoly = (psPolynomial1D *) psAlloc(sizeof(psPolynomial1D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial1DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial1DFree);
     newPoly->n = n;
-    newPoly->coeff    = (float *) psAlloc(n * sizeof(float));
-    newPoly->coeffErr = (float *) psAlloc(n * sizeof(float));
-    newPoly->mask     = (char *)  psAlloc(n * sizeof(char));
-    for (i=0;i<n;i++) {
+    newPoly->coeff = (float *)psAlloc(n * sizeof(float));
+    newPoly->coeffErr = (float *)psAlloc(n * sizeof(float));
+    newPoly->mask = (char *)psAlloc(n * sizeof(char));
+    for (i = 0; i < n; i++) {
         newPoly->coeff[i] = 0.0;
         newPoly->coeffErr[i] = 0.0;
@@ -151,5 +161,5 @@
     }
 
-    return(newPoly);
+    return (newPoly);
 }
 
@@ -161,18 +171,18 @@
 
     newPoly = (psPolynomial2D *) psAlloc(sizeof(psPolynomial2D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial2DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial2DFree);
     newPoly->nX = nX;
     newPoly->nY = nY;
 
-    newPoly->coeff    = (float **) psAlloc(nX * sizeof(float *));
-    newPoly->coeffErr = (float **) psAlloc(nX * sizeof(float *));
-    newPoly->mask     = (char **)  psAlloc(nX * sizeof(char *));
-    for (x=0;x<nX;x++) {
-        newPoly->coeff[x]    = (float *) psAlloc(nY * sizeof(float));
-        newPoly->coeffErr[x] = (float *) psAlloc(nY * sizeof(float));
-        newPoly->mask[x]     = (char *)  psAlloc(nY * sizeof(char));
-    }
-    for (x=0;x<nX;x++) {
-        for (y=0;y<nY;y++) {
+    newPoly->coeff = (float **)psAlloc(nX * sizeof(float *));
+    newPoly->coeffErr = (float **)psAlloc(nX * sizeof(float *));
+    newPoly->mask = (char **)psAlloc(nX * sizeof(char *));
+    for (x = 0; x < nX; x++) {
+        newPoly->coeff[x] = (float *)psAlloc(nY * sizeof(float));
+        newPoly->coeffErr[x] = (float *)psAlloc(nY * sizeof(float));
+        newPoly->mask[x] = (char *)psAlloc(nY * sizeof(char));
+    }
+    for (x = 0; x < nX; x++) {
+        for (y = 0; y < nY; y++) {
             newPoly->coeff[x][y] = 0.0;
             newPoly->coeffErr[x][y] = 0.0;
@@ -181,5 +191,5 @@
     }
 
-    return(newPoly);
+    return (newPoly);
 }
 
@@ -192,25 +202,25 @@
 
     newPoly = (psPolynomial3D *) psAlloc(sizeof(psPolynomial3D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial3DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial3DFree);
     newPoly->nX = nX;
     newPoly->nY = nY;
     newPoly->nZ = nZ;
 
-    newPoly->coeff    = (float ***) psAlloc(nX * sizeof(float **));
-    newPoly->coeffErr = (float ***) psAlloc(nX * sizeof(float **));
-    newPoly->mask     = (char ***)  psAlloc(nX * sizeof(char **));
-    for (x=0;x<nX;x++) {
-        newPoly->coeff[x]    = (float **) psAlloc(nY * sizeof(float *));
-        newPoly->coeffErr[x] = (float **) psAlloc(nY * sizeof(float *));
-        newPoly->mask[x]     = (char **)  psAlloc(nY * sizeof(char *));
-        for (y=0;y<nY;y++) {
-            newPoly->coeff[x][y]    = (float *) psAlloc(nZ * sizeof(float));
-            newPoly->coeffErr[x][y] = (float *) psAlloc(nZ * sizeof(float));
-            newPoly->mask[x][y]     = (char *)  psAlloc(nZ * sizeof(char));
-        }
-    }
-    for (x=0;x<nX;x++) {
-        for (y=0;y<nY;y++) {
-            for (z=0;z<nZ;z++) {
+    newPoly->coeff = (float ***)psAlloc(nX * sizeof(float **));
+    newPoly->coeffErr = (float ***)psAlloc(nX * sizeof(float **));
+    newPoly->mask = (char ***)psAlloc(nX * sizeof(char **));
+    for (x = 0; x < nX; x++) {
+        newPoly->coeff[x] = (float **)psAlloc(nY * sizeof(float *));
+        newPoly->coeffErr[x] = (float **)psAlloc(nY * sizeof(float *));
+        newPoly->mask[x] = (char **)psAlloc(nY * sizeof(char *));
+        for (y = 0; y < nY; y++) {
+            newPoly->coeff[x][y] = (float *)psAlloc(nZ * sizeof(float));
+            newPoly->coeffErr[x][y] = (float *)psAlloc(nZ * sizeof(float));
+            newPoly->mask[x][y] = (char *)psAlloc(nZ * sizeof(char));
+        }
+    }
+    for (x = 0; x < nX; x++) {
+        for (y = 0; y < nY; y++) {
+            for (z = 0; z < nZ; z++) {
                 newPoly->coeff[x][y][z] = 0.0;
                 newPoly->coeffErr[x][y][z] = 0.0;
@@ -220,5 +230,5 @@
     }
 
-    return(newPoly);
+    return (newPoly);
 }
 
@@ -232,5 +242,5 @@
 
     newPoly = (psPolynomial4D *) psAlloc(sizeof(psPolynomial4D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial4DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial4DFree);
     newPoly->nW = nW;
     newPoly->nX = nX;
@@ -238,26 +248,26 @@
     newPoly->nZ = nZ;
 
-    newPoly->coeff    = (float ****) psAlloc(nW * sizeof(float ***));
-    newPoly->coeffErr = (float ****) psAlloc(nW * sizeof(float ***));
-    newPoly->mask     = (char ****)  psAlloc(nW * sizeof(char ***));
-    for (w=0;w<nW;w++) {
-        newPoly->coeff[w]    = (float ***) psAlloc(nX * sizeof(float **));
-        newPoly->coeffErr[w] = (float ***) psAlloc(nX * sizeof(float **));
-        newPoly->mask[w]     = (char ***)  psAlloc(nX * sizeof(char **));
-        for (x=0;x<nX;x++) {
-            newPoly->coeff[w][x]    = (float **) psAlloc(nY * sizeof(float *));
-            newPoly->coeffErr[w][x] = (float **) psAlloc(nY * sizeof(float *));
-            newPoly->mask[w][x]     = (char **) psAlloc(nY * sizeof(char *));
-            for (y=0;y<nY;y++) {
-                newPoly->coeff[w][x][y]    = (float *) psAlloc(nZ * sizeof(float));
-                newPoly->coeffErr[w][x][y] = (float *) psAlloc(nZ * sizeof(float));
-                newPoly->mask[w][x][y]     = (char *) psAlloc(nZ * sizeof(char));
-            }
-        }
-    }
-    for (w=0;w<nW;w++) {
-        for (x=0;x<nX;x++) {
-            for (y=0;y<nY;y++) {
-                for (z=0;z<nZ;z++) {
+    newPoly->coeff = (float ****)psAlloc(nW * sizeof(float ***));
+    newPoly->coeffErr = (float ****)psAlloc(nW * sizeof(float ***));
+    newPoly->mask = (char ****)psAlloc(nW * sizeof(char ***));
+    for (w = 0; w < nW; w++) {
+        newPoly->coeff[w] = (float ***)psAlloc(nX * sizeof(float **));
+        newPoly->coeffErr[w] = (float ***)psAlloc(nX * sizeof(float **));
+        newPoly->mask[w] = (char ***)psAlloc(nX * sizeof(char **));
+        for (x = 0; x < nX; x++) {
+            newPoly->coeff[w][x] = (float **)psAlloc(nY * sizeof(float *));
+            newPoly->coeffErr[w][x] = (float **)psAlloc(nY * sizeof(float *));
+            newPoly->mask[w][x] = (char **)psAlloc(nY * sizeof(char *));
+            for (y = 0; y < nY; y++) {
+                newPoly->coeff[w][x][y] = (float *)psAlloc(nZ * sizeof(float));
+                newPoly->coeffErr[w][x][y] = (float *)psAlloc(nZ * sizeof(float));
+                newPoly->mask[w][x][y] = (char *)psAlloc(nZ * sizeof(char));
+            }
+        }
+    }
+    for (w = 0; w < nW; w++) {
+        for (x = 0; x < nX; x++) {
+            for (y = 0; y < nY; y++) {
+                for (z = 0; z < nZ; z++) {
                     newPoly->coeff[w][x][y][z] = 0.0;
                     newPoly->coeffErr[w][x][y][z] = 0.0;
@@ -268,8 +278,8 @@
     }
 
-    return(newPoly);
-}
-
-static void polynomial1DFree(psPolynomial1D *myPoly)
+    return (newPoly);
+}
+
+static void polynomial1DFree(psPolynomial1D * myPoly)
 {
     psFree(myPoly->coeff);
@@ -278,9 +288,9 @@
 }
 
-static void polynomial2DFree(psPolynomial2D *myPoly)
-{
-    int x = 0;
-
-    for (x=0;x<myPoly->nX;x++) {
+static void polynomial2DFree(psPolynomial2D * myPoly)
+{
+    int x = 0;
+
+    for (x = 0; x < myPoly->nX; x++) {
         psFree(myPoly->coeff[x]);
         psFree(myPoly->coeffErr[x]);
@@ -292,11 +302,11 @@
 }
 
-static void polynomial3DFree(psPolynomial3D *myPoly)
-{
-    int x = 0;
-    int y = 0;
-
-    for (x=0;x<myPoly->nX;x++) {
-        for (y=0;y<myPoly->nY;y++) {
+static void polynomial3DFree(psPolynomial3D * myPoly)
+{
+    int x = 0;
+    int y = 0;
+
+    for (x = 0; x < myPoly->nX; x++) {
+        for (y = 0; y < myPoly->nY; y++) {
             psFree(myPoly->coeff[x][y]);
             psFree(myPoly->coeffErr[x][y]);
@@ -313,5 +323,5 @@
 }
 
-static void polynomial4DFree(psPolynomial4D *myPoly)
+static void polynomial4DFree(psPolynomial4D * myPoly)
 {
     int w = 0;
@@ -319,7 +329,7 @@
     int y = 0;
 
-    for (w=0;w<myPoly->nW;w++) {
-        for (x=0;x<myPoly->nX;x++) {
-            for (y=0;y<myPoly->nY;y++) {
+    for (w = 0; w < myPoly->nW; w++) {
+        for (x = 0; x < myPoly->nX; x++) {
+            for (y = 0; y < myPoly->nY; y++) {
                 psFree(myPoly->coeff[w][x][y]);
                 psFree(myPoly->coeffErr[w][x][y]);
@@ -343,7 +353,5 @@
     Polynomial coefficients will be accessed in [w][x][y][z] fashion.
  *****************************************************************************/
-float
-psPolynomial1DEval(float x,
-                   const psPolynomial1D *myPoly)
+float psPolynomial1DEval(float x, const psPolynomial1D * myPoly)
 {
     int loop_x = 0;
@@ -355,8 +363,7 @@
     }
 
-
     // NOTE: Do we want to flag this case?
     if (myPoly->n == 0) {
-        return(1.0);
+        return (1.0);
     }
 
@@ -365,17 +372,13 @@
     }
 
-    for (loop_x=0;loop_x<myPoly->n;loop_x++) {
-        polySum+= xSum * myPoly->coeff[loop_x];
-        xSum*=x;
-    }
-
-    return(polySum);
-}
-
-
-float
-psPolynomial2DEval(float x,
-                   float y,
-                   const psPolynomial2D *myPoly)
+    for (loop_x = 0; loop_x < myPoly->n; loop_x++) {
+        polySum += xSum * myPoly->coeff[loop_x];
+        xSum *= x;
+    }
+
+    return (polySum);
+}
+
+float psPolynomial2DEval(float x, float y, const psPolynomial2D * myPoly)
 {
     int loop_x = 0;
@@ -385,21 +388,17 @@
     float ySum = 1.0;
 
-    for (loop_x=0;loop_x<myPoly->nX;loop_x++) {
+    for (loop_x = 0; loop_x < myPoly->nX; loop_x++) {
         ySum = xSum;
-        for (loop_y=0;loop_y<myPoly->nY;loop_y++) {
-            polySum+= ySum * myPoly->coeff[loop_x][loop_y];
-            ySum*=y;
-        }
-        xSum*=x;
-    }
-
-    return(polySum);
-}
-
-float
-psPolynomial3DEval(float x,
-                   float y,
-                   float z,
-                   const psPolynomial3D *myPoly)
+        for (loop_y = 0; loop_y < myPoly->nY; loop_y++) {
+            polySum += ySum * myPoly->coeff[loop_x][loop_y];
+            ySum *= y;
+        }
+        xSum *= x;
+    }
+
+    return (polySum);
+}
+
+float psPolynomial3DEval(float x, float y, float z, const psPolynomial3D * myPoly)
 {
     int loop_x = 0;
@@ -411,26 +410,21 @@
     float zSum = 1.0;
 
-    for (loop_x=0;loop_x<myPoly->nX;loop_x++) {
+    for (loop_x = 0; loop_x < myPoly->nX; loop_x++) {
         ySum = xSum;
-        for (loop_y=0;loop_y<myPoly->nY;loop_y++) {
+        for (loop_y = 0; loop_y < myPoly->nY; loop_y++) {
             zSum = ySum;
-            for (loop_z=0;loop_z<myPoly->nZ;loop_z++) {
-                polySum+= zSum * myPoly->coeff[loop_x][loop_y][loop_z];
-                zSum*=z;
-            }
-            ySum*=y;
-        }
-        xSum*=x;
-    }
-
-    return(polySum);
-}
-
-float
-psPolynomial4DEval(float w,
-                   float x,
-                   float y,
-                   float z,
-                   const psPolynomial4D *myPoly)
+            for (loop_z = 0; loop_z < myPoly->nZ; loop_z++) {
+                polySum += zSum * myPoly->coeff[loop_x][loop_y][loop_z];
+                zSum *= z;
+            }
+            ySum *= y;
+        }
+        xSum *= x;
+    }
+
+    return (polySum);
+}
+
+float psPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D * myPoly)
 {
     int loop_w = 0;
@@ -444,27 +438,23 @@
     float zSum = 1.0;
 
-    for (loop_w=0;loop_w<myPoly->nW;loop_w++) {
+    for (loop_w = 0; loop_w < myPoly->nW; loop_w++) {
         xSum = wSum;
-        for (loop_x=0;loop_x<myPoly->nX;loop_x++) {
+        for (loop_x = 0; loop_x < myPoly->nX; loop_x++) {
             ySum = xSum;
-            for (loop_y=0;loop_y<myPoly->nY;loop_y++) {
+            for (loop_y = 0; loop_y < myPoly->nY; loop_y++) {
                 zSum = ySum;
-                for (loop_z=0;loop_z<myPoly->nZ;loop_z++) {
-                    polySum+= zSum *
-                              myPoly->coeff[loop_w][loop_x][loop_y][loop_z];
-                    zSum*=z;
+                for (loop_z = 0; loop_z < myPoly->nZ; loop_z++) {
+                    polySum += zSum * myPoly->coeff[loop_w][loop_x][loop_y][loop_z];
+                    zSum *= z;
                 }
-                ySum*=y;
-            }
-            xSum*=x;
-        }
-        wSum*=w;
-    }
-
-    return(polySum);
-}
-
-
-
+                ySum *= y;
+            }
+            xSum *= x;
+        }
+        wSum *= w;
+    }
+
+    return (polySum);
+}
 
 psDPolynomial1D *psDPolynomial1DAlloc(int n)
@@ -474,10 +464,10 @@
 
     newPoly = (psDPolynomial1D *) psAlloc(sizeof(psDPolynomial1D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial1DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial1DFree);
     newPoly->n = n;
-    newPoly->coeff    = (double *) psAlloc(n * sizeof(double));
-    newPoly->coeffErr = (double *) psAlloc(n * sizeof(double));
-    newPoly->mask     = (char *)  psAlloc(n * sizeof(char));
-    for (i=0;i<n;i++) {
+    newPoly->coeff = (double *)psAlloc(n * sizeof(double));
+    newPoly->coeffErr = (double *)psAlloc(n * sizeof(double));
+    newPoly->mask = (char *)psAlloc(n * sizeof(char));
+    for (i = 0; i < n; i++) {
         newPoly->coeff[i] = 0.0;
         newPoly->coeffErr[i] = 0.0;
@@ -485,5 +475,5 @@
     }
 
-    return(newPoly);
+    return (newPoly);
 }
 
@@ -495,18 +485,18 @@
 
     newPoly = (psDPolynomial2D *) psAlloc(sizeof(psDPolynomial2D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial2DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial2DFree);
     newPoly->nX = nX;
     newPoly->nY = nY;
 
-    newPoly->coeff    = (double **) psAlloc(nX * sizeof(double *));
-    newPoly->coeffErr = (double **) psAlloc(nX * sizeof(double *));
-    newPoly->mask     = (char **)  psAlloc(nX * sizeof(char *));
-    for (x=0;x<nX;x++) {
-        newPoly->coeff[x]    = (double *) psAlloc(nY * sizeof(double));
-        newPoly->coeffErr[x] = (double *) psAlloc(nY * sizeof(double));
-        newPoly->mask[x]     = (char *)  psAlloc(nY * sizeof(char));
-    }
-    for (x=0;x<nX;x++) {
-        for (y=0;y<nY;y++) {
+    newPoly->coeff = (double **)psAlloc(nX * sizeof(double *));
+    newPoly->coeffErr = (double **)psAlloc(nX * sizeof(double *));
+    newPoly->mask = (char **)psAlloc(nX * sizeof(char *));
+    for (x = 0; x < nX; x++) {
+        newPoly->coeff[x] = (double *)psAlloc(nY * sizeof(double));
+        newPoly->coeffErr[x] = (double *)psAlloc(nY * sizeof(double));
+        newPoly->mask[x] = (char *)psAlloc(nY * sizeof(char));
+    }
+    for (x = 0; x < nX; x++) {
+        for (y = 0; y < nY; y++) {
             newPoly->coeff[x][y] = 0.0;
             newPoly->coeffErr[x][y] = 0.0;
@@ -515,5 +505,5 @@
     }
 
-    return(newPoly);
+    return (newPoly);
 }
 
@@ -526,25 +516,25 @@
 
     newPoly = (psDPolynomial3D *) psAlloc(sizeof(psDPolynomial3D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial3DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial3DFree);
     newPoly->nX = nX;
     newPoly->nY = nY;
     newPoly->nZ = nZ;
 
-    newPoly->coeff    = (double ***) psAlloc(nX * sizeof(double **));
-    newPoly->coeffErr = (double ***) psAlloc(nX * sizeof(double **));
-    newPoly->mask     = (char ***)  psAlloc(nX * sizeof(char **));
-    for (x=0;x<nX;x++) {
-        newPoly->coeff[x]    = (double **) psAlloc(nY * sizeof(double *));
-        newPoly->coeffErr[x] = (double **) psAlloc(nY * sizeof(double *));
-        newPoly->mask[x]     = (char **)  psAlloc(nY * sizeof(char *));
-        for (y=0;y<nY;y++) {
-            newPoly->coeff[x][y]    = (double *) psAlloc(nZ * sizeof(double));
-            newPoly->coeffErr[x][y] = (double *) psAlloc(nZ * sizeof(double));
-            newPoly->mask[x][y]     = (char *)  psAlloc(nZ * sizeof(char));
-        }
-    }
-    for (x=0;x<nX;x++) {
-        for (y=0;y<nY;y++) {
-            for (z=0;z<nZ;z++) {
+    newPoly->coeff = (double ***)psAlloc(nX * sizeof(double **));
+    newPoly->coeffErr = (double ***)psAlloc(nX * sizeof(double **));
+    newPoly->mask = (char ***)psAlloc(nX * sizeof(char **));
+    for (x = 0; x < nX; x++) {
+        newPoly->coeff[x] = (double **)psAlloc(nY * sizeof(double *));
+        newPoly->coeffErr[x] = (double **)psAlloc(nY * sizeof(double *));
+        newPoly->mask[x] = (char **)psAlloc(nY * sizeof(char *));
+        for (y = 0; y < nY; y++) {
+            newPoly->coeff[x][y] = (double *)psAlloc(nZ * sizeof(double));
+            newPoly->coeffErr[x][y] = (double *)psAlloc(nZ * sizeof(double));
+            newPoly->mask[x][y] = (char *)psAlloc(nZ * sizeof(char));
+        }
+    }
+    for (x = 0; x < nX; x++) {
+        for (y = 0; y < nY; y++) {
+            for (z = 0; z < nZ; z++) {
                 newPoly->coeff[x][y][z] = 0.0;
                 newPoly->coeffErr[x][y][z] = 0.0;
@@ -554,5 +544,5 @@
     }
 
-    return(newPoly);
+    return (newPoly);
 }
 
@@ -566,5 +556,5 @@
 
     newPoly = (psDPolynomial4D *) psAlloc(sizeof(psDPolynomial4D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial4DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial4DFree);
     newPoly->nW = nW;
     newPoly->nX = nX;
@@ -572,26 +562,26 @@
     newPoly->nZ = nZ;
 
-    newPoly->coeff    = (double ****) psAlloc(nW * sizeof(double ***));
-    newPoly->coeffErr = (double ****) psAlloc(nW * sizeof(double ***));
-    newPoly->mask     = (char ****)  psAlloc(nW * sizeof(char ***));
-    for (w=0;w<nW;w++) {
-        newPoly->coeff[w]    = (double ***) psAlloc(nX * sizeof(double **));
-        newPoly->coeffErr[w] = (double ***) psAlloc(nX * sizeof(double **));
-        newPoly->mask[w]     = (char ***)  psAlloc(nX * sizeof(char **));
-        for (x=0;x<nX;x++) {
-            newPoly->coeff[w][x]    = (double **) psAlloc(nY * sizeof(double *));
-            newPoly->coeffErr[w][x] = (double **) psAlloc(nY * sizeof(double *));
-            newPoly->mask[w][x]     = (char **) psAlloc(nY * sizeof(char *));
-            for (y=0;y<nY;y++) {
-                newPoly->coeff[w][x][y]    = (double *) psAlloc(nZ * sizeof(double));
-                newPoly->coeffErr[w][x][y] = (double *) psAlloc(nZ * sizeof(double));
-                newPoly->mask[w][x][y]     = (char *) psAlloc(nZ * sizeof(char));
-            }
-        }
-    }
-    for (w=0;w<nW;w++) {
-        for (x=0;x<nX;x++) {
-            for (y=0;y<nY;y++) {
-                for (z=0;z<nZ;z++) {
+    newPoly->coeff = (double ****)psAlloc(nW * sizeof(double ***));
+    newPoly->coeffErr = (double ****)psAlloc(nW * sizeof(double ***));
+    newPoly->mask = (char ****)psAlloc(nW * sizeof(char ***));
+    for (w = 0; w < nW; w++) {
+        newPoly->coeff[w] = (double ***)psAlloc(nX * sizeof(double **));
+        newPoly->coeffErr[w] = (double ***)psAlloc(nX * sizeof(double **));
+        newPoly->mask[w] = (char ***)psAlloc(nX * sizeof(char **));
+        for (x = 0; x < nX; x++) {
+            newPoly->coeff[w][x] = (double **)psAlloc(nY * sizeof(double *));
+            newPoly->coeffErr[w][x] = (double **)psAlloc(nY * sizeof(double *));
+            newPoly->mask[w][x] = (char **)psAlloc(nY * sizeof(char *));
+            for (y = 0; y < nY; y++) {
+                newPoly->coeff[w][x][y] = (double *)psAlloc(nZ * sizeof(double));
+                newPoly->coeffErr[w][x][y] = (double *)psAlloc(nZ * sizeof(double));
+                newPoly->mask[w][x][y] = (char *)psAlloc(nZ * sizeof(char));
+            }
+        }
+    }
+    for (w = 0; w < nW; w++) {
+        for (x = 0; x < nX; x++) {
+            for (y = 0; y < nY; y++) {
+                for (z = 0; z < nZ; z++) {
                     newPoly->coeff[w][x][y][z] = 0.0;
                     newPoly->coeffErr[w][x][y][z] = 0.0;
@@ -602,8 +592,8 @@
     }
 
-    return(newPoly);
-}
-
-static void dPolynomial1DFree(psDPolynomial1D *myPoly)
+    return (newPoly);
+}
+
+static void dPolynomial1DFree(psDPolynomial1D * myPoly)
 {
     psFree(myPoly->coeff);
@@ -612,9 +602,9 @@
 }
 
-static void dPolynomial2DFree(psDPolynomial2D *myPoly)
-{
-    int x = 0;
-
-    for (x=0;x<myPoly->nX;x++) {
+static void dPolynomial2DFree(psDPolynomial2D * myPoly)
+{
+    int x = 0;
+
+    for (x = 0; x < myPoly->nX; x++) {
         psFree(myPoly->coeff[x]);
         psFree(myPoly->coeffErr[x]);
@@ -626,11 +616,11 @@
 }
 
-static void dPolynomial3DFree(psDPolynomial3D *myPoly)
-{
-    int x = 0;
-    int y = 0;
-
-    for (x=0;x<myPoly->nX;x++) {
-        for (y=0;y<myPoly->nY;y++) {
+static void dPolynomial3DFree(psDPolynomial3D * myPoly)
+{
+    int x = 0;
+    int y = 0;
+
+    for (x = 0; x < myPoly->nX; x++) {
+        for (y = 0; y < myPoly->nY; y++) {
             psFree(myPoly->coeff[x][y]);
             psFree(myPoly->coeffErr[x][y]);
@@ -647,5 +637,5 @@
 }
 
-static void dPolynomial4DFree(psDPolynomial4D *myPoly)
+static void dPolynomial4DFree(psDPolynomial4D * myPoly)
 {
     int w = 0;
@@ -653,7 +643,7 @@
     int y = 0;
 
-    for (w=0;w<myPoly->nW;w++) {
-        for (x=0;x<myPoly->nX;x++) {
-            for (y=0;y<myPoly->nY;y++) {
+    for (w = 0; w < myPoly->nW; w++) {
+        for (x = 0; x < myPoly->nX; x++) {
+            for (y = 0; y < myPoly->nY; y++) {
                 psFree(myPoly->coeff[w][x][y]);
                 psFree(myPoly->coeffErr[w][x][y]);
@@ -677,7 +667,5 @@
     Polynomial coefficients will be accessed in [w][x][y][z] fashion.
  *****************************************************************************/
-double
-psDPolynomial1DEval(double x,
-                    const psDPolynomial1D *myPoly)
+double psDPolynomial1DEval(double x, const psDPolynomial1D * myPoly)
 {
     int loop_x = 0;
@@ -687,20 +675,16 @@
     // NOTE: Do we want to flag this case?
     if (myPoly->n == 0) {
-        return(1.0);
-    }
-
-    for (loop_x=0;loop_x<myPoly->n;loop_x++) {
-        polySum+= xSum * myPoly->coeff[loop_x];
-        xSum*=x;
-    }
-
-    return(polySum);
-}
-
-
-double
-psDPolynomial2DEval(double x,
-                    double y,
-                    const psDPolynomial2D *myPoly)
+        return (1.0);
+    }
+
+    for (loop_x = 0; loop_x < myPoly->n; loop_x++) {
+        polySum += xSum * myPoly->coeff[loop_x];
+        xSum *= x;
+    }
+
+    return (polySum);
+}
+
+double psDPolynomial2DEval(double x, double y, const psDPolynomial2D * myPoly)
 {
     int loop_x = 0;
@@ -710,21 +694,17 @@
     double ySum = 1.0;
 
-    for (loop_x=0;loop_x<myPoly->nX;loop_x++) {
+    for (loop_x = 0; loop_x < myPoly->nX; loop_x++) {
         ySum = xSum;
-        for (loop_y=0;loop_y<myPoly->nY;loop_y++) {
-            polySum+= ySum * myPoly->coeff[loop_x][loop_y];
-            ySum*=y;
-        }
-        xSum*=x;
-    }
-
-    return(polySum);
-}
-
-double
-psDPolynomial3DEval(double x,
-                    double y,
-                    double z,
-                    const psDPolynomial3D *myPoly)
+        for (loop_y = 0; loop_y < myPoly->nY; loop_y++) {
+            polySum += ySum * myPoly->coeff[loop_x][loop_y];
+            ySum *= y;
+        }
+        xSum *= x;
+    }
+
+    return (polySum);
+}
+
+double psDPolynomial3DEval(double x, double y, double z, const psDPolynomial3D * myPoly)
 {
     int loop_x = 0;
@@ -736,26 +716,21 @@
     double zSum = 1.0;
 
-    for (loop_x=0;loop_x<myPoly->nX;loop_x++) {
+    for (loop_x = 0; loop_x < myPoly->nX; loop_x++) {
         ySum = xSum;
-        for (loop_y=0;loop_y<myPoly->nY;loop_y++) {
+        for (loop_y = 0; loop_y < myPoly->nY; loop_y++) {
             zSum = ySum;
-            for (loop_z=0;loop_z<myPoly->nZ;loop_z++) {
-                polySum+= zSum * myPoly->coeff[loop_x][loop_y][loop_z];
-                zSum*=z;
-            }
-            ySum*=y;
-        }
-        xSum*=x;
-    }
-
-    return(polySum);
-}
-
-double
-psDPolynomial4DEval(double w,
-                    double x,
-                    double y,
-                    double z,
-                    const psDPolynomial4D *myPoly)
+            for (loop_z = 0; loop_z < myPoly->nZ; loop_z++) {
+                polySum += zSum * myPoly->coeff[loop_x][loop_y][loop_z];
+                zSum *= z;
+            }
+            ySum *= y;
+        }
+        xSum *= x;
+    }
+
+    return (polySum);
+}
+
+double psDPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D * myPoly)
 {
     int loop_w = 0;
@@ -769,22 +744,21 @@
     double zSum = 1.0;
 
-    for (loop_w=0;loop_w<myPoly->nW;loop_w++) {
+    for (loop_w = 0; loop_w < myPoly->nW; loop_w++) {
         xSum = wSum;
-        for (loop_x=0;loop_x<myPoly->nX;loop_x++) {
+        for (loop_x = 0; loop_x < myPoly->nX; loop_x++) {
             ySum = xSum;
-            for (loop_y=0;loop_y<myPoly->nY;loop_y++) {
+            for (loop_y = 0; loop_y < myPoly->nY; loop_y++) {
                 zSum = ySum;
-                for (loop_z=0;loop_z<myPoly->nZ;loop_z++) {
-                    polySum+= zSum *
-                              myPoly->coeff[loop_w][loop_x][loop_y][loop_z];
-                    zSum*=z;
+                for (loop_z = 0; loop_z < myPoly->nZ; loop_z++) {
+                    polySum += zSum * myPoly->coeff[loop_w][loop_x][loop_y][loop_z];
+                    zSum *= z;
                 }
-                ySum*=y;
-            }
-            xSum*=x;
-        }
-        wSum*=w;
-    }
-
-    return(polySum);
-}
+                ySum *= y;
+            }
+            xSum *= x;
+        }
+        wSum *= w;
+    }
+
+    return (polySum);
+}
Index: /trunk/psLib/src/dataManip/psFunctions.h
===================================================================
--- /trunk/psLib/src/dataManip/psFunctions.h	(revision 1406)
+++ /trunk/psLib/src/dataManip/psFunctions.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file psFunctions.h
 *  \brief Standard Mathematical Functions.
@@ -12,6 +13,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 22:34:05 $
+*  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -19,9 +20,9 @@
 
 #if !defined(PS_FUNCTIONS_H)
-#define PS_FUNCTIONS_H
-
-#include <stdbool.h>
-
-#include "psVector.h"
+#    define PS_FUNCTIONS_H
+
+#    include <stdbool.h>
+
+#    include "psVector.h"
 
 /** \addtogroup Stats
@@ -33,29 +34,23 @@
     evaluated Gaussian is: \f[ exp(-\frac{(x-mean)^2}{2\sigma^2}) \f] */
 
-float
-psGaussian( float x,         ///< Value at which to evaluate
-            float mean,      ///< Mean for the Gaussian
-            float stddev,    ///< Standard deviation for the Gaussian
-            bool normal      ///< Indicates whether result should be normalized
-          );
-
+float psGaussian(float x,       // /< Value at which to evaluate
+                 float mean,    // /< Mean for the Gaussian
+                 float stddev,  // /< Standard deviation for the Gaussian
+                 bool normal    // /< Indicates whether result should be normalized
+                );
 
 /** Produce a vector of random numbers from a Gaussian distribution with
     the specified mean and sigma */
-psVector *psGaussianDev( float mean,     ///< The mean of the Gaussian
-                         float sigma,    ///< The sigma of the Gaussian
-                         int Npts );     ///< The size of the vector
-
-
-
-
+psVector *psGaussianDev(float mean,     // /< The mean of the Gaussian
+                        float sigma,    // /< The sigma of the Gaussian
+                        int Npts);      // /< The size of the vector
 
 /** One-dimensional polynomial */
 typedef struct
 {
-    int n;           ///< Number of terms
-    float *coeff;    ///< Coefficients
-    float *coeffErr; ///< Error in coefficients
-    char *mask;      ///< Coefficient mask
+    int n;                      // /< Number of terms
+    float *coeff;               // /< Coefficients
+    float *coeffErr;            // /< Error in coefficients
+    char *mask;                 // /< Coefficient mask
 }
 psPolynomial1D;
@@ -64,8 +59,9 @@
 typedef struct
 {
-    int nX, nY;    ///< Number of terms in x and y
-    float **coeff;   ///< Coefficients
-    float **coeffErr;   ///< Error in coefficients
-    char **mask;   ///< Coefficients mask
+    int nX,
+    nY;                       // /< Number of terms in x and y
+    float **coeff;              // /< Coefficients
+    float **coeffErr;           // /< Error in coefficients
+    char **mask;                // /< Coefficients mask
 }
 psPolynomial2D;
@@ -74,8 +70,10 @@
 typedef struct
 {
-    int nX, nY, nZ;   ///< Number of terms in x, y and z
-    float ***coeff;    ///< Coefficients
-    float ***coeffErr;    ///< Error in coefficients
-    char ***mask;    ///< Coefficients mask
+    int nX,
+    nY,
+    nZ;                       // /< Number of terms in x, y and z
+    float ***coeff;             // /< Coefficients
+    float ***coeffErr;          // /< Error in coefficients
+    char ***mask;               // /< Coefficients mask
 }
 psPolynomial3D;
@@ -84,56 +82,58 @@
 typedef struct
 {
-    int nW, nX, nY, nZ;   ///< Number of terms in w, x, y and z
-    float ****coeff;    ///< Coefficients
-    float ****coeffErr;   ///< Error in coefficients
-    char ****mask;    ///< Coefficients mask
+    int nW,
+    nX,
+    nY,
+    nZ;                       // /< Number of terms in w, x, y and z
+    float ****coeff;            // /< Coefficients
+    float ****coeffErr;         // /< Error in coefficients
+    char ****mask;              // /< Coefficients mask
 }
 psPolynomial4D;
 
-
 /** Functions **************************************************************/
 
 /** Constructor */
-psPolynomial1D *psPolynomial1DAlloc( int n ///< Number of terms
-                                   );
-/** Constructor */
-psPolynomial2D *psPolynomial2DAlloc( int nX, int nY ///< Number of terms in x and y
-                                   );
-/** Constructor */
-psPolynomial3D *psPolynomial3DAlloc( int nX, int nY, int nZ ///< Number of terms in x, y and z
-                                   );
-/** Constructor */
-psPolynomial4D *psPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z
+psPolynomial1D *psPolynomial1DAlloc(int n       // /< Number of terms
+                                   );
+
+/** Constructor */
+psPolynomial2D *psPolynomial2DAlloc(int nX, int nY      // /< Number of terms in x and y
+                                   );
+
+/** Constructor */
+psPolynomial3D *psPolynomial3DAlloc(int nX, int nY, int nZ      // /< Number of terms in x, y and z
+                                   );
+
+/** Constructor */
+psPolynomial4D *psPolynomial4DAlloc(int nW, int nX, int nY, int nZ      // /< Number of terms in w, x, y and
+                                    // z
                                    );
 
 /** Evaluate 1D polynomial */
-float
-psPolynomial1DEval( float x,   ///< Value at which to evaluate
-                    const psPolynomial1D *myPoly ///< Coefficients for the polynomial
-                  );
+float psPolynomial1DEval(float x,       // /< Value at which to evaluate
+                         const psPolynomial1D * myPoly  // /< Coefficients for the polynomial
+                        );
 
 /** Evaluate 2D polynomial */
-float
-psPolynomial2DEval( float x,   ///< Value x at which to evaluate
-                    float y,   ///< Value y at which to evaluate
-                    const psPolynomial2D *myPoly ///< Coefficients for the polynomial
-                  );
+float psPolynomial2DEval(float x,       // /< Value x at which to evaluate
+                         float y,       // /< Value y at which to evaluate
+                         const psPolynomial2D * myPoly  // /< Coefficients for the polynomial
+                        );
 
 /** Evaluate 3D polynomial */
-float
-psPolynomial3DEval( float x,   ///< Value x at which to evaluate
-                    float y,   ///< Value y at which to evaluate
-                    float z,   ///< Value z at which to evaluate
-                    const psPolynomial3D *myPoly ///< Coefficients for the polynomial
-                  );
+float psPolynomial3DEval(float x,       // /< Value x at which to evaluate
+                         float y,       // /< Value y at which to evaluate
+                         float z,       // /< Value z at which to evaluate
+                         const psPolynomial3D * myPoly  // /< Coefficients for the polynomial
+                        );
 
 /** Evaluate 4D polynomial */
-float
-psPolynomial4DEval( float w,   ///< Value w at which to evaluate
-                    float x,   ///< Value x at which to evaluate
-                    float y,   ///< Value y at which to evaluate
-                    float z,   ///< Value z at which to evaluate
-                    const psPolynomial4D *myPoly ///< Coefficients for the polynomial
-                  );
+float psPolynomial4DEval(float w,       // /< Value w at which to evaluate
+                         float x,       // /< Value x at which to evaluate
+                         float y,       // /< Value y at which to evaluate
+                         float z,       // /< Value z at which to evaluate
+                         const psPolynomial4D * myPoly  // /< Coefficients for the polynomial
+                        );
 
 /*****************************************************************************/
@@ -144,8 +144,8 @@
 typedef struct
 {
-    int n;    ///< Number of terms
-    double *coeff;   ///< Coefficients
-    double *coeffErr;   ///< Error in coefficients
-    char *mask;    ///< Coefficient mask
+    int n;                      // /< Number of terms
+    double *coeff;              // /< Coefficients
+    double *coeffErr;           // /< Error in coefficients
+    char *mask;                 // /< Coefficient mask
 }
 psDPolynomial1D;
@@ -154,8 +154,9 @@
 typedef struct
 {
-    int nX, nY;    ///< Number of terms in x and y
-    double **coeff;   ///< Coefficients
-    double **coeffErr;    ///< Error in coefficients
-    char **mask;   ///< Coefficients mask
+    int nX,
+    nY;                       // /< Number of terms in x and y
+    double **coeff;             // /< Coefficients
+    double **coeffErr;          // /< Error in coefficients
+    char **mask;                // /< Coefficients mask
 }
 psDPolynomial2D;
@@ -164,8 +165,10 @@
 typedef struct
 {
-    int nX, nY, nZ;   ///< Number of terms in x, y and z
-    double ***coeff;   ///< Coefficients
-    double ***coeffErr;   ///< Error in coefficients
-    char ***mask;    ///< Coefficient mask
+    int nX,
+    nY,
+    nZ;                       // /< Number of terms in x, y and z
+    double ***coeff;            // /< Coefficients
+    double ***coeffErr;         // /< Error in coefficients
+    char ***mask;               // /< Coefficient mask
 }
 psDPolynomial3D;
@@ -174,55 +177,58 @@
 typedef struct
 {
-    int nW, nX, nY, nZ;   ///< Number of terms in w, x, y and z
-    double ****coeff;    ///< Coefficients
-    double ****coeffErr;   ///< Error in coefficients
-    char ****mask;    ///< Coefficients mask
+    int nW,
+    nX,
+    nY,
+    nZ;                       // /< Number of terms in w, x, y and z
+    double ****coeff;           // /< Coefficients
+    double ****coeffErr;        // /< Error in coefficients
+    char ****mask;              // /< Coefficients mask
 }
 psDPolynomial4D;
 
 /** Constructor */
-psDPolynomial1D *psDPolynomial1DAlloc( int n ///< Number of terms
-                                     );
-/** Constructor */
-psDPolynomial2D *psDPolynomial2DAlloc( int nX, int nY ///< Number of terms in x and y
-                                     );
-/** Constructor */
-psDPolynomial3D *psDPolynomial3DAlloc( int nX, int nY, int nZ ///< Number of terms in x, y and z
-                                     );
-/** Constructor */
-psDPolynomial4D *psDPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z
+psDPolynomial1D *psDPolynomial1DAlloc(int n     // /< Number of terms
+                                     );
+
+/** Constructor */
+psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY    // /< Number of terms in x and y
+                                     );
+
+/** Constructor */
+psDPolynomial3D *psDPolynomial3DAlloc(int nX, int nY, int nZ    // /< Number of terms in x, y and z
+                                     );
+
+/** Constructor */
+psDPolynomial4D *psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ    // /< Number of terms in w, x, y and
+                                      // z
                                      );
 
 /** Evaluate 1D polynomial (double precision) */
-double
-psDPolynomial1DEval( double x,   ///< Value at which to evaluate
-                     const psDPolynomial1D *myPoly ///< Coefficients for the polynomial
-                   );
+double psDPolynomial1DEval(double x,    // /< Value at which to evaluate
+                           const psDPolynomial1D * myPoly       // /< Coefficients for the polynomial
+                          );
 
 /** Evaluate 2D polynomial (double precision) */
-double
-psDPolynomial2DEval( double x,   ///< Value x at which to evaluate
-                     double y,   ///< Value y at which to evaluate
-                     const psDPolynomial2D *myPoly ///< Coefficients for the polynomial
-                   );
+double psDPolynomial2DEval(double x,    // /< Value x at which to evaluate
+                           double y,    // /< Value y at which to evaluate
+                           const psDPolynomial2D * myPoly       // /< Coefficients for the polynomial
+                          );
 
 /** Evaluate 3D polynomial (double precision) */
-double
-psDPolynomial3DEval( double x,   ///< Value x at which to evaluate
-                     double y,   ///< Value y at which to evaluate
-                     double z,   ///< Value z at which to evaluate
-                     const psDPolynomial3D *myPoly ///< Coefficients for the polynomial
-                   );
+double psDPolynomial3DEval(double x,    // /< Value x at which to evaluate
+                           double y,    // /< Value y at which to evaluate
+                           double z,    // /< Value z at which to evaluate
+                           const psDPolynomial3D * myPoly       // /< Coefficients for the polynomial
+                          );
 
 /** Evaluate 4D polynomial (double precision) */
-double
-psDPolynomial4DEval( double w,   ///< Value w at which to evaluate
-                     double x,   ///< Value x at which to evaluate
-                     double y,   ///< Value y at which to evaluate
-                     double z,   ///< Value z at which to evaluate
-                     const psDPolynomial4D *myPoly ///< Coefficients for the polynomial
-                   );
-
-/* \} */ // End of MathGroup Functions
+double psDPolynomial4DEval(double w,    // /< Value w at which to evaluate
+                           double x,    // /< Value x at which to evaluate
+                           double y,    // /< Value y at which to evaluate
+                           double z,    // /< Value z at which to evaluate
+                           const psDPolynomial4D * myPoly       // /< Coefficients for the polynomial
+                          );
+
+/* \} */// End of MathGroup Functions
 
 #endif
Index: /trunk/psLib/src/dataManip/psMatrix.c
===================================================================
--- /trunk/psLib/src/dataManip/psMatrix.c	(revision 1406)
+++ /trunk/psLib/src/dataManip/psMatrix.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psMatrix.c
  *
@@ -20,6 +21,6 @@
  *  @author Ross Harman, MHPCC
  *   
- *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -27,5 +28,7 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 #include <string.h>
@@ -42,5 +45,7 @@
 
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
@@ -48,5 +53,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -54,5 +61,7 @@
 
 /*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
+
 /*****************************************************************************/
 
@@ -60,5 +69,7 @@
 
 /*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
+
 /*****************************************************************************/
 
@@ -66,5 +77,7 @@
 
 /*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
+
 /*****************************************************************************/
 
@@ -142,8 +155,10 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
-/*****************************************************************************/
-
-psImage *psMatrixLUD(psImage *outImage, psVector *outPerm, psImage *inImage)
+
+/*****************************************************************************/
+
+psImage *psMatrixLUD(psImage * outImage, psVector * outPerm, psImage * inImage)
 {
     int signum = 0;
@@ -169,5 +184,5 @@
     numRows = inImage->numRows;
     numCols = inImage->numCols;
-    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type)*numRows*numCols;
+    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type) * numRows * numCols;
 
     // Initialize GSL data
@@ -190,6 +205,6 @@
 }
 
-psVector *psMatrixLUSolve(psVector *outVector, const psImage *inImage, const psVector *inVector, const
-                          psVector *inPerm)
+psVector *psMatrixLUSolve(psVector * outVector, const psImage * inImage, const psVector * inVector, const
+                          psVector * inPerm)
 {
     int arraySize = 0;
@@ -219,5 +234,5 @@
     numRows = inImage->numRows;
     numCols = inImage->numCols;
-    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type)*numRows*numCols;
+    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type) * numRows * numCols;
 
     // Initialize GSL data
@@ -243,5 +258,5 @@
 }
 
-psImage *psMatrixInvert(psImage *outImage, const psImage *inImage, float *restrict det)
+psImage *psMatrixInvert(psImage * outImage, const psImage * inImage, float *restrict det)
 {
     int signum = 0;
@@ -254,5 +269,5 @@
 
     // Error checks
-    if(det == NULL) {
+    if (det == NULL) {
         psError(__func__, "Invalid operation: determinant argument is NULL.");
         return outImage;
@@ -269,5 +284,5 @@
     numRows = inImage->numRows;
     numCols = inImage->numCols;
-    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type)*numRows*numCols;
+    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type) * numRows * numCols;
 
     // Allocate GSL structs
@@ -297,5 +312,5 @@
 }
 
-float* psMatrixDeterminant(const psImage *restrict inImage)
+float *psMatrixDeterminant(const psImage * restrict inImage)
 {
     int signum = 0;
@@ -315,5 +330,5 @@
     numRows = inImage->numRows;
     numCols = inImage->numCols;
-    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type)*numRows*numCols;
+    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type) * numRows * numCols;
 
     // Allocate GSL structs
@@ -328,5 +343,5 @@
 
     // Calculate determinant
-    det = (float*)psAlloc(sizeof(float));
+    det = (float *)psAlloc(sizeof(float));
     gsl_linalg_LU_decomp(lu, perm, &signum);
     *det = (float)gsl_linalg_LU_det(lu, signum);
@@ -339,5 +354,5 @@
 }
 
-psImage* psMatrixMultiply(psImage *outImage, psImage *inImage1, psImage *inImage2)
+psImage *psMatrixMultiply(psImage * outImage, psImage * inImage1, psImage * inImage2)
 {
     int arraySize = 0;
@@ -364,5 +379,5 @@
     numRows = inImage1->numRows;
     numCols = inImage1->numCols;
-    arraySize = PSELEMTYPE_SIZEOF(outImage->type.type)*numRows*numCols;
+    arraySize = PSELEMTYPE_SIZEOF(outImage->type.type) * numRows * numCols;
 
     // Initialize GSL data
@@ -381,5 +396,5 @@
 }
 
-psImage* psMatrixTranspose(psImage *outImage, const psImage *inImage)
+psImage *psMatrixTranspose(psImage * outImage, const psImage * inImage)
 {
     int arraySize = 0;
@@ -400,5 +415,5 @@
     numRows = inImage->numRows;
     numCols = inImage->numCols;
-    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type)*numRows*numCols;
+    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type) * numRows * numCols;
 
     // Initialize GSL data
@@ -418,5 +433,5 @@
 }
 
-psImage *psMatrixEigenvectors(psImage *outImage, psImage *inImage)
+psImage *psMatrixEigenvectors(psImage * outImage, psImage * inImage)
 {
     int numRows = 0;
@@ -462,5 +477,5 @@
 }
 
-psVector *psMatrixToVector(psVector *outVector, psImage *inImage)
+psVector *psMatrixToVector(psVector * outVector, psImage * inImage)
 {
     int size = 0;
@@ -471,52 +486,49 @@
     PS_CHECK_SIZE_IMAGE(inImage, outVector);
 
-    if(inImage->numRows == 1) {
+    if (inImage->numRows == 1) {
         // Create transposed row vector
         PS_CHECK_ALLOC_VECTOR(outVector, inImage->numCols, inImage->type.type);
         outVector->type.dimen = PS_DIMEN_TRANSV;
-    } else
-        if(inImage->numCols == 1) {
-            // Create non-transposed column vector
-            PS_CHECK_ALLOC_VECTOR(outVector, inImage->numRows, inImage->type.type);
-        } else {
-            psError(__func__, "Image does not have dim with 1 col or 1 row: (%d x %d).", inImage->numRows,
-                    inImage->numCols);
-            return outVector;
-        }
+    } else if (inImage->numCols == 1) {
+        // Create non-transposed column vector
+        PS_CHECK_ALLOC_VECTOR(outVector, inImage->numRows, inImage->type.type);
+    } else {
+        psError(__func__, "Image does not have dim with 1 col or 1 row: (%d x %d).", inImage->numRows,
+                inImage->numCols);
+        return outVector;
+    }
 
     PS_CHECK_NULL_VECTOR(outVector, outVector);
 
-
     // More checks
-    if(outVector->type.dimen == PS_DIMEN_VECTOR) {
+    if (outVector->type.dimen == PS_DIMEN_VECTOR) {
         PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_VECTOR, outVector);
 
-        if(outVector->n == 0) {
+        if (outVector->n == 0) {
             outVector->n = inImage->numRows;
         }
 
-        if(outVector->n != inImage->numRows) {
+        if (outVector->n != inImage->numRows) {
             psError(__func__, "Image and vector sizes differ: (%d vs %d).", inImage->numRows, outVector->n);
             return outVector;
         }
 
-        size = PSELEMTYPE_SIZEOF(inImage->type.type)*inImage->numRows;
-
-    } else
-        if(outVector->type.dimen == PS_DIMEN_TRANSV) {
-            PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_TRANSV, outVector);
-
-            if(outVector->n == 0) {
-                outVector->n = inImage->numCols;
-            }
-
-            if(outVector->n != inImage->numCols) {
-                psError(__func__, "Image and vector sizes differ: (%d vs %d).", inImage->numCols, outVector->n);
-                return outVector;
-            }
-
-            size = PSELEMTYPE_SIZEOF(inImage->type.type)*inImage->numCols;
+        size = PSELEMTYPE_SIZEOF(inImage->type.type) * inImage->numRows;
+
+    } else if (outVector->type.dimen == PS_DIMEN_TRANSV) {
+        PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_TRANSV, outVector);
+
+        if (outVector->n == 0) {
+            outVector->n = inImage->numCols;
         }
 
+        if (outVector->n != inImage->numCols) {
+            psError(__func__, "Image and vector sizes differ: (%d vs %d).", inImage->numCols, outVector->n);
+            return outVector;
+        }
+
+        size = PSELEMTYPE_SIZEOF(inImage->type.type) * inImage->numCols;
+    }
+
     memcpy(outVector->data.V, inImage->data.V[0], size);
 
@@ -524,5 +536,5 @@
 }
 
-psImage *psVectorToMatrix(psImage *outImage, psVector *inVector)
+psImage *psVectorToMatrix(psImage * outImage, psVector * inVector)
 {
     int size = 0;
@@ -531,39 +543,34 @@
     PS_CHECK_NULL_VECTOR(inVector, outImage);
 
-    if(inVector->type.dimen == PS_DIMEN_VECTOR) {
+    if (inVector->type.dimen == PS_DIMEN_VECTOR) {
         PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_VECTOR, outImage);
         PS_CHECK_SIZE_VECTOR(inVector, outImage);
         PS_CHECK_ALLOC_IMAGE(outImage, 1, inVector->n, PS_TYPE_F64)
-
         // More checks for PS_DIMEN_VECTOR
-        if(outImage->numCols > 1) {
+        if (outImage->numCols > 1) {
             psError(__func__, "Image has more than 1 column: numCols = %d.", outImage->numCols);
             return outImage;
-        } else
-            if(outImage->numRows != inVector->n) {
-                psError(__func__, "Image and vector sizes differ: (%d vs %d).", outImage->numRows, inVector->n);
-                return outImage;
-            }
-
-        size = PSELEMTYPE_SIZEOF(outImage->type.type)*outImage->numRows;
-
-    } else
-        if(inVector->type.dimen == PS_DIMEN_TRANSV) {
-            PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_TRANSV, outImage);
-            PS_CHECK_SIZE_VECTOR(inVector, outImage);
-            PS_CHECK_ALLOC_IMAGE(outImage, inVector->n, 1, PS_TYPE_F64)
-
-            // More checks for PS_DIMEN_TRANSV
-            if(outImage->numRows > 1) {
-                psError(__func__, "Image has more than 1 row: numRows = %d.", outImage->numRows);
-                return outImage;
-            } else
-                if(outImage->numCols != inVector->n) {
-                    psError(__func__, "Image and vector sizes differ: (%d vs %d).", outImage->numCols, inVector->n);
-                    return outImage;
-                }
-
-            size = PSELEMTYPE_SIZEOF(outImage->type.type)*outImage->numCols;
+        } else if (outImage->numRows != inVector->n) {
+            psError(__func__, "Image and vector sizes differ: (%d vs %d).", outImage->numRows, inVector->n);
+            return outImage;
         }
+
+        size = PSELEMTYPE_SIZEOF(outImage->type.type) * outImage->numRows;
+
+    } else if (inVector->type.dimen == PS_DIMEN_TRANSV) {
+        PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_TRANSV, outImage);
+        PS_CHECK_SIZE_VECTOR(inVector, outImage);
+        PS_CHECK_ALLOC_IMAGE(outImage, inVector->n, 1, PS_TYPE_F64)
+        // More checks for PS_DIMEN_TRANSV
+        if (outImage->numRows > 1) {
+            psError(__func__, "Image has more than 1 row: numRows = %d.", outImage->numRows);
+            return outImage;
+        } else if (outImage->numCols != inVector->n) {
+            psError(__func__, "Image and vector sizes differ: (%d vs %d).", outImage->numCols, inVector->n);
+            return outImage;
+        }
+
+        size = PSELEMTYPE_SIZEOF(outImage->type.type) * outImage->numCols;
+    }
 
     PS_CHECK_NULL_IMAGE(outImage, outImage);
@@ -574,3 +581,2 @@
     return outImage;
 }
-
Index: /trunk/psLib/src/dataManip/psMatrix.h
===================================================================
--- /trunk/psLib/src/dataManip/psMatrix.h	(revision 1406)
+++ /trunk/psLib/src/dataManip/psMatrix.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psMatrix.h
  *
@@ -21,6 +22,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-10 01:58:06 $
+ *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -28,5 +29,5 @@
 
 #ifndef PSMATRIX_H
-#define PSMATRIX_H
+#    define PSMATRIX_H
 
 /// @addtogroup Matrix
@@ -42,9 +43,8 @@
  *  @return  psImage*: Pointer to LU decomposed psImage.
  */
-psImage *psMatrixLUD(
-    psImage *outImage,  ///< Image to return, or NULL.
-    psVector *outPerm,  ///< Output permutation vector used by psMatrixLUSolve.
-    psImage *inImage    ///< Image to decompose.
-);
+psImage *psMatrixLUD(psImage * outImage,        // /< Image to return, or NULL.
+                     psVector * outPerm,        // /< Output permutation vector used by psMatrixLUSolve.
+                     psImage * inImage  // /< Image to decompose.
+                    );
 
 /** LU Solution of psImage matrix.
@@ -57,10 +57,10 @@
  *  @return  psVector*: Pointer to psVector solution of matrix equation.
  */
-psVector *psMatrixLUSolve(
-    psVector *outVector,        ///< Vector to return, or NULL.
-    const psImage *luImage,     ///< LU-decomposed matrix.
-    const psVector *inVector,   ///< Vector right-hand-side of equation.
-    const psVector *inPerm      ///< Permutation vector resulting from psMatrixLUD function.
-);
+psVector *psMatrixLUSolve(psVector * outVector, // /< Vector to return, or NULL.
+                          const psImage * luImage,      // /< LU-decomposed matrix.
+                          const psVector * inVector,    // /< Vector right-hand-side of equation.
+                          const psVector * inPerm       // /< Permutation vector resulting from psMatrixLUD
+                          // function.
+                         );
 
 /** Invert psImage matrix.
@@ -73,9 +73,8 @@
  *  @return  psImage*: Pointer to inverted psImage.
  */
-psImage *psMatrixInvert(
-    psImage *outImage,      ///< Image to return, or NULL for in-place substitution.
-    const psImage *inImage, ///< Image to be inverted
-    float *restrict det     ///< Determinant to return, or NULL
-);
+psImage *psMatrixInvert(psImage * outImage,     // /< Image to return, or NULL for in-place substitution.
+                        const psImage * inImage,        // /< Image to be inverted
+                        float *restrict det     // /< Determinant to return, or NULL
+                       );
 
 /** Calculate psImage matrix determinant.
@@ -87,7 +86,6 @@
  *  @return  float: Determinant from psImage.
  */
-float* psMatrixDeterminant(
-    const psImage *restrict inMatrix    ///< Image used to calculate determinant.
-);
+float *psMatrixDeterminant(const psImage * restrict inMatrix    // /< Image used to calculate determinant.
+                          );
 
 /** Performs psImage matrix multiplication.
@@ -100,9 +98,8 @@
  *  @return  psImage*: Pointer to resulting psImage.
  */
-psImage *psMatrixMultiply(
-    psImage *outImage,  ///< Matrix to return, or NULL.
-    psImage *inImage1,  ///< First input image.
-    psImage *inImage2   ///< Second input image.
-);
+psImage *psMatrixMultiply(psImage * outImage,   // /< Matrix to return, or NULL.
+                          psImage * inImage1,   // /< First input image.
+                          psImage * inImage2    // /< Second input image.
+                         );
 
 /** Transpose matrix.
@@ -115,8 +112,7 @@
  *  @return  psImage*: Pointer to transposed psImage.
  */
-psImage *psMatrixTranspose(
-    psImage *outImage,      ///< Image to return, or NULL
-    const psImage *inImage  ///< Image to transpose
-);
+psImage *psMatrixTranspose(psImage * outImage,  // /< Image to return, or NULL
+                           const psImage * inImage      // /< Image to transpose
+                          );
 
 /** Calculate matrix eigenvectors.
@@ -128,8 +124,7 @@
  *  @return  psImage*: Pointer to matrix of Eigenvectors.
  */
-psImage *psMatrixEigenvectors(
-    psImage *outImage,  ///< Eigenvectors to return, or NULL.
-    psImage *inImage    ///< Input image.
-);
+psImage *psMatrixEigenvectors(psImage * outImage,       // /< Eigenvectors to return, or NULL.
+                              psImage * inImage // /< Input image.
+                             );
 
 /** Convert matrix to vector.
@@ -142,8 +137,7 @@
  *  @return  psVector*: Pointer to psVector.
  */
-psVector *psMatrixToVector(
-    psVector *outVector,    ///< Vector to return, or NULL.
-    psImage *inImage        ///< Image to convert.
-);
+psVector *psMatrixToVector(psVector * outVector,        // /< Vector to return, or NULL.
+                           psImage * inImage    // /< Image to convert.
+                          );
 
 /** Convert vector to matrix.
@@ -156,8 +150,7 @@
  *  @return  psVector*: Pointer to psIamge.
  */
-psImage *psVectorToMatrix(
-    psImage *outImage,  ///< Matrix to return, or NULL.
-    psVector *inVector  ///< Vector to convert.
-);
+psImage *psVectorToMatrix(psImage * outImage,   // /< Matrix to return, or NULL.
+                          psVector * inVector   // /< Vector to convert.
+                         );
 
 /// @}
Index: /trunk/psLib/src/dataManip/psMatrixVectorArithmetic.c
===================================================================
--- /trunk/psLib/src/dataManip/psMatrixVectorArithmetic.c	(revision 1406)
+++ /trunk/psLib/src/dataManip/psMatrixVectorArithmetic.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psMatrixVectorArithmetic.c
  *
@@ -29,6 +30,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -36,5 +37,7 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 #include <string.h>
@@ -49,5 +52,7 @@
 
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
@@ -55,5 +60,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -61,5 +68,7 @@
 
 /*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
+
 /*****************************************************************************/
 
@@ -67,5 +76,7 @@
 
 /*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
+
 /*****************************************************************************/
 
@@ -73,5 +84,7 @@
 
 /*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
+
 /*****************************************************************************/
 
@@ -85,7 +98,8 @@
 static complex double psNanDiv(complex double a, complex double b)
 {
-    complex double out = 0+0i;
-    out = a/b;
-    if(isnan(creal(out)) || isnan(cimag(out))) {
+    complex double out = 0 + 0i;
+
+    out = a / b;
+    if (isnan(creal(out)) || isnan(cimag(out))) {
         psError(__func__, ": Divide by zero");
     }
@@ -399,23 +413,23 @@
     psType *psTypeOut = NULL;
 
-    psTypeOut = (psType*)out;
-    if(psTypeOut == NULL) {
+    psTypeOut = (psType *) out;
+    if (psTypeOut == NULL) {
         psError(__func__, ": Line %d - Null out argument", __LINE__);
         return out;
     }
 
-    psType1 = (psType*)in1;
-    if(psType1 == NULL) {
+    psType1 = (psType *) in1;
+    if (psType1 == NULL) {
         psError(__func__, ": Line %d - Null in1 argument", __LINE__);
         return out;
     }
 
-    psType2 = (psType*)in2;
-    if(psType2 == NULL) {
+    psType2 = (psType *) in2;
+    if (psType2 == NULL) {
         psError(__func__, ": Line %d - Null in2 argument", __LINE__);
         return out;
     }
 
-    if(op == NULL) {
+    if (op == NULL) {
         psError(__func__, ": Line %d - Null op argument", __LINE__);
         return out;
@@ -429,5 +443,5 @@
     elTypeOut = psTypeOut->type;
 
-    if(elType1!=elType2 &&  elType1!=elTypeOut) {
+    if (elType1 != elType2 && elType1 != elTypeOut) {
         psError(__func__, ": Line %d - Element types for arguments inconsistent: (%d, %d, %d)", __LINE__,
                 elType1, elType2, elTypeOut);
@@ -435,5 +449,5 @@
     }
 
-    if(dim1==PS_DIMEN_OTHER || dim2==PS_DIMEN_OTHER || dimOut==PS_DIMEN_OTHER) {
+    if (dim1 == PS_DIMEN_OTHER || dim2 == PS_DIMEN_OTHER || dimOut == PS_DIMEN_OTHER) {
         psError(__func__, ": Line %d - PS_DIMEN_OTHER not allowed for arguments: (%d, %d, %d)", __LINE__,
                 dim1, dim2, dimOut);
@@ -441,67 +455,57 @@
     }
 
-    if(dim1 == PS_DIMEN_VECTOR) {
-        if(((psVector*)in1)->n == 0) {
+    if (dim1 == PS_DIMEN_VECTOR) {
+        if (((psVector *) in1)->n == 0) {
             psError(__func__, ": Line %d - Vector contains zero elements");
         }
-    } else
-        if(dim1 == PS_DIMEN_IMAGE) {
-            if(((psImage*)in1)->numCols==0 || ((psImage*)in1)->numRows==0) {
-                psError(__func__, ": Line %d - Image contains zero length row or cols");
-            }
-        }
-
-    if(dim2 == PS_DIMEN_VECTOR) {
-        if(((psVector*)in2)->n == 0) {
+    } else if (dim1 == PS_DIMEN_IMAGE) {
+        if (((psImage *) in1)->numCols == 0 || ((psImage *) in1)->numRows == 0) {
+            psError(__func__, ": Line %d - Image contains zero length row or cols");
+        }
+    }
+
+    if (dim2 == PS_DIMEN_VECTOR) {
+        if (((psVector *) in2)->n == 0) {
             psError(__func__, ": Line %d - Vector contains zero elements");
         }
-    } else
-        if(dim2 == PS_DIMEN_IMAGE) {
-            if(((psImage*)in2)->numCols==0 || ((psImage*)in2)->numRows==0) {
-                psError(__func__, ": Line %d - Image contains zero length row or cols");
-            }
-        }
-
-    if(dim1 == PS_DIMEN_SCALAR) {
-        if(dim2 == PS_DIMEN_SCALAR) {
-            BINARY_OP(SCALAR,SCALAR,out,psType1,op,psType2);               // scalar op scalar
-        } else
-            if(dim2==PS_DIMEN_VECTOR || dim2==PS_DIMEN_TRANSV) {
-                BINARY_OP(SCALAR,VECTOR,out,psType1,op,psType2);               // scalar op vector
-            } else
-                if(dim2 == PS_DIMEN_IMAGE) {
-                    BINARY_OP(SCALAR,IMAGE,out,psType1,op,psType2);                // scalar op image
-                } else {
-                    psError(__func__, ": Line %d - Invalid dimensionality for in2 arg: %d", __LINE__, dim2);
-                }
-    } else
-        if(dim1==PS_DIMEN_VECTOR || dim1==PS_DIMEN_TRANSV) {
-            if(dim2 == PS_DIMEN_SCALAR) {
-                BINARY_OP(VECTOR,SCALAR,out,psType1,op,psType2);               // vector op scalar
-            } else
-                if(dim2==PS_DIMEN_VECTOR || dim2==PS_DIMEN_TRANSV) {
-                    BINARY_OP(VECTOR,VECTOR,out,psType1,op,psType2);               // vector op vector
-                } else
-                    if(dim2 == PS_DIMEN_IMAGE) {
-                        BINARY_OP(VECTOR,IMAGE,out,psType1,op,psType2);                // vector op image
-                    } else {
-                        psError(__func__, ": Line %d - Invalid dimensionality for in2 arg: %d", __LINE__, dim2);
-                    }
-        } else
-            if(dim1 == PS_DIMEN_IMAGE) {
-                if(dim2 == PS_DIMEN_SCALAR) {
-                    BINARY_OP(IMAGE,SCALAR,out,psType1,op,psType2);                // image op scalar
-                } else
-                    if(dim2==PS_DIMEN_VECTOR || dim2==PS_DIMEN_TRANSV) {
-                        BINARY_OP(IMAGE,VECTOR,out,psType1,op,psType2);                // image op vector
-                    } else
-                        if(dim2 == PS_DIMEN_IMAGE) {
-                            BINARY_OP(IMAGE,IMAGE,out,psType1,op,psType2);                 // image op image
-                        } else {
-                            psError(__func__, ": Line %d - Invalid dimensionality for in2 arg: %d", __LINE__, dim2);
-                        }
-            } else {
-                psError(__func__, ": Line %d - Invalid dimensionality for in1 arg: %d", __LINE__, dim1);
-            }
+    } else if (dim2 == PS_DIMEN_IMAGE) {
+        if (((psImage *) in2)->numCols == 0 || ((psImage *) in2)->numRows == 0) {
+            psError(__func__, ": Line %d - Image contains zero length row or cols");
+        }
+    }
+
+    if (dim1 == PS_DIMEN_SCALAR) {
+        if (dim2 == PS_DIMEN_SCALAR) {
+            BINARY_OP(SCALAR, SCALAR, out, psType1, op, psType2);       // scalar op scalar
+        } else if (dim2 == PS_DIMEN_VECTOR || dim2 == PS_DIMEN_TRANSV) {
+            BINARY_OP(SCALAR, VECTOR, out, psType1, op, psType2);       // scalar op vector
+        } else if (dim2 == PS_DIMEN_IMAGE) {
+            BINARY_OP(SCALAR, IMAGE, out, psType1, op, psType2);        // scalar op image
+        } else {
+            psError(__func__, ": Line %d - Invalid dimensionality for in2 arg: %d", __LINE__, dim2);
+        }
+    } else if (dim1 == PS_DIMEN_VECTOR || dim1 == PS_DIMEN_TRANSV) {
+        if (dim2 == PS_DIMEN_SCALAR) {
+            BINARY_OP(VECTOR, SCALAR, out, psType1, op, psType2);       // vector op scalar
+        } else if (dim2 == PS_DIMEN_VECTOR || dim2 == PS_DIMEN_TRANSV) {
+            BINARY_OP(VECTOR, VECTOR, out, psType1, op, psType2);       // vector op vector
+        } else if (dim2 == PS_DIMEN_IMAGE) {
+            BINARY_OP(VECTOR, IMAGE, out, psType1, op, psType2);        // vector op image
+        } else {
+            psError(__func__, ": Line %d - Invalid dimensionality for in2 arg: %d", __LINE__, dim2);
+        }
+    } else if (dim1 == PS_DIMEN_IMAGE) {
+        if (dim2 == PS_DIMEN_SCALAR) {
+            BINARY_OP(IMAGE, SCALAR, out, psType1, op, psType2);        // image op scalar
+        } else if (dim2 == PS_DIMEN_VECTOR || dim2 == PS_DIMEN_TRANSV) {
+            BINARY_OP(IMAGE, VECTOR, out, psType1, op, psType2);        // image op vector
+        } else if (dim2 == PS_DIMEN_IMAGE) {
+            BINARY_OP(IMAGE, IMAGE, out, psType1, op, psType2); // image op image
+        } else {
+            psError(__func__, ": Line %d - Invalid dimensionality for in2 arg: %d", __LINE__, dim2);
+        }
+    } else {
+        psError(__func__, ": Line %d - Invalid dimensionality for in1 arg: %d", __LINE__, dim1);
+    }
 
     return out;
@@ -567,5 +571,4 @@
     }                                                                                                        \
 }
-
 
 // Preprocessor macro function to create arithmetic function based on input type
@@ -596,5 +599,4 @@
 }
 
-
 // Preprocessor macro function to create arithmetic function operation name
 #define UNARY_OP(DIM,OUT,IN,OP)                                                                              \
@@ -714,17 +716,17 @@
     psType *psTypeOut = NULL;
 
-    psTypeOut = (psType*)out;
-    if(psTypeOut == NULL) {
+    psTypeOut = (psType *) out;
+    if (psTypeOut == NULL) {
         psError(__func__, ": Line %d - Null out argument", __LINE__);
         return out;
     }
 
-    psTypeIn = (psType*)in;
-    if(psTypeIn == NULL) {
+    psTypeIn = (psType *) in;
+    if (psTypeIn == NULL) {
         psError(__func__, ": Line %d - Null in argument", __LINE__);
         return out;
     }
 
-    if(op == NULL) {
+    if (op == NULL) {
         psError(__func__, ": Line %d - Null op argument", __LINE__);
         return out;
@@ -736,5 +738,5 @@
     elTypeOut = psTypeOut->type;
 
-    if(elTypeIn!=elTypeOut) {
+    if (elTypeIn != elTypeOut) {
         psError(__func__, ": Line %d - Element types for arguments inconsistent: (%d, %d)", __LINE__,
                 elTypeIn, elTypeOut);
@@ -742,5 +744,5 @@
     }
 
-    if(dimIn!=dimOut) {
+    if (dimIn != dimOut) {
         psError(__func__, ": Line %d - Dimensionality for arguments inconsistent: (%d, %d)", __LINE__,
                 dimIn, dimOut);
@@ -748,5 +750,5 @@
     }
 
-    if(dimIn==PS_DIMEN_OTHER || dimOut==PS_DIMEN_OTHER) {
+    if (dimIn == PS_DIMEN_OTHER || dimOut == PS_DIMEN_OTHER) {
         psError(__func__, ": Line %d - PS_DIMEN_OTHER not allowed for arguments: (%d, %d)", __LINE__,
                 dimIn, dimOut);
@@ -754,37 +756,33 @@
     }
 
-    if(dimIn == PS_DIMEN_VECTOR) {
-        if(((psVector*)in)->n == 0) {
+    if (dimIn == PS_DIMEN_VECTOR) {
+        if (((psVector *) in)->n == 0) {
             psError(__func__, ": Line %d - Vector contains zero elements");
         }
-    } else
-        if(dimIn == PS_DIMEN_IMAGE) {
-            if(((psImage*)in)->numCols==0 || ((psImage*)in)->numRows==0) {
-                psError(__func__, ": Line %d - Image contains zero length row or cols");
-            }
-        }
-
-    if(dimOut == PS_DIMEN_VECTOR) {
-        if(((psVector*)out)->n == 0) {
+    } else if (dimIn == PS_DIMEN_IMAGE) {
+        if (((psImage *) in)->numCols == 0 || ((psImage *) in)->numRows == 0) {
+            psError(__func__, ": Line %d - Image contains zero length row or cols");
+        }
+    }
+
+    if (dimOut == PS_DIMEN_VECTOR) {
+        if (((psVector *) out)->n == 0) {
             psError(__func__, ": Line %d - Vector contains zero elements");
         }
-    } else
-        if(dimOut == PS_DIMEN_IMAGE) {
-            if(((psImage*)out)->numCols==0 || ((psImage*)out)->numRows==0) {
-                psError(__func__, ": Line %d - Image contains zero length row or cols");
-            }
-        }
-
-    if(dimIn == PS_DIMEN_SCALAR) {
-        UNARY_OP(SCALAR,out,psTypeIn,op);                                 // scalar
-    } else
-        if(dimIn==PS_DIMEN_VECTOR || dimIn==PS_DIMEN_TRANSV) {
-            UNARY_OP(VECTOR,out,psTypeIn,op);                                 // vector
-        } else
-            if(dimIn == PS_DIMEN_IMAGE) {
-                UNARY_OP(IMAGE,out,psTypeIn,op);                                  // image
-            } else {
-                psError(__func__, ": Line %d - Invalid dimensionality for in arg: %d", __LINE__, dimIn);
-            }
+    } else if (dimOut == PS_DIMEN_IMAGE) {
+        if (((psImage *) out)->numCols == 0 || ((psImage *) out)->numRows == 0) {
+            psError(__func__, ": Line %d - Image contains zero length row or cols");
+        }
+    }
+
+    if (dimIn == PS_DIMEN_SCALAR) {
+        UNARY_OP(SCALAR, out, psTypeIn, op);    // scalar
+    } else if (dimIn == PS_DIMEN_VECTOR || dimIn == PS_DIMEN_TRANSV) {
+        UNARY_OP(VECTOR, out, psTypeIn, op);    // vector
+    } else if (dimIn == PS_DIMEN_IMAGE) {
+        UNARY_OP(IMAGE, out, psTypeIn, op);     // image
+    } else {
+        psError(__func__, ": Line %d - Invalid dimensionality for in arg: %d", __LINE__, dimIn);
+    }
 
     return out;
Index: /trunk/psLib/src/dataManip/psMatrixVectorArithmetic.h
===================================================================
--- /trunk/psLib/src/dataManip/psMatrixVectorArithmetic.h	(revision 1406)
+++ /trunk/psLib/src/dataManip/psMatrixVectorArithmetic.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psMatrixVectorArithmetic.h
  *
@@ -29,6 +30,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-18 00:54:43 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -36,5 +37,5 @@
 
 #ifndef PSMATRIX_VECTOR_ARITHMETIC_H
-#define PSMATRIX_VECTOR_ARITHMETIC_H
+#    define PSMATRIX_VECTOR_ARITHMETIC_H
 
 /// @addtogroup MatrixVectorArithmetic
@@ -54,10 +55,9 @@
  *  @return  psType*: Pointer to either psImage or psVector.
  */
-psType *psBinaryOp(
-    void *out,  /// Output type, either psImage or psVector.
-    void *in1,  /// First input, either psImage or psVector.
-    char *op,   /// Operator.
-    void *in2   /// Second input, either psImage or psVector.
-);
+psType *psBinaryOp(void *out,   // / Output type, either psImage or psVector.
+                   void *in1,   // / First input, either psImage or psVector.
+                   char *op,    // / Operator.
+                   void *in2    // / Second input, either psImage or psVector.
+                  );
 
 /** Perform simple unary arithmetic with images or vectors
@@ -77,9 +77,8 @@
  *  @return  psType*: Pointer to either psImage or psVector.
  */
-psType *psUnaryOp(
-    void *out,  /// Output type, either psImage or psVector.
-    void *in,   /// Input, either psImage or psVector.
-    char *op    /// Operator.
-);
+psType *psUnaryOp(void *out,    // / Output type, either psImage or psVector.
+                  void *in,     // / Input, either psImage or psVector.
+                  char *op      // / Operator.
+                 );
 
 /// @}
Index: /trunk/psLib/src/dataManip/psMinimize.c
===================================================================
--- /trunk/psLib/src/dataManip/psMinimize.c	(revision 1406)
+++ /trunk/psLib/src/dataManip/psMinimize.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psMinimize.c
  *  \brief basic minimization functions
@@ -9,11 +10,14 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
-/*****************************************************************************/
+
+/*****************************************************************************/
+
 /* INCLUDE FILES                                                             */
+
 /*****************************************************************************/
 #include <stdlib.h>
@@ -40,6 +44,9 @@
 #include "psMinimize.h"
 #include "psMatrix.h"
-/*****************************************************************************/
+
+/*****************************************************************************/
+
 /* DEFINE STATEMENTS                                                         */
+
 /*****************************************************************************/
 #define MAX_LMM_ITERATIONS 100
@@ -83,16 +90,17 @@
 }
 
-
-/*****************************************************************************/
+/*****************************************************************************/
+
 /* TYPE DEFINITIONS                                                          */
+
 /*****************************************************************************/
 typedef struct
 {
-    size_t n;   // Number of data points points in domain.
-    int paramCount;   // Number of non-masked parameters.
-    psVector *restrict       initialGuess;
-    const psImage *restrict  domain;
+    size_t n;                   // Number of data points points in domain.
+    int paramCount;             // Number of non-masked parameters.
+    psVector *restrict initialGuess;
+    const psImage *restrict domain;
     const psVector *restrict data;
-    const psVector *restrict  errors;
+    const psVector *restrict errors;
     const psVector *restrict paramMask;
     float (*evalModel) (const psVector *, const psVector *);
@@ -103,7 +111,7 @@
 typedef struct
 {
-    int paramCount;   // Number of non-masked parameters.
-    psVector *restrict       initialGuess;
-    const psVector *restrict  coord;
+    int paramCount;             // Number of non-masked parameters.
+    psVector *restrict initialGuess;
+    const psVector *restrict coord;
     const psVector *restrict paramMask;
     float (*evalModel) (const psVector *, const psVector *);
@@ -113,5 +121,7 @@
 
 /*****************************************************************************/
+
 /* GLOBAL VARIABLES                                                          */
+
 /*****************************************************************************/
 
@@ -119,5 +129,7 @@
 
 /*****************************************************************************/
+
 /* FILE STATIC VARIABLES                                                     */
+
 /*****************************************************************************/
 
@@ -125,5 +137,7 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - LOCAL                                           */
+
 /*****************************************************************************/
 
@@ -143,15 +157,13 @@
  guess at the parameters, an option parameter mask, etc.
  *****************************************************************************/
-double p_psMinFunc(const gsl_vector *params,
-                   void *funcData)
-{
-    int i;    // Loop index variable.
-    int j;    // Loop index variable.
-    float tmpf;    // Temporary floating point variable.
-    const psVector *restrict coord   = ((psMinimizeData *) funcData)->coord;
-    const psVector *restrict mask     = ((psMinimizeData *) funcData)->paramMask;
-    psVector *restrict initialGuess = ((psMinimizeData *)funcData)->initialGuess;
-    float (*evalModel)(const psVector *, const psVector *) =
-        ((psMinimizeData *) funcData)->evalModel;
+double p_psMinFunc(const gsl_vector * params, void *funcData)
+{
+    int i;                      // Loop index variable.
+    int j;                      // Loop index variable.
+    float tmpf;                 // Temporary floating point variable.
+    const psVector *restrict coord = ((psMinimizeData *) funcData)->coord;
+    const psVector *restrict mask = ((psMinimizeData *) funcData)->paramMask;
+    psVector *restrict initialGuess = ((psMinimizeData *) funcData)->initialGuess;
+    float (*evalModel) (const psVector *, const psVector *) = ((psMinimizeData *) funcData)->evalModel;
     psVector *inputParameterList = NULL;
 
@@ -163,5 +175,5 @@
     if (mask != NULL) {
         j = 0;
-        for (i=0;i<mask->n;i++) {
+        for (i = 0; i < mask->n; i++) {
             if (mask->data.U8[i] != 0) {
                 inputParameterList->data.F32[i] = initialGuess->data.F32[i];
@@ -171,5 +183,5 @@
         }
     } else {
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             inputParameterList->data.F32[i] = gsl_vector_get(params, i);
         }
@@ -181,5 +193,5 @@
     // Free allocated memory and return the value of the function.
     psFree(inputParameterList);
-    return(tmpf);
+    return (tmpf);
 }
 
@@ -199,15 +211,13 @@
  in "params" and return those derivatives in this psVector.
  *****************************************************************************/
-void p_psMinFuncDeriv(const gsl_vector *params,
-                      void *funcData,
-                      gsl_vector *df)
-{
-    int i;    // Loop index variable.
-    int j;    // Loop index variable.
-    float tmpf;    // Temporary floating point variable.
-    const psVector *restrict coord   = ((psMinimizeData *) funcData)->coord;
-    const psVector *restrict mask     = ((psMinimizeData *) funcData)->paramMask;
-    psVector *restrict initialGuess = ((psMinimizeData *)funcData)->initialGuess;
-    float (*d_evalModel)(const psVector *, const psVector *, int) =
+void p_psMinFuncDeriv(const gsl_vector * params, void *funcData, gsl_vector * df)
+{
+    int i;                      // Loop index variable.
+    int j;                      // Loop index variable.
+    float tmpf;                 // Temporary floating point variable.
+    const psVector *restrict coord = ((psMinimizeData *) funcData)->coord;
+    const psVector *restrict mask = ((psMinimizeData *) funcData)->paramMask;
+    psVector *restrict initialGuess = ((psMinimizeData *) funcData)->initialGuess;
+    float (*d_evalModel) (const psVector *, const psVector *, int) =
         ((psMinimizeData *) funcData)->d_evalModel;
     psVector *inputParameterList = NULL;
@@ -220,5 +230,5 @@
     if (mask != NULL) {
         j = 0;
-        for (i=0;i<mask->n;i++) {
+        for (i = 0; i < mask->n; i++) {
             if (mask->data.U8[i] != 0) {
                 inputParameterList->data.F32[i] = initialGuess->data.F32[i];
@@ -228,5 +238,5 @@
         }
     } else {
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             inputParameterList->data.F32[i] = gsl_vector_get(params, i);
         }
@@ -235,5 +245,5 @@
     // Evaluate the derivative w.r.t. each parameter.
     // NOTE: we can probably remove the calls for masked parameters.
-    for (i=0;i<initialGuess->n;i++) {
+    for (i = 0; i < initialGuess->n; i++) {
         tmpf = d_evalModel(inputParameterList, coord, i);
         gsl_vector_set(df, i, tmpf);
@@ -247,8 +257,5 @@
     Compute both p_psMinFunc and p_psMinFuncDeriv together.
  *****************************************************************************/
-void p_psMinFuncFuncDeriv(const gsl_vector *params,
-                          void *funcData,
-                          double *f,
-                          gsl_vector *df)
+void p_psMinFuncFuncDeriv(const gsl_vector * params, void *funcData, double *f, gsl_vector * df)
 {
     *f = p_psMinFunc(params, funcData);
@@ -281,17 +288,15 @@
   expected value and divide by the error.
  *****************************************************************************/
-int p_psMinChi2Func(const gsl_vector *params,
-                    void *funcData,
-                    gsl_vector *outData)
-{
-    int i;    // Loop index variable.
-    int j;    // Loop index variable.
-    float tmpf;    // Temporary floating point variable.
-    const psImage *restrict  domain   = ((psMinChi2Data *)funcData)->domain;
-    const psVector *restrict data     = ((psMinChi2Data *)funcData)->data;
-    const psVector *restrict errors   = ((psMinChi2Data *) funcData)->errors;
-    const psVector *restrict mask     = ((psMinChi2Data *) funcData)->paramMask;
-    psVector *restrict initialGuess = ((psMinChi2Data *)funcData)->initialGuess;
-    float (*evalModel)(const psVector *, const psVector *) = ((psMinChi2Data *) funcData)->evalModel;
+int p_psMinChi2Func(const gsl_vector * params, void *funcData, gsl_vector * outData)
+{
+    int i;                      // Loop index variable.
+    int j;                      // Loop index variable.
+    float tmpf;                 // Temporary floating point variable.
+    const psImage *restrict domain = ((psMinChi2Data *) funcData)->domain;
+    const psVector *restrict data = ((psMinChi2Data *) funcData)->data;
+    const psVector *restrict errors = ((psMinChi2Data *) funcData)->errors;
+    const psVector *restrict mask = ((psMinChi2Data *) funcData)->paramMask;
+    psVector *restrict initialGuess = ((psMinChi2Data *) funcData)->initialGuess;
+    float (*evalModel) (const psVector *, const psVector *) = ((psMinChi2Data *) funcData)->evalModel;
     psVector *inputParameterList = NULL;
     psVector *tmpVecPtr = NULL;
@@ -307,5 +312,5 @@
     if (mask != NULL) {
         j = 0;
-        for (i=0;i<mask->n;i++) {
+        for (i = 0; i < mask->n; i++) {
             if (mask->data.U8[i] != 0) {
                 inputParameterList->data.F32[i] = initialGuess->data.F32[i];
@@ -315,5 +320,5 @@
         }
     } else {
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             inputParameterList->data.F32[i] = gsl_vector_get(params, i);
         }
@@ -321,12 +326,11 @@
 
     // Evaluate the function at each data point.
-    for (i=0;i<domain->numRows;i++) {
-        for (j=0;j<domain->numCols;j++) {
+    for (i = 0; i < domain->numRows; i++) {
+        for (j = 0; j < domain->numCols; j++) {
             tmpVecPtr->data.F32[j] = domain->data.F32[i][j];
         }
         tmpf = evalModel(tmpVecPtr, inputParameterList);
 
-        gsl_vector_set(outData, i, (tmpf - data->data.F32[i])/
-                       errors->data.F32[i]);
+        gsl_vector_set(outData, i, (tmpf - data->data.F32[i]) / errors->data.F32[i]);
     }
 
@@ -354,15 +358,14 @@
  and returned in this data structure.
  *****************************************************************************/
-int p_psMinChi2FuncDeriv(const gsl_vector *params,
-                         void *funcData,
-                         gsl_matrix *J)
-{
-    const psImage *restrict domain   = ((psMinChi2Data *)funcData)->domain;
-    const psVector *restrict errors   = ((psMinChi2Data *) funcData)->errors;
-    const psVector *restrict mask     = ((psMinChi2Data *) funcData)->paramMask;
-    psVector *restrict initialGuess = ((psMinChi2Data *)funcData)->initialGuess;
+int p_psMinChi2FuncDeriv(const gsl_vector * params, void *funcData, gsl_matrix * J)
+{
+    const psImage *restrict domain = ((psMinChi2Data *) funcData)->domain;
+    const psVector *restrict errors = ((psMinChi2Data *) funcData)->errors;
+    const psVector *restrict mask = ((psMinChi2Data *) funcData)->paramMask;
+    psVector *restrict initialGuess = ((psMinChi2Data *) funcData)->initialGuess;
     psVector *inputParameterList = NULL;
     psVector *tmpVecPtr = NULL;
-    float (*d_evalModel)(const psVector *, const psVector *, int) = ((psMinChi2Data *) funcData)->d_evalModel;
+    float (*d_evalModel) (const psVector *, const psVector *, int) =
+        ((psMinChi2Data *) funcData)->d_evalModel;
 
     size_t i;
@@ -380,5 +383,5 @@
     if (mask != NULL) {
         j = 0;
-        for (i=0;i<mask->n;i++) {
+        for (i = 0; i < mask->n; i++) {
             if (mask->data.U8[i] != 0) {
                 inputParameterList->data.F32[i] = initialGuess->data.F32[i];
@@ -388,5 +391,5 @@
         }
     } else {
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             inputParameterList->data.F32[i] = gsl_vector_get(params, i);
         }
@@ -394,12 +397,12 @@
 
     // Evaluate the derivtaive at each data point, and w.r.t. each parameter.
-    for (i=0;i<domain->numRows;i++) {
-        for (j=0;j<tmpVecPtr->n;j++) {
+    for (i = 0; i < domain->numRows; i++) {
+        for (j = 0; j < tmpVecPtr->n; j++) {
             tmpVecPtr->data.F32[j] = domain->data.F32[i][j];
         }
 
-        for (j=0;j<inputParameterList->n;j++) {
+        for (j = 0; j < inputParameterList->n; j++) {
             tmpf = d_evalModel(tmpVecPtr, inputParameterList, j);
-            gsl_matrix_set(J, i, j, (tmpf/errors->data.F32[i]));
+            gsl_matrix_set(J, i, j, (tmpf / errors->data.F32[i]));
         }
     }
@@ -410,9 +413,5 @@
 }
 
-
-int p_psMinChi2FuncFuncDeriv(const gsl_vector *params,
-                             void *funcData,
-                             gsl_vector *f,
-                             gsl_matrix *J)
+int p_psMinChi2FuncFuncDeriv(const gsl_vector * params, void *funcData, gsl_vector * f, gsl_matrix * J)
 {
     p_psMinChi2Func(params, funcData, f);
@@ -421,5 +420,4 @@
     return GSL_SUCCESS;
 }
-
 
 /******************************************************************************
@@ -428,18 +426,15 @@
 returned as a psVector sums.
  *****************************************************************************/
-void p_psBuildSums1D(double x,
-                     int polyOrder,
-                     psVector *sums)
-{
-    int       i = 0;
-    double    xSum = 0.0;
+void p_psBuildSums1D(double x, int polyOrder, psVector * sums)
+{
+    int i = 0;
+    double xSum = 0.0;
 
     xSum = 1.0;
-    for(i=0;i<=polyOrder;i++) {
+    for (i = 0; i <= polyOrder; i++) {
         sums->data.F64[i] = xSum;
-        xSum*= x;
-    }
-}
-
+        xSum *= x;
+    }
+}
 
 /******************************************************************************
@@ -448,17 +443,15 @@
  *****************************************************************************/
 psVector *psBuildImageScalingFactors(int x)
-
 {
     int i = 0;                  // loop index variable.
     psVector *imageScalingFactors = NULL;
 
-
     imageScalingFactors = psVectorAlloc(x, PS_TYPE_F32);
 
-    for (i=0;i<x;i++) {
-        imageScalingFactors->data.F32[i] = (((float) 2*i) / ((float) x)) - 1.0;
-    }
-
-    return(imageScalingFactors);
+    for (i = 0; i < x; i++) {
+        imageScalingFactors->data.F32[i] = (((float)2 * i) / ((float)x)) - 1.0;
+    }
+
+    return (imageScalingFactors);
 }
 
@@ -481,41 +474,39 @@
     *flag   Set this to 1 if we must recalculate the coefficients.
  *****************************************************************************/
-void p_psPolyOrderCheck(float **A,
-                        int N,
-                        int *indx,
-                        float *B,
-                        int polyOrder,
-                        int *flag)
-{
-    float     **y = NULL;  // This 2-D matrix will hold A^-1
-    float      *col = NULL;             // misc NumerRecipes data structure
-    float      *error=NULL;             // will hold the sqrt() of the
+void p_psPolyOrderCheck(float **A, int N, int *indx, float *B, int polyOrder, int *flag)
+{
+    float **y = NULL;           // This 2-D matrix will hold A^-1
+    float *col = NULL;          // misc NumerRecipes data structure
+    float *error = NULL;        // will hold the sqrt() of the
+
     // diagonal of y[][].
-    int         i=0;                    // loop-index variable
-    int         j=0;                    // loop-index variable
-    int         numPolyTerms = 0;       // The number of terms in the
+    int i = 0;                  // loop-index variable
+    int j = 0;                  // loop-index variable
+    int numPolyTerms = 0;       // The number of terms in the
+
     // polynomial.
-    int         lastTerm = 0;           // The index location of the first
+    int lastTerm = 0;           // The index location of the first
+
     // n-th order term in array B[].
-    int         firstTerm = 0;          // Index location of last such term.
+    int firstTerm = 0;          // Index location of last such term.
 
     // Allocate the necessary data structures for this procedure...
-    error = (float *) psAlloc((N + 1) * sizeof(float));
-    col = (float *) psAlloc((N + 1) * sizeof(float));
-    y = (float **) psAlloc((N + 1) * sizeof(float *));
-    for(i=1;i<=N;i++) {
-        y[i] = (float *) psAlloc((N + 1) * sizeof(float));
+    error = (float *)psAlloc((N + 1) * sizeof(float));
+    col = (float *)psAlloc((N + 1) * sizeof(float));
+    y = (float **)psAlloc((N + 1) * sizeof(float *));
+    for (i = 1; i <= N; i++) {
+        y[i] = (float *)psAlloc((N + 1) * sizeof(float));
     }
 
     // Invert the matrix A and put the result in y[][].  This code is taken
     // from Numerical Recipes in C page 48.
-    for(j=1;j<=N;j++) {
-        for(i=1;i<=N;i++) {
+    for (j = 1; j <= N; j++) {
+        for (i = 1; i <= N; i++) {
             col[i] = 0.0;
         }
         col[j] = 1.0;
         // NOTE: substitue the LUD rotine
-        //        lubksb(A, N, indx, col);
-        for(i=1;i<=N;i++) {
+        // lubksb(A, N, indx, col);
+        for (i = 1; i <= N; i++) {
             y[i][j] = col[i];
         }
@@ -527,9 +518,9 @@
     // terms and check if they are consistent with zero.
 
-    numPolyTerms = (((polyOrder+1) * (polyOrder + 2)) / 2);
+    numPolyTerms = (((polyOrder + 1) * (polyOrder + 2)) / 2);
     lastTerm = numPolyTerms + 1;
     firstTerm = lastTerm - polyOrder;
     *flag = 1;
-    for (i=firstTerm; i<=lastTerm; i++) {
+    for (i = firstTerm; i <= lastTerm; i++) {
         #ifdef DARWIN
         error[i] = (float)sqrt(y[i][i]);
@@ -539,6 +530,5 @@
         #endif
 
-        if (!((B[i]  <= (2.0f * error[i])) &&
-                ((-2.0f * error[i]) <= B[i]))) {
+        if (!((B[i] <= (2.0f * error[i])) && ((-2.0f * error[i]) <= B[i]))) {
             *flag = 0;
         }
@@ -548,5 +538,5 @@
     psFree(error);
     psFree(col);
-    for(j=1;j<=N;j++) {
+    for (j = 1; j <= N; j++) {
         psFree(y[j]);
     }
@@ -554,12 +544,9 @@
 }
 
-
-
-
-/*****************************************************************************/
+/*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
-/*****************************************************************************/
-
-
+
+/*****************************************************************************/
 
 /******************************************************************************
@@ -569,10 +556,8 @@
 parameters of that function such that the ...
  *****************************************************************************/
-psVector *
-psMinimize(psVector *restrict initialGuess,
-           float (*myFunction)(const psVector *restrict, const psVector *restrict),
-           float (*myFunctionDeriv)(const psVector *restrict, const psVector *restrict, int),
-           const psVector *restrict coord,
-           const psVector *restrict paramMask)
+psVector *psMinimize(psVector * restrict initialGuess,
+                     float (*myFunction) (const psVector * restrict, const psVector * restrict),
+                     float (*myFunctionDeriv) (const psVector * restrict, const psVector * restrict, int),
+                     const psVector * restrict coord, const psVector * restrict paramMask)
 {
     int status;
@@ -607,5 +592,5 @@
     // for the parameters.
     if (paramMask != NULL) {
-        for (i=0;i<paramMask->n;i++) {
+        for (i = 0; i < paramMask->n; i++) {
             if (paramMask->data.U8[i] != 0) {
                 inputData.paramCount++;
@@ -613,5 +598,5 @@
         }
     } else {
-        inputData.paramCount= initialGuess->n;
+        inputData.paramCount = initialGuess->n;
     }
 
@@ -622,5 +607,5 @@
     if (paramMask != NULL) {
         j = 0;
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             if (paramMask->data.U8[i] == 0) {
                 gsl_vector_set(x, j++, initialGuess->data.F32[i]);
@@ -628,5 +613,5 @@
         }
     } else {
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             gsl_vector_set(x, i, initialGuess->data.F32[i]);
         }
@@ -651,5 +636,5 @@
 
         if (status == GSL_SUCCESS)
-            printf ("Minimum found at:\n");
+            printf("Minimum found at:\n");
 
     } while (status == GSL_CONTINUE && iter < MAX_MINIMIZE_ITERATIONS);
@@ -660,5 +645,5 @@
     if (paramMask != NULL) {
         j = 0;
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             if (paramMask->data.U8[i] == 0) {
                 initialGuess->data.F32[i] = gsl_vector_get(s->x, j++);
@@ -668,15 +653,10 @@
         }
     } else {
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             initialGuess->data.F32[i] = gsl_vector_get(s->x, i);
         }
     }
-    return(initialGuess);
-}
-
-
-
-
-
+    return (initialGuess);
+}
 
 /******************************************************************************
@@ -684,28 +664,28 @@
     such that they best fit the supplied data points.
  *****************************************************************************/
-psVector *
-psMinimizeChi2(float (*evalModel)(const psVector *restrict, const psVector *restrict),
-               float (*DevalModel)(const psVector *restrict, const psVector *restrict, int),
-               const psImage *restrict domain,
-               const psVector *restrict data,
-               const psVector *restrict errors,
-               psVector *restrict initialGuess,
-               const psVector *restrict paramMask,
-               float *chiSq)
-{
-    int numData = domain->numRows; // Number of data points
-    int status;    // Return status for the GSL solver.
-    int i = 0;    // Loop index variable.
-    int j = 0;    // Loop index variable.
-    int iter = 0;   // Iteration counter.
-    gsl_multifit_function_fdf f; // GSL structure that contains the
+psVector *psMinimizeChi2(float (*evalModel) (const psVector * restrict, const psVector * restrict),
+                         float (*DevalModel) (const psVector * restrict, const psVector * restrict, int),
+                         const psImage * restrict domain,
+                         const psVector * restrict data,
+                         const psVector * restrict errors,
+                         psVector * restrict initialGuess, const psVector * restrict paramMask, float *chiSq)
+{
+    int numData = domain->numRows;      // Number of data points
+    int status;                 // Return status for the GSL solver.
+    int i = 0;                  // Loop index variable.
+    int j = 0;                  // Loop index variable.
+    int iter = 0;               // Iteration counter.
+    gsl_multifit_function_fdf f;        // GSL structure that contains the
+
     // functions/derivative to be solved.
-    double *xInit = NULL;        // The initial guess at the parameters
+    double *xInit = NULL;       // The initial guess at the parameters
+
     // with masked parameters removed.
     const gsl_multifit_fdfsolver_type *T;
+
     // This tells GSL to use the Levenberg-
     // Marquardt algorithm for chi2
     // minimization.
-    gsl_multifit_fdfsolver *s; // GSL data structure.
+    gsl_multifit_fdfsolver *s;  // GSL data structure.
     psMinChi2Data inputData;
     float chiSqOld = 0.0;
@@ -721,5 +701,5 @@
     PS_CHECK_VECTOR_SIZE_EQUAL(data, errors);
     if (domain->numRows != data->n) {
-        psAbort(__func__,"Number of data points and data values not equal.");
+        psAbort(__func__, "Number of data points and data values not equal.");
     }
     if (paramMask != NULL) {
@@ -743,5 +723,5 @@
     // for the parameters.
     if (paramMask != NULL) {
-        for (i=0;i<paramMask->n;i++) {
+        for (i = 0; i < paramMask->n; i++) {
             if (paramMask->data.U8[i] != 0) {
                 inputData.paramCount++;
@@ -749,5 +729,5 @@
         }
     } else {
-        inputData.paramCount= initialGuess->n;
+        inputData.paramCount = initialGuess->n;
     }
 
@@ -755,8 +735,8 @@
     // the vector inputParameterList.  If the paramMask is not NULL, then those
     // parameters are masked out.
-    xInit = (double *) psAlloc(inputData.paramCount * sizeof(double));
+    xInit = (double *)psAlloc(inputData.paramCount * sizeof(double));
     if (paramMask != NULL) {
         j = 0;
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             if (paramMask->data.U8[i] == 0) {
                 xInit[j++] = initialGuess->data.F32[i];
@@ -764,5 +744,5 @@
         }
     } else {
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             xInit[i] = initialGuess->data.F32[i];
         }
@@ -771,4 +751,5 @@
     const gsl_rng_type *type;
     gsl_rng *r;
+
     gsl_rng_env_setup();
 
@@ -789,4 +770,5 @@
 
     gsl_vector_view x = gsl_vector_view_array(xInit, inputData.paramCount);
+
     T = gsl_multifit_fdfsolver_lmsder;
     s = gsl_multifit_fdfsolver_alloc(T, numData, inputData.paramCount);
@@ -796,5 +778,5 @@
     do {
         iter++;
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             printf("Iteration %d: parameter %d is %.3f\n", iter, i, gsl_vector_get(s->x, i));
         }
@@ -802,5 +784,5 @@
         status = gsl_multifit_fdfsolver_iterate(s);
         printf("gsl_multifit_fdfsolver_iterate() status is %s\n", gsl_strerror(status));
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             printf("Iteration %d: parameter %d is %.3f\n", iter, i, gsl_vector_get(s->x, i));
         }
@@ -810,9 +792,8 @@
             psAbort(__func__, "gsl_multifit_fdfsolver_iterate(%s)\n", gsl_strerror(status));
         }
-
         // Test if the parameters changed by a small enough amount.
         // NOTE: This wasn't working right when the parameters fit exactly.
         // Figure out why.
-        //        status = gsl_multifit_test_delta(s->dx, s->x, 1e-4, 1e-4);
+        // status = gsl_multifit_test_delta(s->dx, s->x, 1e-4, 1e-4);
 
         // We test for convergence if chiSquared changes by less than 1.0
@@ -829,5 +810,4 @@
     } while (status == GSL_CONTINUE && iter < MAX_LMM_ITERATIONS);
 
-
     // In the above steps we had removed the masked elements from the
     // the solver.  This next code blocks puts those masked elements
@@ -835,5 +815,5 @@
     if (paramMask != NULL) {
         j = 0;
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             if (paramMask->data.U8[i] == 0) {
                 initialGuess->data.F32[i] = gsl_vector_get(s->x, j++);
@@ -843,5 +823,5 @@
         }
     } else {
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             initialGuess->data.F32[i] = gsl_vector_get(s->x, i);
         }
@@ -857,7 +837,6 @@
 
     // Bye bye.
-    return(initialGuess);
-}
-
+    return (initialGuess);
+}
 
 /******************************************************************************
@@ -868,9 +847,7 @@
 NOTE: yErr is currently ignored.
  *****************************************************************************/
-psPolynomial1D *
-psVectorFitPolynomial1D(psPolynomial1D *myPoly,
-                        const psVector *restrict x,
-                        const psVector *restrict y,
-                        const psVector *restrict yErr)
+psPolynomial1D *psVectorFitPolynomial1D(psPolynomial1D * myPoly,
+                                        const psVector * restrict x,
+                                        const psVector * restrict y, const psVector * restrict yErr)
 {
     int polyOrder = myPoly->n;
@@ -879,5 +856,5 @@
     psVector *B = NULL;
     psVector *outPerm = NULL;
-    psVector *X = NULL;   // NOTE: do we need this?
+    psVector *X = NULL;         // NOTE: do we need this?
     psVector *coeffs = NULL;
     int i = 0;
@@ -886,8 +863,8 @@
     psVector *xSums = NULL;
 
-    //    printf("psVectorFitPolynomial1D()\n");
-    //    for (i=0;i<x->n;i++) {
-    //        printf("(x, y, yErr) is (%f, %f, %f)\n", x->data.F64[i], y->data.F64[i], yErr->data.F64[i]);
-    //    }
+    // printf("psVectorFitPolynomial1D()\n");
+    // for (i=0;i<x->n;i++) {
+    // printf("(x, y, yErr) is (%f, %f, %f)\n", x->data.F64[i], y->data.F64[i], yErr->data.F64[i]);
+    // }
 
     PS_CHECK_NULL_1DPOLY(myPoly);
@@ -901,37 +878,37 @@
     PS_CHECK_VECTOR_SIZE_EQUAL(y, yErr);
 
-    A       = psImageAlloc(polyOrder, polyOrder, PS_TYPE_F64);
-    ALUD    = psImageAlloc(polyOrder, polyOrder, PS_TYPE_F64);
-    B       = psVectorAlloc(polyOrder, PS_TYPE_F64);
-    coeffs  = psVectorAlloc(polyOrder, PS_TYPE_F64);
-    X       = psVectorAlloc(x->n, PS_TYPE_F64);
+    A = psImageAlloc(polyOrder, polyOrder, PS_TYPE_F64);
+    ALUD = psImageAlloc(polyOrder, polyOrder, PS_TYPE_F64);
+    B = psVectorAlloc(polyOrder, PS_TYPE_F64);
+    coeffs = psVectorAlloc(polyOrder, PS_TYPE_F64);
+    X = psVectorAlloc(x->n, PS_TYPE_F64);
     outPerm = psVectorAlloc(polyOrder, PS_TYPE_F64);
-    xSums   = psVectorAlloc(1+2*polyOrder, PS_TYPE_F64);
+    xSums = psVectorAlloc(1 + 2 * polyOrder, PS_TYPE_F64);
 
     // Initialize data structures.
-    for(i=0;i<(polyOrder);i++) {
+    for (i = 0; i < (polyOrder); i++) {
         B->data.F64[i] = 0.0;
         coeffs->data.F64[i] = 0.0;
         outPerm->data.F64[i] = 0.0;
-        for(j=0;j<(polyOrder);j++) {
+        for (j = 0; j < (polyOrder); j++) {
             A->data.F64[i][j] = 0.0;
             ALUD->data.F64[i][j] = 0.0;
         }
     }
-    for (i=0;i<X->n;i++) {
+    for (i = 0; i < X->n; i++) {
         X->data.F64[i] = x->data.F64[i];
     }
 
     // Build the B and A data structs.
-    for (i=0;i<X->n;i++) {
-        p_psBuildSums1D(X->data.F64[i], 2*polyOrder, xSums);
-
-        for(k=0;k<(polyOrder);k++) {
-            B->data.F64[k]+= y->data.F64[i] * xSums->data.F64[k];
-        }
-
-        for(k=0;k<(polyOrder);k++) {
-            for(j=0;j<(polyOrder);j++) {
-                A->data.F64[k][j]+= xSums->data.F64[k+j];
+    for (i = 0; i < X->n; i++) {
+        p_psBuildSums1D(X->data.F64[i], 2 * polyOrder, xSums);
+
+        for (k = 0; k < (polyOrder); k++) {
+            B->data.F64[k] += y->data.F64[i] * xSums->data.F64[k];
+        }
+
+        for (k = 0; k < (polyOrder); k++) {
+            for (j = 0; j < (polyOrder); j++) {
+                A->data.F64[k][j] += xSums->data.F64[k + j];
             }
         }
@@ -941,13 +918,13 @@
     coeffs = psMatrixLUSolve(coeffs, ALUD, B, outPerm);
 
-    for(k=0;k<(polyOrder);k++) {
+    for (k = 0; k < (polyOrder); k++) {
         myPoly->coeff[k] = coeffs->data.F64[k];
-        //        printf("myPoly->coeff[%d] is %f\n", k, myPoly->coeff[k]);
-    }
-
-
-    //    for (i=0;i<x->n;i++) {
-    //        printf("HMMM: psEvalPolynomial1D(%f) is %f\n", x->data.F64[i], psEvalPolynomial1D(x->data.F64[i], myPoly));
-    //    }
+        // printf("myPoly->coeff[%d] is %f\n", k, myPoly->coeff[k]);
+    }
+
+    // for (i=0;i<x->n;i++) {
+    // printf("HMMM: psEvalPolynomial1D(%f) is %f\n", x->data.F64[i], psEvalPolynomial1D(x->data.F64[i],
+    // myPoly));
+    // }
 
     psFree(A);
@@ -959,4 +936,4 @@
     psFree(xSums);
 
-    return(myPoly);
-}
+    return (myPoly);
+}
Index: /trunk/psLib/src/dataManip/psMinimize.h
===================================================================
--- /trunk/psLib/src/dataManip/psMinimize.h	(revision 1406)
+++ /trunk/psLib/src/dataManip/psMinimize.h	(revision 1407)
@@ -1,6 +1,7 @@
 #if !defined(PS_MINIMIZE_H)
-#define PS_MINIMIZE_H
+#    define PS_MINIMIZE_H
 
-#include "psFunctions.h"
+#    include "psFunctions.h"
+
 /** \file psMinimize.h
  *  \brief minimization operations
@@ -9,4 +10,5 @@
 
 /** Functions **************************************************************/
+
 /** \addtogroup Stats
  *  \{
@@ -14,36 +16,44 @@
 
 /** This routine must minimize a non-linear function */
-psVector *
-psMinimize(psVector *restrict initialGuess,
-           float (*myFunction)(const psVector *restrict, const psVector *restrict),
-           float (*myFunctionDeriv)(const psVector *restrict, const psVector *restrict, int),
-           const psVector *restrict coord,
-           const psVector *restrict paramMask);
-
+psVector *psMinimize(psVector * restrict initialGuess,
+                     float (*myFunction) (const psVector * restrict, const psVector * restrict),
+                     float (*myFunctionDeriv) (const psVector * restrict, const psVector * restrict, int),
+                     const psVector * restrict coord, const psVector * restrict paramMask);
 
 /** Minimize chi^2 for input data */
-psVector *
-psMinimizeChi2(float (*evalModel)(const psVector *restrict,
-                                  const psVector *restrict), ///< Model to fit; (domain and params)
-               float (*DevalModel)(const psVector *restrict,
-                                   const psVector *restrict,
-                                   int), ///< Derivative of model to fit; (domain and params)
-               const psImage *restrict domain, ///< The domain values for the corresponding measurements
-               const psVector *restrict data, ///< Data to fit
-               const psVector *restrict errors, ///< Errors in the data
-               psVector *restrict initialGuess, ///< Initial guess
-               const psVector *restrict paramMask, ///< 1 = fit for parameter, 0 = hold parameter constant
-               float *chiSq
-              );
+psVector *psMinimizeChi2(float (*evalModel) (const psVector * restrict, const psVector * restrict),     // /<
+                         // Model
+                         // to
+                         // fit;
+                         // (domain
+                         // and
+                         // params)
+                         float (*DevalModel) (const psVector * restrict, const psVector * restrict, int),       // /<
+                         // Derivative
+                         // of
+                         // model
+                         // to
+                         // fit;
+                         // (domain
+                         // and
+                         // params)
+                         const psImage * restrict domain,       // /< The domain values for the corresponding
+                         // measurements
+                         const psVector * restrict data,        // /< Data to fit
+                         const psVector * restrict errors,      // /< Errors in the data
+                         psVector * restrict initialGuess,      // /< Initial guess
+                         const psVector * restrict paramMask,   // /< 1 = fit for parameter, 0 = hold
+                         // parameter constant
+                         float *chiSq);
 
 /** Derive a polynomial fit by chi^2 minimisation (analytically) */
-psPolynomial1D *
-psVectorFitPolynomial1D(psPolynomial1D *myPoly, ///< Polynomial to fit
-                        const psVector *restrict x, ///< Ordinates (or NULL to just use the indices)
-                        const psVector *restrict y, ///< Coordinates
-                        const psVector *restrict yErr ///< Errors in coordinates, or NULL
-                       );
+psPolynomial1D *psVectorFitPolynomial1D(psPolynomial1D * myPoly,        // /< Polynomial to fit
+                                        const psVector * restrict x,    // /< Ordinates (or NULL to just use
+                                        // the indices)
+                                        const psVector * restrict y,    // /< Coordinates
+                                        const psVector * restrict yErr  // /< Errors in coordinates, or NULL
+                                       );
 
-/* \} */ // End of MathGroup Functions
+/* \} */// End of MathGroup Functions
 
 #endif
Index: /trunk/psLib/src/dataManip/psStats.c
===================================================================
--- /trunk/psLib/src/dataManip/psStats.c	(revision 1406)
+++ /trunk/psLib/src/dataManip/psStats.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psStats.c
  *  \brief basic statistical operations
@@ -9,6 +10,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.51 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -21,6 +22,9 @@
 #include <float.h>
 #include <math.h>
+
 /*****************************************************************************/
+
 /* INCLUDE FILES                                                             */
+
 /*****************************************************************************/
 #include "psMemory.h"
@@ -35,8 +39,10 @@
 
 /*****************************************************************************/
+
 /* DEFINE STATEMENTS                                                         */
+
 /*****************************************************************************/
 // will use robust statistical methods.
-#define GAUSS_WIDTH 20                  // The width of the Gaussian or boxcar smoothing.
+#define GAUSS_WIDTH 20                     // The width of the Gaussian or boxcar smoothing.
 #define CLIPPED_NUM_ITER_LB 1
 #define CLIPPED_NUM_ITER_UB 10
@@ -48,8 +54,6 @@
 #define MAX_ITERATIONS 10
 
-void p_psVectorRobustStats( const psVector *restrict myVector,
-                            const psVector *restrict maskVector,
-                            unsigned int maskVal,
-                            psStats *stats );
+void p_psVectorRobustStats(const psVector * restrict myVector,
+                           const psVector * restrict maskVector, unsigned int maskVal, psStats * stats);
 
 /** Preprocessor macro to generate error on an incorrect type */
@@ -83,10 +87,15 @@
 printf("\n"); \
 
+
 /*****************************************************************************/
+
 /* TYPE DEFINITIONS                                                          */
+
 /*****************************************************************************/
 
 /*****************************************************************************/
+
 /* GLOBAL VARIABLES                                                          */
+
 /*****************************************************************************/
 
@@ -94,5 +103,7 @@
 
 /*****************************************************************************/
+
 /* FILE STATIC VARIABLES                                                     */
+
 /*****************************************************************************/
 
@@ -100,12 +111,13 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - LOCAL                                           */
+
 /*****************************************************************************/
 
-bool p_psGetStatValue( const psStats* stats, double* value )
-{
-
-    switch ( stats->options &
-             ~ ( PS_STAT_USE_RANGE | PS_STAT_USE_BINSIZE | PS_STAT_ROBUST_FOR_SAMPLE ) ) {
+bool p_psGetStatValue(const psStats * stats, double *value)
+{
+
+    switch (stats->options & ~(PS_STAT_USE_RANGE | PS_STAT_USE_BINSIZE | PS_STAT_ROBUST_FOR_SAMPLE)) {
     case PS_STAT_SAMPLE_MEAN:
         *value = stats->sampleMean;
@@ -163,16 +175,13 @@
  *****************************************************************************/
 
-void p_psVectorPrint( psVector *myVector,
-                      psVector *maskVector,
-                      unsigned int maskVal,
-                      psStats *stats )
-{
-    int i = 0;                                  // Loop index variable.
-
-    for ( i = 0;i < myVector->n;i++ ) {
-        if ( maskVector != NULL )
-            printf( "Element %d is %f (mask is %d)\n", i, myVector->data.F32[ i ], maskVector->data.U8[ i ] );
+void p_psVectorPrint(psVector * myVector, psVector * maskVector, unsigned int maskVal, psStats * stats)
+{
+    int i = 0;                  // Loop index variable.
+
+    for (i = 0; i < myVector->n; i++) {
+        if (maskVector != NULL)
+            printf("Element %d is %f (mask is %d)\n", i, myVector->data.F32[i], maskVector->data.U8[i]);
         else
-            printf( "Element %d is %f\n", i, myVector->data.F32[ i ] );
+            printf("Element %d is %f\n", i, myVector->data.F32[i]);
     }
 }
@@ -195,5 +204,4 @@
  *****************************************************************************/
 
-
 /******************************************************************************
 p_psVectorSampleMean(myVector, maskVector, maskVal, stats): calculates the
@@ -210,55 +218,51 @@
  *****************************************************************************/
 
-void p_psVectorSampleMean( const psVector *restrict myVector,
-                           const psVector *restrict maskVector,
-                           unsigned int maskVal,
-                           psStats *stats )
-{
-    int i = 0;                                  // Loop index variable
-    float mean = 0.0;                           // The mean
-    int count = 0;                              // # of points in this mean?
-    float rangeMin = 0.0;                       // Exclude data below this
-    float rangeMax = 0.0;                       // Exclude date above this
+void p_psVectorSampleMean(const psVector * restrict myVector,
+                          const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+{
+    int i = 0;                  // Loop index variable
+    float mean = 0.0;           // The mean
+    int count = 0;              // # of points in this mean?
+    float rangeMin = 0.0;       // Exclude data below this
+    float rangeMax = 0.0;       // Exclude date above this
 
     // If PS_STAT_USE_RANGE is requested, then we enter a slightly different
     // loop.
-    if ( stats->options & PS_STAT_USE_RANGE ) {
+    if (stats->options & PS_STAT_USE_RANGE) {
         rangeMin = stats->min;
         rangeMax = stats->max;
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
                 // Check if the data is with the specified range
-                if ( !( maskVal & maskVector->data.U8[ i ] ) &&
-                        ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                    mean += myVector->data.F32[ i ];
+                if (!(maskVal & maskVector->data.U8[i]) &&
+                        (rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                    mean += myVector->data.F32[i];
                     count++;
                 }
             }
-            mean /= ( float ) count;
+            mean /= (float)count;
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                    mean += myVector->data.F32[ i ];
+            for (i = 0; i < myVector->n; i++) {
+                if ((rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                    mean += myVector->data.F32[i];
                     count++;
                 }
             }
-            mean /= ( float ) count;
+            mean /= (float)count;
         }
     } else {
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                    mean += myVector->data.F32[ i ];
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i])) {
+                    mean += myVector->data.F32[i];
                     count++;
                 }
             }
-            mean /= ( float ) count;
+            mean /= (float)count;
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                mean += myVector->data.F32[ i ];
-            }
-            mean /= ( float ) myVector->n;
+            for (i = 0; i < myVector->n; i++) {
+                mean += myVector->data.F32[i];
+            }
+            mean /= (float)myVector->n;
         }
     }
@@ -278,50 +282,46 @@
     NULL
  *****************************************************************************/
-void p_psVectorMax( const psVector *restrict myVector,
-                    const psVector *restrict maskVector,
-                    unsigned int maskVal,
-                    psStats *stats )
-{
-    int i = 0;                                  // Loop index variable
-    float max = -MY_MAX_FLOAT;                    // The calculated maximum
-    float rangeMin = 0.0;                       // Exclude data below this
-    float rangeMax = 0.0;                       // Exclude date above this
+void p_psVectorMax(const psVector * restrict myVector,
+                   const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+{
+    int i = 0;                  // Loop index variable
+    float max = -MY_MAX_FLOAT;  // The calculated maximum
+    float rangeMin = 0.0;       // Exclude data below this
+    float rangeMax = 0.0;       // Exclude date above this
 
     // If PS_STAT_USE_RANGE is requested, then we enter a different loop.
-    if ( stats->options & PS_STAT_USE_RANGE ) {
+    if (stats->options & PS_STAT_USE_RANGE) {
         rangeMin = stats->min;
         rangeMax = stats->max;
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                    if ( ( myVector->data.F32[ i ] > max ) &&
-                            ( rangeMin <= myVector->data.F32[ i ] ) &&
-                            ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                        max = myVector->data.F32[ i ];
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i])) {
+                    if ((myVector->data.F32[i] > max) &&
+                            (rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                        max = myVector->data.F32[i];
                     }
                 }
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( ( myVector->data.F32[ i ] > max ) &&
-                        ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                    max = myVector->data.F32[ i ];
+            for (i = 0; i < myVector->n; i++) {
+                if ((myVector->data.F32[i] > max) &&
+                        (rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                    max = myVector->data.F32[i];
                 }
             }
         }
     } else {
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                    if ( myVector->data.F32[ i ] > max ) {
-                        max = myVector->data.F32[ i ];
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i])) {
+                    if (myVector->data.F32[i] > max) {
+                        max = myVector->data.F32[i];
                     }
                 }
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( myVector->data.F32[ i ] > max ) {
-                    max = myVector->data.F32[ i ];
+            for (i = 0; i < myVector->n; i++) {
+                if (myVector->data.F32[i] > max) {
+                    max = myVector->data.F32[i];
                 }
             }
@@ -343,49 +343,45 @@
     NULL
  *****************************************************************************/
-void p_psVectorMin( const psVector *restrict myVector,
-                    const psVector *restrict maskVector,
-                    unsigned int maskVal,
-                    psStats *stats )
-{
-    int i = 0;                                  // Loop index variable
-    float min = MY_MAX_FLOAT;                     // The calculated maximum
-    float rangeMin = 0.0;                       // Exclude data below this
-    float rangeMax = 0.0;                       // Exclude date above this
-
-    if ( stats->options & PS_STAT_USE_RANGE ) {
+void p_psVectorMin(const psVector * restrict myVector,
+                   const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+{
+    int i = 0;                  // Loop index variable
+    float min = MY_MAX_FLOAT;   // The calculated maximum
+    float rangeMin = 0.0;       // Exclude data below this
+    float rangeMax = 0.0;       // Exclude date above this
+
+    if (stats->options & PS_STAT_USE_RANGE) {
         rangeMin = stats->min;
         rangeMax = stats->max;
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                    if ( ( myVector->data.F32[ i ] < min ) &&
-                            ( rangeMin <= myVector->data.F32[ i ] ) &&
-                            ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                        min = myVector->data.F32[ i ];
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i])) {
+                    if ((myVector->data.F32[i] < min) &&
+                            (rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                        min = myVector->data.F32[i];
                     }
                 }
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( ( myVector->data.F32[ i ] < min ) &&
-                        ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                    min = myVector->data.F32[ i ];
+            for (i = 0; i < myVector->n; i++) {
+                if ((myVector->data.F32[i] < min) &&
+                        (rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                    min = myVector->data.F32[i];
                 }
             }
         }
     } else {
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                    if ( myVector->data.F32[ i ] < min ) {
-                        min = myVector->data.F32[ i ];
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i])) {
+                    if (myVector->data.F32[i] < min) {
+                        min = myVector->data.F32[i];
                     }
                 }
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( myVector->data.F32[ i ] < min ) {
-                    min = myVector->data.F32[ i ];
+            for (i = 0; i < myVector->n; i++) {
+                if (myVector->data.F32[i] < min) {
+                    min = myVector->data.F32[i];
                 }
             }
@@ -408,29 +404,25 @@
     NULL
  *****************************************************************************/
-int p_psVectorNValues( const psVector *restrict myVector,
-                       const psVector *restrict maskVector,
-                       unsigned int maskVal,
-                       psStats *stats )
-{
-    int i = 0;                                  // Loop index variable
-    int numData = 0;                            // The number of data points
-    float rangeMin = 0.0;                       // Exclude data below this
-    float rangeMax = 0.0;                       // Exclude date above this
-
-    if ( stats->options & PS_STAT_USE_RANGE ) {
+int p_psVectorNValues(const psVector * restrict myVector,
+                      const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+{
+    int i = 0;                  // Loop index variable
+    int numData = 0;            // The number of data points
+    float rangeMin = 0.0;       // Exclude data below this
+    float rangeMax = 0.0;       // Exclude date above this
+
+    if (stats->options & PS_STAT_USE_RANGE) {
         rangeMin = stats->min;
         rangeMax = stats->max;
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) &&
-                        ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i]) &&
+                        (rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
                     numData++;
                 }
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+            for (i = 0; i < myVector->n; i++) {
+                if ((rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
                     numData++;
                 }
@@ -440,7 +432,7 @@
         rangeMin = stats->min;
         rangeMax = stats->max;
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i])) {
                     numData++;
                 }
@@ -450,8 +442,6 @@
         }
     }
-    return ( numData );
-}
-
-
+    return (numData);
+}
 
 /******************************************************************************
@@ -466,17 +456,14 @@
     NULL
  *****************************************************************************/
-void p_psVectorSampleMedian( const psVector *restrict myVector,
-                             const psVector *restrict maskVector,
-                             unsigned int maskVal,
-                             psStats *stats )
-{
-    psVector * unsortedVector = NULL;            // Temporary vector
-    psVector *sortedVector = NULL;              // Temporary vector
-    int i = 0;                                  // Loop index variable
-    int count = 0;                              // # of points in this mean?
-    int nValues = 0;                            // # of points in vector
-    float rangeMin = 0.0;                       // Exclude data below this
-    float rangeMax = 0.0;                       // Exclude date above this
-
+void p_psVectorSampleMedian(const psVector * restrict myVector,
+                            const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+{
+    psVector *unsortedVector = NULL;    // Temporary vector
+    psVector *sortedVector = NULL;      // Temporary vector
+    int i = 0;                  // Loop index variable
+    int count = 0;              // # of points in this mean?
+    int nValues = 0;            // # of points in vector
+    float rangeMin = 0.0;       // Exclude data below this
+    float rangeMax = 0.0;       // Exclude date above this
 
     // Determine if the number of data points exceed a threshold which will
@@ -485,37 +472,33 @@
     // regardless of the vector size.
     /*
-        if (myVector->n > stats->sampleLimit) {
-            psAbort(__func__, "Robust Statistic Algorithms have not yet been defined or implemented.");
-     
-            // Calculate the robust quartiles.
-            stats2 = psStatsAlloc(PS_STAT_ROBUST_MEDIAN);
-            p_psVectorRobustStats(myVector, maskVector, maskVal, stats2);
-     
-            // Store the robust quartiles into the sample quartile members.
-            stats->sampleMedian = stats2->robustMedian;
-     
-            // Free temporary data buffers.
-            psFree(stats2);
-     
-            // Set the PS_STAT_ROBUST_FOR_SAMPLE bit in the stats structure.
-            stats->options = stats->options | PS_STAT_ROBUST_FOR_SAMPLE;
-     
-            return;
-        }
-    */
+     * if (myVector->n > stats->sampleLimit) { psAbort(__func__, "Robust Statistic Algorithms have not yet
+     * been defined or implemented.");
+     * 
+     * // Calculate the robust quartiles. stats2 = psStatsAlloc(PS_STAT_ROBUST_MEDIAN);
+     * p_psVectorRobustStats(myVector, maskVector, maskVal, stats2);
+     * 
+     * // Store the robust quartiles into the sample quartile members. stats->sampleMedian =
+     * stats2->robustMedian;
+     * 
+     * // Free temporary data buffers. psFree(stats2);
+     * 
+     * // Set the PS_STAT_ROBUST_FOR_SAMPLE bit in the stats structure. stats->options = stats->options |
+     * PS_STAT_ROBUST_FOR_SAMPLE;
+     * 
+     * return; } */
 
     // Determine how many data points fit inside this min/max range
     // and are not masked, IF the maskVector is not NULL>
-    nValues = p_psVectorNValues( myVector, maskVector, maskVal, stats );
+    nValues = p_psVectorNValues(myVector, maskVector, maskVal, stats);
 
     // Allocate temporary vectors for the data.
-    unsortedVector = psVectorAlloc( nValues, PS_TYPE_F32 );
+    unsortedVector = psVectorAlloc(nValues, PS_TYPE_F32);
     unsortedVector->n = unsortedVector->nalloc;
 
-    sortedVector = psVectorAlloc( nValues, PS_TYPE_F32 );
+    sortedVector = psVectorAlloc(nValues, PS_TYPE_F32);
     sortedVector->n = sortedVector->nalloc;
 
     // Determine if we must only use data points within a min/max range.
-    if ( stats->options & PS_STAT_USE_RANGE ) {
+    if (stats->options & PS_STAT_USE_RANGE) {
         rangeMin = stats->min;
         rangeMax = stats->max;
@@ -524,17 +507,15 @@
         // into the temporary vectors.
         count = 0;
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) &&
-                        ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                    unsortedVector->data.F32[ count++ ] = maskVector->data.F32[ i ];
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i]) &&
+                        (rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                    unsortedVector->data.F32[count++] = maskVector->data.F32[i];
                 }
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
+            for (i = 0; i < myVector->n; i++) {
+                if ((rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                    unsortedVector->data.F32[count++] = myVector->data.F32[i];
                 }
             }
@@ -543,31 +524,31 @@
         // Store all non-masked data points into the temporary vectors.
         count = 0;
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i])) {
+                    unsortedVector->data.F32[count++] = myVector->data.F32[i];
                 }
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                unsortedVector->data.F32[ i ] = myVector->data.F32[ i ];
+            for (i = 0; i < myVector->n; i++) {
+                unsortedVector->data.F32[i] = myVector->data.F32[i];
             }
         }
     }
     // Sort the temporary vectors.
-    psVectorSort( sortedVector, unsortedVector );
+    psVectorSort(sortedVector, unsortedVector);
 
     // Calculate the median exactly.
     // XXX: Is this the correct action?
-    if ( 0 == ( nValues % 2 ) ) {
-        stats->sampleMedian = 0.5 * ( sortedVector->data.F32[ ( nValues / 2 ) - 1 ] +
-                                      sortedVector->data.F32[ nValues / 2 ] );
+    if (0 == (nValues % 2)) {
+        stats->sampleMedian = 0.5 * (sortedVector->data.F32[(nValues / 2) - 1] +
+                                     sortedVector->data.F32[nValues / 2]);
     } else {
-        stats->sampleMedian = sortedVector->data.F32[ nValues / 2 ];
+        stats->sampleMedian = sortedVector->data.F32[nValues / 2];
     }
 
     // Free the temporary data structures.
-    psFree( unsortedVector );
-    psFree( sortedVector );
+    psFree(unsortedVector);
+    psFree(sortedVector);
 }
 
@@ -584,27 +565,26 @@
     XXX: use a static variable for gaussianCoefs[] and compute them once.
  *****************************************************************************/
-psVector *p_psVectorsmoothHistGaussian( psHistogram *robustHistogram,
-                                        float sigma )
-{
-    int i = 0;                                  // Loop index variable
-    int j = 0;                                  // Loop index variable
-    float denom = 0.0;                           // Temporary variable
-    float expo = 0.0;                            // Temporary variable
-    float gaussianCoefs[ 1 + ( 2 * GAUSS_WIDTH ) ]; // The Gaussian Coefficients
-    psVector *smooth = psVectorAlloc( robustHistogram->nums->n, PS_TYPE_F32 );
-
-    for ( i = 0;i < ( 1 + ( 2 * GAUSS_WIDTH ) );i++ ) {
-        if ( fabs( sigma ) >= FLT_EPSILON ) {
+psVector *p_psVectorsmoothHistGaussian(psHistogram * robustHistogram, float sigma)
+{
+    int i = 0;                  // Loop index variable
+    int j = 0;                  // Loop index variable
+    float denom = 0.0;          // Temporary variable
+    float expo = 0.0;           // Temporary variable
+    float gaussianCoefs[1 + (2 * GAUSS_WIDTH)]; // The Gaussian Coefficients
+    psVector *smooth = psVectorAlloc(robustHistogram->nums->n, PS_TYPE_F32);
+
+    for (i = 0; i < (1 + (2 * GAUSS_WIDTH)); i++) {
+        if (fabs(sigma) >= FLT_EPSILON) {
             // If sigma does not equal zero, then we use Gaussian smoothing.
             #ifdef  DARWIN
-            denom = ( float ) sqrt( 2.0 * M_PI * sigma * sigma );
+            denom = (float)sqrt(2.0 * M_PI * sigma * sigma);
             #else
 
-            denom = sqrtf( 2.0 * M_PI * sigma * sigma );
+            denom = sqrtf(2.0 * M_PI * sigma * sigma);
             #endif
 
-            expo = - ( float ) ( ( i - GAUSS_WIDTH ) * ( i - GAUSS_WIDTH ) );
-            expo /= ( 2.0 * sigma * sigma );
-            gaussianCoefs[ i ] = exp( expo / denom );
+            expo = -(float)((i - GAUSS_WIDTH) * (i - GAUSS_WIDTH));
+            expo /= (2.0 * sigma * sigma);
+            gaussianCoefs[i] = exp(expo / denom);
 
             // NOTE: Gaussian smoothing just isn't working with low sigma
@@ -612,29 +592,27 @@
             // all zero, except for the middle coefficient, which is exactly
             // one.  Therefore, I'm using boxcar smoothing.
-            gaussianCoefs[ i ] = 1.0 / ( 1.0 + ( 2.0 * ( float ) GAUSS_WIDTH ) );
-            //            printf("gaussianCoefs[%d] is %f\n", i, gaussianCoefs[i]);
+            gaussianCoefs[i] = 1.0 / (1.0 + (2.0 * (float)GAUSS_WIDTH));
+            // printf("gaussianCoefs[%d] is %f\n", i, gaussianCoefs[i]);
         } else {
-            /* If sigma equals zero (all pixels have the same value)
-             * the above code will divide by zero.  Therefore, we don't need
-             * to smooth the data.
-             */
-            for ( i = 0;i < robustHistogram->nums->n;i++ ) {
-                smooth->data.F32[ i ] = ( float ) robustHistogram->nums->data.S32[ i ];
-            }
-            return ( smooth );
+            /* If sigma equals zero (all pixels have the same value) the above code will divide by zero.
+             * Therefore, we don't need to smooth the data. */
+            for (i = 0; i < robustHistogram->nums->n; i++) {
+                smooth->data.F32[i] = (float)robustHistogram->nums->data.S32[i];
+            }
+            return (smooth);
         }
     }
 
     // Perform the actual smoothing.
-    for ( i = 0;i < robustHistogram->nums->n;i++ ) {
-        smooth->data.F32[ i ] = 0.0;
-        for ( j = -GAUSS_WIDTH;j <= + GAUSS_WIDTH;j++ ) {
-            if ( ( ( j + i ) >= 0 ) && ( ( j + i ) < smooth->n ) ) {
-                smooth->data.F32[ i ] += ( gaussianCoefs[ j + GAUSS_WIDTH ] *
-                                           ( float ) robustHistogram->nums->data.S32[ j + i ] );
-            }
-        }
-    }
-    return ( smooth );
+    for (i = 0; i < robustHistogram->nums->n; i++) {
+        smooth->data.F32[i] = 0.0;
+        for (j = -GAUSS_WIDTH; j <= +GAUSS_WIDTH; j++) {
+            if (((j + i) >= 0) && ((j + i) < smooth->n)) {
+                smooth->data.F32[i] += (gaussianCoefs[j + GAUSS_WIDTH] *
+                                        (float)robustHistogram->nums->data.S32[j + i]);
+            }
+        }
+    }
+    return (smooth);
 }
 
@@ -650,29 +628,27 @@
     NULL
  *****************************************************************************/
-void p_psVectorSampleQuartiles( const psVector *restrict myVector,
-                                const psVector *restrict maskVector,
-                                unsigned int maskVal,
-                                psStats *stats )
-{
-    psVector * unsortedVector = NULL;            // Temporary vector
-    psVector *sortedVector = NULL;              // Temporary vector
-    int i = 0;                                  // Loop index variable
-    int count = 0;                              // # of points in this mean?
-    int nValues = 0;                            // # data points
-    float rangeMin = 0.0;                       // Exclude data below this
-    float rangeMax = 0.0;                       // Exclude date above this
+void p_psVectorSampleQuartiles(const psVector * restrict myVector,
+                               const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+{
+    psVector *unsortedVector = NULL;    // Temporary vector
+    psVector *sortedVector = NULL;      // Temporary vector
+    int i = 0;                  // Loop index variable
+    int count = 0;              // # of points in this mean?
+    int nValues = 0;            // # data points
+    float rangeMin = 0.0;       // Exclude data below this
+    float rangeMax = 0.0;       // Exclude date above this
 
     // Determine how many data points fit inside this min/max range
     // and are not maxed, IF the maskVector is not NULL>
-    nValues = p_psVectorNValues( myVector, maskVector, maskVal, stats );
+    nValues = p_psVectorNValues(myVector, maskVector, maskVal, stats);
 
     // Allocate temporary vectors for the data.
-    unsortedVector = psVectorAlloc( nValues, PS_TYPE_F32 );
+    unsortedVector = psVectorAlloc(nValues, PS_TYPE_F32);
     unsortedVector->n = unsortedVector->nalloc;
-    sortedVector = psVectorAlloc( nValues, PS_TYPE_F32 );
+    sortedVector = psVectorAlloc(nValues, PS_TYPE_F32);
     sortedVector->n = sortedVector->nalloc;
 
     // Determine if we must only use data points within a min/max range.
-    if ( stats->options & PS_STAT_USE_RANGE ) {
+    if (stats->options & PS_STAT_USE_RANGE) {
         rangeMin = stats->min;
         rangeMax = stats->max;
@@ -680,17 +656,15 @@
         // into the temporary vectors.
         count = 0;
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) &&
-                        ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i]) &&
+                        (rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                    unsortedVector->data.F32[count++] = myVector->data.F32[i];
                 }
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
+            for (i = 0; i < myVector->n; i++) {
+                if ((rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                    unsortedVector->data.F32[count++] = myVector->data.F32[i];
                 }
             }
@@ -699,13 +673,13 @@
         // Store all non-masked data points into the temporary vectors.
         count = 0;
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i])) {
+                    unsortedVector->data.F32[count++] = myVector->data.F32[i];
                 }
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                unsortedVector->data.F32[ i ] = myVector->data.F32[ i ];
+            for (i = 0; i < myVector->n; i++) {
+                unsortedVector->data.F32[i] = myVector->data.F32[i];
             }
         }
@@ -713,15 +687,14 @@
 
     // Sort the temporary vectors.
-    psVectorSort( sortedVector, unsortedVector );
+    psVectorSort(sortedVector, unsortedVector);
 
     // Calculate the quartile points exactly.
-    stats->sampleUQ = sortedVector->data.F32[ 3 * ( nValues / 4 ) ];
-    stats->sampleLQ = sortedVector->data.F32[ nValues / 4 ];
+    stats->sampleUQ = sortedVector->data.F32[3 * (nValues / 4)];
+    stats->sampleLQ = sortedVector->data.F32[nValues / 4];
 
     // Free the temporary data structures.
-    psFree( unsortedVector );
-    psFree( sortedVector );
-}
-
+    psFree(unsortedVector);
+    psFree(sortedVector);
+}
 
 /******************************************************************************
@@ -737,34 +710,31 @@
  
  *****************************************************************************/
-void p_psVectorSampleStdev( const psVector *restrict myVector,
-                            const psVector *restrict maskVector,
-                            unsigned int maskVal,
-                            psStats *stats )
-{
-    int i = 0;                                  // Loop index variable
-    int countInt = 0;                           // # of data points being used
-    float countFloat = 0.0;                     // # of data points being used
-    float mean = 0.0;                           // The mean
-    float diff = 0.0;                           // Used in calculating stdev
-    float sumSquares = 0.0;                     // temporary variable
-    float sumDiffs = 0.0;                       // temporary variable
-    float rangeMin = 0.0;                       // Exclude data below this
-    float rangeMax = 0.0;                       // Exclude date above this
+void p_psVectorSampleStdev(const psVector * restrict myVector,
+                           const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+{
+    int i = 0;                  // Loop index variable
+    int countInt = 0;           // # of data points being used
+    float countFloat = 0.0;     // # of data points being used
+    float mean = 0.0;           // The mean
+    float diff = 0.0;           // Used in calculating stdev
+    float sumSquares = 0.0;     // temporary variable
+    float sumDiffs = 0.0;       // temporary variable
+    float rangeMin = 0.0;       // Exclude data below this
+    float rangeMax = 0.0;       // Exclude date above this
 
     // This procedure requires the mean.  If it has not been already
     // calculated, then call p_psVectorSampleMean()
-    if ( 0 != isnan( stats->sampleMean ) ) {
-        p_psVectorSampleMean( myVector, maskVector, maskVal, stats );
+    if (0 != isnan(stats->sampleMean)) {
+        p_psVectorSampleMean(myVector, maskVector, maskVal, stats);
     }
     mean = stats->sampleMean;
 
-    if ( stats->options & PS_STAT_USE_RANGE ) {
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) &&
-                        ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                    diff = myVector->data.F32[ i ] - mean;
-                    sumSquares += ( diff * diff );
+    if (stats->options & PS_STAT_USE_RANGE) {
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i]) &&
+                        (rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                    diff = myVector->data.F32[i] - mean;
+                    sumSquares += (diff * diff);
                     sumDiffs += diff;
                     countInt++;
@@ -772,9 +742,8 @@
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                    diff = myVector->data.F32[ i ] - mean;
-                    sumSquares += ( diff * diff );
+            for (i = 0; i < myVector->n; i++) {
+                if ((rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                    diff = myVector->data.F32[i] - mean;
+                    sumSquares += (diff * diff);
                     sumDiffs += diff;
                     countInt++;
@@ -784,9 +753,9 @@
         }
     } else {
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                    diff = myVector->data.F32[ i ] - mean;
-                    sumSquares += ( diff * diff );
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i])) {
+                    diff = myVector->data.F32[i] - mean;
+                    sumSquares += (diff * diff);
                     sumDiffs += diff;
                     countInt++;
@@ -794,7 +763,7 @@
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                diff = myVector->data.F32[ i ] - mean;
-                sumSquares += ( diff * diff );
+            for (i = 0; i < myVector->n; i++) {
+                diff = myVector->data.F32[i] - mean;
+                sumSquares += (diff * diff);
                 sumDiffs += diff;
                 countInt++;
@@ -803,14 +772,12 @@
         }
     }
-    countFloat = ( float ) countInt;
+    countFloat = (float)countInt;
 
     #ifdef DARWIN
 
-    stats->sampleStdev = ( float ) sqrt( ( sumSquares - ( sumDiffs *
-                                           sumDiffs / countFloat ) ) / ( countFloat - 1 ) );
+    stats->sampleStdev = (float)sqrt((sumSquares - (sumDiffs * sumDiffs / countFloat)) / (countFloat - 1));
     #else
 
-    stats->sampleStdev = sqrtf( ( sumSquares - ( sumDiffs *
-                                  sumDiffs / countFloat ) ) / ( countFloat - 1 ) );
+    stats->sampleStdev = sqrtf((sumSquares - (sumDiffs * sumDiffs / countFloat)) / (countFloat - 1));
     #endif
 }
@@ -828,52 +795,43 @@
     NULL
  *****************************************************************************/
-void p_psVectorClippedStats( const psVector *restrict myVector,
-                             const psVector *restrict maskVector,
-                             unsigned int maskVal,
-                             psStats *stats )
-{
-    int i = 0;                                  // Loop index variable
-    int j = 0;                                  // Loop index variable
-    float clippedMean = 0.0;                    // self-explanatory
-    float clippedStdev = 0.0;                   // self-explanatory
-    float oldStanMean = 0.0;                    // Temporary variable
-    float oldStanStdev = 0.0;                   // Temporary variable
-    psVector *tmpMask = NULL;                   // Temporary vector
+void p_psVectorClippedStats(const psVector * restrict myVector,
+                            const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+{
+    int i = 0;                  // Loop index variable
+    int j = 0;                  // Loop index variable
+    float clippedMean = 0.0;    // self-explanatory
+    float clippedStdev = 0.0;   // self-explanatory
+    float oldStanMean = 0.0;    // Temporary variable
+    float oldStanStdev = 0.0;   // Temporary variable
+    psVector *tmpMask = NULL;   // Temporary vector
 
     // Endure that stats->clipIter is within the proper range.
-    if ( !( ( CLIPPED_NUM_ITER_LB <= stats->clipIter ) &&
-            ( stats->clipIter <= CLIPPED_NUM_ITER_UB ) ) ) {
-        psAbort( __func__, "Unallowed value for clipIter (%d).\n",
-                 stats->clipIter );
-    }
-
+    if (!((CLIPPED_NUM_ITER_LB <= stats->clipIter) && (stats->clipIter <= CLIPPED_NUM_ITER_UB))) {
+        psAbort(__func__, "Unallowed value for clipIter (%d).\n", stats->clipIter);
+    }
     // Endure that stats->clipSigma is within the proper range.
-    if ( !( ( CLIPPED_SIGMA_LB <= stats->clipSigma ) &&
-            ( stats->clipSigma <= CLIPPED_SIGMA_UB ) ) ) {
-        psAbort( __func__, "Unallowed value for clipSigma (%f).\n",
-                 stats->clipSigma );
-    }
-
+    if (!((CLIPPED_SIGMA_LB <= stats->clipSigma) && (stats->clipSigma <= CLIPPED_SIGMA_UB))) {
+        psAbort(__func__, "Unallowed value for clipSigma (%f).\n", stats->clipSigma);
+    }
     // We allocate a temporary mask vector since during the iterative
     // steps that follow, we will be masking off additional data points.
     // However, we do no want to modify the original mask vector.
-    tmpMask = psVectorAlloc( myVector->n, PS_TYPE_U8 );
+    tmpMask = psVectorAlloc(myVector->n, PS_TYPE_U8);
     tmpMask->n = myVector->n;
 
     // If we were called with a mask vector, then initialize the temporary
     // mask vector with those values.
-    if ( maskVector != NULL ) {
-        for ( i = 0;i < tmpMask->n;i++ ) {
-            tmpMask->data.U8[ i ] = maskVector->data.U8[ i ];
-        }
-    }
-
+    if (maskVector != NULL) {
+        for (i = 0; i < tmpMask->n; i++) {
+            tmpMask->data.U8[i] = maskVector->data.U8[i];
+        }
+    }
     // 1. Compute the sample median.
     // NOTE: This seems odd.  Verify with IfA that we want to calculate the
     // median here, not the mean.
-    p_psVectorSampleMedian( myVector, maskVector, maskVal, stats );
+    p_psVectorSampleMedian(myVector, maskVector, maskVal, stats);
 
     // 2. Compute the sample standard deviation.
-    p_psVectorSampleStdev( myVector, maskVector, maskVal, stats );
+    p_psVectorSampleStdev(myVector, maskVector, maskVal, stats);
 
     // 3. Use the sample median as the first estimator of the mean X.
@@ -889,14 +847,13 @@
 
     // 5. Repeat N times:
-    for ( i = 0;i < stats->clipIter;i++ ) {
-        for ( j = 0;j < myVector->n;j++ ) {
+    for (i = 0; i < stats->clipIter; i++) {
+        for (j = 0; j < myVector->n; j++) {
             // a) Exclude all values x_i for which |x_i - x| > K * stdev
-            if ( fabs( myVector->data.F32[ j ] - clippedMean ) >
-                    ( stats->clipSigma * clippedStdev ) ) {
-                tmpMask->data.U8[ i ] = 0xff;
+            if (fabs(myVector->data.F32[j] - clippedMean) > (stats->clipSigma * clippedStdev)) {
+                tmpMask->data.U8[i] = 0xff;
             }
             // b) compute new mean and stdev
-            p_psVectorSampleMedian( myVector, tmpMask, maskVal, stats );
-            p_psVectorSampleStdev( myVector, tmpMask, maskVal, stats );
+            p_psVectorSampleMedian(myVector, tmpMask, maskVal, stats);
+            p_psVectorSampleStdev(myVector, tmpMask, maskVal, stats);
 
             // c) Use the new mean for x
@@ -912,14 +869,13 @@
 
     // 7. The last calcuated value of x is the cliped mean.
-    if ( stats->options & PS_STAT_CLIPPED_MEAN ) {
+    if (stats->options & PS_STAT_CLIPPED_MEAN) {
         stats->clippedMean = clippedMean;
     }
-
     // 8. The last calcuated value of stdev is the cliped stdev.
-    if ( stats->options & PS_STAT_CLIPPED_STDEV ) {
+    if (stats->options & PS_STAT_CLIPPED_STDEV) {
         stats->clippedStdev = clippedStdev;
     }
 
-    psFree( tmpMask );
+    psFree(tmpMask);
 }
 
@@ -928,26 +884,25 @@
 elements of a vector to a range between 0.0 and 1.0.
  *****************************************************************************/
-void p_psNormalizeVector( psVector *myData )
-{
-    float min = ( float ) HUGE;
-    float max = ( float ) - HUGE;
+void p_psNormalizeVector(psVector * myData)
+{
+    float min = (float)HUGE;
+    float max = (float)-HUGE;
     float range = 0.0;
     int i = 0;
 
-    for ( i = 0;i < myData->n;i++ ) {
-        if ( myData->data.F32[ i ] < min ) {
-            min = myData->data.F32[ i ];
-        }
-        if ( myData->data.F32[ i ] > max ) {
-            max = myData->data.F32[ i ];
+    for (i = 0; i < myData->n; i++) {
+        if (myData->data.F32[i] < min) {
+            min = myData->data.F32[i];
+        }
+        if (myData->data.F32[i] > max) {
+            max = myData->data.F32[i];
         }
     }
 
     range = max - min;
-    for ( i = 0;i < myData->n;i++ ) {
-        myData->data.F32[ i ] = ( myData->data.F32[ i ] - min ) / range;
-    }
-}
-
+    for (i = 0; i < myData->n; i++) {
+        myData->data.F32[i] = (myData->data.F32[i] - min) / range;
+    }
+}
 
 /*****************************************************************************
@@ -956,15 +911,15 @@
 specified data point.
  *****************************************************************************/
-float p_psGaussian( const psVector *restrict myData,
-                    const psVector *restrict myParams )
-{
-    float x = myData->data.F32[ 0 ];
-    float mean = myParams->data.F32[ 0 ];
-    float stdev = myParams->data.F32[ 1 ];
-    float tmp = exp( -( ( x - mean ) * ( x - mean ) ) / ( 2.0 * stdev * stdev ) );
-    tmp /= ( ( float ) sqrt( 2.0 * M_PI * ( stdev * stdev ) ) );
-
-    //    printf("p_psGaussian((%.2f), %.2f, %.2f) is %.2f\n", x, mean, stdev, tmp);
-    return ( tmp );
+float p_psGaussian(const psVector * restrict myData, const psVector * restrict myParams)
+{
+    float x = myData->data.F32[0];
+    float mean = myParams->data.F32[0];
+    float stdev = myParams->data.F32[1];
+    float tmp = exp(-((x - mean) * (x - mean)) / (2.0 * stdev * stdev));
+
+    tmp /= ((float)sqrt(2.0 * M_PI * (stdev * stdev)));
+
+    // printf("p_psGaussian((%.2f), %.2f, %.2f) is %.2f\n", x, mean, stdev, tmp);
+    return (tmp);
 }
 
@@ -973,28 +928,24 @@
 calculates the specified partial derivative of the above Gaussian function.
  *****************************************************************************/
-float p_psGaussianDeriv( const psVector *restrict myData,
-                         const psVector *restrict myParams,
-                         int whichParam )
-{
-    float x = myData->data.F32[ 0 ];
-    float mean = myParams->data.F32[ 0 ];
-    float stdev = myParams->data.F32[ 1 ];
+float p_psGaussianDeriv(const psVector * restrict myData, const psVector * restrict myParams, int whichParam)
+{
+    float x = myData->data.F32[0];
+    float mean = myParams->data.F32[0];
+    float stdev = myParams->data.F32[1];
     float tmp = 0.0;
 
-    if ( whichParam == 0 ) {
+    if (whichParam == 0) {
         // Return the derivative w.r.t. the mean.
-        tmp = ( x - mean ) * p_psGaussian( myData, myParams );
-        tmp /= ( stdev * stdev );
-    } else
-        if ( whichParam == 1 ) {
-            // Return the derivative w.r.t. the stdev.
-            tmp = ( x - mean ) * ( x - mean ) * p_psGaussian( myData, myParams );
-            tmp /= ( stdev * stdev * stdev );
-        }
-    printf( "p_psGaussianDeriv((%.2f), %.2f, %.2f, (%d)) is %.2f\n", x, mean, stdev, whichParam, tmp );
-
-    return ( tmp );
-}
-
+        tmp = (x - mean) * p_psGaussian(myData, myParams);
+        tmp /= (stdev * stdev);
+    } else if (whichParam == 1) {
+        // Return the derivative w.r.t. the stdev.
+        tmp = (x - mean) * (x - mean) * p_psGaussian(myData, myParams);
+        tmp /= (stdev * stdev * stdev);
+    }
+    printf("p_psGaussianDeriv((%.2f), %.2f, %.2f, (%d)) is %.2f\n", x, mean, stdev, whichParam, tmp);
+
+    return (tmp);
+}
 
 /*****************************************************************************
@@ -1003,15 +954,14 @@
 specified data point.
  *****************************************************************************/
-float p_psQuadratic( const psVector *restrict myParams,
-                     const psVector *restrict myCoords )
-{
-    float x = myCoords->data.F32[ 0 ];
-    float A = myParams->data.F32[ 0 ];
-    float B = myParams->data.F32[ 1 ];
-    float C = myParams->data.F32[ 2 ];
+float p_psQuadratic(const psVector * restrict myParams, const psVector * restrict myCoords)
+{
+    float x = myCoords->data.F32[0];
+    float A = myParams->data.F32[0];
+    float B = myParams->data.F32[1];
+    float C = myParams->data.F32[2];
     float tmp = 0.0;
 
-    tmp = ( A * x * x ) + ( B * x ) + C;
-    return ( tmp );
+    tmp = (A * x * x) + (B * x) + C;
+    return (tmp);
 }
 
@@ -1020,22 +970,19 @@
 calculates the specified partial derivative of the above quadratic function.
  *****************************************************************************/
-float p_psQuadraticDeriv( const psVector *restrict myParams,
-                          const psVector *restrict myCoords,
-                          int whichParamDeriv )
-{
-    float x = myCoords->data.F32[ 0 ];
+float p_psQuadraticDeriv(const psVector * restrict myParams,
+                         const psVector * restrict myCoords, int whichParamDeriv)
+{
+    float x = myCoords->data.F32[0];
     float tmp = 0.0;
 
-    if ( whichParamDeriv == 0 ) {
+    if (whichParamDeriv == 0) {
         tmp = x * x;
-    } else
-        if ( whichParamDeriv == 1 ) {
-            tmp = x;
-        } else
-            if ( whichParamDeriv == 2 ) {
-                tmp = 1.0;
-            }
-
-    return ( tmp );
+    } else if (whichParamDeriv == 1) {
+        tmp = x;
+    } else if (whichParamDeriv == 2) {
+        tmp = 1.0;
+    }
+
+    return (tmp);
 }
 
@@ -1049,8 +996,5 @@
 decreasing within that range.
  *****************************************************************************/
-float p_ps1DPolyMedian( psPolynomial1D *myPoly,
-                        float rangeLow,
-                        float rangeHigh,
-                        float getThisValue )
+float p_ps1DPolyMedian(psPolynomial1D * myPoly, float rangeLow, float rangeHigh, float getThisValue)
 {
     int numIterations = 0;
@@ -1059,20 +1003,20 @@
     float f = 0.0;
 
-    //  printf("p_ps1DPolyMedian(%f, %f, %f) \n", rangeLow, rangeHigh, getThisValue);
-
-    while ( numIterations < MAX_ITERATIONS ) {
-        midpoint = ( rangeHigh + rangeLow ) / 2.0;
-        if ( fabs( midpoint - oldMidpoint ) <= FLT_EPSILON ) {
-            return ( midpoint );
+    // printf("p_ps1DPolyMedian(%f, %f, %f) \n", rangeLow, rangeHigh, getThisValue);
+
+    while (numIterations < MAX_ITERATIONS) {
+        midpoint = (rangeHigh + rangeLow) / 2.0;
+        if (fabs(midpoint - oldMidpoint) <= FLT_EPSILON) {
+            return (midpoint);
         }
         oldMidpoint = midpoint;
 
-        f = psPolynomial1DEval( midpoint, myPoly );
-        //        printf("p_ps1DPolyMedian() iteration %d.  f(%f) is %f\n", numIterations, midpoint, f);
-        if ( fabs( f - getThisValue ) <= FLT_EPSILON ) {
-            return ( midpoint );
-        }
-
-        if ( f > getThisValue ) {
+        f = psPolynomial1DEval(midpoint, myPoly);
+        // printf("p_ps1DPolyMedian() iteration %d.  f(%f) is %f\n", numIterations, midpoint, f);
+        if (fabs(f - getThisValue) <= FLT_EPSILON) {
+            return (midpoint);
+        }
+
+        if (f > getThisValue) {
             rangeHigh = midpoint;
         } else {
@@ -1081,5 +1025,5 @@
         numIterations++;
     }
-    return ( midpoint );
+    return (midpoint);
 }
 
@@ -1092,52 +1036,42 @@
 XXX: This function is currently not being used.
  *****************************************************************************/
-float p_psFitQuadratic( psHistogram *histogram,
-                        psVector *cumulativeSums,
-                        int binNum,
-                        float fitFloat )
-{
-    psVector * x = psVectorAlloc( 3, PS_TYPE_F64 );
-    psVector *y = psVectorAlloc( 3, PS_TYPE_F64 );
-    psVector *yErr = psVectorAlloc( 3, PS_TYPE_F64 );
-    psPolynomial1D *myPoly = psPolynomial1DAlloc( 2 );
-
-    if ( ( binNum > 0 ) &&
-            ( binNum < ( histogram->nums->n + 1 ) ) ) {
-        x->data.F64[ 0 ] = ( double ) 0.5 *
-                           ( histogram->bounds->data.F32[ binNum - 1 ] +
-                             histogram->bounds->data.F32[ binNum ] );
-        x->data.F64[ 1 ] = ( double ) 0.5 *
-                           ( histogram->bounds->data.F32[ binNum ] +
-                             histogram->bounds->data.F32[ binNum + 1 ] );
-        x->data.F64[ 2 ] = ( double ) 0.5 *
-                           ( histogram->bounds->data.F32[ binNum + 1 ] +
-                             histogram->bounds->data.F32[ binNum + 2 ] );
-
-        y->data.F64[ 0 ] = cumulativeSums->data.F32[ binNum - 1 ];
-        y->data.F64[ 1 ] = cumulativeSums->data.F32[ binNum ];
-        y->data.F64[ 2 ] = cumulativeSums->data.F32[ binNum + 1 ];
-
-        if ( !( ( y->data.F64[ 0 ] <= fitFloat ) &&
-                ( fitFloat <= y->data.F64[ 2 ] ) ) ) {
-            psAbort( __func__, "p_psVectorRobustStats(0): midpoint not within y-range\n" );
-        }
-
-        yErr->data.F64[ 0 ] = 1.0;
-        yErr->data.F64[ 1 ] = 1.0;
-        yErr->data.F64[ 2 ] = 1.0;
-
-        myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
-        return ( p_ps1DPolyMedian( myPoly, x->data.F64[ 0 ], x->data.F64[ 2 ],
-                                   fitFloat ) );
+float p_psFitQuadratic(psHistogram * histogram, psVector * cumulativeSums, int binNum, float fitFloat)
+{
+    psVector *x = psVectorAlloc(3, PS_TYPE_F64);
+    psVector *y = psVectorAlloc(3, PS_TYPE_F64);
+    psVector *yErr = psVectorAlloc(3, PS_TYPE_F64);
+    psPolynomial1D *myPoly = psPolynomial1DAlloc(2);
+
+    if ((binNum > 0) && (binNum < (histogram->nums->n + 1))) {
+        x->data.F64[0] = (double)0.5 *
+                         (histogram->bounds->data.F32[binNum - 1] + histogram->bounds->data.F32[binNum]);
+        x->data.F64[1] = (double)0.5 *
+                         (histogram->bounds->data.F32[binNum] + histogram->bounds->data.F32[binNum + 1]);
+        x->data.F64[2] = (double)0.5 *
+                         (histogram->bounds->data.F32[binNum + 1] + histogram->bounds->data.F32[binNum + 2]);
+
+        y->data.F64[0] = cumulativeSums->data.F32[binNum - 1];
+        y->data.F64[1] = cumulativeSums->data.F32[binNum];
+        y->data.F64[2] = cumulativeSums->data.F32[binNum + 1];
+
+        if (!((y->data.F64[0] <= fitFloat) && (fitFloat <= y->data.F64[2]))) {
+            psAbort(__func__, "p_psVectorRobustStats(0): midpoint not within y-range\n");
+        }
+
+        yErr->data.F64[0] = 1.0;
+        yErr->data.F64[1] = 1.0;
+        yErr->data.F64[2] = 1.0;
+
+        myPoly = psVectorFitPolynomial1D(myPoly, x, y, yErr);
+        return (p_ps1DPolyMedian(myPoly, x->data.F64[0], x->data.F64[2], fitFloat));
     } else {
-        return ( 0.5 * ( histogram->bounds->data.F32[ binNum + 1 ] +
-                         histogram->bounds->data.F32[ binNum ] ) );
-    }
-
-    psFree( x );
-    psFree( y );
-    psFree( yErr );
-    psFree( myPoly );
-    return ( 0.0 );
+        return (0.5 * (histogram->bounds->data.F32[binNum + 1] + histogram->bounds->data.F32[binNum]));
+    }
+
+    psFree(x);
+    psFree(y);
+    psFree(yErr);
+    psFree(myPoly);
+    return (0.0);
 }
 
@@ -1166,28 +1100,27 @@
     NULL
 *****************************************************************************/
-void p_psVectorRobustStats( const psVector *restrict myVector,
-                            const psVector *restrict maskVector,
-                            unsigned int maskVal,
-                            psStats *stats )
-{
-    psHistogram * robustHistogram = NULL;
+void p_psVectorRobustStats(const psVector * restrict myVector,
+                           const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+{
+    psHistogram *robustHistogram = NULL;
     psVector *robustHistogramVector = NULL;
-    float binSize = 0.0;                        // Size of the histogram bins
-    int LQBinNum = -1;                          // Bin num for lower quartile
-    int UQBinNum = -1;                          // Bin num for upper quartile
-    int i = 0;                                  // Loop index variable
+    float binSize = 0.0;        // Size of the histogram bins
+    int LQBinNum = -1;          // Bin num for lower quartile
+    int UQBinNum = -1;          // Bin num for upper quartile
+    int i = 0;                  // Loop index variable
     int maxBinNum = 0;
     float maxBinCount = 0.0;
     float dL = 0.0;
     int numBins = 0;
-    psStats *tmpStats = psStatsAlloc( PS_STAT_CLIPPED_STDEV | PS_STAT_CLIPPED_MEAN );
-    //    psImage *domain;
-    //    psVector *errors;
-    //    psVector *data;
-    //    psVector *initialGuess;
-    //    psVector *theParams;
-    //    float chiSq=0.0;
-    //    float max = -HUGE;
-    //    float max_pos;
+    psStats *tmpStats = psStatsAlloc(PS_STAT_CLIPPED_STDEV | PS_STAT_CLIPPED_MEAN);
+
+    // psImage *domain;
+    // psVector *errors;
+    // psVector *data;
+    // psVector *initialGuess;
+    // psVector *theParams;
+    // float chiSq=0.0;
+    // float max = -HUGE;
+    // float max_pos;
     float myMean = 0.0;
     float myStdev = 0.0;
@@ -1196,8 +1129,8 @@
     float sumSquares = 0.0;
     float sumDiffs = 0.0;
-    psVector *x = psVectorAlloc( 3, PS_TYPE_F64 );
-    psVector *y = psVectorAlloc( 3, PS_TYPE_F64 );
-    psVector *yErr = psVectorAlloc( 3, PS_TYPE_F64 );
-    psPolynomial1D *myPoly = psPolynomial1DAlloc( 2 );
+    psVector *x = psVectorAlloc(3, PS_TYPE_F64);
+    psVector *y = psVectorAlloc(3, PS_TYPE_F64);
+    psVector *yErr = psVectorAlloc(3, PS_TYPE_F64);
+    psPolynomial1D *myPoly = psPolynomial1DAlloc(2);
     psVector *cumulativeRobustSumsFullRange = NULL;
     psVector *cumulativeRobustSumsDlRange = NULL;
@@ -1210,23 +1143,23 @@
     // by computing the clipped standard deviation of the vector, and dividing
     // that by 10.0;
-    p_psVectorClippedStats( myVector, maskVector, maskVal, tmpStats );
+    p_psVectorClippedStats(myVector, maskVector, maskVal, tmpStats);
     binSize = tmpStats->clippedStdev / 10.0f;
 
     // If stats->clippedStdev == 0.0, then all data elements have the same
     // value.  Therefore, we can set the appropiate results and return.
-    if ( fabs( binSize ) <= FLT_EPSILON ) {
-        if ( stats->options & PS_STAT_ROBUST_MEAN ) {
+    if (fabs(binSize) <= FLT_EPSILON) {
+        if (stats->options & PS_STAT_ROBUST_MEAN) {
             stats->robustMean = stats->clippedMean;
         }
-        if ( stats->options & PS_STAT_ROBUST_MEDIAN ) {
+        if (stats->options & PS_STAT_ROBUST_MEDIAN) {
             stats->robustMedian = stats->clippedMean;
         }
-        if ( stats->options & PS_STAT_ROBUST_MODE ) {
+        if (stats->options & PS_STAT_ROBUST_MODE) {
             stats->robustMode = stats->clippedMean;
         }
-        if ( stats->options & PS_STAT_ROBUST_STDEV ) {
+        if (stats->options & PS_STAT_ROBUST_STDEV) {
             stats->robustStdev = 0.0;
         }
-        if ( stats->options & PS_STAT_ROBUST_QUARTILE ) {
+        if (stats->options & PS_STAT_ROBUST_QUARTILE) {
             stats->robustUQ = stats->clippedMean;
             stats->robustLQ = stats->clippedMean;
@@ -1235,32 +1168,27 @@
         stats->robustNfit = 0.0;
         stats->robustN50 = 0.0;
-        psFree( tmpStats );
-        return ;
-    }
-
+        psFree(tmpStats);
+        return;
+    }
     // Determine minimum and maximum values in the data vector.
-    if ( isnan( stats->min ) ) {
-        p_psVectorMin( myVector, maskVector, maskVal, stats );
-    }
-    if ( isnan( stats->max ) ) {
-        p_psVectorMax( myVector, maskVector, maskVal, stats );
-    }
-
+    if (isnan(stats->min)) {
+        p_psVectorMin(myVector, maskVector, maskVal, stats);
+    }
+    if (isnan(stats->max)) {
+        p_psVectorMax(myVector, maskVector, maskVal, stats);
+    }
     // Create the histogram structure.  NOTE: we can not specify the bin size
     // precisely since the argument to psHistogramAlloc() is the number of
     // bins, not the binSize.  Also, if we get here, we know that
     // binSize != 0.0.
-    numBins = ( int ) ( ( stats->max - stats->min ) / binSize );
-    robustHistogram = psHistogramAlloc( stats->min,
-                                        stats->max,
-                                        numBins );
+    numBins = (int)((stats->max - stats->min) / binSize);
+    robustHistogram = psHistogramAlloc(stats->min, stats->max, numBins);
 
     // Populate the histogram array.
-    psVectorHistogram( robustHistogram, myVector, maskVector, maskVal );
+    psVectorHistogram(robustHistogram, myVector, maskVector, maskVal);
 
     // Smooth the histogram.
     // XXX: is that the right stdev?
-    robustHistogramVector = p_psVectorsmoothHistGaussian( robustHistogram,
-                            tmpStats->clippedStdev / 4.0f );
+    robustHistogramVector = p_psVectorsmoothHistGaussian(robustHistogram, tmpStats->clippedStdev / 4.0f);
 
     // The following was necessary to fit a gaussian to the data, since
@@ -1274,17 +1202,16 @@
     // index position i is equal to the sum of bins 0:i.  This will be used
     // now and later in determining the lower/upper quartiles.
-    cumulativeRobustSumsFullRange = psVectorAlloc( robustHistogramVector->n, PS_TYPE_F32 );
-    cumulativeRobustSumsFullRange->data.F32[ 0 ] = robustHistogramVector->data.F32[ 0 ];
-    for ( i = 1;i < robustHistogramVector->n;i++ ) {
-        cumulativeRobustSumsFullRange->data.F32[ i ] =
-            cumulativeRobustSumsFullRange->data.F32[ i - 1 ] +
-            robustHistogramVector->data.F32[ i ];
-    }
-    sumRobust = cumulativeRobustSumsFullRange->data.F32[ robustHistogramVector->n - 1 ];
+    cumulativeRobustSumsFullRange = psVectorAlloc(robustHistogramVector->n, PS_TYPE_F32);
+    cumulativeRobustSumsFullRange->data.F32[0] = robustHistogramVector->data.F32[0];
+    for (i = 1; i < robustHistogramVector->n; i++) {
+        cumulativeRobustSumsFullRange->data.F32[i] =
+            cumulativeRobustSumsFullRange->data.F32[i - 1] + robustHistogramVector->data.F32[i];
+    }
+    sumRobust = cumulativeRobustSumsFullRange->data.F32[robustHistogramVector->n - 1];
 
     // Determine the bin number containing the lower quartile point.
     LQBinNum = -1;
-    for ( i = 0;i < cumulativeRobustSumsFullRange->n;i++ ) {
-        if ( cumulativeRobustSumsFullRange->data.F32[ i ] >= ( sumRobust / 4.0 ) ) {
+    for (i = 0; i < cumulativeRobustSumsFullRange->n; i++) {
+        if (cumulativeRobustSumsFullRange->data.F32[i] >= (sumRobust / 4.0)) {
             LQBinNum = i;
             break;
@@ -1294,6 +1221,6 @@
     // Determine the bin number containing the upper quartile point.
     UQBinNum = -1;
-    for ( i = cumulativeRobustSumsFullRange->n - 1;i >= 0;i-- ) {
-        if ( cumulativeRobustSumsFullRange->data.F32[ i ] <= ( 3.0 * sumRobust / 4.0 ) ) {
+    for (i = cumulativeRobustSumsFullRange->n - 1; i >= 0; i--) {
+        if (cumulativeRobustSumsFullRange->data.F32[i] <= (3.0 * sumRobust / 4.0)) {
             UQBinNum = i;
             break;
@@ -1301,8 +1228,8 @@
     }
 
-    if ( ( LQBinNum == -1 ) ||
-            ( UQBinNum == -1 ) ) {
-        psAbort( __func__, "Could not determine the robust lower/upper quartiles." );
-    }
+    if ((LQBinNum == -1) || (UQBinNum == -1)) {
+        psAbort(__func__, "Could not determine the robust lower/upper quartiles.");
+    }
+
     /**************************************************************************
     Determine the mode in the range LQ:UQ.
@@ -1310,35 +1237,34 @@
     // Determine the bin with the peak value in the range LQ to UQ.
     maxBinNum = LQBinNum;
-    maxBinCount = robustHistogramVector->data.F32[ LQBinNum ];
-    sumN50 = ( float ) robustHistogram->nums->data.S32[ LQBinNum ];
-    for ( i = LQBinNum + 1;i <= UQBinNum;i++ ) {
-        if ( robustHistogramVector->data.F32[ i ] > maxBinCount ) {
+    maxBinCount = robustHistogramVector->data.F32[LQBinNum];
+    sumN50 = (float)robustHistogram->nums->data.S32[LQBinNum];
+    for (i = LQBinNum + 1; i <= UQBinNum; i++) {
+        if (robustHistogramVector->data.F32[i] > maxBinCount) {
             maxBinNum = i;
-            maxBinCount = robustHistogramVector->data.F32[ i ];
-        }
-        sumN50 += ( float ) robustHistogram->nums->data.S32[ i ];
+            maxBinCount = robustHistogramVector->data.F32[i];
+        }
+        sumN50 += (float)robustHistogram->nums->data.S32[i];
     }
 
     // XXX: is dL defined as the value at the LQ/UQ, or the bin number?
-    dL = ( UQBinNum - LQBinNum ) / 4;
-
-    printf( "(LQBinNum, UQBinNum, maxBinNum) is (%d, %d, %d)\n", LQBinNum, UQBinNum, maxBinNum );
+    dL = (UQBinNum - LQBinNum) / 4;
+
+    printf("(LQBinNum, UQBinNum, maxBinNum) is (%d, %d, %d)\n", LQBinNum, UQBinNum, maxBinNum);
 
     /**************************************************************************
     Determine the mean/stdev for the bins in the range mode-dL to mode+dL
     **************************************************************************/
-    cumulativeRobustSumsDlRange = psVectorAlloc( robustHistogramVector->n, PS_TYPE_F32 );
-    for ( i = 0;i < robustHistogramVector->n;i++ ) {
-        cumulativeRobustSumsDlRange->data.F32[ i ] = 0.0;
+    cumulativeRobustSumsDlRange = psVectorAlloc(robustHistogramVector->n, PS_TYPE_F32);
+    for (i = 0; i < robustHistogramVector->n; i++) {
+        cumulativeRobustSumsDlRange->data.F32[i] = 0.0;
     }
     sumNfit = 0.0;
     cumulativeMedian = 0.0;
-    for ( i = maxBinNum - dL;i <= maxBinNum + dL;i++ ) {
-        if ( ( 0 <= i ) && ( i < robustHistogramVector->n ) ) {
-            cumulativeRobustSumsDlRange->data.F32[ i ] =
-                cumulativeRobustSumsDlRange->data.F32[ i - 1 ] +
-                robustHistogramVector->data.F32[ i ];
-            cumulativeMedian += robustHistogramVector->data.F32[ i ];
-            sumNfit += ( float ) robustHistogram->nums->data.S32[ i ];
+    for (i = maxBinNum - dL; i <= maxBinNum + dL; i++) {
+        if ((0 <= i) && (i < robustHistogramVector->n)) {
+            cumulativeRobustSumsDlRange->data.F32[i] =
+                cumulativeRobustSumsDlRange->data.F32[i - 1] + robustHistogramVector->data.F32[i];
+            cumulativeMedian += robustHistogramVector->data.F32[i];
+            sumNfit += (float)robustHistogram->nums->data.S32[i];
         }
     }
@@ -1348,10 +1274,9 @@
     // that bin (this is a non-exact approximation).
     myMean = 0.0;
-    for ( i = maxBinNum - dL;i <= maxBinNum + dL;i++ ) {
-        if ( ( 0 <= i ) && ( i < robustHistogramVector->n ) ) {
-            myMean += ( robustHistogramVector->data.F32[ i ] ) * 0.5 *
-                      ( robustHistogram->bounds->data.F32[ i + 1 ] +
-                        robustHistogram->bounds->data.F32[ i ] );
-            countFloat += robustHistogramVector->data.F32[ i ];
+    for (i = maxBinNum - dL; i <= maxBinNum + dL; i++) {
+        if ((0 <= i) && (i < robustHistogramVector->n)) {
+            myMean += (robustHistogramVector->data.F32[i]) * 0.5 *
+                      (robustHistogram->bounds->data.F32[i + 1] + robustHistogram->bounds->data.F32[i]);
+            countFloat += robustHistogramVector->data.F32[i];
         }
     }
@@ -1361,31 +1286,29 @@
     // mode-dL to mode+dL.  We use the midpoint of each bin as the mean for
     // that bin.
-    for ( i = maxBinNum - dL;i <= maxBinNum + dL;i++ ) {
-        if ( ( 0 <= i ) && ( i < robustHistogramVector->n ) ) {
-            diff = ( 0.5 * ( robustHistogram->bounds->data.F32[ i + 1 ] +
-                             robustHistogram->bounds->data.F32[ i ] ) ) - myMean;
-            sumSquares += diff * diff * robustHistogramVector->data.F32[ i ];
-            sumDiffs += diff * robustHistogramVector->data.F32[ i ];
-        }
-    }
-    myStdev = sqrt( ( sumSquares - ( sumDiffs * sumDiffs / countFloat ) ) / ( countFloat - 1 ) );
+    for (i = maxBinNum - dL; i <= maxBinNum + dL; i++) {
+        if ((0 <= i) && (i < robustHistogramVector->n)) {
+            diff = (0.5 * (robustHistogram->bounds->data.F32[i + 1] +
+                           robustHistogram->bounds->data.F32[i])) - myMean;
+            sumSquares += diff * diff * robustHistogramVector->data.F32[i];
+            sumDiffs += diff * robustHistogramVector->data.F32[i];
+        }
+    }
+    myStdev = sqrt((sumSquares - (sumDiffs * sumDiffs / countFloat)) / (countFloat - 1));
 
     /**************************************************************************
     Set the appropriate members in the output stats struct.
     **************************************************************************/
-    if ( stats->options & PS_STAT_ROBUST_MEAN ) {
+    if (stats->options & PS_STAT_ROBUST_MEAN) {
         stats->robustMean = myMean;
     }
 
-    if ( stats->options & PS_STAT_ROBUST_MODE ) {
+    if (stats->options & PS_STAT_ROBUST_MODE) {
         stats->robustMode = 0.5 *
-                            ( robustHistogram->bounds->data.F32[ maxBinNum ] +
-                              robustHistogram->bounds->data.F32[ maxBinNum + 1 ] );
-    }
-
-    if ( stats->options & PS_STAT_ROBUST_STDEV ) {
+                            (robustHistogram->bounds->data.F32[maxBinNum] + robustHistogram->bounds->data.F32[maxBinNum + 1]);
+    }
+
+    if (stats->options & PS_STAT_ROBUST_STDEV) {
         stats->robustStdev = myStdev;
     }
-
     // To determine the median (and later, the lower/upper quartile), we fit
     // a quadratic to the three bins surrounding the bin containing the median.
@@ -1394,49 +1317,46 @@
     // this bin.  We then solve the quadratic for
 
-    if ( stats->options & PS_STAT_ROBUST_MEDIAN ) {
-        if ( ( maxBinNum > 0 ) && ( maxBinNum < ( robustHistogram->nums->n - 1 ) ) ) {
-            x->data.F64[ 0 ] = ( double ) 0.5 *
-                               ( robustHistogram->bounds->data.F32[ maxBinNum - 1 ] +
-                                 robustHistogram->bounds->data.F32[ maxBinNum ] );
-            x->data.F64[ 1 ] = ( double ) 0.5 *
-                               ( robustHistogram->bounds->data.F32[ maxBinNum ] +
-                                 robustHistogram->bounds->data.F32[ maxBinNum + 1 ] );
-            x->data.F64[ 2 ] = ( double ) 0.5 *
-                               ( robustHistogram->bounds->data.F32[ maxBinNum + 1 ] +
-                                 robustHistogram->bounds->data.F32[ maxBinNum + 2 ] );
-
-            y->data.F64[ 0 ] = cumulativeRobustSumsDlRange->data.F32[ maxBinNum - 1 ];
-            y->data.F64[ 1 ] = cumulativeRobustSumsDlRange->data.F32[ maxBinNum ];
-            y->data.F64[ 2 ] = cumulativeRobustSumsDlRange->data.F32[ maxBinNum + 1 ];
+    if (stats->options & PS_STAT_ROBUST_MEDIAN) {
+        if ((maxBinNum > 0) && (maxBinNum < (robustHistogram->nums->n - 1))) {
+            x->data.F64[0] = (double)0.5 *
+                             (robustHistogram->bounds->data.F32[maxBinNum - 1] +
+                              robustHistogram->bounds->data.F32[maxBinNum]);
+            x->data.F64[1] = (double)0.5 *
+                             (robustHistogram->bounds->data.F32[maxBinNum] +
+                              robustHistogram->bounds->data.F32[maxBinNum + 1]);
+            x->data.F64[2] = (double)0.5 *
+                             (robustHistogram->bounds->data.F32[maxBinNum + 1] +
+                              robustHistogram->bounds->data.F32[maxBinNum + 2]);
+
+            y->data.F64[0] = cumulativeRobustSumsDlRange->data.F32[maxBinNum - 1];
+            y->data.F64[1] = cumulativeRobustSumsDlRange->data.F32[maxBinNum];
+            y->data.F64[2] = cumulativeRobustSumsDlRange->data.F32[maxBinNum + 1];
 
             // Ensure that cumulativeMedian/2 is actually within the range of the bins
             // we are using.
             cumulativeMedian *= 0.5;
-            if ( !( ( y->data.F64[ 0 ] <= cumulativeMedian ) &&
-                    ( cumulativeMedian <= y->data.F64[ 2 ] ) ) ) {
-                printf( "((%f), %f, %f)\n", cumulativeMedian, y->data.F64[ 0 ], y->data.F64[ 2 ] );
-                psAbort( __func__, "p_psVectorRobustStats(1): midpoint not within y-range\n" );
+            if (!((y->data.F64[0] <= cumulativeMedian) && (cumulativeMedian <= y->data.F64[2]))) {
+                printf("((%f), %f, %f)\n", cumulativeMedian, y->data.F64[0], y->data.F64[2]);
+                psAbort(__func__, "p_psVectorRobustStats(1): midpoint not within y-range\n");
             }
             // XXX: yErr is not currently used by psVectorFitPolynomial1D().  We
             // may have to set this meaningfully later.
-            yErr->data.F64[ 0 ] = 1.0;
-            yErr->data.F64[ 1 ] = 1.0;
-            yErr->data.F64[ 2 ] = 1.0;
+            yErr->data.F64[0] = 1.0;
+            yErr->data.F64[1] = 1.0;
+            yErr->data.F64[2] = 1.0;
 
             // Determine the coefficients of the polynomial.
-            myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
+            myPoly = psVectorFitPolynomial1D(myPoly, x, y, yErr);
             // Call p_ps1DPolyMedian(), which does a binary search on the
             // polynomial, looking for the value x such that
             // f(x) = cumulativeMedian.
-            stats->robustMedian = p_ps1DPolyMedian( myPoly, x->data.F64[ 0 ],
-                                                    x->data.F64[ 2 ], cumulativeMedian );
+            stats->robustMedian = p_ps1DPolyMedian(myPoly, x->data.F64[0], x->data.F64[2], cumulativeMedian);
         } else {
             // If the mode is the first/last histogram bin, then simply use
             // the midpoint of that bin.
-            stats->robustMedian = 0.5 * ( robustHistogram->bounds->data.F32[ maxBinNum + 1 ] +
-                                          robustHistogram->bounds->data.F32[ maxBinNum ] );
-        }
-    }
-
+            stats->robustMedian = 0.5 * (robustHistogram->bounds->data.F32[maxBinNum + 1] +
+                                         robustHistogram->bounds->data.F32[maxBinNum]);
+        }
+    }
     // The lower/upper quartile calculations are very similar to the median
     // calculations.  We fit a quadratic to the array containing the
@@ -1444,78 +1364,72 @@
     // f(x) equals the lower/upper quartile exactly.
     //
-    if ( stats->options & PS_STAT_ROBUST_QUARTILE ) {
-        countFloat = cumulativeRobustSumsFullRange->data.F32[ robustHistogramVector->n - 1 ];
-
-        if ( ( LQBinNum > 0 ) && ( LQBinNum < ( robustHistogram->nums->n - 1 ) ) ) {
-            x->data.F64[ 0 ] = ( double ) 0.5 *
-                               ( robustHistogram->bounds->data.F32[ LQBinNum - 1 ] +
-                                 robustHistogram->bounds->data.F32[ LQBinNum ] );
-            x->data.F64[ 1 ] = ( double ) 0.5 *
-                               ( robustHistogram->bounds->data.F32[ LQBinNum ] +
-                                 robustHistogram->bounds->data.F32[ LQBinNum + 1 ] );
-            x->data.F64[ 2 ] = ( double ) 0.5 *
-                               ( robustHistogram->bounds->data.F32[ LQBinNum + 1 ] +
-                                 robustHistogram->bounds->data.F32[ LQBinNum + 2 ] );
-
-            y->data.F64[ 0 ] = cumulativeRobustSumsFullRange->data.F32[ LQBinNum - 1 ];
-            y->data.F64[ 1 ] = cumulativeRobustSumsFullRange->data.F32[ LQBinNum ];
-            y->data.F64[ 2 ] = cumulativeRobustSumsFullRange->data.F32[ LQBinNum + 1 ];
-
-            if ( !( ( y->data.F64[ 0 ] <= ( countFloat / 4.0 ) ) &&
-                    ( ( countFloat / 4.0 ) <= y->data.F64[ 2 ] ) ) ) {
-                psAbort( __func__, "p_psVectorRobustStats(2): midpoint not within y-range\n" );
-            }
-
-            yErr->data.F64[ 0 ] = 1.0;
-            yErr->data.F64[ 1 ] = 1.0;
-            yErr->data.F64[ 2 ] = 1.0;
-
-            myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
-            stats->robustLQ = p_ps1DPolyMedian( myPoly,
-                                                x->data.F64[ 0 ],
-                                                x->data.F64[ 2 ],
-                                                countFloat / 4.0 );
+    if (stats->options & PS_STAT_ROBUST_QUARTILE) {
+        countFloat = cumulativeRobustSumsFullRange->data.F32[robustHistogramVector->n - 1];
+
+        if ((LQBinNum > 0) && (LQBinNum < (robustHistogram->nums->n - 1))) {
+            x->data.F64[0] = (double)0.5 *
+                             (robustHistogram->bounds->data.F32[LQBinNum - 1] +
+                              robustHistogram->bounds->data.F32[LQBinNum]);
+            x->data.F64[1] = (double)0.5 *
+                             (robustHistogram->bounds->data.F32[LQBinNum] +
+                              robustHistogram->bounds->data.F32[LQBinNum + 1]);
+            x->data.F64[2] = (double)0.5 *
+                             (robustHistogram->bounds->data.F32[LQBinNum + 1] +
+                              robustHistogram->bounds->data.F32[LQBinNum + 2]);
+
+            y->data.F64[0] = cumulativeRobustSumsFullRange->data.F32[LQBinNum - 1];
+            y->data.F64[1] = cumulativeRobustSumsFullRange->data.F32[LQBinNum];
+            y->data.F64[2] = cumulativeRobustSumsFullRange->data.F32[LQBinNum + 1];
+
+            if (!((y->data.F64[0] <= (countFloat / 4.0)) && ((countFloat / 4.0) <= y->data.F64[2]))) {
+                psAbort(__func__, "p_psVectorRobustStats(2): midpoint not within y-range\n");
+            }
+
+            yErr->data.F64[0] = 1.0;
+            yErr->data.F64[1] = 1.0;
+            yErr->data.F64[2] = 1.0;
+
+            myPoly = psVectorFitPolynomial1D(myPoly, x, y, yErr);
+            stats->robustLQ = p_ps1DPolyMedian(myPoly, x->data.F64[0], x->data.F64[2], countFloat / 4.0);
 
         } else {
             // If the LQ is the first/last histogram bin, then simply use
             // the midpoint of that bin.
-            stats->robustLQ = 0.5 * ( robustHistogram->bounds->data.F32[ LQBinNum + 1 ] +
-                                      robustHistogram->bounds->data.F32[ LQBinNum ] );
-        }
-
-        if ( ( UQBinNum > 0 ) && ( UQBinNum < ( robustHistogram->nums->n - 1 ) ) ) {
-            x->data.F64[ 0 ] = ( double ) 0.5 *
-                               ( robustHistogram->bounds->data.F32[ UQBinNum - 1 ] +
-                                 robustHistogram->bounds->data.F32[ UQBinNum ] );
-            x->data.F64[ 1 ] = ( double ) 0.5 *
-                               ( robustHistogram->bounds->data.F32[ UQBinNum ] +
-                                 robustHistogram->bounds->data.F32[ UQBinNum + 1 ] );
-            x->data.F64[ 2 ] = ( double ) 0.5 *
-                               ( robustHistogram->bounds->data.F32[ UQBinNum + 1 ] +
-                                 robustHistogram->bounds->data.F32[ UQBinNum + 2 ] );
-
-            y->data.F64[ 0 ] = cumulativeRobustSumsFullRange->data.F32[ UQBinNum - 1 ];
-            y->data.F64[ 1 ] = cumulativeRobustSumsFullRange->data.F32[ UQBinNum ];
-            y->data.F64[ 2 ] = cumulativeRobustSumsFullRange->data.F32[ UQBinNum + 1 ];
-
-            if ( !( ( y->data.F64[ 0 ] <= ( 3.0 * countFloat / 4.0 ) ) &&
-                    ( ( 3.0 * countFloat / 4.0 ) <= y->data.F64[ 2 ] ) ) ) {
-                psAbort( __func__, "p_psVectorRobustStats(3): midpoint not within y-range\n" );
-            }
-
-            yErr->data.F64[ 0 ] = 1.0;
-            yErr->data.F64[ 1 ] = 1.0;
-            yErr->data.F64[ 2 ] = 1.0;
-
-            myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
-            stats->robustUQ = p_ps1DPolyMedian( myPoly,
-                                                x->data.F64[ 0 ],
-                                                x->data.F64[ 2 ],
-                                                3.0 * countFloat / 4.0 );
+            stats->robustLQ = 0.5 * (robustHistogram->bounds->data.F32[LQBinNum + 1] +
+                                     robustHistogram->bounds->data.F32[LQBinNum]);
+        }
+
+        if ((UQBinNum > 0) && (UQBinNum < (robustHistogram->nums->n - 1))) {
+            x->data.F64[0] = (double)0.5 *
+                             (robustHistogram->bounds->data.F32[UQBinNum - 1] +
+                              robustHistogram->bounds->data.F32[UQBinNum]);
+            x->data.F64[1] = (double)0.5 *
+                             (robustHistogram->bounds->data.F32[UQBinNum] +
+                              robustHistogram->bounds->data.F32[UQBinNum + 1]);
+            x->data.F64[2] = (double)0.5 *
+                             (robustHistogram->bounds->data.F32[UQBinNum + 1] +
+                              robustHistogram->bounds->data.F32[UQBinNum + 2]);
+
+            y->data.F64[0] = cumulativeRobustSumsFullRange->data.F32[UQBinNum - 1];
+            y->data.F64[1] = cumulativeRobustSumsFullRange->data.F32[UQBinNum];
+            y->data.F64[2] = cumulativeRobustSumsFullRange->data.F32[UQBinNum + 1];
+
+            if (!((y->data.F64[0] <= (3.0 * countFloat / 4.0)) &&
+                    ((3.0 * countFloat / 4.0) <= y->data.F64[2]))) {
+                psAbort(__func__, "p_psVectorRobustStats(3): midpoint not within y-range\n");
+            }
+
+            yErr->data.F64[0] = 1.0;
+            yErr->data.F64[1] = 1.0;
+            yErr->data.F64[2] = 1.0;
+
+            myPoly = psVectorFitPolynomial1D(myPoly, x, y, yErr);
+            stats->robustUQ = p_ps1DPolyMedian(myPoly,
+                                               x->data.F64[0], x->data.F64[2], 3.0 * countFloat / 4.0);
         } else {
             // If the UQ is the first/last histogram bin, then simply use
             // the midpoint of that bin.
-            stats->robustUQ = 0.5 * ( robustHistogram->bounds->data.F32[ UQBinNum + 1 ] +
-                                      robustHistogram->bounds->data.F32[ UQBinNum ] );
+            stats->robustUQ = 0.5 * (robustHistogram->bounds->data.F32[UQBinNum + 1] +
+                                     robustHistogram->bounds->data.F32[UQBinNum]);
         }
     }
@@ -1523,15 +1437,13 @@
     stats->robustN50 = sumN50;
 
-    psFree( x );
-    psFree( y );
-    psFree( yErr );
-    psFree( tmpStats );
-    psFree( robustHistogram );
-    psFree( myPoly );
-    psFree( cumulativeRobustSumsFullRange );
-    psFree( cumulativeRobustSumsDlRange );
-}
-
-
+    psFree(x);
+    psFree(y);
+    psFree(yErr);
+    psFree(tmpStats);
+    psFree(robustHistogram);
+    psFree(myPoly);
+    psFree(cumulativeRobustSumsFullRange);
+    psFree(cumulativeRobustSumsDlRange);
+}
 
 /*
@@ -1582,19 +1494,20 @@
 */
 
-
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
+
 /*****************************************************************************/
 
-static void histogramFree( psHistogram *myHist );
+static void histogramFree(psHistogram * myHist);
 
 /******************************************************************************
     psStatsAlloc(): This routine must create a new psStats data structure.
  *****************************************************************************/
-psStats *psStatsAlloc( psStatsOptions options )
-{
-    psStats * newStruct = NULL;
-
-    newStruct = ( psStats * ) psAlloc( sizeof( psStats ) );
+psStats *psStatsAlloc(psStatsOptions options)
+{
+    psStats *newStruct = NULL;
+
+    newStruct = (psStats *) psAlloc(sizeof(psStats));
     newStruct->sampleMean = NAN;
     newStruct->sampleMedian = NAN;
@@ -1620,5 +1533,5 @@
     newStruct->options = options;
 
-    return ( newStruct );
+    return (newStruct);
 }
 
@@ -1635,46 +1548,42 @@
     The histogram structure
  *****************************************************************************/
-psHistogram *psHistogramAlloc( float lower,
-                               float upper,
-                               int n )
-{
-    int i = 0;                          // Loop index variable
+psHistogram *psHistogramAlloc(float lower, float upper, int n)
+{
+    int i = 0;                  // Loop index variable
     psHistogram *newHist = NULL;        // The new histogram structure
-    float binSize = 0.0;                // The histogram bin size
+    float binSize = 0.0;        // The histogram bin size
 
     // NOTE: Verify that this is the correct action.
-    if ( n == 0 ) {
-        return ( NULL );
-    }
-    if ( n < 0 ) {
-        psAbort( __func__, "psHistogramAlloc() called with bin size %d.\n", n );
-    }
-
+    if (n == 0) {
+        return (NULL);
+    }
+    if (n < 0) {
+        psAbort(__func__, "psHistogramAlloc() called with bin size %d.\n", n);
+    }
     // NOTE: Verify that this is the correct action.
-    if ( lower > upper ) {
-        return ( NULL );
-    }
-
+    if (lower > upper) {
+        return (NULL);
+    }
     // Allocate memory for the new histogram structure.  If there are N
     // bins, then there are N+1 bounds to those bins.
-    newHist = ( psHistogram * ) psAlloc( sizeof( psHistogram ) );
-    p_psMemSetDeallocator( newHist, ( psFreeFcn ) histogramFree );
-    newHist->bounds = psVectorAlloc( n + 1, PS_TYPE_F32 );
+    newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
+    p_psMemSetDeallocator(newHist, (psFreeFcn) histogramFree);
+    newHist->bounds = psVectorAlloc(n + 1, PS_TYPE_F32);
     newHist->bounds->n = newHist->bounds->nalloc;
 
     // Calculate the bounds for each bin.
-    binSize = ( upper - lower ) / ( float ) n;
-    // NOTE: Is the following necessary?  It prevents the max data point
+    binSize = (upper - lower) / (float)n;
+    // NOTE: Is the following necessary? It prevents the max data point
     // from being in a non-existant bin.
     binSize += FLT_EPSILON;
-    for ( i = 0;i < n + 1;i++ ) {
-        newHist->bounds->data.F32[ i ] = lower + ( binSize * ( float ) i );
+    for (i = 0; i < n + 1; i++) {
+        newHist->bounds->data.F32[i] = lower + (binSize * (float)i);
     }
 
     // Allocate the bins, and initialize them to zero.
-    newHist->nums = psVectorAlloc( n, PS_TYPE_U32 );
+    newHist->nums = psVectorAlloc(n, PS_TYPE_U32);
     newHist->nums->n = newHist->nums->nalloc;
-    for ( i = 0;i < newHist->nums->n;i++ ) {
-        newHist->nums->data.U32[ i ] = 0;
+    for (i = 0; i < newHist->nums->n; i++) {
+        newHist->nums->data.U32[i] = 0;
     }
 
@@ -1684,5 +1593,5 @@
     newHist->uniform = true;
 
-    return ( newHist );
+    return (newHist);
 }
 
@@ -1696,41 +1605,39 @@
     The histogram structure
  *****************************************************************************/
-psHistogram *psHistogramAllocGeneric( const psVector *restrict bounds )
-{
-    psHistogram * newHist = NULL;        // The new histogram structure
-    int i;                              // Loop index variable
+psHistogram *psHistogramAllocGeneric(const psVector * restrict bounds)
+{
+    psHistogram *newHist = NULL;        // The new histogram structure
+    int i;                      // Loop index variable
 
     // NOTE: Verify that this is the correct action.
-    if ( bounds == NULL ) {
+    if (bounds == NULL) {
         // psAbort(__func__, "psHistogram requested with NULL bounds");
-        return ( NULL );
-    }
-
+        return (NULL);
+    }
     // NOTE: Verify that this is the correct action.
-    if ( bounds->n <= 1 ) {
+    if (bounds->n <= 1) {
         // psAbort(__func__, "psHistogram requested with NULL bounds");
-        return ( NULL );
-    }
-
-    if ( bounds->type.type != PS_TYPE_F32 ) {
+        return (NULL);
+    }
+
+    if (bounds->type.type != PS_TYPE_F32) {
         // psAbort(__func__, "psHistogram request a bound which is not type F32");
-        return ( NULL );
-    }
-
+        return (NULL);
+    }
     // Allocate memory for the new histogram structure.
-    newHist = ( psHistogram * ) psAlloc( sizeof( psHistogram ) );
-    p_psMemSetDeallocator( newHist, ( psFreeFcn ) histogramFree );
-    newHist->bounds = psVectorAlloc( bounds->n, PS_TYPE_F32 );
+    newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
+    p_psMemSetDeallocator(newHist, (psFreeFcn) histogramFree);
+    newHist->bounds = psVectorAlloc(bounds->n, PS_TYPE_F32);
     newHist->bounds->n = newHist->bounds->nalloc;
-    for ( i = 0;i < bounds->n;i++ ) {
-        newHist->bounds->data.F32[ i ] = bounds->data.F32[ i ];
+    for (i = 0; i < bounds->n; i++) {
+        newHist->bounds->data.F32[i] = bounds->data.F32[i];
     }
 
     // Allocate the bins, and initialize them to zero.  If there are N bounds,
     // then there are N-1 bins.
-    newHist->nums = psVectorAlloc( ( bounds->n ) - 1, PS_TYPE_U32 );
+    newHist->nums = psVectorAlloc((bounds->n) - 1, PS_TYPE_U32);
     newHist->nums->n = newHist->nums->nalloc;
-    for ( i = 0;i < newHist->nums->n;i++ ) {
-        newHist->nums->data.U32[ i ] = 0;
+    for (i = 0; i < newHist->nums->n; i++) {
+        newHist->nums->data.U32[i] = 0;
     }
 
@@ -1740,13 +1647,12 @@
     newHist->uniform = false;
 
-    return ( newHist );
-}
-
-static void histogramFree( psHistogram *myHist )
-{
-    psFree( myHist->bounds );
-    psFree( myHist->nums );
-}
-
+    return (newHist);
+}
+
+static void histogramFree(psHistogram * myHist)
+{
+    psFree(myHist->bounds);
+    psFree(myHist->nums);
+}
 
 /*****************************************************************************
@@ -1764,49 +1670,41 @@
     The histogram structure "out".
  *****************************************************************************/
-psHistogram *psVectorHistogram( psHistogram *out,
-                                const psVector *restrict in,
-                                const psVector *restrict mask,
-                                unsigned int maskVal )
-{
-    int i = 0;                                  // Loop index variable
-    int j = 0;                                  // Loop index variable
-    float binSize = 0.0;                        // Histogram bin size
-    int binNum = 0;                             // A temporary bin number
-    int numBins = 0;                            // The total number of bins
+psHistogram *psVectorHistogram(psHistogram * out,
+                               const psVector * restrict in,
+                               const psVector * restrict mask, unsigned int maskVal)
+{
+    int i = 0;                  // Loop index variable
+    int j = 0;                  // Loop index variable
+    float binSize = 0.0;        // Histogram bin size
+    int binNum = 0;             // A temporary bin number
+    int numBins = 0;            // The total number of bins
 
     // NOTE: Verify that this is the correct action.
-    if ( out == NULL ) {
-        return ( NULL );
-    }
-
+    if (out == NULL) {
+        return (NULL);
+    }
     // Check the specified output histogram for type psF32
-    if ( out->bounds->type.type != PS_TYPE_F32 ) {
-        psAbort( __func__,
-                 "Only data type PS_TYPE_F32 for the output.bounds member." );
-    }
-
-    if ( out->nums->type.type != PS_TYPE_U32 ) {
-        psAbort( __func__,
-                 "Only data type PS_TYPE_U32 for output.nums member." );
-    }
-
+    if (out->bounds->type.type != PS_TYPE_F32) {
+        psAbort(__func__, "Only data type PS_TYPE_F32 for the output.bounds member.");
+    }
+
+    if (out->nums->type.type != PS_TYPE_U32) {
+        psAbort(__func__, "Only data type PS_TYPE_U32 for output.nums member.");
+    }
     // NOTE: Verify that this is the correct action.
-    if ( in == NULL ) {
-        return ( out );
-    }
-
-    if ( in->type.type != PS_TYPE_F32 ) {
-        psAbort( __func__,
-                 "Only data type PS_TYPE_F32 is currently supported (0x%x).",
-                 in->type.type );
-    }
-
-    if ( mask != NULL ) {
-        if ( in->n != mask->n ) {
-            psAbort( __func__,
-                     "Vector data and vector mask are of different sizes." );
-        }
-        if ( mask->type.type != PS_TYPE_U8 ) {
-            psAbort( __func__, "Vector mask must be type PS_TYPE_U8" );
+    if (in == NULL) {
+        return (out);
+    }
+
+    if (in->type.type != PS_TYPE_F32) {
+        psAbort(__func__, "Only data type PS_TYPE_F32 is currently supported (0x%x).", in->type.type);
+    }
+
+    if (mask != NULL) {
+        if (in->n != mask->n) {
+            psAbort(__func__, "Vector data and vector mask are of different sizes.");
+        }
+        if (mask->type.type != PS_TYPE_U8) {
+            psAbort(__func__, "Vector mask must be type PS_TYPE_U8");
         }
     }
@@ -1815,50 +1713,47 @@
 
     numBins = out->nums->n;
-    for ( i = 0;i < in->n;i++ ) {
+    for (i = 0; i < in->n; i++) {
         // Check if this pixel is masked, and if so, skip it.
-        if ( ( mask == NULL ) ||
-                ( ( mask != NULL ) && ( !( mask->data.U8[ i ] & maskVal ) ) ) ) {
+        if ((mask == NULL) || ((mask != NULL) && (!(mask->data.U8[i] & maskVal)))) {
             // Check if this pixel is below the minimum value, and if so
             // count it, then skip it.
-            if ( in->data.F32[ i ] < out->bounds->data.F32[ 0 ] ) {
+            if (in->data.F32[i] < out->bounds->data.F32[0]) {
                 out->minNum++;
                 // Check if this pixel is above the maximum value, and if so
                 // count it, then skip it.
-            } else
-                if ( in->data.F32[ i ] > out->bounds->data.F32[ numBins ] ) {
-                    out->maxNum++;
+            } else if (in->data.F32[i] > out->bounds->data.F32[numBins]) {
+                out->maxNum++;
+            } else {
+                // If this is a uniform histogram, determining the correct
+                // number is trivial.
+                if (out->uniform == true) {
+                    binSize = out->bounds->data.F32[1] - out->bounds->data.F32[0];
+                    binNum = (int)((in->data.F32[i] - out->bounds->data.F32[0]) / binSize);
+
+                    // NOTE: This next if-statement really shouldn't be necessary.
+                    // However, do to numerical lack of precision, we occasionally
+                    // produce a binNum outside the range of bins.
+                    if (binNum >= out->nums->n) {
+                        binNum = out->nums->n - 1;
+                    }
+
+                    (out->nums->data.S32[binNum])++;
+
+                    // If this is a non-uniform histogram, determining the correct
+                    // bin number requires a bit more work.
                 } else {
-                    // If this is a uniform histogram, determining the correct
-                    // number is trivial.
-                    if ( out->uniform == true ) {
-                        binSize = out->bounds->data.F32[ 1 ] - out->bounds->data.F32[ 0 ];
-                        binNum = ( int ) ( ( in->data.F32[ i ] - out->bounds->data.F32[ 0 ] ) /
-                                           binSize );
-
-                        // NOTE: This next if-statement really shouldn't be necessary.
-                        // However, do to numerical lack of precision, we occasionally
-                        // produce a binNum outside the range of bins.
-                        if ( binNum >= out->nums->n ) {
-                            binNum = out->nums->n - 1;
-                        }
-
-                        ( out->nums->data.S32[ binNum ] ) ++;
-
-                        // If this is a non-uniform histogram, determining the correct
-                        // bin number requires a bit more work.
-                    } else {
-                        // NOTE: This is slow.  Put a smarter algorithm here to
-                        // find the correct bin number (bin search, probably)
-                        for ( j = 0;j < ( out->bounds->n ) - 1;j++ ) {
-                            if ( ( out->bounds->data.S32[ j ] <= in->data.F32[ i ] ) &&
-                                    ( in->data.F32[ i ] <= out->bounds->data.S32[ j + 1 ] ) ) {
-                                ( out->nums->data.S32[ j ] ) ++;
-                            }
+                    // NOTE: This is slow.  Put a smarter algorithm here to
+                    // find the correct bin number (bin search, probably)
+                    for (j = 0; j < (out->bounds->n) - 1; j++) {
+                        if ((out->bounds->data.S32[j] <= in->data.F32[i]) &&
+                                (in->data.F32[i] <= out->bounds->data.S32[j + 1])) {
+                            (out->nums->data.S32[j])++;
                         }
                     }
                 }
-        }
-    }
-    return ( out );
+            }
+        }
+    }
+    return (out);
 }
 
@@ -1872,38 +1767,31 @@
 the various stat functions.
  *****************************************************************************/
-psVector *p_psConvertToF32( psStats *stats,
-                            psVector *in,
-                            psVector *mask,
-                            unsigned int maskVal )
+psVector *p_psConvertToF32(psStats * stats, psVector * in, psVector * mask, unsigned int maskVal)
 {
     int i = 0;
     psVector *tmp = NULL;
 
-    if ( in->type.type == PS_TYPE_S32 ) {
-        tmp = psVectorAlloc( in->n, PS_TYPE_F32 );
-        for ( i = 0;i < in->n;i++ ) {
-            tmp->data.F32[ i ] = ( float ) in->data.S32[ i ];
-        }
-    } else
-        if ( in->type.type == PS_TYPE_U32 ) {
-            tmp = psVectorAlloc( in->n, PS_TYPE_F32 );
-            for ( i = 0;i < in->n;i++ ) {
-                tmp->data.F32[ i ] = ( float ) in->data.U32[ i ];
-            }
-        } else
-            if ( in->type.type == PS_TYPE_F64 ) {
-                tmp = psVectorAlloc( in->n, PS_TYPE_F32 );
-                for ( i = 0;i < in->n;i++ ) {
-                    tmp->data.F32[ i ] = ( float ) in->data.F64[ i ];
-                }
-            } else
-                if ( in->type.type == PS_TYPE_F32 ) {
-                    // do nothing
-                } else {
-                    psAbort( __func__, "unsupported vector type 0x%x\n", in->type.type );
-                }
-    return ( tmp );
-}
-
+    if (in->type.type == PS_TYPE_S32) {
+        tmp = psVectorAlloc(in->n, PS_TYPE_F32);
+        for (i = 0; i < in->n; i++) {
+            tmp->data.F32[i] = (float)in->data.S32[i];
+        }
+    } else if (in->type.type == PS_TYPE_U32) {
+        tmp = psVectorAlloc(in->n, PS_TYPE_F32);
+        for (i = 0; i < in->n; i++) {
+            tmp->data.F32[i] = (float)in->data.U32[i];
+        }
+    } else if (in->type.type == PS_TYPE_F64) {
+        tmp = psVectorAlloc(in->n, PS_TYPE_F32);
+        for (i = 0; i < in->n; i++) {
+            tmp->data.F32[i] = (float)in->data.F64[i];
+        }
+    } else if (in->type.type == PS_TYPE_F32) {
+        // do nothing
+    } else {
+        psAbort(__func__, "unsupported vector type 0x%x\n", in->type.type);
+    }
+    return (tmp);
+}
 
 /******************************************************************************
@@ -1924,93 +1812,77 @@
 macro-ize everything and add PS_TYPE_U16 and PS_TYPE_F64.
  *****************************************************************************/
-psStats *psVectorStats( psStats *stats,
-                        psVector *in,
-                        psVector *mask,
-                        unsigned int maskVal )
-{
-    psVector * inF32;
+psStats *psVectorStats(psStats * stats, psVector * in, psVector * mask, unsigned int maskVal)
+{
+    psVector *inF32;
     int mustFreeTmp = 1;
 
     // NOTE: Verify that this is the correct action.
-    if ( in == NULL ) {
-        return ( stats );
-    }
-    if ( stats == NULL ) {
-        return ( NULL );
-    }
-
-    inF32 = p_psConvertToF32( stats, in, mask, maskVal );
-    if ( inF32 == NULL ) {
+    if (in == NULL) {
+        return (stats);
+    }
+    if (stats == NULL) {
+        return (NULL);
+    }
+
+    inF32 = p_psConvertToF32(stats, in, mask, maskVal);
+    if (inF32 == NULL) {
         inF32 = in;
         mustFreeTmp = 0;
     }
-
     // XXX: Should we abort if (stats->min == stats->max)?
-    if ( ( stats->options & PS_STAT_USE_RANGE ) &&
-            ( stats->min >= stats->max ) ) {
-        psAbort( __func__, "psVectorStats() called with range: %f to %f\n",
-                 stats->min, stats->max );
-    }
-
-    //    PS_CHECK_VECTOR_TYPE(in, PS_TYPE_F32);
-    if ( mask != NULL ) {
-        PS_CHECK_NULL_VECTOR( mask );
-        PS_CHECK_EMPTY_VECTOR( mask );
-        PS_CHECK_VECTOR_SIZE_EQUAL( mask, in );
-        PS_CHECK_VECTOR_TYPE( mask, PS_TYPE_U8 );
-    }
-
+    if ((stats->options & PS_STAT_USE_RANGE) && (stats->min >= stats->max)) {
+        psAbort(__func__, "psVectorStats() called with range: %f to %f\n", stats->min, stats->max);
+    }
+    // PS_CHECK_VECTOR_TYPE(in, PS_TYPE_F32);
+    if (mask != NULL) {
+        PS_CHECK_NULL_VECTOR(mask);
+        PS_CHECK_EMPTY_VECTOR(mask);
+        PS_CHECK_VECTOR_SIZE_EQUAL(mask, in);
+        PS_CHECK_VECTOR_TYPE(mask, PS_TYPE_U8);
+    }
     // ************************************************************************
-    if ( stats->options & PS_STAT_SAMPLE_MEAN ) {
-        p_psVectorSampleMean( in, mask, maskVal, stats );
-    }
-
+    if (stats->options & PS_STAT_SAMPLE_MEAN) {
+        p_psVectorSampleMean(in, mask, maskVal, stats);
+    }
     // ************************************************************************
-    if ( stats->options & PS_STAT_SAMPLE_MEDIAN ) {
-        p_psVectorSampleMedian( in, mask, maskVal, stats );
-    }
-
+    if (stats->options & PS_STAT_SAMPLE_MEDIAN) {
+        p_psVectorSampleMedian(in, mask, maskVal, stats);
+    }
     // ************************************************************************
     // NOTE: The Stdev calculation requires the mean.  Should we assume the
-    // mean has already been calculated?  Or should we always calculate it?
-    if ( stats->options & PS_STAT_SAMPLE_STDEV ) {
-        p_psVectorSampleMean( in, mask, maskVal, stats );
-        p_psVectorSampleStdev( in, mask, maskVal, stats );
-    }
-
+    // mean has already been calculated? Or should we always calculate it?
+    if (stats->options & PS_STAT_SAMPLE_STDEV) {
+        p_psVectorSampleMean(in, mask, maskVal, stats);
+        p_psVectorSampleStdev(in, mask, maskVal, stats);
+    }
     // ************************************************************************
-    if ( stats->options & PS_STAT_SAMPLE_QUARTILE ) {
-        p_psVectorSampleQuartiles( in, mask, maskVal, stats );
-    }
-
+    if (stats->options & PS_STAT_SAMPLE_QUARTILE) {
+        p_psVectorSampleQuartiles(in, mask, maskVal, stats);
+    }
     // Since the various robust stats quantities share much computation, they
     // are grouped together in a single private function:
     // p_psVectorRobustStats()
-    if ( ( stats->options & PS_STAT_ROBUST_MEAN ) ||
-            ( stats->options & PS_STAT_ROBUST_MEDIAN ) ||
-            ( stats->options & PS_STAT_ROBUST_MODE ) ||
-            ( stats->options & PS_STAT_ROBUST_STDEV ) ||
-            ( stats->options & PS_STAT_ROBUST_QUARTILE ) ) {
-        p_psVectorRobustStats( in, mask, maskVal, stats );
-    }
-
-    if ( ( stats->options & PS_STAT_CLIPPED_MEAN ) ||
-            ( stats->options & PS_STAT_CLIPPED_STDEV ) ) {
-        p_psVectorClippedStats( in, mask, maskVal, stats );
-    }
-
+    if ((stats->options & PS_STAT_ROBUST_MEAN) ||
+            (stats->options & PS_STAT_ROBUST_MEDIAN) ||
+            (stats->options & PS_STAT_ROBUST_MODE) ||
+            (stats->options & PS_STAT_ROBUST_STDEV) || (stats->options & PS_STAT_ROBUST_QUARTILE)) {
+        p_psVectorRobustStats(in, mask, maskVal, stats);
+    }
+
+    if ((stats->options & PS_STAT_CLIPPED_MEAN) || (stats->options & PS_STAT_CLIPPED_STDEV)) {
+        p_psVectorClippedStats(in, mask, maskVal, stats);
+    }
     // ************************************************************************
-    if ( stats->options & PS_STAT_MAX ) {
-        p_psVectorMax( in, mask, maskVal, stats );
-    }
-
+    if (stats->options & PS_STAT_MAX) {
+        p_psVectorMax(in, mask, maskVal, stats);
+    }
     // ************************************************************************
-    if ( stats->options & PS_STAT_MIN ) {
-        p_psVectorMin( in, mask, maskVal, stats );
-    }
-
-    if ( mustFreeTmp == 1 ) {
-        psFree( inF32 );
-    }
-    return ( stats );
-}
+    if (stats->options & PS_STAT_MIN) {
+        p_psVectorMin(in, mask, maskVal, stats);
+    }
+
+    if (mustFreeTmp == 1) {
+        psFree(inF32);
+    }
+    return (stats);
+}
Index: /trunk/psLib/src/dataManip/psStats.h
===================================================================
--- /trunk/psLib/src/dataManip/psStats.h	(revision 1406)
+++ /trunk/psLib/src/dataManip/psStats.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psStats.h
  *  \brief basic statistical operations
@@ -9,13 +10,13 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
 #if !defined(PS_STATS_H)
-#define PS_STATS_H
+#    define PS_STATS_H
 
-#include "psVector.h"
+#    include "psVector.h"
 
 /// @addtogroup Stats
@@ -26,22 +27,21 @@
  *****************************************************************************/
 typedef enum {
-    PS_STAT_SAMPLE_MEAN           = 0x000001,
-    PS_STAT_SAMPLE_MEDIAN         = 0x000002,
-    PS_STAT_SAMPLE_STDEV          = 0x000004,
-    PS_STAT_SAMPLE_QUARTILE       = 0x000008,
-    PS_STAT_ROBUST_MEAN           = 0x000010,
-    PS_STAT_ROBUST_MEDIAN         = 0x000020,
-    PS_STAT_ROBUST_MODE           = 0x000040,
-    PS_STAT_ROBUST_STDEV          = 0x000080,
-    PS_STAT_ROBUST_QUARTILE       = 0x000100,
-    PS_STAT_CLIPPED_MEAN          = 0x000200,
-    PS_STAT_CLIPPED_STDEV         = 0x000400,
-    PS_STAT_MAX                   = 0x000800,
-    PS_STAT_MIN                   = 0x001000,
-    PS_STAT_USE_RANGE             = 0x002000,
-    PS_STAT_USE_BINSIZE           = 0x004000,
-    PS_STAT_ROBUST_FOR_SAMPLE     = 0x008000
+    PS_STAT_SAMPLE_MEAN = 0x000001,
+    PS_STAT_SAMPLE_MEDIAN = 0x000002,
+    PS_STAT_SAMPLE_STDEV = 0x000004,
+    PS_STAT_SAMPLE_QUARTILE = 0x000008,
+    PS_STAT_ROBUST_MEAN = 0x000010,
+    PS_STAT_ROBUST_MEDIAN = 0x000020,
+    PS_STAT_ROBUST_MODE = 0x000040,
+    PS_STAT_ROBUST_STDEV = 0x000080,
+    PS_STAT_ROBUST_QUARTILE = 0x000100,
+    PS_STAT_CLIPPED_MEAN = 0x000200,
+    PS_STAT_CLIPPED_STDEV = 0x000400,
+    PS_STAT_MAX = 0x000800,
+    PS_STAT_MIN = 0x001000,
+    PS_STAT_USE_RANGE = 0x002000,
+    PS_STAT_USE_BINSIZE = 0x004000,
+    PS_STAT_ROBUST_FOR_SAMPLE = 0x008000
 } psStatsOptions;
-
 
 /** This is the generic statistics structure.  It contails the data members
@@ -50,80 +50,74 @@
 typedef struct
 {
-    double sampleMean;          ///< formal mean of sample
-    double sampleMedian;        ///< formal median of sample
-    double sampleStdev;         ///< standard deviation of sample
-    double sampleUQ;            ///< upper quartile of sample
-    double sampleLQ;            ///< lower quartile of sample
-    double sampleLimit;         ///<
-    double robustMean;          ///< robust mean of array
-    double robustMedian;        ///< robust median of array
-    double robustMode;          ///< Robust mode of array
-    double robustStdev;         ///< robust standard deviation of array
-    double robustUQ;            ///< robust upper quartile
-    double robustLQ;            ///< robust lower quartile
+    double sampleMean;          // /< formal mean of sample
+    double sampleMedian;        // /< formal median of sample
+    double sampleStdev;         // /< standard deviation of sample
+    double sampleUQ;            // /< upper quartile of sample
+    double sampleLQ;            // /< lower quartile of sample
+    double sampleLimit;         // /<
+    double robustMean;          // /< robust mean of array
+    double robustMedian;        // /< robust median of array
+    double robustMode;          // /< Robust mode of array
+    double robustStdev;         // /< robust standard deviation of array
+    double robustUQ;            // /< robust upper quartile
+    double robustLQ;            // /< robust lower quartile
     double XXX;
-    double robustN50;           ///<
-    double robustNfit;          ///<
-    double clippedMean;         ///< Nsigma clipped mean
-    double clippedStdev;        ///< standard deviation after clipping
-    double clipSigma;           ///< Nsigma used for clipping; user input
-    int    clipIter;            ///< Number of clipping iterations; user input
-    double min;                 ///< minimum data value in array
-    double max;                 ///< maximum data value in array
-    double binsize;             ///<
-    psStatsOptions options;     ///< bitmask of calculated values
+    double robustN50;           // /<
+    double robustNfit;          // /<
+    double clippedMean;         // /< Nsigma clipped mean
+    double clippedStdev;        // /< standard deviation after clipping
+    double clipSigma;           // /< Nsigma used for clipping; user input
+    int clipIter;               // /< Number of clipping iterations; user input
+    double min;                 // /< minimum data value in array
+    double max;                 // /< maximum data value in array
+    double binsize;             // /<
+    psStatsOptions options;     // /< bitmask of calculated values
 }
 psStats;
 
-
 /** Do Statistics on an array.  Returns a status value. \ingroup MathGroup */
-psStats *
-psVectorStats(psStats *stats,       ///< stats structure defines stats to be calculated and how
-              psVector *in,         ///< Vector to be analysed: must be F32
-              psVector *mask,       ///< Ignore elements where (maskVector & maskVal) != 0: must be INT or NULL
-              unsigned int maskVal ///< Only mask elements with one of these bits set in maskVector
-             );
+psStats *psVectorStats(psStats * stats, // /< stats structure defines stats to be calculated and how
+                       psVector * in,   // /< Vector to be analysed: must be F32
+                       psVector * mask, // /< Ignore elements where (maskVector & maskVal) != 0: must be INT
+                       // or NULL
+                       unsigned int maskVal     // /< Only mask elements with one of these bits set in
+                       // maskVector
+                      );
 
 /** A constructor for the stats structure.*/
-psStats *psStatsAlloc(psStatsOptions options); ///< Statistics to measure
+psStats *psStatsAlloc(psStatsOptions options);  // /< Statistics to measure
 
 /******************************************************************************
     Histogram functions and data structures.
  *****************************************************************************/
+
 /** The basic histogram structure which contains bounds and bins. */
 typedef struct
 {
-    psVector *bounds;                ///< Bounds for the bins (type F32)
-    psVector *nums;                  ///< Number in each of the bins (INT)
-    int minNum;                      ///< Number below the minimum
-    int maxNum;                      ///< Number above the maximum
-    bool uniform;                     ///< Is it a uniform distribution?
+    psVector *bounds;           // /< Bounds for the bins (type F32)
+    psVector *nums;             // /< Number in each of the bins (INT)
+    int minNum;                 // /< Number below the minimum
+    int maxNum;                 // /< Number above the maximum
+    bool uniform;               // /< Is it a uniform distribution?
 }
 psHistogram;
 
-
 /** Constructor \ingroup MathGroup */
-psHistogram *
-psHistogramAlloc(float lower,  ///< Lower limit for the bins
-                 float upper,  ///< Upper limit for the bins
-                 int n);       ///< Number of bins
-
+psHistogram *psHistogramAlloc(float lower,      // /< Lower limit for the bins
+                              float upper,      // /< Upper limit for the bins
+                              int n);   // /< Number of bins
 
 /** Generic constructor \ingroup MathGroup */
-psHistogram * psHistogramAllocGeneric(const psVector *restrict bounds); ///< Bounds for the bins
+psHistogram *psHistogramAllocGeneric(const psVector * restrict bounds); // /< Bounds for the bins
 
 /** Calculate a histogram \ingroup MathGroup **/
-psHistogram *psVectorHistogram (psHistogram *out,   ///< Histogram data
-                                const psVector *restrict in,       ///< Vector to analyse
-                                const psVector *restrict mask,     ///< Mask dat for input vector
-                                unsigned int maskVal);       ///< Mask value
+psHistogram *psVectorHistogram(psHistogram * out,       // /< Histogram data
+                               const psVector * restrict in,    // /< Vector to analyse
+                               const psVector * restrict mask,  // /< Mask dat for input vector
+                               unsigned int maskVal);   // /< Mask value
 
-bool p_psGetStatValue(
-    const psStats* stats,
-    double* value
-);
+bool p_psGetStatValue(const psStats * stats, double *value);
 
 /// @}
 
 #endif
-
Index: /trunk/psLib/src/dataManip/psVectorFFT.c
===================================================================
--- /trunk/psLib/src/dataManip/psVectorFFT.c	(revision 1406)
+++ /trunk/psLib/src/dataManip/psVectorFFT.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psFFT.c
 *
@@ -5,6 +6,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 22:34:05 $
+*  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -27,5 +28,5 @@
 static bool p_fftwWisdomImported = false;
 
-psImage* psImageFFT( psImage* out, const psImage* in, psFftDirection direction )
+psImage *psImageFFT(psImage * out, const psImage * in, psFftDirection direction)
 {
     unsigned int numCols;
@@ -35,35 +36,32 @@
 
     /* got good image data? */
-    if ( in == NULL ) {
-        psFree( out );
-        return NULL;
-    }
-
-    type = in->type.type;
-
-    if ( ( type != PS_TYPE_F32 ) && ( type != PS_TYPE_C32 ) ) {
-        psError( __func__, "Input image must be a 32-bit float or complex image (type=%d)",
-                 type );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( type != PS_TYPE_C32 && direction == PS_FFT_REVERSE ) {
-        psError( __func__, "Input image must be complex image for reverse FFT (type=%d).",
-                 type );
-        psFree( out );
-        return NULL;
-
-    }
-
-    if ( type != PS_TYPE_F32 && direction == PS_FFT_FORWARD ) {
-        psError( __func__, "Input image must be real image for forward FFT (type=%d).",
-                 type );
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
+        return NULL;
+    }
+
+    type = in->type.type;
+
+    if ((type != PS_TYPE_F32) && (type != PS_TYPE_C32)) {
+        psError(__func__, "Input image must be a 32-bit float or complex image (type=%d)", type);
+        psFree(out);
+        return NULL;
+    }
+
+    if (type != PS_TYPE_C32 && direction == PS_FFT_REVERSE) {
+        psError(__func__, "Input image must be complex image for reverse FFT (type=%d).", type);
+        psFree(out);
+        return NULL;
+
+    }
+
+    if (type != PS_TYPE_F32 && direction == PS_FFT_FORWARD) {
+        psError(__func__, "Input image must be real image for forward FFT (type=%d).", type);
+        psFree(out);
         return NULL;
     }
 
     /* make sure the system-level wisdom information is imported. */
-    if ( ! p_fftwWisdomImported ) {
+    if (!p_fftwWisdomImported) {
         fftwf_import_system_wisdom();
         p_fftwWisdomImported = true;
@@ -73,30 +71,27 @@
     numCols = in->numCols;
 
-    out = psImageCopy( out, in, PS_TYPE_C32 );
-
-    plan = fftwf_plan_dft_2d( numCols, numRows,
-                              ( fftwf_complex* ) out->data.C32[ 0 ],
-                              ( fftwf_complex* ) out->data.C32[ 0 ],
-                              direction,
-                              P_FFTW_PLAN_RIGOR );
-
-    /* check if a plan exists now*/
-    if ( plan == NULL ) {
-        psError( __func__, "Failed to create FFTW plan." );
-        psFree( out );
+    out = psImageCopy(out, in, PS_TYPE_C32);
+
+    plan = fftwf_plan_dft_2d(numCols, numRows,
+                             (fftwf_complex *) out->data.C32[0],
+                             (fftwf_complex *) out->data.C32[0], direction, P_FFTW_PLAN_RIGOR);
+
+    /* check if a plan exists now */
+    if (plan == NULL) {
+        psError(__func__, "Failed to create FFTW plan.");
+        psFree(out);
         return NULL;
     }
 
     /* finally, call FFTW with the plan made above */
-    fftwf_execute( plan );
-
-    fftwf_destroy_plan( plan );
-
-    return out;
-
-}
-
-
-psImage *psImageReal( psImage *out, const psImage* in )
+    fftwf_execute(plan);
+
+    fftwf_destroy_plan(plan);
+
+    return out;
+
+}
+
+psImage *psImageReal(psImage * out, const psImage * in)
 {
     psElemType type;
@@ -104,7 +99,6 @@
     unsigned int numRows;
 
-
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -115,49 +109,47 @@
 
     /* if not a complex number, this is logically just a copy */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
         // Warn user, as this is probably not expected
-        psLogMsg( __func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
-                  "Just an image copy was performed." );
-        return psImageCopy( out, in, type );
-    }
-
-    if ( type == PS_TYPE_C32 ) {
-        psF32 * outRow;
-        psC32* inRow;
-
-        out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
-        for ( unsigned int row = 0;row < numRows;row++ ) {
-            outRow = out->data.F32[ row ];
-            inRow = in->data.C32[ row ];
-
-            for ( unsigned int col = 0;col < numCols;col++ ) {
-                outRow[ col ] = crealf( inRow[ col ] );
-            }
-        }
-    } else
-        if ( type == PS_TYPE_C64 ) {
-            psF64 * outRow;
-            psC64* inRow;
-
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_F64 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                outRow = out->data.F64[ row ];
-                inRow = in->data.C64[ row ];
-
-                for ( unsigned int col = 0;col < numCols;col++ ) {
-                    outRow[ col ] = creal( inRow[ col ] );
-                }
-            }
-        } else {
-            psError( __func__, "Can not extract real component from given image type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-
-    return out;
-}
-
-psImage *psImageImaginary( psImage *out, const psImage* in )
+        psLogMsg(__func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
+                 "Just an image copy was performed.");
+        return psImageCopy(out, in, type);
+    }
+
+    if (type == PS_TYPE_C32) {
+        psF32 *outRow;
+        psC32 *inRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.F32[row];
+            inRow = in->data.C32[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = crealf(inRow[col]);
+            }
+        }
+    } else if (type == PS_TYPE_C64) {
+        psF64 *outRow;
+        psC64 *inRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.F64[row];
+            inRow = in->data.C64[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = creal(inRow[col]);
+            }
+        }
+    } else {
+        psError(__func__, "Can not extract real component from given image type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psImage *psImageImaginary(psImage * out, const psImage * in)
 {
     psElemType type;
@@ -165,7 +157,6 @@
     unsigned int numRows;
 
-
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -176,51 +167,49 @@
 
     /* if not a complex number, this is logically just zeroed image of same size */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
         // Warn user, as this is probably not expected
-        psLogMsg( __func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
-                  "A zero image was returned." );
-        out = psImageRecycle( out, numCols, numRows, type );
-        memset( out->data.V[ 0 ], 0, PSELEMTYPE_SIZEOF( type ) * numCols * numRows );
+        psLogMsg(__func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
+                 "A zero image was returned.");
+        out = psImageRecycle(out, numCols, numRows, type);
+        memset(out->data.V[0], 0, PSELEMTYPE_SIZEOF(type) * numCols * numRows);
         return out;
     }
 
-    if ( type == PS_TYPE_C32 ) {
-        psF32 * outRow;
-        psC32* inRow;
-
-        out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
-        for ( unsigned int row = 0;row < numRows;row++ ) {
-            outRow = out->data.F32[ row ];
-            inRow = in->data.C32[ row ];
-
-            for ( unsigned int col = 0;col < numCols;col++ ) {
-                outRow[ col ] = cimagf( inRow[ col ] );
-            }
-        }
-    } else
-        if ( type == PS_TYPE_C64 ) {
-            psF64 * outRow;
-            psC64* inRow;
-
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_F64 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                outRow = out->data.F64[ row ];
-                inRow = in->data.C64[ row ];
-
-                for ( unsigned int col = 0;col < numCols;col++ ) {
-                    outRow[ col ] = cimag( inRow[ col ] );
-                }
-            }
-        } else {
-            psError( __func__, "Can not extract imaginary component from given image type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-
-    return out;
-}
-
-psImage *psImageComplex( psImage* out, psImage *real, const psImage *imag )
+    if (type == PS_TYPE_C32) {
+        psF32 *outRow;
+        psC32 *inRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.F32[row];
+            inRow = in->data.C32[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = cimagf(inRow[col]);
+            }
+        }
+    } else if (type == PS_TYPE_C64) {
+        psF64 *outRow;
+        psC64 *inRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.F64[row];
+            inRow = in->data.C64[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = cimag(inRow[col]);
+            }
+        }
+    } else {
+        psError(__func__, "Can not extract imaginary component from given image type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psImage *psImageComplex(psImage * out, psImage * real, const psImage * imag)
 {
     psElemType type;
@@ -228,7 +217,6 @@
     unsigned int numRows;
 
-
-    if ( real == NULL || imag == NULL ) {
-        psFree( out );
+    if (real == NULL || imag == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -238,72 +226,69 @@
     numRows = real->numRows;
 
-    if ( imag->type.type != type ) {
-        psError( __func__, "The inputs to psImageComplex must be the same type." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( imag->numCols != numCols ||
-            imag->numRows != numRows ) {
-        psError( __func__, "The inputs to psImageComplex must be the same dimensions." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-        psError( __func__, "The inputs to psImageComplex can not be complex." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( type != PS_TYPE_F32 && type != PS_TYPE_F64 ) {
-        psError( __func__, "The input type to psImageComplex must be a floating point." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( type == PS_TYPE_F32 ) {
-        psC32 * outRow;
-        psF32* realRow;
-        psF32* imagRow;
-
-        out = psImageRecycle( out, numCols, numRows, PS_TYPE_C32 );
-
-        for ( unsigned int row = 0;row < numRows;row++ ) {
-            outRow = out->data.C32[ row ];
-            realRow = real->data.F32[ row ];
-            imagRow = imag->data.F32[ row ];
-
-            for ( unsigned int col = 0;col < numCols;col++ ) {
-                outRow[ col ] = realRow[ col ] + I * imagRow[ col ];
-            }
-        }
-    } else
-        if ( type == PS_TYPE_F64 ) {
-            psC64 * outRow;
-            psF64* realRow;
-            psF64* imagRow;
-
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_C64 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                outRow = out->data.C64[ row ];
-                realRow = real->data.F64[ row ];
-                imagRow = imag->data.F64[ row ];
-
-                for ( unsigned int col = 0;col < numCols;col++ ) {
-                    outRow[ col ] = realRow[ col ] + I * imagRow[ col ];
-                }
-            }
-        } else {
-            psError( __func__, "Can not merge real and imaginary portions for given image type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-
-    return out;
-}
-
-psImage *psImageConjugate( psImage *out, const psImage *in )
+    if (imag->type.type != type) {
+        psError(__func__, "The inputs to psImageComplex must be the same type.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (imag->numCols != numCols || imag->numRows != numRows) {
+        psError(__func__, "The inputs to psImageComplex must be the same dimensions.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
+        psError(__func__, "The inputs to psImageComplex can not be complex.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (type != PS_TYPE_F32 && type != PS_TYPE_F64) {
+        psError(__func__, "The input type to psImageComplex must be a floating point.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (type == PS_TYPE_F32) {
+        psC32 *outRow;
+        psF32 *realRow;
+        psF32 *imagRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32);
+
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.C32[row];
+            realRow = real->data.F32[row];
+            imagRow = imag->data.F32[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = realRow[col] + I * imagRow[col];
+            }
+        }
+    } else if (type == PS_TYPE_F64) {
+        psC64 *outRow;
+        psF64 *realRow;
+        psF64 *imagRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.C64[row];
+            realRow = real->data.F64[row];
+            imagRow = imag->data.F64[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = realRow[col] + I * imagRow[col];
+            }
+        }
+    } else {
+        psError(__func__, "Can not merge real and imaginary portions for given image type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psImage *psImageConjugate(psImage * out, const psImage * in)
 {
     psElemType type;
@@ -311,7 +296,6 @@
     unsigned int numRows;
 
-
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -322,49 +306,47 @@
 
     /* if not a complex number, this is logically just a image copy */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
         // Warn user, as this is probably not expected
-        psLogMsg( __func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
-                  "Image copy was performed instead." );
-        return psImageCopy( out, in, type );
-    }
-
-    if ( type == PS_TYPE_C32 ) {
-        psC32 * outRow;
-        psC32* inRow;
-
-        out = psImageRecycle( out, numCols, numRows, PS_TYPE_C32 );
-        for ( unsigned int row = 0;row < numRows;row++ ) {
-            outRow = out->data.C32[ row ];
-            inRow = in->data.C32[ row ];
-
-            for ( unsigned int col = 0;col < numCols;col++ ) {
-                outRow[ col ] = crealf( inRow[ col ] ) - I * cimagf( inRow[ col ] );
-            }
-        }
-    } else
-        if ( type == PS_TYPE_C64 ) {
-            psC64 * outRow;
-            psC64* inRow;
-
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_C64 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                outRow = out->data.C64[ row ];
-                inRow = in->data.C64[ row ];
-
-                for ( unsigned int col = 0;col < numCols;col++ ) {
-                    outRow[ col ] = creal( inRow[ col ] ) - I * cimag( inRow[ col ] );
-                }
-            }
-        } else {
-            psError( __func__, "Can not compute complex conjugate for given image type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-
-    return out;
-}
-
-psImage *psImagePowerSpectrum( psImage* out, const psImage* in )
+        psLogMsg(__func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
+                 "Image copy was performed instead.");
+        return psImageCopy(out, in, type);
+    }
+
+    if (type == PS_TYPE_C32) {
+        psC32 *outRow;
+        psC32 *inRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.C32[row];
+            inRow = in->data.C32[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = crealf(inRow[col]) - I * cimagf(inRow[col]);
+            }
+        }
+    } else if (type == PS_TYPE_C64) {
+        psC64 *outRow;
+        psC64 *inRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.C64[row];
+            inRow = in->data.C64[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = creal(inRow[col]) - I * cimag(inRow[col]);
+            }
+        }
+    } else {
+        psError(__func__, "Can not compute complex conjugate for given image type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psImage *psImagePowerSpectrum(psImage * out, const psImage * in)
 {
     psElemType type;
@@ -373,6 +355,6 @@
     int numElementsSquared;
 
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -384,53 +366,49 @@
 
     /* if not a complex number, this is not implemented */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-        psError( __func__, "Power Spectrum for non-complex inputs is not implemented." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( type == PS_TYPE_C32 ) {
-        psF32 * outRow;
-        psC32* inRow;
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
+        psError(__func__, "Power Spectrum for non-complex inputs is not implemented.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (type == PS_TYPE_C32) {
+        psF32 *outRow;
+        psC32 *inRow;
         psF32 real;
         psF32 imag;
 
-
-        out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
-        for ( unsigned int row = 0;row < numRows;row++ ) {
-            outRow = out->data.F32[ row ];
-            inRow = in->data.C32[ row ];
-
-            for ( unsigned int col = 0;col < numCols;col++ ) {
-                real = crealf( inRow[ col ] );
-                imag = cimagf( inRow[ col ] );
-                outRow[ col ] = ( real * real + imag * imag ) / numElementsSquared;
-            }
-        }
-    } else
-        if ( type == PS_TYPE_C64 ) {
-            psF64 * outRow;
-            psC64* inRow;
-            psF64 real;
-            psF64 imag;
-
-
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_F64 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                outRow = out->data.F64[ row ];
-                inRow = in->data.C64[ row ];
-
-                for ( unsigned int col = 0;col < numCols;col++ ) {
-                    real = crealf( inRow[ col ] );
-                    imag = cimagf( inRow[ col ] );
-                    outRow[ col ] = real * real + imag * imag / numElementsSquared;
-                }
-            }
-        } else {
-            psError( __func__, "Can not power spectrum for given image type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.F32[row];
+            inRow = in->data.C32[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                real = crealf(inRow[col]);
+                imag = cimagf(inRow[col]);
+                outRow[col] = (real * real + imag * imag) / numElementsSquared;
+            }
+        }
+    } else if (type == PS_TYPE_C64) {
+        psF64 *outRow;
+        psC64 *inRow;
+        psF64 real;
+        psF64 imag;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.F64[row];
+            inRow = in->data.C64[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                real = crealf(inRow[col]);
+                imag = cimagf(inRow[col]);
+                outRow[col] = real * real + imag * imag / numElementsSquared;
+            }
+        }
+    } else {
+        psError(__func__, "Can not power spectrum for given image type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
 
     return out;
@@ -440,5 +418,5 @@
 /************************************** Vector Functions ***************************************/
 
-psVector* psVectorFFT( psVector* out, const psVector* in, psFftDirection direction )
+psVector *psVectorFFT(psVector * out, const psVector * in, psFftDirection direction)
 {
     unsigned int numElements;
@@ -447,35 +425,32 @@
 
     /* got good image data? */
-    if ( in == NULL ) {
-        psFree( out );
-        return NULL;
-    }
-
-    type = in->type.type;
-
-    if ( ( type != PS_TYPE_F32 ) && ( type != PS_TYPE_C32 ) ) {
-        psError( __func__, "Input image must be a 32-bit float or complex image (type=%d)",
-                 type );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( ( type != PS_TYPE_C32 ) && ( direction == PS_FFT_REVERSE ) ) {
-        psError( __func__, "Input image must be complex image for reverse FFT (type=%d).",
-                 type );
-        psFree( out );
-        return NULL;
-
-    }
-
-    if ( ( type != PS_TYPE_F32 ) && ( direction == PS_FFT_FORWARD ) ) {
-        psError( __func__, "Input image must be real image for forward FFT (type=%d).",
-                 type );
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
+        return NULL;
+    }
+
+    type = in->type.type;
+
+    if ((type != PS_TYPE_F32) && (type != PS_TYPE_C32)) {
+        psError(__func__, "Input image must be a 32-bit float or complex image (type=%d)", type);
+        psFree(out);
+        return NULL;
+    }
+
+    if ((type != PS_TYPE_C32) && (direction == PS_FFT_REVERSE)) {
+        psError(__func__, "Input image must be complex image for reverse FFT (type=%d).", type);
+        psFree(out);
+        return NULL;
+
+    }
+
+    if ((type != PS_TYPE_F32) && (direction == PS_FFT_FORWARD)) {
+        psError(__func__, "Input image must be real image for forward FFT (type=%d).", type);
+        psFree(out);
         return NULL;
     }
 
     /* make sure the system-level wisdom information is imported. */
-    if ( ! p_fftwWisdomImported ) {
+    if (!p_fftwWisdomImported) {
         fftwf_import_system_wisdom();
         p_fftwWisdomImported = true;
@@ -484,51 +459,50 @@
     numElements = in->n;
 
-    out = psVectorRecycle( out, numElements, PS_TYPE_C32 );
+    out = psVectorRecycle(out, numElements, PS_TYPE_C32);
     out->n = numElements;
 
-    if ( type == PS_TYPE_F32 ) {
+    if (type == PS_TYPE_F32) {
         // need to convert to complex
-        psC32 * outVec = out->data.C32;
-        psF32* inVec = in->data.F32;
-        for ( unsigned int i = 0;i < numElements;i++ ) {
-            outVec[ i ] = inVec[ i ];
-        }
-    } else {
-        psC32* outVec = out->data.C32;
-        psC32* inVec = in->data.C32;
-        for ( unsigned int i = 0;i < numElements;i++ ) {
-            outVec[ i ] = inVec[ i ];
-        }
-    }
-
-    plan = fftwf_plan_dft_1d( numElements,
-                              ( fftwf_complex* ) out->data.C32,
-                              ( fftwf_complex* ) out->data.C32,
-                              direction,
-                              P_FFTW_PLAN_RIGOR );
-
-    /* check if a plan exists now*/
-    if ( plan == NULL ) {
-        psError( __func__, "Failed to create FFTW plan." );
-        psFree( out );
+        psC32 *outVec = out->data.C32;
+        psF32 *inVec = in->data.F32;
+
+        for (unsigned int i = 0; i < numElements; i++) {
+            outVec[i] = inVec[i];
+        }
+    } else {
+        psC32 *outVec = out->data.C32;
+        psC32 *inVec = in->data.C32;
+
+        for (unsigned int i = 0; i < numElements; i++) {
+            outVec[i] = inVec[i];
+        }
+    }
+
+    plan = fftwf_plan_dft_1d(numElements,
+                             (fftwf_complex *) out->data.C32,
+                             (fftwf_complex *) out->data.C32, direction, P_FFTW_PLAN_RIGOR);
+
+    /* check if a plan exists now */
+    if (plan == NULL) {
+        psError(__func__, "Failed to create FFTW plan.");
+        psFree(out);
         return NULL;
     }
 
     /* finally, call FFTW with the plan made above */
-    fftwf_execute( plan );
-
-    fftwf_destroy_plan( plan );
-
-    return out;
-}
-
-
-psVector *psVectorReal( psVector *out, const psVector* in )
+    fftwf_execute(plan);
+
+    fftwf_destroy_plan(plan);
+
+    return out;
+}
+
+psVector *psVectorReal(psVector * out, const psVector * in)
 {
     psElemType type;
     unsigned int numElements;
 
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -538,43 +512,41 @@
 
     /* if not a complex number, this is logically just a copy */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
         // Warn user, as this is probably not expected
-        psLogMsg( __func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
-                  "Just a vector copy was performed." );
-        out = psVectorRecycle( out, numElements, type );
+        psLogMsg(__func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
+                 "Just a vector copy was performed.");
+        out = psVectorRecycle(out, numElements, type);
         out->n = numElements;
-        memcpy( out->data.V, in->data.V, numElements * PSELEMTYPE_SIZEOF( type ) );
+        memcpy(out->data.V, in->data.V, numElements * PSELEMTYPE_SIZEOF(type));
         return out;
     }
 
-    if ( type == PS_TYPE_C32 ) {
-        psF32 * outVec;
-        psC32* inVec = in->data.C32;
-
-        out = psVectorRecycle( out, numElements, PS_TYPE_F32 );
+    if (type == PS_TYPE_C32) {
+        psF32 *outVec;
+        psC32 *inVec = in->data.C32;
+
+        out = psVectorRecycle(out, numElements, PS_TYPE_F32);
         out->n = numElements;
         outVec = out->data.F32;
 
-        for ( unsigned int i = 0;i < numElements;i++ ) {
-            outVec[ i ] = crealf( inVec[ i ] );
-        }
-    } else {
-        psError( __func__, "Can not extract real component from given vector type (%d).",
-                 type );
-        psFree( out );
-        return NULL;
-    }
-
-    return out;
-}
-
-psVector *psVectorImaginary( psVector *out, const psVector* in )
+        for (unsigned int i = 0; i < numElements; i++) {
+            outVec[i] = crealf(inVec[i]);
+        }
+    } else {
+        psError(__func__, "Can not extract real component from given vector type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psVector *psVectorImaginary(psVector * out, const psVector * in)
 {
     psElemType type;
     unsigned int numElements;
 
-
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -584,48 +556,46 @@
 
     /* if not a complex number, this is logically just zeroed image of same size */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
         // Warn user, as this is probably not expected
-        psLogMsg( __func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
-                  "A zeroed vector was returned." );
-        out = psVectorRecycle( out, numElements, type );
+        psLogMsg(__func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
+                 "A zeroed vector was returned.");
+        out = psVectorRecycle(out, numElements, type);
         out->n = numElements;
-        memset( out->data.V, 0, PSELEMTYPE_SIZEOF( type ) * numElements );
+        memset(out->data.V, 0, PSELEMTYPE_SIZEOF(type) * numElements);
         return out;
     }
 
-    if ( type == PS_TYPE_C32 ) {
-        psF32 * outVec;
-        psC32* inVec = in->data.C32;
-
-        out = psVectorRecycle( out, numElements, PS_TYPE_F32 );
+    if (type == PS_TYPE_C32) {
+        psF32 *outVec;
+        psC32 *inVec = in->data.C32;
+
+        out = psVectorRecycle(out, numElements, PS_TYPE_F32);
         out->n = numElements;
         outVec = out->data.F32;
 
-        for ( unsigned int i = 0;i < numElements;i++ ) {
-            outVec[ i ] = cimagf( inVec[ i ] );
-        }
-    } else {
-        psError( __func__, "Can not extract imaginary component from given vector type (%d).",
-                 type );
-        psFree( out );
-        return NULL;
-    }
-
-    return out;
-}
-
-psVector *psVectorComplex( psVector* out, psVector *real, const psVector *imag )
+        for (unsigned int i = 0; i < numElements; i++) {
+            outVec[i] = cimagf(inVec[i]);
+        }
+    } else {
+        psError(__func__, "Can not extract imaginary component from given vector type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psVector *psVectorComplex(psVector * out, psVector * real, const psVector * imag)
 {
     psElemType type;
     unsigned int numElements;
 
-
-    if ( real == NULL || imag == NULL ) {
-        psFree( out );
+    if (real == NULL || imag == NULL) {
+        psFree(out);
         return NULL;
     }
 
     type = real->type.type;
-    if ( real->n < imag->n ) {
+    if (real->n < imag->n) {
         numElements = real->n;
     } else {
@@ -633,46 +603,44 @@
     }
 
-    if ( imag->type.type != type ) {
-        psError( __func__, "The inputs to psVectorComplex must be the same type." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-        psError( __func__, "The inputs to psVectorComplex can not be complex." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( type == PS_TYPE_F32 ) {
-        psC32 * outVec;
-        psF32* realVec = real->data.F32;
-        psF32* imagVec = imag->data.F32;
-
-        out = psVectorRecycle( out, numElements, PS_TYPE_C32 );
+    if (imag->type.type != type) {
+        psError(__func__, "The inputs to psVectorComplex must be the same type.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
+        psError(__func__, "The inputs to psVectorComplex can not be complex.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (type == PS_TYPE_F32) {
+        psC32 *outVec;
+        psF32 *realVec = real->data.F32;
+        psF32 *imagVec = imag->data.F32;
+
+        out = psVectorRecycle(out, numElements, PS_TYPE_C32);
         out->n = numElements;
         outVec = out->data.C32;
 
-        for ( unsigned int i = 0;i < numElements;i++ ) {
-            outVec[ i ] = realVec[ i ] + I * imagVec[ i ];
-        }
-    } else {
-        psError( __func__, "Can not merge real and imaginary portions for given vector type (%d).",
-                 type );
-        psFree( out );
-        return NULL;
-    }
-
-    return out;
-}
-
-psVector *psVectorConjugate( psVector *out, const psVector *in )
+        for (unsigned int i = 0; i < numElements; i++) {
+            outVec[i] = realVec[i] + I * imagVec[i];
+        }
+    } else {
+        psError(__func__, "Can not merge real and imaginary portions for given vector type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psVector *psVectorConjugate(psVector * out, const psVector * in)
 {
     psElemType type;
     unsigned int numElements;
 
-
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -682,37 +650,36 @@
 
     /* if not a complex number, this is logically just a image copy */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
         // Warn user, as this is probably not expected
-        psLogMsg( __func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
-                  "Vector copy was performed instead." );
-
-        out = psVectorRecycle( out, numElements, type );
+        psLogMsg(__func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
+                 "Vector copy was performed instead.");
+
+        out = psVectorRecycle(out, numElements, type);
         out->n = numElements;
-        memcpy( out->data.V, in->data.V, PSELEMTYPE_SIZEOF( type ) * numElements );
+        memcpy(out->data.V, in->data.V, PSELEMTYPE_SIZEOF(type) * numElements);
         return out;
     }
 
-    if ( type == PS_TYPE_C32 ) {
-        psC32 * outVec;
-        psC32* inVec = in->data.C32;
-
-        out = psVectorRecycle( out, numElements, PS_TYPE_C32 );
+    if (type == PS_TYPE_C32) {
+        psC32 *outVec;
+        psC32 *inVec = in->data.C32;
+
+        out = psVectorRecycle(out, numElements, PS_TYPE_C32);
         out->n = numElements;
         outVec = out->data.C32;
 
-        for ( unsigned int i = 0;i < numElements;i++ ) {
-            outVec[ i ] = crealf( inVec[ i ] ) - I * cimagf( inVec[ i ] );
-        }
-    } else {
-        psError( __func__, "Can not compute complex conjugate for given vector type (%d).",
-                 type );
-        psFree( out );
-        return NULL;
-    }
-
-    return out;
-}
-
-psVector *psVectorPowerSpectrum( psVector* out, const psVector* in )
+        for (unsigned int i = 0; i < numElements; i++) {
+            outVec[i] = crealf(inVec[i]) - I * cimagf(inVec[i]);
+        }
+    } else {
+        psError(__func__, "Can not compute complex conjugate for given vector type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psVector *psVectorPowerSpectrum(psVector * out, const psVector * in)
 {
     psElemType type;
@@ -722,6 +689,6 @@
     unsigned int inNumElementsSquared;
 
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -734,42 +701,41 @@
 
     /* if not a complex number, this is not implemented */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-        psError( __func__, "Power Spectrum for non-complex inputs is not implemented." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( type == PS_TYPE_C32 ) {
-        psF32 * outVec;
-        psC32* inVec = in->data.C32;
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
+        psError(__func__, "Power Spectrum for non-complex inputs is not implemented.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (type == PS_TYPE_C32) {
+        psF32 *outVec;
+        psC32 *inVec = in->data.C32;
         psF32 inAbs1;
         psF32 inAbs2;
 
-        out = psVectorRecycle( out, outNumElements, PS_TYPE_F32 );
+        out = psVectorRecycle(out, outNumElements, PS_TYPE_F32);
         out->n = outNumElements;
         outVec = out->data.F32;
 
         // from ADD: P_0 = |C_0|^2/N^2
-        inAbs1 = cabsf( inVec[ 0 ] );
-        outVec[ 0 ] = inAbs1 * inAbs1 / inNumElementsSquared;
+        inAbs1 = cabsf(inVec[0]);
+        outVec[0] = inAbs1 * inAbs1 / inNumElementsSquared;
 
         // from ADD: P_j = (|C_j|^2+|C_N-j|^2)/N^2, where j = 1,2,...,(N/2-1)
-        for ( unsigned int i = 1;i < inHalfNumElements;i++ ) {
-            inAbs1 = cabsf( inVec[ i ] );
-            inAbs2 = cabsf( inVec[ inNumElements - i ] );
-            outVec[ i ] = ( inAbs1 * inAbs1 + inAbs2 * inAbs2 ) / inNumElementsSquared;
+        for (unsigned int i = 1; i < inHalfNumElements; i++) {
+            inAbs1 = cabsf(inVec[i]);
+            inAbs2 = cabsf(inVec[inNumElements - i]);
+            outVec[i] = (inAbs1 * inAbs1 + inAbs2 * inAbs2) / inNumElementsSquared;
         }
 
         // from ADD: P_N/2 = |C_N/2|^2/N^2
-        inAbs1 = cabsf( inVec[ inHalfNumElements ] );
-        outVec[ inHalfNumElements ] = inAbs1 * inAbs1 / inNumElementsSquared;
-    } else {
-        psError( __func__, "Can not power spectrum for given vector type (%d).",
-                 type );
-        psFree( out );
-        return NULL;
-    }
-
-    return out;
-
-}
+        inAbs1 = cabsf(inVec[inHalfNumElements]);
+        outVec[inHalfNumElements] = inAbs1 * inAbs1 / inNumElementsSquared;
+    } else {
+        psError(__func__, "Can not power spectrum for given vector type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+
+}
Index: /trunk/psLib/src/dataManip/psVectorFFT.h
===================================================================
--- /trunk/psLib/src/dataManip/psVectorFFT.h	(revision 1406)
+++ /trunk/psLib/src/dataManip/psVectorFFT.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psFFT.h
  *
@@ -7,6 +8,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -14,8 +15,8 @@
 
 #ifndef PS_FFT_H
-#define PS_FFT_H
+#    define PS_FFT_H
 
-#include "psImage.h"
-#include "psVector.h"
+#    include "psImage.h"
+#    include "psVector.h"
 
 /// @addtogroup Transform
@@ -24,29 +25,27 @@
 /** Details on FFT implementation (private). */
 
-
 typedef enum {
-    /// psImageFFT/psVectorFFT should perform a forward FFT.
+    // / psImageFFT/psVectorFFT should perform a forward FFT.
     PS_FFT_FORWARD = (-1),
 
-    ///< psImageFFT/psVectorFFT should perform a reverse FFT.
+    // /< psImageFFT/psVectorFFT should perform a reverse FFT.
     PS_FFT_REVERSE = (+1)
 } psFftDirection;
 
-psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction);
-psImage* psImageReal(psImage *out, const psImage* in);
-psImage* psImageImaginary(psImage *out, const psImage* in);
-psImage* psImageComplex(psImage* out, psImage *real, const psImage *imag);
-psImage* psImageConjugate(psImage *out, const psImage *in);
-psImage* psImagePowerSpectrum(psImage* out, const psImage* in);
+psImage *psImageFFT(psImage * out, const psImage * in, psFftDirection direction);
+psImage *psImageReal(psImage * out, const psImage * in);
+psImage *psImageImaginary(psImage * out, const psImage * in);
+psImage *psImageComplex(psImage * out, psImage * real, const psImage * imag);
+psImage *psImageConjugate(psImage * out, const psImage * in);
+psImage *psImagePowerSpectrum(psImage * out, const psImage * in);
 
-psVector* psVectorFFT(psVector* out, const psVector* in, psFftDirection direction);
-psVector* psVectorReal(psVector* out, const psVector* in);
-psVector* psVectorImaginary(psVector* out, const psVector* in);
-psVector* psVectorComplex(psVector* out, psVector* real, const psVector* imag);
-psVector* psVectorConjugate(psVector* out, const psVector* in);
-psVector* psVectorPowerSpectrum(psVector* out, const psVector* in);
+psVector *psVectorFFT(psVector * out, const psVector * in, psFftDirection direction);
+psVector *psVectorReal(psVector * out, const psVector * in);
+psVector *psVectorImaginary(psVector * out, const psVector * in);
+psVector *psVectorComplex(psVector * out, psVector * real, const psVector * imag);
+psVector *psVectorConjugate(psVector * out, const psVector * in);
+psVector *psVectorPowerSpectrum(psVector * out, const psVector * in);
 
 /// @}
 
 #endif
-
Index: /trunk/psLib/src/fft/psVectorFFT.c
===================================================================
--- /trunk/psLib/src/fft/psVectorFFT.c	(revision 1406)
+++ /trunk/psLib/src/fft/psVectorFFT.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psFFT.c
 *
@@ -5,6 +6,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 22:34:05 $
+*  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -27,5 +28,5 @@
 static bool p_fftwWisdomImported = false;
 
-psImage* psImageFFT( psImage* out, const psImage* in, psFftDirection direction )
+psImage *psImageFFT(psImage * out, const psImage * in, psFftDirection direction)
 {
     unsigned int numCols;
@@ -35,35 +36,32 @@
 
     /* got good image data? */
-    if ( in == NULL ) {
-        psFree( out );
-        return NULL;
-    }
-
-    type = in->type.type;
-
-    if ( ( type != PS_TYPE_F32 ) && ( type != PS_TYPE_C32 ) ) {
-        psError( __func__, "Input image must be a 32-bit float or complex image (type=%d)",
-                 type );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( type != PS_TYPE_C32 && direction == PS_FFT_REVERSE ) {
-        psError( __func__, "Input image must be complex image for reverse FFT (type=%d).",
-                 type );
-        psFree( out );
-        return NULL;
-
-    }
-
-    if ( type != PS_TYPE_F32 && direction == PS_FFT_FORWARD ) {
-        psError( __func__, "Input image must be real image for forward FFT (type=%d).",
-                 type );
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
+        return NULL;
+    }
+
+    type = in->type.type;
+
+    if ((type != PS_TYPE_F32) && (type != PS_TYPE_C32)) {
+        psError(__func__, "Input image must be a 32-bit float or complex image (type=%d)", type);
+        psFree(out);
+        return NULL;
+    }
+
+    if (type != PS_TYPE_C32 && direction == PS_FFT_REVERSE) {
+        psError(__func__, "Input image must be complex image for reverse FFT (type=%d).", type);
+        psFree(out);
+        return NULL;
+
+    }
+
+    if (type != PS_TYPE_F32 && direction == PS_FFT_FORWARD) {
+        psError(__func__, "Input image must be real image for forward FFT (type=%d).", type);
+        psFree(out);
         return NULL;
     }
 
     /* make sure the system-level wisdom information is imported. */
-    if ( ! p_fftwWisdomImported ) {
+    if (!p_fftwWisdomImported) {
         fftwf_import_system_wisdom();
         p_fftwWisdomImported = true;
@@ -73,30 +71,27 @@
     numCols = in->numCols;
 
-    out = psImageCopy( out, in, PS_TYPE_C32 );
-
-    plan = fftwf_plan_dft_2d( numCols, numRows,
-                              ( fftwf_complex* ) out->data.C32[ 0 ],
-                              ( fftwf_complex* ) out->data.C32[ 0 ],
-                              direction,
-                              P_FFTW_PLAN_RIGOR );
-
-    /* check if a plan exists now*/
-    if ( plan == NULL ) {
-        psError( __func__, "Failed to create FFTW plan." );
-        psFree( out );
+    out = psImageCopy(out, in, PS_TYPE_C32);
+
+    plan = fftwf_plan_dft_2d(numCols, numRows,
+                             (fftwf_complex *) out->data.C32[0],
+                             (fftwf_complex *) out->data.C32[0], direction, P_FFTW_PLAN_RIGOR);
+
+    /* check if a plan exists now */
+    if (plan == NULL) {
+        psError(__func__, "Failed to create FFTW plan.");
+        psFree(out);
         return NULL;
     }
 
     /* finally, call FFTW with the plan made above */
-    fftwf_execute( plan );
-
-    fftwf_destroy_plan( plan );
-
-    return out;
-
-}
-
-
-psImage *psImageReal( psImage *out, const psImage* in )
+    fftwf_execute(plan);
+
+    fftwf_destroy_plan(plan);
+
+    return out;
+
+}
+
+psImage *psImageReal(psImage * out, const psImage * in)
 {
     psElemType type;
@@ -104,7 +99,6 @@
     unsigned int numRows;
 
-
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -115,49 +109,47 @@
 
     /* if not a complex number, this is logically just a copy */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
         // Warn user, as this is probably not expected
-        psLogMsg( __func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
-                  "Just an image copy was performed." );
-        return psImageCopy( out, in, type );
-    }
-
-    if ( type == PS_TYPE_C32 ) {
-        psF32 * outRow;
-        psC32* inRow;
-
-        out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
-        for ( unsigned int row = 0;row < numRows;row++ ) {
-            outRow = out->data.F32[ row ];
-            inRow = in->data.C32[ row ];
-
-            for ( unsigned int col = 0;col < numCols;col++ ) {
-                outRow[ col ] = crealf( inRow[ col ] );
-            }
-        }
-    } else
-        if ( type == PS_TYPE_C64 ) {
-            psF64 * outRow;
-            psC64* inRow;
-
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_F64 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                outRow = out->data.F64[ row ];
-                inRow = in->data.C64[ row ];
-
-                for ( unsigned int col = 0;col < numCols;col++ ) {
-                    outRow[ col ] = creal( inRow[ col ] );
-                }
-            }
-        } else {
-            psError( __func__, "Can not extract real component from given image type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-
-    return out;
-}
-
-psImage *psImageImaginary( psImage *out, const psImage* in )
+        psLogMsg(__func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
+                 "Just an image copy was performed.");
+        return psImageCopy(out, in, type);
+    }
+
+    if (type == PS_TYPE_C32) {
+        psF32 *outRow;
+        psC32 *inRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.F32[row];
+            inRow = in->data.C32[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = crealf(inRow[col]);
+            }
+        }
+    } else if (type == PS_TYPE_C64) {
+        psF64 *outRow;
+        psC64 *inRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.F64[row];
+            inRow = in->data.C64[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = creal(inRow[col]);
+            }
+        }
+    } else {
+        psError(__func__, "Can not extract real component from given image type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psImage *psImageImaginary(psImage * out, const psImage * in)
 {
     psElemType type;
@@ -165,7 +157,6 @@
     unsigned int numRows;
 
-
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -176,51 +167,49 @@
 
     /* if not a complex number, this is logically just zeroed image of same size */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
         // Warn user, as this is probably not expected
-        psLogMsg( __func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
-                  "A zero image was returned." );
-        out = psImageRecycle( out, numCols, numRows, type );
-        memset( out->data.V[ 0 ], 0, PSELEMTYPE_SIZEOF( type ) * numCols * numRows );
+        psLogMsg(__func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
+                 "A zero image was returned.");
+        out = psImageRecycle(out, numCols, numRows, type);
+        memset(out->data.V[0], 0, PSELEMTYPE_SIZEOF(type) * numCols * numRows);
         return out;
     }
 
-    if ( type == PS_TYPE_C32 ) {
-        psF32 * outRow;
-        psC32* inRow;
-
-        out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
-        for ( unsigned int row = 0;row < numRows;row++ ) {
-            outRow = out->data.F32[ row ];
-            inRow = in->data.C32[ row ];
-
-            for ( unsigned int col = 0;col < numCols;col++ ) {
-                outRow[ col ] = cimagf( inRow[ col ] );
-            }
-        }
-    } else
-        if ( type == PS_TYPE_C64 ) {
-            psF64 * outRow;
-            psC64* inRow;
-
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_F64 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                outRow = out->data.F64[ row ];
-                inRow = in->data.C64[ row ];
-
-                for ( unsigned int col = 0;col < numCols;col++ ) {
-                    outRow[ col ] = cimag( inRow[ col ] );
-                }
-            }
-        } else {
-            psError( __func__, "Can not extract imaginary component from given image type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-
-    return out;
-}
-
-psImage *psImageComplex( psImage* out, psImage *real, const psImage *imag )
+    if (type == PS_TYPE_C32) {
+        psF32 *outRow;
+        psC32 *inRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.F32[row];
+            inRow = in->data.C32[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = cimagf(inRow[col]);
+            }
+        }
+    } else if (type == PS_TYPE_C64) {
+        psF64 *outRow;
+        psC64 *inRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.F64[row];
+            inRow = in->data.C64[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = cimag(inRow[col]);
+            }
+        }
+    } else {
+        psError(__func__, "Can not extract imaginary component from given image type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psImage *psImageComplex(psImage * out, psImage * real, const psImage * imag)
 {
     psElemType type;
@@ -228,7 +217,6 @@
     unsigned int numRows;
 
-
-    if ( real == NULL || imag == NULL ) {
-        psFree( out );
+    if (real == NULL || imag == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -238,72 +226,69 @@
     numRows = real->numRows;
 
-    if ( imag->type.type != type ) {
-        psError( __func__, "The inputs to psImageComplex must be the same type." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( imag->numCols != numCols ||
-            imag->numRows != numRows ) {
-        psError( __func__, "The inputs to psImageComplex must be the same dimensions." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-        psError( __func__, "The inputs to psImageComplex can not be complex." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( type != PS_TYPE_F32 && type != PS_TYPE_F64 ) {
-        psError( __func__, "The input type to psImageComplex must be a floating point." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( type == PS_TYPE_F32 ) {
-        psC32 * outRow;
-        psF32* realRow;
-        psF32* imagRow;
-
-        out = psImageRecycle( out, numCols, numRows, PS_TYPE_C32 );
-
-        for ( unsigned int row = 0;row < numRows;row++ ) {
-            outRow = out->data.C32[ row ];
-            realRow = real->data.F32[ row ];
-            imagRow = imag->data.F32[ row ];
-
-            for ( unsigned int col = 0;col < numCols;col++ ) {
-                outRow[ col ] = realRow[ col ] + I * imagRow[ col ];
-            }
-        }
-    } else
-        if ( type == PS_TYPE_F64 ) {
-            psC64 * outRow;
-            psF64* realRow;
-            psF64* imagRow;
-
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_C64 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                outRow = out->data.C64[ row ];
-                realRow = real->data.F64[ row ];
-                imagRow = imag->data.F64[ row ];
-
-                for ( unsigned int col = 0;col < numCols;col++ ) {
-                    outRow[ col ] = realRow[ col ] + I * imagRow[ col ];
-                }
-            }
-        } else {
-            psError( __func__, "Can not merge real and imaginary portions for given image type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-
-    return out;
-}
-
-psImage *psImageConjugate( psImage *out, const psImage *in )
+    if (imag->type.type != type) {
+        psError(__func__, "The inputs to psImageComplex must be the same type.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (imag->numCols != numCols || imag->numRows != numRows) {
+        psError(__func__, "The inputs to psImageComplex must be the same dimensions.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
+        psError(__func__, "The inputs to psImageComplex can not be complex.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (type != PS_TYPE_F32 && type != PS_TYPE_F64) {
+        psError(__func__, "The input type to psImageComplex must be a floating point.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (type == PS_TYPE_F32) {
+        psC32 *outRow;
+        psF32 *realRow;
+        psF32 *imagRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32);
+
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.C32[row];
+            realRow = real->data.F32[row];
+            imagRow = imag->data.F32[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = realRow[col] + I * imagRow[col];
+            }
+        }
+    } else if (type == PS_TYPE_F64) {
+        psC64 *outRow;
+        psF64 *realRow;
+        psF64 *imagRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.C64[row];
+            realRow = real->data.F64[row];
+            imagRow = imag->data.F64[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = realRow[col] + I * imagRow[col];
+            }
+        }
+    } else {
+        psError(__func__, "Can not merge real and imaginary portions for given image type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psImage *psImageConjugate(psImage * out, const psImage * in)
 {
     psElemType type;
@@ -311,7 +296,6 @@
     unsigned int numRows;
 
-
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -322,49 +306,47 @@
 
     /* if not a complex number, this is logically just a image copy */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
         // Warn user, as this is probably not expected
-        psLogMsg( __func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
-                  "Image copy was performed instead." );
-        return psImageCopy( out, in, type );
-    }
-
-    if ( type == PS_TYPE_C32 ) {
-        psC32 * outRow;
-        psC32* inRow;
-
-        out = psImageRecycle( out, numCols, numRows, PS_TYPE_C32 );
-        for ( unsigned int row = 0;row < numRows;row++ ) {
-            outRow = out->data.C32[ row ];
-            inRow = in->data.C32[ row ];
-
-            for ( unsigned int col = 0;col < numCols;col++ ) {
-                outRow[ col ] = crealf( inRow[ col ] ) - I * cimagf( inRow[ col ] );
-            }
-        }
-    } else
-        if ( type == PS_TYPE_C64 ) {
-            psC64 * outRow;
-            psC64* inRow;
-
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_C64 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                outRow = out->data.C64[ row ];
-                inRow = in->data.C64[ row ];
-
-                for ( unsigned int col = 0;col < numCols;col++ ) {
-                    outRow[ col ] = creal( inRow[ col ] ) - I * cimag( inRow[ col ] );
-                }
-            }
-        } else {
-            psError( __func__, "Can not compute complex conjugate for given image type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
-
-    return out;
-}
-
-psImage *psImagePowerSpectrum( psImage* out, const psImage* in )
+        psLogMsg(__func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
+                 "Image copy was performed instead.");
+        return psImageCopy(out, in, type);
+    }
+
+    if (type == PS_TYPE_C32) {
+        psC32 *outRow;
+        psC32 *inRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.C32[row];
+            inRow = in->data.C32[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = crealf(inRow[col]) - I * cimagf(inRow[col]);
+            }
+        }
+    } else if (type == PS_TYPE_C64) {
+        psC64 *outRow;
+        psC64 *inRow;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.C64[row];
+            inRow = in->data.C64[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                outRow[col] = creal(inRow[col]) - I * cimag(inRow[col]);
+            }
+        }
+    } else {
+        psError(__func__, "Can not compute complex conjugate for given image type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psImage *psImagePowerSpectrum(psImage * out, const psImage * in)
 {
     psElemType type;
@@ -373,6 +355,6 @@
     int numElementsSquared;
 
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -384,53 +366,49 @@
 
     /* if not a complex number, this is not implemented */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-        psError( __func__, "Power Spectrum for non-complex inputs is not implemented." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( type == PS_TYPE_C32 ) {
-        psF32 * outRow;
-        psC32* inRow;
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
+        psError(__func__, "Power Spectrum for non-complex inputs is not implemented.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (type == PS_TYPE_C32) {
+        psF32 *outRow;
+        psC32 *inRow;
         psF32 real;
         psF32 imag;
 
-
-        out = psImageRecycle( out, numCols, numRows, PS_TYPE_F32 );
-        for ( unsigned int row = 0;row < numRows;row++ ) {
-            outRow = out->data.F32[ row ];
-            inRow = in->data.C32[ row ];
-
-            for ( unsigned int col = 0;col < numCols;col++ ) {
-                real = crealf( inRow[ col ] );
-                imag = cimagf( inRow[ col ] );
-                outRow[ col ] = ( real * real + imag * imag ) / numElementsSquared;
-            }
-        }
-    } else
-        if ( type == PS_TYPE_C64 ) {
-            psF64 * outRow;
-            psC64* inRow;
-            psF64 real;
-            psF64 imag;
-
-
-            out = psImageRecycle( out, numCols, numRows, PS_TYPE_F64 );
-            for ( unsigned int row = 0;row < numRows;row++ ) {
-                outRow = out->data.F64[ row ];
-                inRow = in->data.C64[ row ];
-
-                for ( unsigned int col = 0;col < numCols;col++ ) {
-                    real = crealf( inRow[ col ] );
-                    imag = cimagf( inRow[ col ] );
-                    outRow[ col ] = real * real + imag * imag / numElementsSquared;
-                }
-            }
-        } else {
-            psError( __func__, "Can not power spectrum for given image type (%d).",
-                     type );
-            psFree( out );
-            return NULL;
-        }
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.F32[row];
+            inRow = in->data.C32[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                real = crealf(inRow[col]);
+                imag = cimagf(inRow[col]);
+                outRow[col] = (real * real + imag * imag) / numElementsSquared;
+            }
+        }
+    } else if (type == PS_TYPE_C64) {
+        psF64 *outRow;
+        psC64 *inRow;
+        psF64 real;
+        psF64 imag;
+
+        out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64);
+        for (unsigned int row = 0; row < numRows; row++) {
+            outRow = out->data.F64[row];
+            inRow = in->data.C64[row];
+
+            for (unsigned int col = 0; col < numCols; col++) {
+                real = crealf(inRow[col]);
+                imag = cimagf(inRow[col]);
+                outRow[col] = real * real + imag * imag / numElementsSquared;
+            }
+        }
+    } else {
+        psError(__func__, "Can not power spectrum for given image type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
 
     return out;
@@ -440,5 +418,5 @@
 /************************************** Vector Functions ***************************************/
 
-psVector* psVectorFFT( psVector* out, const psVector* in, psFftDirection direction )
+psVector *psVectorFFT(psVector * out, const psVector * in, psFftDirection direction)
 {
     unsigned int numElements;
@@ -447,35 +425,32 @@
 
     /* got good image data? */
-    if ( in == NULL ) {
-        psFree( out );
-        return NULL;
-    }
-
-    type = in->type.type;
-
-    if ( ( type != PS_TYPE_F32 ) && ( type != PS_TYPE_C32 ) ) {
-        psError( __func__, "Input image must be a 32-bit float or complex image (type=%d)",
-                 type );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( ( type != PS_TYPE_C32 ) && ( direction == PS_FFT_REVERSE ) ) {
-        psError( __func__, "Input image must be complex image for reverse FFT (type=%d).",
-                 type );
-        psFree( out );
-        return NULL;
-
-    }
-
-    if ( ( type != PS_TYPE_F32 ) && ( direction == PS_FFT_FORWARD ) ) {
-        psError( __func__, "Input image must be real image for forward FFT (type=%d).",
-                 type );
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
+        return NULL;
+    }
+
+    type = in->type.type;
+
+    if ((type != PS_TYPE_F32) && (type != PS_TYPE_C32)) {
+        psError(__func__, "Input image must be a 32-bit float or complex image (type=%d)", type);
+        psFree(out);
+        return NULL;
+    }
+
+    if ((type != PS_TYPE_C32) && (direction == PS_FFT_REVERSE)) {
+        psError(__func__, "Input image must be complex image for reverse FFT (type=%d).", type);
+        psFree(out);
+        return NULL;
+
+    }
+
+    if ((type != PS_TYPE_F32) && (direction == PS_FFT_FORWARD)) {
+        psError(__func__, "Input image must be real image for forward FFT (type=%d).", type);
+        psFree(out);
         return NULL;
     }
 
     /* make sure the system-level wisdom information is imported. */
-    if ( ! p_fftwWisdomImported ) {
+    if (!p_fftwWisdomImported) {
         fftwf_import_system_wisdom();
         p_fftwWisdomImported = true;
@@ -484,51 +459,50 @@
     numElements = in->n;
 
-    out = psVectorRecycle( out, numElements, PS_TYPE_C32 );
+    out = psVectorRecycle(out, numElements, PS_TYPE_C32);
     out->n = numElements;
 
-    if ( type == PS_TYPE_F32 ) {
+    if (type == PS_TYPE_F32) {
         // need to convert to complex
-        psC32 * outVec = out->data.C32;
-        psF32* inVec = in->data.F32;
-        for ( unsigned int i = 0;i < numElements;i++ ) {
-            outVec[ i ] = inVec[ i ];
-        }
-    } else {
-        psC32* outVec = out->data.C32;
-        psC32* inVec = in->data.C32;
-        for ( unsigned int i = 0;i < numElements;i++ ) {
-            outVec[ i ] = inVec[ i ];
-        }
-    }
-
-    plan = fftwf_plan_dft_1d( numElements,
-                              ( fftwf_complex* ) out->data.C32,
-                              ( fftwf_complex* ) out->data.C32,
-                              direction,
-                              P_FFTW_PLAN_RIGOR );
-
-    /* check if a plan exists now*/
-    if ( plan == NULL ) {
-        psError( __func__, "Failed to create FFTW plan." );
-        psFree( out );
+        psC32 *outVec = out->data.C32;
+        psF32 *inVec = in->data.F32;
+
+        for (unsigned int i = 0; i < numElements; i++) {
+            outVec[i] = inVec[i];
+        }
+    } else {
+        psC32 *outVec = out->data.C32;
+        psC32 *inVec = in->data.C32;
+
+        for (unsigned int i = 0; i < numElements; i++) {
+            outVec[i] = inVec[i];
+        }
+    }
+
+    plan = fftwf_plan_dft_1d(numElements,
+                             (fftwf_complex *) out->data.C32,
+                             (fftwf_complex *) out->data.C32, direction, P_FFTW_PLAN_RIGOR);
+
+    /* check if a plan exists now */
+    if (plan == NULL) {
+        psError(__func__, "Failed to create FFTW plan.");
+        psFree(out);
         return NULL;
     }
 
     /* finally, call FFTW with the plan made above */
-    fftwf_execute( plan );
-
-    fftwf_destroy_plan( plan );
-
-    return out;
-}
-
-
-psVector *psVectorReal( psVector *out, const psVector* in )
+    fftwf_execute(plan);
+
+    fftwf_destroy_plan(plan);
+
+    return out;
+}
+
+psVector *psVectorReal(psVector * out, const psVector * in)
 {
     psElemType type;
     unsigned int numElements;
 
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -538,43 +512,41 @@
 
     /* if not a complex number, this is logically just a copy */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
         // Warn user, as this is probably not expected
-        psLogMsg( __func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
-                  "Just a vector copy was performed." );
-        out = psVectorRecycle( out, numElements, type );
+        psLogMsg(__func__, PS_LOG_WARN, "Real portion of a non-Complex type called called for. "
+                 "Just a vector copy was performed.");
+        out = psVectorRecycle(out, numElements, type);
         out->n = numElements;
-        memcpy( out->data.V, in->data.V, numElements * PSELEMTYPE_SIZEOF( type ) );
+        memcpy(out->data.V, in->data.V, numElements * PSELEMTYPE_SIZEOF(type));
         return out;
     }
 
-    if ( type == PS_TYPE_C32 ) {
-        psF32 * outVec;
-        psC32* inVec = in->data.C32;
-
-        out = psVectorRecycle( out, numElements, PS_TYPE_F32 );
+    if (type == PS_TYPE_C32) {
+        psF32 *outVec;
+        psC32 *inVec = in->data.C32;
+
+        out = psVectorRecycle(out, numElements, PS_TYPE_F32);
         out->n = numElements;
         outVec = out->data.F32;
 
-        for ( unsigned int i = 0;i < numElements;i++ ) {
-            outVec[ i ] = crealf( inVec[ i ] );
-        }
-    } else {
-        psError( __func__, "Can not extract real component from given vector type (%d).",
-                 type );
-        psFree( out );
-        return NULL;
-    }
-
-    return out;
-}
-
-psVector *psVectorImaginary( psVector *out, const psVector* in )
+        for (unsigned int i = 0; i < numElements; i++) {
+            outVec[i] = crealf(inVec[i]);
+        }
+    } else {
+        psError(__func__, "Can not extract real component from given vector type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psVector *psVectorImaginary(psVector * out, const psVector * in)
 {
     psElemType type;
     unsigned int numElements;
 
-
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -584,48 +556,46 @@
 
     /* if not a complex number, this is logically just zeroed image of same size */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
         // Warn user, as this is probably not expected
-        psLogMsg( __func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
-                  "A zeroed vector was returned." );
-        out = psVectorRecycle( out, numElements, type );
+        psLogMsg(__func__, PS_LOG_WARN, "Imaginary portion of a non-Complex type called for. "
+                 "A zeroed vector was returned.");
+        out = psVectorRecycle(out, numElements, type);
         out->n = numElements;
-        memset( out->data.V, 0, PSELEMTYPE_SIZEOF( type ) * numElements );
+        memset(out->data.V, 0, PSELEMTYPE_SIZEOF(type) * numElements);
         return out;
     }
 
-    if ( type == PS_TYPE_C32 ) {
-        psF32 * outVec;
-        psC32* inVec = in->data.C32;
-
-        out = psVectorRecycle( out, numElements, PS_TYPE_F32 );
+    if (type == PS_TYPE_C32) {
+        psF32 *outVec;
+        psC32 *inVec = in->data.C32;
+
+        out = psVectorRecycle(out, numElements, PS_TYPE_F32);
         out->n = numElements;
         outVec = out->data.F32;
 
-        for ( unsigned int i = 0;i < numElements;i++ ) {
-            outVec[ i ] = cimagf( inVec[ i ] );
-        }
-    } else {
-        psError( __func__, "Can not extract imaginary component from given vector type (%d).",
-                 type );
-        psFree( out );
-        return NULL;
-    }
-
-    return out;
-}
-
-psVector *psVectorComplex( psVector* out, psVector *real, const psVector *imag )
+        for (unsigned int i = 0; i < numElements; i++) {
+            outVec[i] = cimagf(inVec[i]);
+        }
+    } else {
+        psError(__func__, "Can not extract imaginary component from given vector type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psVector *psVectorComplex(psVector * out, psVector * real, const psVector * imag)
 {
     psElemType type;
     unsigned int numElements;
 
-
-    if ( real == NULL || imag == NULL ) {
-        psFree( out );
+    if (real == NULL || imag == NULL) {
+        psFree(out);
         return NULL;
     }
 
     type = real->type.type;
-    if ( real->n < imag->n ) {
+    if (real->n < imag->n) {
         numElements = real->n;
     } else {
@@ -633,46 +603,44 @@
     }
 
-    if ( imag->type.type != type ) {
-        psError( __func__, "The inputs to psVectorComplex must be the same type." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-        psError( __func__, "The inputs to psVectorComplex can not be complex." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( type == PS_TYPE_F32 ) {
-        psC32 * outVec;
-        psF32* realVec = real->data.F32;
-        psF32* imagVec = imag->data.F32;
-
-        out = psVectorRecycle( out, numElements, PS_TYPE_C32 );
+    if (imag->type.type != type) {
+        psError(__func__, "The inputs to psVectorComplex must be the same type.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
+        psError(__func__, "The inputs to psVectorComplex can not be complex.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (type == PS_TYPE_F32) {
+        psC32 *outVec;
+        psF32 *realVec = real->data.F32;
+        psF32 *imagVec = imag->data.F32;
+
+        out = psVectorRecycle(out, numElements, PS_TYPE_C32);
         out->n = numElements;
         outVec = out->data.C32;
 
-        for ( unsigned int i = 0;i < numElements;i++ ) {
-            outVec[ i ] = realVec[ i ] + I * imagVec[ i ];
-        }
-    } else {
-        psError( __func__, "Can not merge real and imaginary portions for given vector type (%d).",
-                 type );
-        psFree( out );
-        return NULL;
-    }
-
-    return out;
-}
-
-psVector *psVectorConjugate( psVector *out, const psVector *in )
+        for (unsigned int i = 0; i < numElements; i++) {
+            outVec[i] = realVec[i] + I * imagVec[i];
+        }
+    } else {
+        psError(__func__, "Can not merge real and imaginary portions for given vector type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psVector *psVectorConjugate(psVector * out, const psVector * in)
 {
     psElemType type;
     unsigned int numElements;
 
-
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -682,37 +650,36 @@
 
     /* if not a complex number, this is logically just a image copy */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
         // Warn user, as this is probably not expected
-        psLogMsg( __func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
-                  "Vector copy was performed instead." );
-
-        out = psVectorRecycle( out, numElements, type );
+        psLogMsg(__func__, PS_LOG_WARN, "Complex Conjugate of a non-Complex type called for. "
+                 "Vector copy was performed instead.");
+
+        out = psVectorRecycle(out, numElements, type);
         out->n = numElements;
-        memcpy( out->data.V, in->data.V, PSELEMTYPE_SIZEOF( type ) * numElements );
+        memcpy(out->data.V, in->data.V, PSELEMTYPE_SIZEOF(type) * numElements);
         return out;
     }
 
-    if ( type == PS_TYPE_C32 ) {
-        psC32 * outVec;
-        psC32* inVec = in->data.C32;
-
-        out = psVectorRecycle( out, numElements, PS_TYPE_C32 );
+    if (type == PS_TYPE_C32) {
+        psC32 *outVec;
+        psC32 *inVec = in->data.C32;
+
+        out = psVectorRecycle(out, numElements, PS_TYPE_C32);
         out->n = numElements;
         outVec = out->data.C32;
 
-        for ( unsigned int i = 0;i < numElements;i++ ) {
-            outVec[ i ] = crealf( inVec[ i ] ) - I * cimagf( inVec[ i ] );
-        }
-    } else {
-        psError( __func__, "Can not compute complex conjugate for given vector type (%d).",
-                 type );
-        psFree( out );
-        return NULL;
-    }
-
-    return out;
-}
-
-psVector *psVectorPowerSpectrum( psVector* out, const psVector* in )
+        for (unsigned int i = 0; i < numElements; i++) {
+            outVec[i] = crealf(inVec[i]) - I * cimagf(inVec[i]);
+        }
+    } else {
+        psError(__func__, "Can not compute complex conjugate for given vector type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+}
+
+psVector *psVectorPowerSpectrum(psVector * out, const psVector * in)
 {
     psElemType type;
@@ -722,6 +689,6 @@
     unsigned int inNumElementsSquared;
 
-    if ( in == NULL ) {
-        psFree( out );
+    if (in == NULL) {
+        psFree(out);
         return NULL;
     }
@@ -734,42 +701,41 @@
 
     /* if not a complex number, this is not implemented */
-    if ( ! PS_IS_PSELEMTYPE_COMPLEX( type ) ) {
-        psError( __func__, "Power Spectrum for non-complex inputs is not implemented." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( type == PS_TYPE_C32 ) {
-        psF32 * outVec;
-        psC32* inVec = in->data.C32;
+    if (!PS_IS_PSELEMTYPE_COMPLEX(type)) {
+        psError(__func__, "Power Spectrum for non-complex inputs is not implemented.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (type == PS_TYPE_C32) {
+        psF32 *outVec;
+        psC32 *inVec = in->data.C32;
         psF32 inAbs1;
         psF32 inAbs2;
 
-        out = psVectorRecycle( out, outNumElements, PS_TYPE_F32 );
+        out = psVectorRecycle(out, outNumElements, PS_TYPE_F32);
         out->n = outNumElements;
         outVec = out->data.F32;
 
         // from ADD: P_0 = |C_0|^2/N^2
-        inAbs1 = cabsf( inVec[ 0 ] );
-        outVec[ 0 ] = inAbs1 * inAbs1 / inNumElementsSquared;
+        inAbs1 = cabsf(inVec[0]);
+        outVec[0] = inAbs1 * inAbs1 / inNumElementsSquared;
 
         // from ADD: P_j = (|C_j|^2+|C_N-j|^2)/N^2, where j = 1,2,...,(N/2-1)
-        for ( unsigned int i = 1;i < inHalfNumElements;i++ ) {
-            inAbs1 = cabsf( inVec[ i ] );
-            inAbs2 = cabsf( inVec[ inNumElements - i ] );
-            outVec[ i ] = ( inAbs1 * inAbs1 + inAbs2 * inAbs2 ) / inNumElementsSquared;
+        for (unsigned int i = 1; i < inHalfNumElements; i++) {
+            inAbs1 = cabsf(inVec[i]);
+            inAbs2 = cabsf(inVec[inNumElements - i]);
+            outVec[i] = (inAbs1 * inAbs1 + inAbs2 * inAbs2) / inNumElementsSquared;
         }
 
         // from ADD: P_N/2 = |C_N/2|^2/N^2
-        inAbs1 = cabsf( inVec[ inHalfNumElements ] );
-        outVec[ inHalfNumElements ] = inAbs1 * inAbs1 / inNumElementsSquared;
-    } else {
-        psError( __func__, "Can not power spectrum for given vector type (%d).",
-                 type );
-        psFree( out );
-        return NULL;
-    }
-
-    return out;
-
-}
+        inAbs1 = cabsf(inVec[inHalfNumElements]);
+        outVec[inHalfNumElements] = inAbs1 * inAbs1 / inNumElementsSquared;
+    } else {
+        psError(__func__, "Can not power spectrum for given vector type (%d).", type);
+        psFree(out);
+        return NULL;
+    }
+
+    return out;
+
+}
Index: /trunk/psLib/src/fft/psVectorFFT.h
===================================================================
--- /trunk/psLib/src/fft/psVectorFFT.h	(revision 1406)
+++ /trunk/psLib/src/fft/psVectorFFT.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psFFT.h
  *
@@ -7,6 +8,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -14,8 +15,8 @@
 
 #ifndef PS_FFT_H
-#define PS_FFT_H
+#    define PS_FFT_H
 
-#include "psImage.h"
-#include "psVector.h"
+#    include "psImage.h"
+#    include "psVector.h"
 
 /// @addtogroup Transform
@@ -24,29 +25,27 @@
 /** Details on FFT implementation (private). */
 
-
 typedef enum {
-    /// psImageFFT/psVectorFFT should perform a forward FFT.
+    // / psImageFFT/psVectorFFT should perform a forward FFT.
     PS_FFT_FORWARD = (-1),
 
-    ///< psImageFFT/psVectorFFT should perform a reverse FFT.
+    // /< psImageFFT/psVectorFFT should perform a reverse FFT.
     PS_FFT_REVERSE = (+1)
 } psFftDirection;
 
-psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction);
-psImage* psImageReal(psImage *out, const psImage* in);
-psImage* psImageImaginary(psImage *out, const psImage* in);
-psImage* psImageComplex(psImage* out, psImage *real, const psImage *imag);
-psImage* psImageConjugate(psImage *out, const psImage *in);
-psImage* psImagePowerSpectrum(psImage* out, const psImage* in);
+psImage *psImageFFT(psImage * out, const psImage * in, psFftDirection direction);
+psImage *psImageReal(psImage * out, const psImage * in);
+psImage *psImageImaginary(psImage * out, const psImage * in);
+psImage *psImageComplex(psImage * out, psImage * real, const psImage * imag);
+psImage *psImageConjugate(psImage * out, const psImage * in);
+psImage *psImagePowerSpectrum(psImage * out, const psImage * in);
 
-psVector* psVectorFFT(psVector* out, const psVector* in, psFftDirection direction);
-psVector* psVectorReal(psVector* out, const psVector* in);
-psVector* psVectorImaginary(psVector* out, const psVector* in);
-psVector* psVectorComplex(psVector* out, psVector* real, const psVector* imag);
-psVector* psVectorConjugate(psVector* out, const psVector* in);
-psVector* psVectorPowerSpectrum(psVector* out, const psVector* in);
+psVector *psVectorFFT(psVector * out, const psVector * in, psFftDirection direction);
+psVector *psVectorReal(psVector * out, const psVector * in);
+psVector *psVectorImaginary(psVector * out, const psVector * in);
+psVector *psVectorComplex(psVector * out, psVector * real, const psVector * imag);
+psVector *psVectorConjugate(psVector * out, const psVector * in);
+psVector *psVectorPowerSpectrum(psVector * out, const psVector * in);
 
 /// @}
 
 #endif
-
Index: /trunk/psLib/src/image/psImage.c
===================================================================
--- /trunk/psLib/src/image/psImage.c	(revision 1406)
+++ /trunk/psLib/src/image/psImage.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psImage.c
  *
@@ -9,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.37 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -18,5 +19,7 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 
@@ -29,53 +32,61 @@
 #include "psImage.h"
 
-static void imageFree(psImage* image);
+static void imageFree(psImage * image);
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
+
 /*****************************************************************************/
 
-psImage *psImageAlloc(unsigned int numCols, unsigned int numRows,
-                      const psElemType type)
+psImage *psImageAlloc(unsigned int numCols, unsigned int numRows, const psElemType type)
 {
     int area = 0;
-    int elementSize = PSELEMTYPE_SIZEOF(type); // element size in bytes
-    int rowSize = numCols*elementSize;  // row size in bytes.
-
-    area = numCols*numRows;
+    int elementSize = PSELEMTYPE_SIZEOF(type);  // element
+
+    // size in
+    // bytes
+    int rowSize = numCols * elementSize;        // row
+
+    // size
+
+    // in bytes.
+
+    area = numCols * numRows;
 
     if (area < 1) {
-        psError(__func__, "Invalid value for number of rows or columns "
-                "(numRows=%d, numCols=%d).", numRows, numCols);
+        psError(__func__,
+                "Invalid value for number of rows or columns " "(numRows=%d, numCols=%d).", numRows, numCols);
         return NULL;
     }
 
-    psImage *image = (psImage *)psAlloc(sizeof(psImage));
-    if(image == NULL) {
-        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
-    }
-
-    p_psMemSetDeallocator(image,(psFreeFcn)imageFree);
-
-    image->data.V = psAlloc(sizeof(void*)*numRows);
-    if(image->data.V == NULL) {
-        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
-    }
-
-
-    image->data.V[0] = psAlloc(area*elementSize);
-    if(image->data.V[0] == NULL) {
-        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
-    }
-
-    for(int i = 1; i < numRows; i++) {
-        image->data.V[i] = (void*)((int8_t*)image->data.V[i-1]+rowSize);
-    }
-
-    *(int*)&image->col0 = 0;
-    *(int*)&image->row0 = 0;
-    *(unsigned int*)&image->numCols = numCols;
-    *(unsigned int*)&image->numRows = numRows;
-    *(psDimen*)&image->type.dimen = PS_DIMEN_IMAGE;
-    *(psElemType*)&image->type.type = type;
+    psImage *image = (psImage *) psAlloc(sizeof(psImage));
+
+    if (image == NULL) {
+        psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
+    }
+
+    p_psMemSetDeallocator(image, (psFreeFcn) imageFree);
+
+    image->data.V = psAlloc(sizeof(void *) * numRows);
+    if (image->data.V == NULL) {
+        psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
+    }
+
+    image->data.V[0] = psAlloc(area * elementSize);
+    if (image->data.V[0] == NULL) {
+        psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
+    }
+
+    for (int i = 1; i < numRows; i++) {
+        image->data.V[i] = (void *)((int8_t *) image->data.V[i - 1] + rowSize);
+    }
+
+    *(int *)&image->col0 = 0;
+    *(int *)&image->row0 = 0;
+    *(unsigned int *)&image->numCols = numCols;
+    *(unsigned int *)&image->numRows = numRows;
+    *(psDimen *) & image->type.dimen = PS_DIMEN_IMAGE;
+    *(psElemType *) & image->type.type = type;
     image->parent = NULL;
     image->nChildren = 0;
@@ -85,5 +96,5 @@
 }
 
-static void imageFree(psImage* image)
+static void imageFree(psImage * image)
 {
     if (image == NULL) {
@@ -92,12 +103,13 @@
 
     if (image->type.type == PS_TYPE_PTR) {
-        // 2-D array of pointers -- must dereference
+        // 2-D array of pointers -- must
+        // dereference
         unsigned int oldNumRows = image->numRows;
         unsigned int oldNumCols = image->numCols;
-        psPTR* rowPtr;
-
-        for(unsigned int row=0;row<oldNumRows;row++) {
+        psPTR *rowPtr;
+
+        for (unsigned int row = 0; row < oldNumRows; row++) {
             rowPtr = image->data.PTR[row];
-            for (unsigned int col=0;col<oldNumCols;col++) {
+            for (unsigned int col = 0; col < oldNumCols; col++) {
                 psMemDecrRefCounter(rowPtr[col]);
             }
@@ -112,31 +124,36 @@
 }
 
-psImage* psImageRecycle(psImage* old,
-                        unsigned int numCols,
-                        unsigned int numRows,
-                        const psElemType type)
+psImage *psImageRecycle(psImage * old, unsigned int numCols, unsigned int numRows, const psElemType type)
 {
-    int elementSize = PSELEMTYPE_SIZEOF(type); // element size in bytes
-    int rowSize = numCols*elementSize;  // row size in bytes.
+    int elementSize = PSELEMTYPE_SIZEOF(type);  // element
+
+    // size in
+    // bytes
+    int rowSize = numCols * elementSize;        // row
+
+    // size
+
+    // in bytes.
 
     if (old == NULL) {
-        old = psImageAlloc(numCols,numRows,type);
+        old = psImageAlloc(numCols, numRows, type);
         return old;
     }
 
     if (old->type.dimen != PS_DIMEN_IMAGE) {
-        psError(__func__,"Can not realloc image because input is not an image.");
+        psError(__func__, "Can not realloc image because input is not an image.");
         return NULL;
     }
 
     if (old->type.type == PS_TYPE_PTR) {
-        // 2-D array of pointers -- must dereference
+        // 2-D array of pointers -- must
+        // dereference
         unsigned int oldNumRows = old->numRows;
         unsigned int oldNumCols = old->numCols;
-        psPTR* rowPtr;
-
-        for(unsigned int row=0;row<oldNumRows;row++) {
+        psPTR *rowPtr;
+
+        for (unsigned int row = 0; row < oldNumRows; row++) {
             rowPtr = old->data.PTR[row];
-            for (unsigned int col=0;col<oldNumCols;col++) {
+            for (unsigned int col = 0; col < oldNumCols; col++) {
                 psMemDecrRefCounter(rowPtr[col]);
                 rowPtr[col] = NULL;
@@ -146,26 +163,24 @@
 
     /* image already the right size/type? */
-    if (numCols == old->numCols && numRows == old->numRows &&
-            type == old->type.type) {
+    if (numCols == old->numCols && numRows == old->numRows && type == old->type.type) {
         return old;
     }
-
     // Resize the image buffer
-    old->data.V[0] = psRealloc(old->data.V[0],numCols * numRows * elementSize);
-    old->data.V = (void**) psRealloc(old->data.V,numRows * sizeof(void*));
+    old->data.V[0] = psRealloc(old->data.V[0], numCols * numRows * elementSize);
+    old->data.V = (void **)psRealloc(old->data.V, numRows * sizeof(void *));
 
     // recreate the row pointers
-    for(int i = 1; i < numRows; i++) {
-        old->data.V[i] = (void*)((int8_t*)old->data.V[i-1]+rowSize);
-    }
-
-    *(unsigned int*)&old->numCols = numCols;
-    *(unsigned int*)&old->numRows = numRows;
-    *(psElemType*)&old->type.type = type;
+    for (int i = 1; i < numRows; i++) {
+        old->data.V[i] = (void *)((int8_t *) old->data.V[i - 1] + rowSize);
+    }
+
+    *(unsigned int *)&old->numCols = numCols;
+    *(unsigned int *)&old->numRows = numRows;
+    *(psElemType *) & old->type.type = type;
 
     return old;
 }
 
-int psImageFreeChildren(psImage* image)
+int psImageFreeChildren(psImage * image)
 {
     int i = 0;
@@ -181,5 +196,5 @@
     children = image->children;
 
-    for(i=0; i<nChildren; i++) {
+    for (i = 0; i < nChildren; i++) {
         if (children[i] != NULL) {
             numFreed++;
@@ -191,5 +206,4 @@
     image->nChildren = 0;
     image->children = NULL;
-
 
     return numFreed;
@@ -202,17 +216,12 @@
 linear interpolation is performed on the image.
  *****************************************************************************/
-psF32 psImagePixelInterpolate(
-    const psImage *input,
-    float x,
-    float y,
-    psF32 unexposedValue,
-    psImageInterpolateMode mode)
+psF32 psImagePixelInterpolate(const psImage * input,
+                              float x, float y, psF32 unexposedValue, psImageInterpolateMode mode)
 {
 
     if (input == NULL) {
-        psError(__func__,"Image can not be NULL.");
+        psError(__func__, "Image can not be NULL.");
         return unexposedValue;
     }
-
     #define PSIMAGE_PIXEL_INTERPOLATE_CASE(TYPE) \
 case PS_TYPE_##TYPE: \
@@ -243,5 +252,5 @@
         PSIMAGE_PIXEL_INTERPOLATE_CASE(C64);
     default:
-        psError(__func__,"Unsupported image datatype (%d)",input->type.type);
+        psError(__func__, "Unsupported image datatype (%d)", input->type.type);
     }
 
@@ -303,5 +312,4 @@
 PSIMAGE_PIXEL_INTERPOLATE_FLAT_COMPLEX(C32)
 PSIMAGE_PIXEL_INTERPOLATE_FLAT_COMPLEX(C64)
-
 #define PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(TYPE) \
 inline psF64 p_psImagePixelInterpolateBILINEAR_##TYPE(const psImage *input, \
@@ -359,5 +367,4 @@
     return(pixel); \
 }
-
 #define PSIMAGE_PIXEL_INTERPOLATE_BILINEAR_COMPLEX(TYPE) \
 inline psC64 p_psImagePixelInterpolateBILINEAR_##TYPE(const psImage *input, \
@@ -428,4 +435,2 @@
 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR_COMPLEX(C32)
 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR_COMPLEX(C64)
-
-
Index: /trunk/psLib/src/image/psImage.h
===================================================================
--- /trunk/psLib/src/image/psImage.h	(revision 1406)
+++ /trunk/psLib/src/image/psImage.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psImage.h
  *
@@ -11,15 +12,15 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
-# ifndef PS_IMAGE_H
-# define PS_IMAGE_H
+#ifndef PS_IMAGE_H
+#    define PS_IMAGE_H
 
-#include <complex.h>
+#    include <complex.h>
 
-#include "psType.h"
+#    include "psType.h"
 
 /// @addtogroup Image
@@ -39,36 +40,37 @@
 typedef struct psImage
 {
-    const psType type;                  ///< Image data type and dimension.
-    const unsigned int numCols;         ///< Number of columns in image
-    const unsigned int numRows;         ///< Number of rows in image.
-    const int col0;                     ///< Column position relative to parent.
-    const int row0;                     ///< Row position relative to parent.
+    const psType type;          // /< Image data type and dimension.
+    const unsigned int numCols; // /< Number of columns in image
+    const unsigned int numRows; // /< Number of rows in image.
+    const int col0;             // /< Column position relative to parent.
+    const int row0;             // /< Row position relative to parent.
 
     union {
-        psU8    **U8;                   ///< Unsigned 8-bit integer data.
-        psU16   **U16;                  ///< Unsigned 16-bit integer data.
-        psU32   **U32;                  ///< Unsigned 32-bit integer data.
-        psU64   **U64;                  ///< Unsigned 64-bit integer data.
-        psS8    **S8;                   ///< Signed 8-bit integer data.
-        psS16   **S16;                  ///< Signed 16-bit integer data.
-        psS32   **S32;                  ///< Signed 32-bit integer data.
-        psS64   **S64;                  ///< Signed 64-bit integer data.
-        psF32   **F32;                  ///< Single-precision float data.
-        psF64   **F64;                  ///< Double-precision float data.
-        psC32   **C32;                  ///< Single-precision complex data.
-        psC64   **C64;                  ///< Double-precision complex data.
-        psPTR   **PTR;                  ///< Void pointers.
-        psPTR    *V;                    ///< Pointer to data.
-    } data;                             ///< Union for data types.
-    const struct psImage *parent;       ///< Parent, if a subimage.
-    int nChildren;                      ///< Number of subimages.
-    struct psImage** children;          ///< Children of this region.
+        psU8 **U8;              // /< Unsigned 8-bit integer data.
+        psU16 **U16;            // /< Unsigned 16-bit integer data.
+        psU32 **U32;            // /< Unsigned 32-bit integer data.
+        psU64 **U64;            // /< Unsigned 64-bit integer data.
+        psS8 **S8;              // /< Signed 8-bit integer data.
+        psS16 **S16;            // /< Signed 16-bit integer data.
+        psS32 **S32;            // /< Signed 32-bit integer data.
+        psS64 **S64;            // /< Signed 64-bit integer data.
+        psF32 **F32;            // /< Single-precision float data.
+        psF64 **F64;            // /< Double-precision float data.
+        psC32 **C32;            // /< Single-precision complex data.
+        psC64 **C64;            // /< Double-precision complex data.
+        psPTR **PTR;            // /< Void pointers.
+        psPTR *V;               // /< Pointer to data.
+    } data;                     // /< Union for data types.
+    const struct psImage *parent;       // /< Parent, if a subimage.
+    int nChildren;              // /< Number of subimages.
+    struct psImage **children;  // /< Children of this region.
 }
 psImage;
 
 /*****************************************************************************/
+
 /* FUNCTION PROTOTYPES                                                       */
+
 /*****************************************************************************/
-
 
 /** Create an image of the specified size and type.
@@ -80,9 +82,8 @@
  *
  */
-psImage *psImageAlloc(
-    unsigned int numCols,               ///< Number of rows in image.
-    unsigned int numRows,               ///< Number of columns in image.
-    const psElemType type               ///< Type of data for image.
-);
+psImage *psImageAlloc(unsigned int numCols,     // /< Number of rows in image.
+                      unsigned int numRows,     // /< Number of columns in image.
+                      const psElemType type     // /< Type of data for image.
+                     );
 
 /** Resize a given image to the given size/type.
@@ -91,11 +92,9 @@
  *
  */
-psImage* psImageRecycle(
-    psImage* old,                       ///< the psImage to recycle by resizing image buffer
-    unsigned int numCols,               ///< the desired number of columns in image
-    unsigned int numRows,               ///< the desired number of rows in image
-    const psElemType type               ///< the desired datatype of the image
-);
-
+psImage *psImageRecycle(psImage * old,  // /< the psImage to recycle by resizing image buffer
+                        unsigned int numCols,   // /< the desired number of columns in image
+                        unsigned int numRows,   // /< the desired number of rows in image
+                        const psElemType type   // /< the desired datatype of the image
+                       );
 
 /** Frees all children of a psImage.
@@ -104,18 +103,13 @@
  *
  */
-int psImageFreeChildren(
-    psImage* image
-    /**< psImage in which all children shall be deallocated */
-);
+int psImageFreeChildren(psImage * image
 
-psF32 psImagePixelInterpolate(
-    const psImage *input,
-    float x,
-    float y,
-    psF32 unexposedValue,
-    psImageInterpolateMode mode
-);
+                        /**< psImage in which all children shall be deallocated */
+                       );
 
-#define p_psImagePixelInterpolateFcns(TYPE) \
+psF32 psImagePixelInterpolate(const psImage * input,
+                              float x, float y, psF32 unexposedValue, psImageInterpolateMode mode);
+
+#    define p_psImagePixelInterpolateFcns(TYPE) \
 inline psF64 p_psImagePixelInterpolateFLAT_##TYPE( \
         const psImage *input, \
@@ -131,5 +125,5 @@
                                                      );
 
-#define p_psImagePixelInterpolateComplexFcns(TYPE) \
+#    define p_psImagePixelInterpolateComplexFcns(TYPE) \
 inline psC64 p_psImagePixelInterpolateFLAT_##TYPE( \
         const psImage *input, \
@@ -157,6 +151,4 @@
 p_psImagePixelInterpolateComplexFcns(C32)
 p_psImagePixelInterpolateComplexFcns(C64)
-
 /// @}
-
 #endif
Index: /trunk/psLib/src/image/psImageExtraction.c
===================================================================
--- /trunk/psLib/src/image/psImageExtraction.c	(revision 1406)
+++ /trunk/psLib/src/image/psImageExtraction.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psImageExtraction.c
 *
@@ -9,6 +10,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 22:34:05 $
+*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -22,72 +23,83 @@
 #include "psError.h"
 
-psImage *psImageSubset( psImage *out, psImage *image, unsigned int numCols,
-                        unsigned int numRows, unsigned int col0,
-                        unsigned int row0 )
+psImage *psImageSubset(psImage * out,
+                       psImage * image,
+                       unsigned int numCols, unsigned int numRows, unsigned int col0, unsigned int row0)
 {
-    unsigned int elementSize;           // size of image element in bytes
-    unsigned int outputRowSize;         // output row size in bytes
-    unsigned int inputColOffset;        // offset in bytes to first subset pixel in input row
-
-    if ( image == NULL || image->data.V == NULL ) {
-        psError( __func__, "Can not subset image because input image or its pixel buffer is NULL." );
-        return NULL;
-    }
-
-    if ( image->type.dimen != PS_DIMEN_IMAGE ) {
-        psError( __func__, "Can not subset image because input image is not an image." );
-        return NULL;
-    }
-
-    if ( numCols < 1 || numRows < 1 ) {
-        psError( __func__, "Can not subset image because number of rows or columns are zero (%dx%d).",
-                 numCols, numRows );
-        return NULL;
-    }
-
-    if ( col0 >= image->numCols || row0 >= image->numRows ) {
-        psError( __func__, "Can not subset image because col0,row0 (%d,%d) is not a valid pixel location.",
-                 col0, row0 );
+    unsigned int elementSize;   // size of image
+
+    // element in
+    // bytes
+    unsigned int outputRowSize; // output row
+
+    // size in bytes
+    unsigned int inputColOffset;        // offset
+
+    // in
+    // bytes
+    // to
+    // first
+    // subset
+
+    // pixel in input row
+
+    if (image == NULL || image->data.V == NULL) {
+        psError(__func__, "Can not subset image because input image or its pixel buffer is NULL.");
+        return NULL;
+    }
+
+    if (image->type.dimen != PS_DIMEN_IMAGE) {
+        psError(__func__, "Can not subset image because input image is not an image.");
+        return NULL;
+    }
+
+    if (numCols < 1 || numRows < 1) {
+        psError(__func__,
+                "Can not subset image because number of rows or columns are zero (%dx%d).", numCols, numRows);
+        return NULL;
+    }
+
+    if (col0 >= image->numCols || row0 >= image->numRows) {
+        psError(__func__,
+                "Can not subset image because col0,row0 (%d,%d) is not a valid pixel location.", col0, row0);
         return NULL;
     }
 
     /* validate subimage size */
-    if ( col0 + numCols >= image->numCols || row0 + numRows >= image->numRows ) {
-        psError( __func__, "Can not subset image outside of image boundaries (size=%dx%d, "
-                 "subset=[%d:%d,%d:%d]).", image->numCols, image->numRows, col0,
-                 col0 + numCols, row0, row0 + numRows );
-        return NULL;
-    }
-
-
-    elementSize = PSELEMTYPE_SIZEOF( image->type.type );
-
-    out = psImageRecycle( out, numCols, numRows, image->type.type );
-
-    // set the parent information into the child output image
-    *( int* ) & out->row0 = row0;
-    *( int* ) & out->col0 = col0;
-    *( psImage** ) & out->parent = ( psImage* ) image;
-
-    // add output image as a child of the input image.
+    if (col0 + numCols >= image->numCols || row0 + numRows >= image->numRows) {
+        psError(__func__,
+                "Can not subset image outside of image boundaries (size=%dx%d, "
+                "subset=[%d:%d,%d:%d]).",
+                image->numCols, image->numRows, col0, col0 + numCols, row0, row0 + numRows);
+        return NULL;
+    }
+
+    elementSize = PSELEMTYPE_SIZEOF(image->type.type);
+
+    out = psImageRecycle(out, numCols, numRows, image->type.type);
+
+    // set the parent information into the child
+    // output image
+    *(int *)&out->row0 = row0;
+    *(int *)&out->col0 = col0;
+    *(psImage **) & out->parent = (psImage *) image;
+
+    // add output image as a child of the input
+    // image.
     image->nChildren++;
-    image->children = ( psImage ** ) psRealloc( image->children,
-                      image->nChildren * sizeof( psImage* ) );
-    image->children[ image->nChildren - 1 ] = out;
+    image->children = (psImage **) psRealloc(image->children, image->nChildren * sizeof(psImage *));
+    image->children[image->nChildren - 1] = out;
 
     inputColOffset = elementSize * col0;
     outputRowSize = elementSize * numCols;
 
-    for ( int row = 0; row < numRows; row++ ) {
-        memcpy( out->data.V[ row ], image->data.U8[ row0 + row ] + inputColOffset,
-                outputRowSize );
-    }
-
-    return ( out );
+    for (int row = 0; row < numRows; row++) {
+        memcpy(out->data.V[row], image->data.U8[row0 + row] + inputColOffset, outputRowSize);
+    }
+
+    return (out);
 }
 
-
-psImage *psImageCopy( psImage* restrict output, const psImage *input,
-                      psElemType type )
+psImage *psImageCopy(psImage * restrict output, const psImage * input, psElemType type)
 {
     psElemType inDatatype;
@@ -97,20 +109,21 @@
     int numCols;
 
-    if ( input == NULL || input->data.V == NULL ) {
-        psError( __func__, "Can not copy image because input image or its pixel buffer is NULL." );
-        psFree( output );
-        return NULL;
-    }
-
-    if ( input == output ) {
-        psError( __func__, "Can not copy image because given input and output "
-                 "parameter reference the same psImage struct." );
-        psFree( output );
-        return NULL;
-    }
-
-    if ( input->type.dimen != PS_DIMEN_IMAGE ) {
-        psError( __func__, "Can not copy image because input image is not actually an image." );
-        psFree( output );
+    if (input == NULL || input->data.V == NULL) {
+        psError(__func__, "Can not copy image because input image or its pixel buffer is NULL.");
+        psFree(output);
+        return NULL;
+    }
+
+    if (input == output) {
+        psError(__func__,
+                "Can not copy image because given input and output "
+                "parameter reference the same psImage struct.");
+        psFree(output);
+        return NULL;
+    }
+
+    if (input->type.dimen != PS_DIMEN_IMAGE) {
+        psError(__func__, "Can not copy image because input image is not actually an image.");
+        psFree(output);
         return NULL;
     }
@@ -120,20 +133,20 @@
     numCols = input->numCols;
     elements = numRows * numCols;
-    elementSize = PSELEMTYPE_SIZEOF( inDatatype );
-
-    if ( inDatatype == PS_TYPE_PTR || type == PS_TYPE_PTR ) {
-        psError( __func__, "Can not copy image to/from a void* matrix" );
-        psFree( output );
-        return NULL;
-    }
-
-    output = psImageRecycle( output, numCols, numRows, type );
-
-    // cover the trival case of copy of the same datatype.
-    if ( type == inDatatype ) {
-        memcpy( output->data.V[ 0 ], input->data.V[ 0 ], elementSize * elements );
+    elementSize = PSELEMTYPE_SIZEOF(inDatatype);
+
+    if (inDatatype == PS_TYPE_PTR || type == PS_TYPE_PTR) {
+        psError(__func__, "Can not copy image to/from a void* matrix");
+        psFree(output);
+        return NULL;
+    }
+
+    output = psImageRecycle(output, numCols, numRows, type);
+
+    // cover the trival case of copy of the same
+    // datatype.
+    if (type == inDatatype) {
+        memcpy(output->data.V[0], input->data.V[0], elementSize * elements);
         return output;
     }
-
     #define PSIMAGE_ELEMENT_COPY(IN,INTYPE,OUT,OUTTYPE,ELEMENTS) { \
         ps##INTYPE *in = IN->data.INTYPE[0]; \
@@ -186,40 +199,40 @@
     }
 
-    switch ( type ) {
+    switch (type) {
     case PS_TYPE_S8:
-        PSIMAGE_COPY_CASE( output, S8 );
+        PSIMAGE_COPY_CASE(output, S8);
         break;
     case PS_TYPE_S16:
-        PSIMAGE_COPY_CASE( output, S16 );
+        PSIMAGE_COPY_CASE(output, S16);
         break;
     case PS_TYPE_S32:
-        PSIMAGE_COPY_CASE( output, S32 );
+        PSIMAGE_COPY_CASE(output, S32);
         break;
     case PS_TYPE_S64:
-        PSIMAGE_COPY_CASE( output, S64 );
+        PSIMAGE_COPY_CASE(output, S64);
         break;
     case PS_TYPE_U8:
-        PSIMAGE_COPY_CASE( output, U8 );
+        PSIMAGE_COPY_CASE(output, U8);
         break;
     case PS_TYPE_U16:
-        PSIMAGE_COPY_CASE( output, U16 );
+        PSIMAGE_COPY_CASE(output, U16);
         break;
     case PS_TYPE_U32:
-        PSIMAGE_COPY_CASE( output, U32 );
+        PSIMAGE_COPY_CASE(output, U32);
         break;
     case PS_TYPE_U64:
-        PSIMAGE_COPY_CASE( output, U64 );
+        PSIMAGE_COPY_CASE(output, U64);
         break;
     case PS_TYPE_F32:
-        PSIMAGE_COPY_CASE( output, F32 );
+        PSIMAGE_COPY_CASE(output, F32);
         break;
     case PS_TYPE_F64:
-        PSIMAGE_COPY_CASE( output, F64 );
+        PSIMAGE_COPY_CASE(output, F64);
         break;
     case PS_TYPE_C32:
-        PSIMAGE_COPY_CASE( output, C32 );
+        PSIMAGE_COPY_CASE(output, C32);
         break;
     case PS_TYPE_C64:
-        PSIMAGE_COPY_CASE( output, C64 );
+        PSIMAGE_COPY_CASE(output, C64);
         break;
     default:
@@ -229,34 +242,31 @@
 }
 
-psVector* psImageSlice( psVector* out,
-                        psVector* slicePositions,
-                        const psImage* restrict in,
-                        const psImage* restrict mask,
-                        unsigned int maskVal,
-                        unsigned int col,
-                        unsigned int row,
-                        unsigned int numCols,
-                        unsigned int numRows,
-                        psImageCutDirection direction,
-                        const psStats* stats )
+psVector *psImageSlice(psVector * out,
+                       psVector * slicePositions,
+                       const psImage * restrict in,
+                       const psImage * restrict mask,
+                       unsigned int maskVal,
+                       unsigned int col,
+                       unsigned int row,
+                       unsigned int numCols,
+                       unsigned int numRows, psImageCutDirection direction, const psStats * stats)
 {
     double statVal;
-    psStats* myStats;
+    psStats *myStats;
     psElemType type;
     int inRows;
     int inCols;
     int delta = 1;
-    psF64* outData;
-
-    if ( in == NULL || in->data.V == NULL ) {
-        psError( __func__, "Input image can not be NULL." );
-        psFree( out );
-        return NULL;
-    }
-
-    if ( numRows == 0 || numCols == 0 ) {
-        psError( __func__, "The specified region contains no data (%dx%d)",
-                 numCols, numRows );
-        psFree( out );
+    psF64 *outData;
+
+    if (in == NULL || in->data.V == NULL) {
+        psError(__func__, "Input image can not be NULL.");
+        psFree(out);
+        return NULL;
+    }
+
+    if (numRows == 0 || numCols == 0) {
+        psError(__func__, "The specified region contains no data (%dx%d)", numCols, numRows);
+        psFree(out);
         return NULL;
     }
@@ -266,71 +276,73 @@
     inCols = in->numCols;
 
-    if ( direction == PS_CUT_X_NEG || direction == PS_CUT_Y_NEG ) {
+    if (direction == PS_CUT_X_NEG || direction == PS_CUT_Y_NEG) {
         delta = -1;
     }
-
-    // if numRows/numCols is negative, invert the problem to give positive
-    // numRows/numCols (and cut in opposite direction).
-    if ( numRows < 0 ) {
+    // if numRows/numCols is negative, invert the
+    // problem to give positive
+    // numRows/numCols (and cut in opposite
+    // direction).
+    if (numRows < 0) {
         numRows = -numRows;
-        row -= ( numRows - 1 );
+        row -= (numRows - 1);
         delta = -delta;
     }
 
-    if ( numCols < 0 ) {
+    if (numCols < 0) {
         numCols = -numCols;
-        col -= ( numCols - 1 );
+        col -= (numCols - 1);
         delta = -delta;
     }
 
-    if ( mask != NULL ) {
-        if ( inRows != mask->numRows || inCols != mask->numCols ) {
-            psError( __func__, "The mask and image dimensions did not match (%dx%d vs %dx%d)",
-                     mask->numCols, mask->numRows, in->numCols, in->numRows );
-            psFree( out );
-        }
-        if ( mask->type.type != PS_TYPE_MASK ) {
-            psError( __func__, "The mask datatype (%d) must be %s.",
-                     mask->type.type, PS_TYPE_MASK_NAME );
-            psFree( out );
-        }
-    }
-
-    if ( row >= inRows || col >= inCols ||
-            col + numCols > in->numCols || row + numRows > in->numRows ) {
-        psError( __func__, "The specified image region (%d,%d to %d,%d) is outside of image area (0,0 to %d,%d).",
-                 col, row, col + numCols - 1, row + numRows - 1, in->numCols - 1, in->numRows - 1 );
-        psFree( out );
-        return NULL;
-    }
-
-    // verify that the stats struct specifies a single stats operation
-    if ( stats == NULL || p_psGetStatValue( stats, &statVal ) == false ) {
-        psError( __func__, "The stat options didn't specify a single supported statistic type." );
-        psFree( out );
-        return NULL;
-    }
-
-    // since stats input is const, I need to create a 'scratch' stats struct
-    myStats = psAlloc( sizeof( psStats ) );
+    if (mask != NULL) {
+        if (inRows != mask->numRows || inCols != mask->numCols) {
+            psError(__func__,
+                    "The mask and image dimensions did not match (%dx%d vs %dx%d)",
+                    mask->numCols, mask->numRows, in->numCols, in->numRows);
+            psFree(out);
+        }
+        if (mask->type.type != PS_TYPE_MASK) {
+            psError(__func__, "The mask datatype (%d) must be %s.", mask->type.type, PS_TYPE_MASK_NAME);
+            psFree(out);
+        }
+    }
+
+    if (row >= inRows || col >= inCols || col + numCols > in->numCols || row + numRows > in->numRows) {
+        psError(__func__,
+                "The specified image region (%d,%d to %d,%d) is outside of image area (0,0 to %d,%d).",
+                col, row, col + numCols - 1, row + numRows - 1, in->numCols - 1, in->numRows - 1);
+        psFree(out);
+        return NULL;
+    }
+    // verify that the stats struct specifies a
+    // single stats operation
+    if (stats == NULL || p_psGetStatValue(stats, &statVal) == false) {
+        psError(__func__, "The stat options didn't specify a single supported statistic type.");
+        psFree(out);
+        return NULL;
+    }
+    // since stats input is const, I need to
+    // create a 'scratch' stats struct
+    myStats = psAlloc(sizeof(psStats));
     *myStats = *stats;
 
-
-
-    if ( direction == PS_CUT_X_POS || direction == PS_CUT_X_NEG ) {
-        psVector * imgVec = psVectorAlloc( numRows, type );
-        psVector* maskVec = NULL;
-        psMaskType* maskData = NULL;
-        psU32* outPosition = NULL;
-
-        // recycle output to make a proper sized/type output structure
-        // n.b. type is double as that is the type given for all stats in psStats.
-        out = psVectorRecycle( out, numCols, PS_TYPE_F64);
+    if (direction == PS_CUT_X_POS || direction == PS_CUT_X_NEG) {
+        psVector *imgVec = psVectorAlloc(numRows, type);
+        psVector *maskVec = NULL;
+        psMaskType *maskData = NULL;
+        psU32 *outPosition = NULL;
+
+        // recycle output to make a proper
+        // sized/type output structure
+        // n.b. type is double as that is the
+        // type given for all stats in
+        // psStats.
+        out = psVectorRecycle(out, numCols, PS_TYPE_F64);
         if (slicePositions != NULL) {
-            slicePositions = psVectorRecycle(slicePositions,numCols,PS_TYPE_U32);
+            slicePositions = psVectorRecycle(slicePositions, numCols, PS_TYPE_U32);
             outPosition = slicePositions->data.U32;
         }
         outData = out->data.F64;
-        if ( delta < 0 ) {
+        if (delta < 0) {
             outData += numCols - 1;
             if (outPosition != NULL) {
@@ -339,8 +351,7 @@
         }
 
-        if ( mask != NULL ) {
-            maskVec = psVectorAlloc( numRows, mask->type.type );
-        }
-
+        if (mask != NULL) {
+            maskVec = psVectorAlloc(numRows, mask->type.type);
+        }
         #define PSIMAGE_CUT_VERTICAL(TYPE) \
     case PS_TYPE_##TYPE: { \
@@ -373,83 +384,108 @@
         }
 
-        switch ( type ) {
-            PSIMAGE_CUT_VERTICAL( U8 );
-            PSIMAGE_CUT_VERTICAL( U16 );
-            PSIMAGE_CUT_VERTICAL( U32 );
-            PSIMAGE_CUT_VERTICAL( U64 );
-            PSIMAGE_CUT_VERTICAL( S8 );
-            PSIMAGE_CUT_VERTICAL( S16 );
-            PSIMAGE_CUT_VERTICAL( S32 );
-            PSIMAGE_CUT_VERTICAL( S64 );
-            PSIMAGE_CUT_VERTICAL( F32 );
-            PSIMAGE_CUT_VERTICAL( F64 );
-            PSIMAGE_CUT_VERTICAL( C32 );
-            PSIMAGE_CUT_VERTICAL( C64 );
+        switch (type) {
+            PSIMAGE_CUT_VERTICAL(U8);
+            PSIMAGE_CUT_VERTICAL(U16);
+            PSIMAGE_CUT_VERTICAL(U32);
+            PSIMAGE_CUT_VERTICAL(U64);
+            PSIMAGE_CUT_VERTICAL(S8);
+            PSIMAGE_CUT_VERTICAL(S16);
+            PSIMAGE_CUT_VERTICAL(S32);
+            PSIMAGE_CUT_VERTICAL(S64);
+            PSIMAGE_CUT_VERTICAL(F32);
+            PSIMAGE_CUT_VERTICAL(F64);
+            PSIMAGE_CUT_VERTICAL(C32);
+            PSIMAGE_CUT_VERTICAL(C64);
         default:
-            psError( __func__, "Unsupported datatype (%d)", type );
-            psFree( out );
+            psError(__func__, "Unsupported datatype (%d)", type);
+            psFree(out);
             out = NULL;
         }
-        psFree( imgVec );
-        psFree( maskVec );
-    } else
-        if ( direction == PS_CUT_Y_POS || direction == PS_CUT_Y_NEG ) { // Cut in Y direction
-            psVector * imgVec = NULL;
-            psVector* maskVec = NULL;
-            int elementSize = PSELEMTYPE_SIZEOF( type );
-            psU32* outPosition = NULL;
-
-            // fill in psVectors to fake out the statistics functions.
-            imgVec = psAlloc( sizeof( psVector ) );
-            imgVec->type = in->type;
-            imgVec->n = imgVec->nalloc = numCols;
-            if ( mask != NULL ) {
-                maskVec = psAlloc( sizeof( psVector ) );
-                maskVec->type = mask->type;
-                maskVec->n = maskVec->nalloc = numCols;
+        psFree(imgVec);
+        psFree(maskVec);
+    } else if (direction == PS_CUT_Y_POS || direction == PS_CUT_Y_NEG) {        // Cut
+        //
+        //
+        //
+        //
+        //
+        //
+        //
+        //
+        //
+        // in
+        // Y
+        // direction
+        psVector *imgVec = NULL;
+        psVector *maskVec = NULL;
+        int elementSize = PSELEMTYPE_SIZEOF(type);
+        psU32 *outPosition = NULL;
+
+        // fill in psVectors to fake out the
+        // statistics functions.
+        imgVec = psAlloc(sizeof(psVector));
+        imgVec->type = in->type;
+        imgVec->n = imgVec->nalloc = numCols;
+        if (mask != NULL) {
+            maskVec = psAlloc(sizeof(psVector));
+            maskVec->type = mask->type;
+            maskVec->n = maskVec->nalloc = numCols;
+        }
+        // recycle output to make a proper
+        // sized/type output structure
+        // n.b. type is double as that is the
+        // type given for all stats in
+        // psStats.
+        out = psVectorRecycle(out, numRows, PS_TYPE_F64);
+        if (slicePositions != NULL) {
+            slicePositions = psVectorRecycle(slicePositions, numRows, PS_TYPE_U32);
+            outPosition = slicePositions->data.U32;
+        }
+        outData = out->data.F64;
+        if (delta < 0) {
+            outData += numRows - 1;
+            if (outPosition != NULL) {
+                outPosition += numRows - 1;
             }
-
-            // recycle output to make a proper sized/type output structure
-            // n.b. type is double as that is the type given for all stats in psStats.
-            out = psVectorRecycle( out, numRows, PS_TYPE_F64 );
-            if (slicePositions != NULL) {
-                slicePositions = psVectorRecycle(slicePositions,numRows,PS_TYPE_U32);
-                outPosition = slicePositions->data.U32;
+        }
+
+        for (int r = 0; r < numRows; r++) {
+            // point the vector struct to the
+            // data to calculate the stats
+            imgVec->data.V = (void *)(in->data.U8[row + r] + col * elementSize);
+            if (maskVec != NULL) {
+                maskVec->data.V = (void *)(mask->data.U8[row + r] + col * sizeof(psMaskType));
             }
-            outData = out->data.F64;
-            if ( delta < 0 ) {
-                outData += numRows - 1;
-                if (outPosition != NULL) {
-                    outPosition += numRows - 1;
-                }
+            myStats = psVectorStats(myStats, imgVec, maskVec, maskVal);
+            (void)p_psGetStatValue(myStats, &statVal);  // we
+            // know
+            // it
+            // works
+            // cause we tested it
+            // above
+            *outData = statVal;
+            if (outPosition != NULL) {
+                *outPosition = row + r;
+                outPosition += delta;
+
             }
-
-            for ( int r = 0;r < numRows;r++ ) {
-                // point the vector struct to the data to calculate the stats
-                imgVec->data.V = ( void* ) ( in->data.U8[ row + r ] + col * elementSize );
-                if ( maskVec != NULL ) {
-                    maskVec->data.V = ( void* ) ( mask->data.U8[ row + r ] + col * sizeof( psMaskType ) );
-                }
-                myStats = psVectorStats( myStats, imgVec, maskVec, maskVal );
-                ( void ) p_psGetStatValue( myStats, &statVal ); // we know it works cause we tested it above
-                *outData = statVal;
-                if (outPosition != NULL) {
-                    *outPosition = row+r;
-                    outPosition += delta;
-                    \
-                }
-                outData += delta;
-            }
-            psFree( imgVec );
-            psFree( maskVec );
-        } else { // don't know what the direction flag is
-            psError( __func__, "Invalid direction flag (%d)", direction );
-            psFree( out );
-            out = NULL;
-        }
-
-    psFree( myStats );
+            outData += delta;
+        }
+        psFree(imgVec);
+        psFree(maskVec);
+    } else {                               // don't
+        // know
+        // what
+        // the
+        // direction
+        // flag
+        // is
+        psError(__func__, "Invalid direction flag (%d)", direction);
+        psFree(out);
+        out = NULL;
+    }
+
+    psFree(myStats);
 
     return out;
 }
-
Index: /trunk/psLib/src/image/psImageExtraction.h
===================================================================
--- /trunk/psLib/src/image/psImageExtraction.h	(revision 1406)
+++ /trunk/psLib/src/image/psImageExtraction.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psImageExtraction.h
 *
@@ -9,6 +10,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 21:50:13 $
+*  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -16,9 +17,9 @@
 
 #ifndef PSIMAGEEXTRACTION_H
-#define PSIMAGEEXTRACTION_H
+#    define PSIMAGEEXTRACTION_H
 
-#include "psImage.h"
-#include "psVector.h"
-#include "psStats.h"
+#    include "psImage.h"
+#    include "psVector.h"
+#    include "psStats.h"
 
 /// @addtogroup Image
@@ -40,12 +41,11 @@
 *
 */
-psImage *psImageSubset(
-    psImage *out,                         ///< Subimage to return, or NULL.
-    psImage *image,                       ///< Parent image.
-    unsigned int numCols,                 ///< Subimage width (<= image.nCols - col0).
-    unsigned int numRows,                 ///< Subimage height (<= image.nRows - row0).
-    unsigned int col0,                    ///< Subimage col-offset (0 <= col0 < nCol).
-    unsigned int row0                   ///< Subimage row-offset (0 <= row0 < nCol).
-);
+psImage *psImageSubset(psImage * out,   // /< Subimage to return, or NULL.
+                       psImage * image, // /< Parent image.
+                       unsigned int numCols,    // /< Subimage width (<= image.nCols - col0).
+                       unsigned int numRows,    // /< Subimage height (<= image.nRows - row0).
+                       unsigned int col0,       // /< Subimage col-offset (0 <= col0 < nCol).
+                       unsigned int row0        // /< Subimage row-offset (0 <= row0 < nCol).
+                      );
 
 /** Makes a copy of a psImage
@@ -55,52 +55,39 @@
  *
  */
-psImage *psImageCopy(
-    psImage* restrict output,
-    /**< if not NULL, a psImage that could be recycled.  If it can not be used,
-     *   it will be freed via psImageFree
-     */
-    const psImage *input,
-    /**< the psImage to copy */
-    psElemType type
-    /**< the desired datatype of the returned copy */
-);
+psImage *psImageCopy(psImage * restrict output,
 
-psVector* psImageSlice(
-    psVector* out,
-    psVector* slicePositions,
-    const psImage* restrict input,
-    const psImage* restrict mask,
-    unsigned int maskVal,
-    unsigned int col,
-    unsigned int row,
-    unsigned int numCols,
-    unsigned int numRows,
-    psImageCutDirection direction,
-    const psStats* stats
-);
+                     /**< if not NULL, a psImage that could be recycled.  If it can not be used,
+                      *   it will be freed via psImageFree
+                      */
+                     const psImage * input,
 
-psVector* psImageCut(
-    psVector* out,
-    const psImage* input,
-    const psImage* restrict mask,
-    unsigned int maskVal,
-    float startCol,
-    float startRow,
-    float endCol,
-    float endRow,
-    float width,
-    const psStats* stats
-);
+                     /**< the psImage to copy */
+                     psElemType type
 
-psVector* psImageRadialCut(
-    psVector* out,
-    const psImage* input,
-    const psImage* restrict mask,
-    unsigned int maskVal,
-    float centerCol,
-    float centerRow,
-    const psVector* radii,
-    const psStats* stats
-);
+                     /**< the desired datatype of the returned copy */
+                    );
+
+psVector *psImageSlice(psVector * out,
+                       psVector * slicePositions,
+                       const psImage * restrict input,
+                       const psImage * restrict mask,
+                       unsigned int maskVal,
+                       unsigned int col,
+                       unsigned int row,
+                       unsigned int numCols,
+                       unsigned int numRows, psImageCutDirection direction, const psStats * stats);
+
+psVector *psImageCut(psVector * out,
+                     const psImage * input,
+                     const psImage * restrict mask,
+                     unsigned int maskVal,
+                     float startCol,
+                     float startRow, float endCol, float endRow, float width, const psStats * stats);
+
+psVector *psImageRadialCut(psVector * out,
+                           const psImage * input,
+                           const psImage * restrict mask,
+                           unsigned int maskVal,
+                           float centerCol, float centerRow, const psVector * radii, const psStats * stats);
 
 /// @}
Index: /trunk/psLib/src/image/psImageIO.c
===================================================================
--- /trunk/psLib/src/image/psImageIO.c	(revision 1406)
+++ /trunk/psLib/src/image/psImageIO.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psImageIO.c
  *
@@ -7,6 +8,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -21,23 +22,25 @@
 #include "psMemory.h"
 
-psImage* psImageReadSection(psImage* output, int col, int row, int numCols,
-                            int numRows, int z, char* extname, int extnum, char* filename)
+psImage *psImageReadSection(psImage * output,
+                            int col,
+                            int row,
+                            int numCols, int numRows, int z, char *extname, int extnum, char *filename)
 {
-    fitsfile    *fptr=NULL;                 /*Pointer to the FITS file*/
-    int         status=0;                   /*CFITSIO file vars*/
-    int         nAxis=0;
-    int         anynull=0;
-    int         bitPix=0;                   /*Pixel type*/
-    long        nAxes[3];
-    long        firstPixel[3];              /* lower-left corner of image subset */
-    long        lastPixel[3];               /* upper-right corner of image subset */
-    long        increment[3];               /* increment for image subset */
-    char        fitsErr[80] = "";           /*CFITSIO error message string */
-    int         hduType = IMAGE_HDU;
-    int         fitsDatatype = 0;
-    int         datatype = 0;
+    fitsfile *fptr = NULL;      /* Pointer to the FITS file */
+    int status = 0;             /* CFITSIO file vars */
+    int nAxis = 0;
+    int anynull = 0;
+    int bitPix = 0;             /* Pixel type */
+    long nAxes[3];
+    long firstPixel[3];         /* lower-left corner of image subset */
+    long lastPixel[3];          /* upper-right corner of image subset */
+    long increment[3];          /* increment for image subset */
+    char fitsErr[80] = "";      /* CFITSIO error message string */
+    int hduType = IMAGE_HDU;
+    int fitsDatatype = 0;
+    int datatype = 0;
 
     if (filename == NULL) {
-        psError(__func__,"Must specify filename; it can not be NULL.");
+        psError(__func__, "Must specify filename; it can not be NULL.");
         psFree(output);
         return NULL;
@@ -47,7 +50,6 @@
     (void)fits_open_file(&fptr, filename, READONLY, &status);
     if (fptr == NULL || status != 0) {
-        fits_get_errstatus(status,fitsErr);
-        psError(__func__,"Could not open file '%s'. (%s)",
-                filename, fitsErr);
+        fits_get_errstatus(status, fitsErr);
+        psError(__func__, "Could not open file '%s'. (%s)", filename, fitsErr);
         psFree(output);
         return NULL;
@@ -56,20 +58,18 @@
     /* find the specified extension */
     if (extname != NULL) {
-        if (fits_movnam_hdu(fptr, hduType, extname, 0,&status) != 0) {
+        if (fits_movnam_hdu(fptr, hduType, extname, 0, &status) != 0) {
             fits_get_errstatus(status, fitsErr);
             status = 0;
             (void)fits_close_file(fptr, &status);
-            psError(__func__,"Could not index to '%s' HDU for file %s. (%s)",
-                    extname, filename, fitsErr);
+            psError(__func__, "Could not index to '%s' HDU for file %s. (%s)", extname, filename, fitsErr);
             psFree(output);
             return NULL;
         }
     } else {
-        if (fits_movabs_hdu(fptr, extnum+1, &hduType, &status) != 0) {
+        if (fits_movabs_hdu(fptr, extnum + 1, &hduType, &status) != 0) {
             fits_get_errstatus(status, fitsErr);
             status = 0;
             (void)fits_close_file(fptr, &status);
-            psError(__func__,"Could not index to HDU #%d for file %s. (%s)",
-                    extnum, filename, fitsErr);
+            psError(__func__, "Could not index to HDU #%d for file %s. (%s)", extnum, filename, fitsErr);
             psFree(output);
             return NULL;
@@ -82,6 +82,5 @@
         status = 0;
         (void)fits_close_file(fptr, &status);
-        psError("Could not determine image data type of '%s'. (%s)",
-                filename, fitsErr);
+        psError("Could not determine image data type of '%s'. (%s)", filename, fitsErr);
         psFree(output);
         return NULL;
@@ -93,6 +92,5 @@
         status = 0;
         (void)fits_close_file(fptr, &status);
-        psError("Could not determine dimensions of '%s'. (%s)",
-                filename,fitsErr);
+        psError("Could not determine dimensions of '%s'. (%s)", filename, fitsErr);
         psFree(output);
         return NULL;
@@ -100,20 +98,18 @@
 
     /* Validate the number of axis */
-    if ( (nAxis < 2) || (nAxis > 3) ) {
-        status=0;
-        (void)fits_close_file(fptr, &status);
-        psError("Dimensions of '%s' are not supported (NAXIS=%i).",
-                filename, nAxis);
-        psFree(output);
-        return NULL;
-    }
-
-    /* Get the Image size from the FITS file  */
-    if ( fits_get_img_size(fptr, nAxis, nAxes, &status) != 0) {
+    if ((nAxis < 2) || (nAxis > 3)) {
+        status = 0;
+        (void)fits_close_file(fptr, &status);
+        psError("Dimensions of '%s' are not supported (NAXIS=%i).", filename, nAxis);
+        psFree(output);
+        return NULL;
+    }
+
+    /* Get the Image size from the FITS file */
+    if (fits_get_img_size(fptr, nAxis, nAxes, &status) != 0) {
         (void)fits_get_errstatus(status, fitsErr);
         status = 0;
         (void)fits_close_file(fptr, &status);
-        psError("Could not determine image size of '%s'. (%s)",
-                filename,fitsErr);
+        psError("Could not determine image size of '%s'. (%s)", filename, fitsErr);
         psFree(output);
         return NULL;
@@ -127,11 +123,11 @@
     }
 
-    firstPixel[0] = col+1;
-    firstPixel[1] = row+1;
-    firstPixel[2] = z+1;
+    firstPixel[0] = col + 1;
+    firstPixel[1] = row + 1;
+    firstPixel[2] = z + 1;
 
     lastPixel[0] = firstPixel[0] + numCols - 1;
     lastPixel[1] = firstPixel[1] + numRows - 1;
-    lastPixel[2] = z+1;
+    lastPixel[2] = z + 1;
 
     increment[0] = 1;
@@ -139,6 +135,8 @@
     increment[2] = 1;
 
-    // turn off the BSCALE/BZERO processing in CFITSIO
-    // (void)fits_set_bscale(fptr, 1.0,0.0,&status);
+    // turn off the BSCALE/BZERO processing in
+    // CFITSIO
+    // (void)fits_set_bscale(fptr,
+    // 1.0,0.0,&status);
 
     switch (bitPix) {
@@ -180,18 +178,17 @@
         break;
     default:
-        psError(__func__,"Unsupported bitpix value (%d) in FITS file %s.",
-                bitPix,filename);
-        psFree(output);
-        return NULL;
-    }
-    output = psImageRecycle(output,numCols,numRows,datatype);
-    if (fits_read_subset(fptr, fitsDatatype, firstPixel, lastPixel, increment,
-                         NULL, output->data.V[0], &anynull, &status) != 0) {
+        psError(__func__, "Unsupported bitpix value (%d) in FITS file %s.", bitPix, filename);
+        psFree(output);
+        return NULL;
+    }
+    output = psImageRecycle(output, numCols, numRows, datatype);
+    if (fits_read_subset
+            (fptr, fitsDatatype, firstPixel,
+             lastPixel, increment, NULL, output->data.V[0], &anynull, &status) != 0) {
         psFree(output);
         (void)fits_get_errstatus(status, fitsErr);
         status = 0;
         (void)fits_close_file(fptr, &status);
-        psError(__func__,"Failed to read image [%s]",
-                filename, fitsErr);
+        psError(__func__, "Failed to read image [%s]", filename, fitsErr);
         return NULL;
     }
@@ -202,28 +199,26 @@
 }
 
-
-bool psImageWriteSection(psImage* input, int col0,int row0,int z,
-                         char* extname, int extnum, char* filename)
+bool psImageWriteSection(psImage * input, int col0, int row0, int z, char *extname, int extnum,
+                         char *filename)
 {
-    int         numCols = 0;
-    int         numRows = 0;
-
-    int         status=0;               /* CFITSIO  status */
-    fitsfile    *fptr=NULL;             /* pointer to the FITS file */
-    long        nAxes[3];               /* Image axis vars */
-    long        firstPixel[3];          /* First Pixel to read */
-    long        lastPixel[3];           /* Last Pixel to read */
-    char        fitsErr[80];            /* FITSIO message string */
-    int         datatype = 0;           /* the datatype of the image */
-    int         bitPix = 0;             /* FITS bitPix value */
-    int         hduType = IMAGE_HDU;    /* the HDU type (image,table, etc.) */
-    double      bscale = 1.0;
-    double      bzero = 0.0;
-    bool        createNewHDU = false;
+    int numCols = 0;
+    int numRows = 0;
+
+    int status = 0;             /* CFITSIO status */
+    fitsfile *fptr = NULL;      /* pointer to the FITS file */
+    long nAxes[3];              /* Image axis vars */
+    long firstPixel[3];         /* First Pixel to read */
+    long lastPixel[3];          /* Last Pixel to read */
+    char fitsErr[80];           /* FITSIO message string */
+    int datatype = 0;           /* the datatype of the image */
+    int bitPix = 0;             /* FITS bitPix value */
+    int hduType = IMAGE_HDU;    /* the HDU type (image,table, etc.) */
+    double bscale = 1.0;
+    double bzero = 0.0;
+    bool createNewHDU = false;
 
     /* need a valid image to write */
-    if(input==NULL) {
-        psError(__func__, "Can not write %s.  Input psImage is NULL.",
-                filename);
+    if (input == NULL) {
+        psError(__func__, "Can not write %s.  Input psImage is NULL.", filename);
         return false;
     }
@@ -244,5 +239,5 @@
     case PS_TYPE_U16:
         bitPix = SHORT_IMG;
-        bzero = -1.0f*INT16_MIN;
+        bzero = -1.0f * INT16_MIN;
         datatype = TUSHORT;
         break;
@@ -253,5 +248,5 @@
     case PS_TYPE_U32:
         bitPix = LONG_IMG;
-        bzero = -1.0f*INT32_MIN;
+        bzero = -1.0f * INT32_MIN;
         datatype = TUINT;
         break;
@@ -269,16 +264,16 @@
         break;
     default:
-        psError(__func__, "psImage datatype (%d) not supported.  File %s not written.",
-                input->type.type,filename);
+        psError(__func__,
+                "psImage datatype (%d) not supported.  File %s not written.", input->type.type, filename);
         return false;
     }
 
     /* Open the FITS file */
-    if (access(filename, F_OK) == 0) { // file exists
+    if (access(filename, F_OK) == 0) {     // file
+        // exists
         (void)fits_open_file(&fptr, filename, READWRITE, &status);
         if (fptr == NULL || status != 0) {
-            fits_get_errstatus(status,fitsErr);
-            psError(__func__,"Could not open file '%s'. FITS error:%s",
-                    filename, fitsErr);
+            fits_get_errstatus(status, fitsErr);
+            psError(__func__, "Could not open file '%s'. FITS error:%s", filename, fitsErr);
             return false;
         }
@@ -286,42 +281,42 @@
         /* find the specified extension */
         if (extname != NULL) {
-            if (fits_movnam_hdu(fptr, hduType, extname, 0,&status) != 0) {
+            if (fits_movnam_hdu(fptr, hduType, extname, 0, &status) != 0) {
                 fits_get_errstatus(status, fitsErr);
                 status = 0;
                 (void)fits_close_file(fptr, &status);
-                psError(__func__,"Could not index to '%s' HDU for file %s. (%s)",
-                        extname, filename, fitsErr);
+                psError(__func__,
+                        "Could not index to '%s' HDU for file %s. (%s)", extname, filename, fitsErr);
                 return false;
             }
         } else {
             int numHDUs = 0;
-            fits_get_num_hdus(fptr,&numHDUs,&status);
+
+            fits_get_num_hdus(fptr, &numHDUs, &status);
             if (numHDUs < extnum) {
                 status = 0;
                 (void)fits_close_file(fptr, &status);
-                psError(__func__,"extnum (%d) must not exceed number of HDUs (%d) by more than one.",
-                        extnum, numHDUs);
+                psError(__func__,
+                        "extnum (%d) must not exceed number of HDUs (%d) by more than one.", extnum, numHDUs);
                 return false;
-            } else
-                if (numHDUs == extnum) {
-                    createNewHDU = true;
-                } else
-                    if (fits_movabs_hdu(fptr, extnum+1, &hduType, &status) != 0) {
-                        fits_get_errstatus(status, fitsErr);
-                        status = 0;
-                        (void)fits_close_file(fptr, &status);
-                        psError(__func__,"Could not index to HDU #%d for file %s. (%s)",
-                                extnum, filename, fitsErr);
-                        return false;
-                    }
-        }
-
-    } else { // file does not exist
-
-        (void)fits_create_file(&fptr,filename,&status);
+            } else if (numHDUs == extnum) {
+                createNewHDU = true;
+            } else if (fits_movabs_hdu(fptr, extnum + 1, &hduType, &status) != 0) {
+                fits_get_errstatus(status, fitsErr);
+                status = 0;
+                (void)fits_close_file(fptr, &status);
+                psError(__func__, "Could not index to HDU #%d for file %s. (%s)", extnum, filename, fitsErr);
+                return false;
+            }
+        }
+
+    } else {                               // file
+        // does
+        // not
+        // exist
+
+        (void)fits_create_file(&fptr, filename, &status);
         if (fptr == NULL || status != 0) {
-            fits_get_errstatus(status,fitsErr);
-            psError(__func__,"Could not create file '%s'. (%s)",
-                    filename, fitsErr);
+            fits_get_errstatus(status, fitsErr);
+            psError(__func__, "Could not create file '%s'. (%s)", filename, fitsErr);
             return false;
         }
@@ -330,21 +325,19 @@
 
     if (createNewHDU) {
-        /*  create the mandatory image keywords */
-        nAxes[0] = col0+numCols;
-        nAxes[1] = row0+numRows;
-        nAxes[2] = z+1;
+        /* create the mandatory image keywords */
+        nAxes[0] = col0 + numCols;
+        nAxes[1] = row0 + numRows;
+        nAxes[2] = z + 1;
         if (fits_create_img(fptr, bitPix, 3, nAxes, &status) != 0) {
             (void)fits_get_errstatus(status, fitsErr);
             status = 0;
             (void)fits_close_file(fptr, &status);
-            psError(__func__,"Could not create image HDU in FITS file '%s'. %s",
-                    filename, fitsErr);
+            psError(__func__, "Could not create image HDU in FITS file '%s'. %s", filename, fitsErr);
             return false;
         }
-
         // set the bscale/bzero
-        fits_write_key_dbl(fptr, "BZERO",bzero,12,"Pixel Value Offset",&status);
-        fits_write_key_dbl(fptr, "BSCALE",bscale,12,"Pixel Value Scale",&status);
-        fits_set_bscale(fptr,bscale,bzero,&status);
+        fits_write_key_dbl(fptr, "BZERO", bzero, 12, "Pixel Value Offset", &status);
+        fits_write_key_dbl(fptr, "BSCALE", bscale, 12, "Pixel Value Scale", &status);
+        fits_set_bscale(fptr, bscale, bzero, &status);
 
         if (extname != NULL) {
@@ -354,6 +347,6 @@
                 status = 0;
                 (void)fits_close_file(fptr, &status);
-                psError(__func__,"Could not create EXTNAME keyword in FITS file '%s'. (%s)",
-                        filename, fitsErr);
+                psError(__func__,
+                        "Could not create EXTNAME keyword in FITS file '%s'. (%s)", filename, fitsErr);
                 return false;
             }
@@ -361,18 +354,17 @@
     }
 
-    firstPixel[0] = col0+1;
-    firstPixel[1] = row0+1;
-    firstPixel[2] = z+1;
+    firstPixel[0] = col0 + 1;
+    firstPixel[1] = row0 + 1;
+    firstPixel[2] = z + 1;
 
     lastPixel[0] = firstPixel[0] + numCols - 1;
     lastPixel[1] = firstPixel[1] + numRows - 1;
-    lastPixel[2] = z+1;
-
-    if ( fits_write_subset(fptr, datatype, firstPixel, lastPixel, input->data.V[0], &status) != 0) {
+    lastPixel[2] = z + 1;
+
+    if (fits_write_subset(fptr, datatype, firstPixel, lastPixel, input->data.V[0], &status) != 0) {
         (void)fits_get_errstatus(status, fitsErr);
         status = 0;
         (void)fits_close_file(fptr, &status);
-        psError(__func__, "Could not write image data to '%s'. (%s)",
-                filename, fitsErr);
+        psError(__func__, "Could not write image data to '%s'. (%s)", filename, fitsErr);
         return false;
     }
Index: /trunk/psLib/src/image/psImageIO.h
===================================================================
--- /trunk/psLib/src/image/psImageIO.h	(revision 1406)
+++ /trunk/psLib/src/image/psImageIO.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psImageIO.h
  *
@@ -9,15 +10,15 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-19 22:01:19 $
+ *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
-# ifndef PS_IMAGEIO_H
-# define PS_IMAGEIO_H
+#ifndef PS_IMAGEIO_H
+#    define PS_IMAGEIO_H
 
-#include <stdbool.h>
+#    include <stdbool.h>
 
-#include "psImage.h"
+#    include "psImage.h"
 
 /// @addtogroup ImageIO
@@ -29,28 +30,36 @@
  *                          signifies that a problem had occured.
  */
-psImage* psImageReadSection(
-    psImage* output,
-    /**< the output psImage to recycle, or NULL if new psImage desired */
-    int col0,
-    /**< the column index of the origin to start reading */
-    int row0,
-    /**< the row index of the origin to start reading */
-    int numCols,
-    /**< the number of desired columns to read */
-    int numRows,
-    /**< the number of desired rows to read */
-    int z,
-    /**< the z index to read if file is organized as a 3D image cube. */
-    char* extname,
-    /**< the image extension to read (this should match the EXTNAME keyword in
-     *   the extension If NULL, the extnum parameter is to be used instead
-     */
-    int extnum,
-    /**< the image extension to read (0=PHU, 1=first extension, etc.)  This is
-     *   only used if extname is NULL
-     */
-    char* filename
-    /**< the filename of the FITS image file to read */
-);
+psImage *psImageReadSection(psImage * output,
+
+                            /**< the output psImage to recycle, or NULL if new psImage desired */
+                            int col0,
+
+                            /**< the column index of the origin to start reading */
+                            int row0,
+
+                            /**< the row index of the origin to start reading */
+                            int numCols,
+
+                            /**< the number of desired columns to read */
+                            int numRows,
+
+                            /**< the number of desired rows to read */
+                            int z,
+
+                            /**< the z index to read if file is organized as a 3D image cube. */
+                            char *extname,
+
+                            /**< the image extension to read (this should match the EXTNAME keyword in
+                             *   the extension If NULL, the extnum parameter is to be used instead
+                             */
+                            int extnum,
+
+                            /**< the image extension to read (0=PHU, 1=first extension, etc.)  This is
+                             *   only used if extname is NULL
+                             */
+                            char *filename
+
+                            /**< the filename of the FITS image file to read */
+                           );
 
 /** Read an image or subimage from a FITS file specified by a filename.
@@ -58,24 +67,30 @@
  *  return bool         TRUE is successful, otherwise FALSE.
  */
-bool psImageWriteSection(
-    psImage* input,
-    /**< the psImage to write */
-    int col0,
-    /**< the column index of the origin to start writing */
-    int row0,
-    /**< the row index of the origin to start writing */
-    int z,
-    /**< the z index to start writing */
-    char* extname,
-    /**< the image extension to write (this should match the EXTNAME keyword in
-     *   the extension If NULL, the extnum parameter is to be used instead
-     */
-    int extnum,
-    /**< the image extension to write (0=PHU, 1=first extension, etc.)  This is
-     *   only used if extname is NULL.
-     */
-    char* filename
-    /**< the filename of the FITS image file to write */
-);
+bool psImageWriteSection(psImage * input,
+
+                         /**< the psImage to write */
+                         int col0,
+
+                         /**< the column index of the origin to start writing */
+                         int row0,
+
+                         /**< the row index of the origin to start writing */
+                         int z,
+
+                         /**< the z index to start writing */
+                         char *extname,
+
+                         /**< the image extension to write (this should match the EXTNAME keyword in
+                          *   the extension If NULL, the extnum parameter is to be used instead
+                          */
+                         int extnum,
+
+                         /**< the image extension to write (0=PHU, 1=first extension, etc.)  This is
+                          *   only used if extname is NULL.
+                          */
+                         char *filename
+
+                         /**< the filename of the FITS image file to write */
+                        );
 
 /// @}
Index: /trunk/psLib/src/image/psImageManip.c
===================================================================
--- /trunk/psLib/src/image/psImageManip.c	(revision 1406)
+++ /trunk/psLib/src/image/psImageManip.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psImageManip.c
  *
@@ -10,13 +11,17 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
-#include <math.h>                      // for isfinite(), etc.
+#include <math.h>                          // for
+// isfinite(),
+// etc.
 #include <stdlib.h>
 #include <stdbool.h>
-#include <string.h>                    // for memcpy, etc.
+#include <string.h>                        // for
+// memcpy,
+// etc.
 
 #include "psError.h"
@@ -26,5 +31,5 @@
 #include "psImageExtraction.h"
 
-int psImageClip(psImage* input, psF64 min, psF64 vmin, psF64 max, psF64 vmax)
+int psImageClip(psImage * input, psF64 min, psF64 vmin, psF64 max, psF64 vmax)
 {
     int numClipped = 0;
@@ -37,5 +42,5 @@
 
     if (max < min) {
-        psError(__func__,"psImageClip can not be invoked with max < min.");
+        psError(__func__, "psImageClip can not be invoked with max < min.");
         return 0;
     }
@@ -100,20 +105,19 @@
         break;
 
-        psImageClipCase(S8,"psS8")
-        psImageClipCase(S16,"psS16")
-        psImageClipCase(S32,"psS32")
-        psImageClipCase(S64,"psS64")
-        psImageClipCase(U8,"psU8")
-        psImageClipCase(U16,"psU16")
-        psImageClipCase(U32,"psU32")
-        psImageClipCase(U64,"psU64")
-        psImageClipCase(F32,"psF32")
-        psImageClipCase(F64,"psF64")
-        psImageClipCaseComplex(C32,"psC32",cabsf)
-        psImageClipCaseComplex(C64,"psC64",cabs)
+        psImageClipCase(S8, "psS8")
+        psImageClipCase(S16, "psS16")
+        psImageClipCase(S32, "psS32")
+        psImageClipCase(S64, "psS64")
+        psImageClipCase(U8, "psU8")
+        psImageClipCase(U16, "psU16")
+        psImageClipCase(U32, "psU32")
+        psImageClipCase(U64, "psU64")
+        psImageClipCase(F32, "psF32")
+        psImageClipCase(F64, "psF64")
+        psImageClipCaseComplex(C32, "psC32", cabsf)
+        psImageClipCaseComplex(C64, "psC64", cabs)
 
     default:
-        psError(__func__,"psImageClip does not support the given datatype (%d)",
-                input->type.type);
+        psError(__func__, "psImageClip does not support the given datatype (%d)", input->type.type);
     }
 
@@ -121,5 +125,5 @@
 }
 
-int psImageClipNaN(psImage* input,psF64 value)
+int psImageClipNaN(psImage * input, psF64 value)
 {
     int numClipped = 0;
@@ -154,6 +158,5 @@
 
     default:
-        psError(__func__,"psImageClip does not support the given datatype (%d)",
-                input->type.type);
+        psError(__func__, "psImageClip does not support the given datatype (%d)", input->type.type);
     }
 
@@ -161,6 +164,5 @@
 }
 
-int psImageOverlaySection(psImage* image, const psImage* overlay, int col0,
-                          int row0, const char* op)
+int psImageOverlaySection(psImage * image, const psImage * overlay, int col0, int row0, const char *op)
 {
     unsigned int imageNumRows;
@@ -170,13 +172,13 @@
     unsigned int imageRowLimit;
     unsigned int imageColLimit;
-    psElemType  type;
+    psElemType type;
 
     if (image == NULL || overlay == NULL) {
-        psError(__func__,"one of the input images was NULL.");
+        psError(__func__, "one of the input images was NULL.");
         return 1;
     }
 
     if (op == NULL) {
-        psError(__func__,"Operation can not be NULL.");
+        psError(__func__, "Operation can not be NULL.");
         return 1;
     }
@@ -185,6 +187,5 @@
 
     if (type != overlay->type.type) {
-        psError(__func__,"Image and overlay datatypes must match. (%d vs %d)",
-                type,overlay->type.type);
+        psError(__func__, "Image and overlay datatypes must match. (%d vs %d)", type, overlay->type.type);
         return 2;
     }
@@ -197,5 +198,6 @@
     /* check row0/col0 to see if it is within the image size */
     if (row0 < 0 || col0 < 0 || row0 >= imageNumRows || col0 >= imageNumCols) {
-        psError(__func__, "Overlay origin of (%d,%d) is outside of the image dimensions (%d x %d).",
+        psError(__func__,
+                "Overlay origin of (%d,%d) is outside of the image dimensions (%d x %d).",
                 col0, row0, imageNumCols, imageNumRows);
         return 3;
@@ -203,11 +205,11 @@
 
     /* check if overlay is totally withing input image */
-    imageRowLimit = row0+overlayNumRows;
-    imageColLimit = col0+overlayNumCols;
+    imageRowLimit = row0 + overlayNumRows;
+    imageColLimit = col0 + overlayNumCols;
     if (imageRowLimit > imageNumRows || imageColLimit > imageNumCols) {
-        psError(__func__, "Overlay image (%d,%d -> %d,%d) is partially outside"
+        psError(__func__,
+                "Overlay image (%d,%d -> %d,%d) is partially outside"
                 " of the input image (%d x %d).",
-                col0, row0, col0+overlayNumCols-1, row0+overlayNumRows-1,
-                imageNumCols,imageNumRows);
+                col0, row0, col0 + overlayNumCols - 1, row0 + overlayNumRows - 1, imageNumCols, imageNumRows);
         return 4;
     }
@@ -259,5 +261,5 @@
 
     default:
-        psError(__func__,"Can not operate on type %d.",type);
+        psError(__func__, "Can not operate on type %d.", type);
     }
 
@@ -265,5 +267,5 @@
 }
 
-int psImageClipComplexRegion(psImage* input, psC64 min, psC64 vmin, psC64 max, psC64 vmax)
+int psImageClipComplexRegion(psImage * input, psC64 min, psC64 vmin, psC64 max, psC64 vmax)
 {
     int numClipped = 0;
@@ -276,15 +278,16 @@
 
     if (input == NULL) {
-        psError(__func__,"Can not perform clip on NULL image");
+        psError(__func__, "Can not perform clip on NULL image");
         return 0;
     }
 
-    if ( realMax < realMin ) {
-        psError(__func__,"psImageClipComplexRegion can not be invoked with "
-                "max < min in the real image space.");
+    if (realMax < realMin) {
+        psError(__func__,
+                "psImageClipComplexRegion can not be invoked with " "max < min in the real image space.");
         return 0;
     }
-    if ( imagMax < imagMin ) {
-        psError(__func__,"psImageClipComplexRegion can not be invoked with "
+    if (imagMax < imagMin) {
+        psError(__func__,
+                "psImageClipComplexRegion can not be invoked with "
                 "max < min in the imaginary image space.");
         return 0;
@@ -294,43 +297,42 @@
     numCols = input->numCols;
 
+    #define psImageClipComplexRegionCase(type,typename,realfcn,imagfcn) \
+case PS_TYPE_##type: { \
+        if (realfcn(vmin) < PS_MIN_##type || imagfcn(vmin) < PS_MIN_##type || \
+                realfcn(vmin) > PS_MAX_##type || imagfcn(vmin) > PS_MAX_##type ) { \
+            psError(__func__, "Specified vmin (%g%+gi) is outside of image's " \
+                    typename " pixel range", \
+                    creal(vmin),cimag(vmin)); \
+            break; \
+        } \
+        if (realfcn(vmax) > PS_MAX_##type || imagfcn(vmax) > PS_MAX_##type || \
+                realfcn(vmax) < PS_MIN_##type || imagfcn(vmax) < PS_MIN_##type ) { \
+            psError(__func__, "Specified vmax (%g%+gi) is outside of image's " \
+                    typename " pixel range", \
+                    creal(vmax),cimag(vmax)); \
+            break; \
+        } \
+        for (unsigned int row = 0;row<numRows;row++) { \
+            ps##type* inputRow = input->data.type[row]; \
+            for (unsigned int col = 0; col < numCols; col++) { \
+                if ( (realfcn(inputRow[col]) > realMax) || (imagfcn(inputRow[col]) > imagMax) ) { \
+                    inputRow[col] = (ps##type)vmax; \
+                    numClipped++; \
+                } else if ( (realfcn(inputRow[col]) < realMin) || (imagfcn(inputRow[col]) < imagMin) ){ \
+                    inputRow[col] = (ps##type)vmin; \
+                    numClipped++; \
+                } \
+            } \
+        } \
+    } \
+    break;
+
     switch (input->type.type) {
 
-        #define psImageClipComplexRegionCase(type,typename,realfcn,imagfcn) \
-    case PS_TYPE_##type: { \
-            if (realfcn(vmin) < PS_MIN_##type || imagfcn(vmin) < PS_MIN_##type || \
-                    realfcn(vmin) > PS_MAX_##type || imagfcn(vmin) > PS_MAX_##type ) { \
-                psError(__func__, "Specified vmin (%g%+gi) is outside of image's " \
-                        typename " pixel range", \
-                        creal(vmin),cimag(vmin)); \
-                break; \
-            } \
-            if (realfcn(vmax) > PS_MAX_##type || imagfcn(vmax) > PS_MAX_##type || \
-                    realfcn(vmax) < PS_MIN_##type || imagfcn(vmax) < PS_MIN_##type ) { \
-                psError(__func__, "Specified vmax (%g%+gi) is outside of image's " \
-                        typename " pixel range", \
-                        creal(vmax),cimag(vmax)); \
-                break; \
-            } \
-            for (unsigned int row = 0;row<numRows;row++) { \
-                ps##type* inputRow = input->data.type[row]; \
-                for (unsigned int col = 0; col < numCols; col++) { \
-                    if ( (realfcn(inputRow[col]) > realMax) || (imagfcn(inputRow[col]) > imagMax) ) { \
-                        inputRow[col] = (ps##type)vmax; \
-                        numClipped++; \
-                    } else if ( (realfcn(inputRow[col]) < realMin) || (imagfcn(inputRow[col]) < imagMin) ){ \
-                        inputRow[col] = (ps##type)vmin; \
-                        numClipped++; \
-                    } \
-                } \
-            } \
-        } \
-        break;
-
-        psImageClipComplexRegionCase(C32,"psC32",crealf,cimagf)
-        psImageClipComplexRegionCase(C64,"psC64",creal,cimag)
+        psImageClipComplexRegionCase(C32, "psC32", crealf, cimagf)
+        psImageClipComplexRegionCase(C64, "psC64", creal, cimag)
 
     default:
-        psError(__func__,"psImageClip does not support the given datatype (%d)",
-                input->type.type);
+        psError(__func__, "psImageClip does not support the given datatype (%d)", input->type.type);
     }
 
@@ -338,6 +340,5 @@
 }
 
-
-psImage* psImageRebin(psImage* out,const psImage* in,unsigned int scale,const psStats* stats)
+psImage *psImageRebin(psImage * out, const psImage * in, unsigned int scale, const psStats * stats)
 {
     int inRows;
@@ -345,10 +346,13 @@
     int outRows;
     int outCols;
-    psVector* vec;            // vector to hold the values of a single bin.
-    psStats* myStats;
+    psVector *vec;              // vector to hold
+
+    // the values of
+    // a single bin.
+    psStats *myStats;
     double statVal;
 
     if (in == NULL) {
-        psError(__func__,"Input image is NULL.");
+        psError(__func__, "Input image is NULL.");
         psFree(out);
         return NULL;
@@ -356,5 +360,5 @@
 
     if (scale < 1) {
-        psError(__func__,"The scale must be positive.");
+        psError(__func__, "The scale must be positive.");
         psFree(out);
         return NULL;
@@ -362,11 +366,11 @@
 
     if (stats == NULL) {
-        psError(__func__,"The stats input can not be NULL.");
+        psError(__func__, "The stats input can not be NULL.");
         psFree(out);
         return NULL;
     }
 
-    if (p_psGetStatValue(stats,&statVal) == false) {
-        psError(__func__,"The stat options didn't specify a single supported statistic type.");
+    if (p_psGetStatValue(stats, &statVal) == false) {
+        psError(__func__, "The stat options didn't specify a single supported statistic type.");
         psFree(out);
         return NULL;
@@ -376,12 +380,16 @@
     *myStats = *stats;
 
-    vec = psVectorAlloc(scale*scale,in->type.type);
+    vec = psVectorAlloc(scale * scale, in->type.type);
 
     // create output image.
     inRows = in->numRows;
     inCols = in->numCols;
-    outRows = (inRows+scale-1) / scale;   // round-up for remainders
-    outCols = (inCols+scale-1) / scale;   // round-up for remainders
-    out = psImageRecycle(out,outCols,outRows,in->type.type);
+    outRows = (inRows + scale - 1) / scale;     // round-up
+    // for
+    // remainders
+    outCols = (inCols + scale - 1) / scale;     // round-up
+    // for
+    // remainders
+    out = psImageRecycle(out, outCols, outRows, in->type.type);
 
     #define PS_IMAGE_REBIN_CASE(type) \
@@ -425,5 +433,5 @@
         PS_IMAGE_REBIN_CASE(C64);
     default:
-        psError(__func__,"Input image type not supported.");
+        psError(__func__, "Input image type not supported.");
         psFree(out);
         out = NULL;
@@ -435,5 +443,6 @@
     return out;
 }
-psImage* psImageResample(psImage* out, const psImage* in, int scale, psImageInterpolateMode mode)
+
+psImage *psImageResample(psImage * out, const psImage * in, int scale, psImageInterpolateMode mode)
 {
     int outRows;
@@ -442,14 +451,13 @@
 
     if (in == NULL) {
-        psError(__func__,"Input image can not be NULL.");
+        psError(__func__, "Input image can not be NULL.");
         psFree(out);
         return NULL;
     }
-
-    // create an output image of the same size and type
-    outRows = in->numRows*scale;
-    outCols = in->numCols*scale;
+    // create an output image of the same size
+    // and type
+    outRows = in->numRows * scale;
+    outCols = in->numCols * scale;
     invScale = 1.0f / (float)scale;
-
 
     #define PSIMAGE_RESAMPLE_CASE(TYPE) \
@@ -466,5 +474,5 @@
     }
 
-    switch(in->type.type) {
+    switch (in->type.type) {
         PSIMAGE_RESAMPLE_CASE(U8)
         PSIMAGE_RESAMPLE_CASE(U16)
@@ -480,5 +488,5 @@
         PSIMAGE_RESAMPLE_CASE(C64)
     default:
-        psError(__func__,"Unsupported type (%d)",in->type.type);
+        psError(__func__, "Unsupported type (%d)", in->type.type);
         psFree(out);
         return NULL;
@@ -488,5 +496,5 @@
 }
 
-psImage* psImageRoll(psImage* out, const psImage* in, int dx, int dy)
+psImage *psImageRoll(psImage * out, const psImage * in, int dx, int dy)
 {
     int outRows;
@@ -495,16 +503,17 @@
 
     if (in == NULL) {
-        psError(__func__,"Input image can not be NULL.");
+        psError(__func__, "Input image can not be NULL.");
         psFree(out);
         return NULL;
     }
-
-    // create an output image of the same size and type
+    // create an output image of the same size
+    // and type
     outRows = in->numRows;
     outCols = in->numCols;
     elementSize = PSELEMTYPE_SIZEOF(in->type.type);
-    out = psImageRecycle(out,outCols, outRows, in->type.type);
-
-    // make dx and dy between 0 and outCols or outRows, respectively
+    out = psImageRecycle(out, outCols, outRows, in->type.type);
+
+    // make dx and dy between 0 and outCols or
+    // outRows, respectively
     dx = dx % outCols;
     dy = dy % outRows;
@@ -516,16 +525,25 @@
     }
 
-    int segment1Size = elementSize*(outCols-dx);
-    int segment2Size = elementSize*dx;
-
-    for (int row=0;row<outRows;row++) {
-        int inRowNumber = row+dy;
+    int segment1Size = elementSize * (outCols - dx);
+    int segment2Size = elementSize * dx;
+
+    for (int row = 0; row < outRows; row++) {
+        int inRowNumber = row + dy;
+
         if (inRowNumber >= outRows) {
             inRowNumber -= outRows;
         }
-        psU8* inRow = in->data.U8[inRowNumber]; // to allow byte arithmetic, but for all types
-        psU8* outRow = out->data.U8[row];
-        memcpy(outRow,inRow+segment2Size,segment1Size);
-        memcpy(outRow+segment1Size,inRow,segment2Size);
+        psU8 *inRow = in->data.U8[inRowNumber]; // to
+
+        // allow
+
+        // byte
+        // arithmetic,
+
+        // but for all types
+        psU8 *outRow = out->data.U8[row];
+
+        memcpy(outRow, inRow + segment2Size, segment1Size);
+        memcpy(outRow + segment1Size, inRow, segment2Size);
     }
 
@@ -533,16 +551,16 @@
 }
 
-psImage* psImageRotate(psImage* out, const psImage* in, float angle, float unexposedValue, psImageInterpolateMode mode)
+psImage *psImageRotate(psImage * out,
+                       const psImage * in, float angle, float unexposedValue, psImageInterpolateMode mode)
 {
     if (in == NULL) {
-        psError(__func__,"The input image was NULL.");
+        psError(__func__, "The input image was NULL.");
         psFree(out);
         return NULL;
     }
-
     // put the angle in the range of 0...360.
-    angle = angle - 360.0f*floor(angle/360.0f);
-
-    if (fabsf(angle-90.0f) < FLT_EPSILON) {
+    angle = angle - 360.0f * floor(angle / 360.0f);
+
+    if (fabsf(angle - 90.0f) < FLT_EPSILON) {
         // perform 1/4 rotate counter-clockwise
         int numRows = in->numCols;
@@ -550,5 +568,6 @@
         int lastCol = numCols - 1;
         psElemType type = in->type.type;
-        out = psImageRecycle(out,numCols,numRows,type);
+
+        out = psImageRecycle(out, numCols, numRows, type);
 
         #define PSIMAGE_ROTATE_LEFT_90(TYPE) \
@@ -578,217 +597,213 @@
             PSIMAGE_ROTATE_LEFT_90(C64);
         default:
-            psError(__func__,"Unsupported type (%d)",type);
+            psError(__func__, "Unsupported type (%d)", type);
             psFree(out);
             return NULL;
         }
-    } else
-        if (fabsf(angle-180.0f) < FLT_EPSILON) {
-            // perform 1/2 rotate
-            int numRows = in->numRows;
-            int lastRow = numRows - 1;
-            int numCols = in->numCols;
-            int lastCol = numCols - 1;
-            psElemType type = in->type.type;
-            out = psImageRecycle(out,numCols,numRows,type);
-
-            #define PSIMAGE_ROTATE_180_CASE(TYPE) \
-        case PS_TYPE_##TYPE: { \
-                for (int row=0;row<numRows;row++) { \
-                    ps##TYPE* outRow = out->data.TYPE[row]; \
-                    ps##TYPE* inRow = in->data.TYPE[lastRow-row]; \
-                    for (int col=0;col<numCols;col++) { \
-                        outRow[col] = inRow[lastCol - col]; \
-                    } \
-                } \
-            } \
-            break;
-
-            switch (type) {
-                PSIMAGE_ROTATE_180_CASE(U8);
-                PSIMAGE_ROTATE_180_CASE(U16);
-                PSIMAGE_ROTATE_180_CASE(U32);
-                PSIMAGE_ROTATE_180_CASE(U64);
-                PSIMAGE_ROTATE_180_CASE(S8);
-                PSIMAGE_ROTATE_180_CASE(S16);
-                PSIMAGE_ROTATE_180_CASE(S32);
-                PSIMAGE_ROTATE_180_CASE(S64);
-                PSIMAGE_ROTATE_180_CASE(F32);
-                PSIMAGE_ROTATE_180_CASE(F64);
-                PSIMAGE_ROTATE_180_CASE(C32);
-                PSIMAGE_ROTATE_180_CASE(C64);
-            default:
-                psError(__func__,"Unsupported type (%d)",type);
-                psFree(out);
-                return NULL;
-            }
-        } else
-            if (fabsf(angle-270.0f) < FLT_EPSILON) {
-                // perform 1/4 rotate clockwise
-                int numRows = in->numCols;
-                int lastRow = numRows - 1;
-                int numCols = in->numRows;
-                psElemType type = in->type.type;
-                out = psImageRecycle(out,numCols,numRows,type);
-
-                #define PSIMAGE_ROTATE_RIGHT_90(TYPE) \
-            case PS_TYPE_##TYPE: { \
-                    ps##TYPE** inData = in->data.TYPE; \
-                    for (int row=0;row<numRows;row++) { \
-                        ps##TYPE* outRow = out->data.TYPE[row]; \
-                        for (int col=0;col<numCols;col++) { \
-                            outRow[col] = inData[col][lastRow-row]; \
-                        } \
-                    } \
-                } \
-                break;
-
-                switch (type) {
-                    PSIMAGE_ROTATE_RIGHT_90(U8);
-                    PSIMAGE_ROTATE_RIGHT_90(U16);
-                    PSIMAGE_ROTATE_RIGHT_90(U32);
-                    PSIMAGE_ROTATE_RIGHT_90(U64);
-                    PSIMAGE_ROTATE_RIGHT_90(S8);
-                    PSIMAGE_ROTATE_RIGHT_90(S16);
-                    PSIMAGE_ROTATE_RIGHT_90(S32);
-                    PSIMAGE_ROTATE_RIGHT_90(S64);
-                    PSIMAGE_ROTATE_RIGHT_90(F32);
-                    PSIMAGE_ROTATE_RIGHT_90(F64);
-                    PSIMAGE_ROTATE_RIGHT_90(C32);
-                    PSIMAGE_ROTATE_RIGHT_90(C64);
-                default:
-                    psError(__func__,"Unsupported type (%d)",type);
-                    psFree(out);
-                    return NULL;
-                }
-            } else
-                if (fabsf(angle) < FLT_EPSILON) {
-                    out = psImageCopy(out,in,in->type.type);
-                } else {
-                    psElemType type = in->type.type;
-                    int numRows = in->numRows;
-                    int numCols = in->numCols;
-                    double centerX = (float)(numCols) / 2.0f;
-                    float centerY = (float)(numRows) / 2.0f;
-                    float t = angle*(3.14159265358f/180.0f);
-                    float cosT = cosf(t);
-                    float sinT = sinf(t);
-
-                    // calculate the corners of the rotated image so we know the proper output image size.
-                    //    x' = x cos(t) + y sin(t);  i.e, x' = (x-centerX)*cosT + (y-centerY)*sinT;
-                    //    y' = y cos(t) - x sin(t);  i.e. y' = (y-centerY)*cosT - (x-centerX)*sinT;
-
-
-                    int outCols = ceil(abs(numCols*cosT)+abs(numRows*sinT))+1;
-                    int outRows = ceil(abs(numCols*sinT)+abs(numRows*cosT))+1;
-                    float minX = (float)outCols/-2.0f;
-                    int intMinY = outRows/-2;
-
-                    out = psImageRecycle(out,outCols,outRows,type);
-
-                    /* optimized public domain rotation routine by Karl Lager
-                    float cosT,sinT;
-                    cosT = cos(t);
-                    sinT = sin(t);
-                    for (y = min_y; y <= max_y; y++)
-                     { x' = min_x * cosT + y * sinT + x1';
-                       y' = y * cosT - min_x * sinT + y1';
-                       for (x = min_x; x <= max_x; x++)
-                        { if (x', y') is in the bounds of the bitmap, 
-                             get pixel(x', y') and plot the pixel to 
-                             (x, y) on screen.
-                          x' += cosT;
-                          y' -= sinT;
-                        }
-                     }
-                    */
-
-                    // precalculate some figures that are used within loop
-                    float minXTimesCosTPlusCenterX = minX*cosT+centerX;
-                    float CenterYMinusminXTimesSinT = centerY-minX*sinT;
-
-                    #define PSIMAGE_ROTATE_ARBITRARY_LOOP(TYPE,MODE) { \
-                        if (unexposedValue < PS_MIN_##TYPE || unexposedValue > PS_MAX_##TYPE) { \
-                            psError(__func__,"The given unexposedValue (%g) is outside of the " \
-                                    "image type's range (%g->%g).", \
-                                    unexposedValue, (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \
-                            psFree(out); \
-                            out = NULL; \
-                            break; \
-                        } \
-                        float inX; \
-                        float inY; \
-                        ps##TYPE* outRow; \
-                        for (int y = 0; y < outRows; y++) { \
-                            inX = minXTimesCosTPlusCenterX + (y+intMinY) * sinT; \
-                            inY = CenterYMinusminXTimesSinT + (y+intMinY) * cosT; \
-                            outRow = out->data.TYPE[y]; \
-                            for (int x = 0; x < outCols; x++) { \
-                                outRow[x] = p_psImagePixelInterpolate##MODE##_##TYPE(in,inX,inY,unexposedValue); \
-                                inX += cosT; \
-                                inY -= sinT; \
-                            } \
-                        } \
-                    }
-
-                    #define PSIMAGE_ROTATE_ARBITRARY_CASE(MODE) \
-                case PS_INTERPOLATE_##MODE: \
-                    switch (type) { \
-                    case PS_TYPE_U8: \
-                        PSIMAGE_ROTATE_ARBITRARY_LOOP(U8,MODE); \
-                        break; \
-                    case PS_TYPE_U16: \
-                        PSIMAGE_ROTATE_ARBITRARY_LOOP(U16,MODE); \
-                        break; \
-                    case PS_TYPE_U32: \
-                        PSIMAGE_ROTATE_ARBITRARY_LOOP(U32,MODE); \
-                        break; \
-                    case PS_TYPE_U64: \
-                        PSIMAGE_ROTATE_ARBITRARY_LOOP(U64,MODE); \
-                        break; \
-                    case PS_TYPE_S8: \
-                        PSIMAGE_ROTATE_ARBITRARY_LOOP(S8,MODE); \
-                        break; \
-                    case PS_TYPE_S16: \
-                        PSIMAGE_ROTATE_ARBITRARY_LOOP(S16,MODE); \
-                        break; \
-                    case PS_TYPE_S32: \
-                        PSIMAGE_ROTATE_ARBITRARY_LOOP(S32,MODE); \
-                        break; \
-                    case PS_TYPE_S64: \
-                        PSIMAGE_ROTATE_ARBITRARY_LOOP(S64,MODE); \
-                        break; \
-                    case PS_TYPE_F32: \
-                        PSIMAGE_ROTATE_ARBITRARY_LOOP(F32,MODE); \
-                        break; \
-                    case PS_TYPE_F64: \
-                        PSIMAGE_ROTATE_ARBITRARY_LOOP(F64,MODE); \
-                        break; \
-                    case PS_TYPE_C32: \
-                        PSIMAGE_ROTATE_ARBITRARY_LOOP(C32,MODE); \
-                        break; \
-                    case PS_TYPE_C64: \
-                        PSIMAGE_ROTATE_ARBITRARY_LOOP(C64,MODE); \
-                        break; \
-                    default: \
-                        psError(__func__,"Image type (%d) not supported",type); \
-                        psFree(out); \
-                        out = NULL; \
-                    } \
-                    break;
-
-                    switch (mode) {
-                        PSIMAGE_ROTATE_ARBITRARY_CASE(FLAT);
-                        PSIMAGE_ROTATE_ARBITRARY_CASE(BILINEAR);
-                    default:
-                        psError(__func__,"Unsupported interpolation mode (%d)",mode);
-                        psFree(out);
-                        out = NULL;
-                    }
-                }
+    } else if (fabsf(angle - 180.0f) < FLT_EPSILON) {
+        // perform 1/2 rotate
+        int numRows = in->numRows;
+        int lastRow = numRows - 1;
+        int numCols = in->numCols;
+        int lastCol = numCols - 1;
+        psElemType type = in->type.type;
+
+        out = psImageRecycle(out, numCols, numRows, type);
+
+        #define PSIMAGE_ROTATE_180_CASE(TYPE) \
+    case PS_TYPE_##TYPE: { \
+            for (int row=0;row<numRows;row++) { \
+                ps##TYPE* outRow = out->data.TYPE[row]; \
+                ps##TYPE* inRow = in->data.TYPE[lastRow-row]; \
+                for (int col=0;col<numCols;col++) { \
+                    outRow[col] = inRow[lastCol - col]; \
+                } \
+            } \
+        } \
+        break;
+
+        switch (type) {
+            PSIMAGE_ROTATE_180_CASE(U8);
+            PSIMAGE_ROTATE_180_CASE(U16);
+            PSIMAGE_ROTATE_180_CASE(U32);
+            PSIMAGE_ROTATE_180_CASE(U64);
+            PSIMAGE_ROTATE_180_CASE(S8);
+            PSIMAGE_ROTATE_180_CASE(S16);
+            PSIMAGE_ROTATE_180_CASE(S32);
+            PSIMAGE_ROTATE_180_CASE(S64);
+            PSIMAGE_ROTATE_180_CASE(F32);
+            PSIMAGE_ROTATE_180_CASE(F64);
+            PSIMAGE_ROTATE_180_CASE(C32);
+            PSIMAGE_ROTATE_180_CASE(C64);
+        default:
+            psError(__func__, "Unsupported type (%d)", type);
+            psFree(out);
+            return NULL;
+        }
+    } else if (fabsf(angle - 270.0f) < FLT_EPSILON) {
+        // perform 1/4 rotate clockwise
+        int numRows = in->numCols;
+        int lastRow = numRows - 1;
+        int numCols = in->numRows;
+        psElemType type = in->type.type;
+
+        out = psImageRecycle(out, numCols, numRows, type);
+
+        #define PSIMAGE_ROTATE_RIGHT_90(TYPE) \
+    case PS_TYPE_##TYPE: { \
+            ps##TYPE** inData = in->data.TYPE; \
+            for (int row=0;row<numRows;row++) { \
+                ps##TYPE* outRow = out->data.TYPE[row]; \
+                for (int col=0;col<numCols;col++) { \
+                    outRow[col] = inData[col][lastRow-row]; \
+                } \
+            } \
+        } \
+        break;
+
+        switch (type) {
+            PSIMAGE_ROTATE_RIGHT_90(U8);
+            PSIMAGE_ROTATE_RIGHT_90(U16);
+            PSIMAGE_ROTATE_RIGHT_90(U32);
+            PSIMAGE_ROTATE_RIGHT_90(U64);
+            PSIMAGE_ROTATE_RIGHT_90(S8);
+            PSIMAGE_ROTATE_RIGHT_90(S16);
+            PSIMAGE_ROTATE_RIGHT_90(S32);
+            PSIMAGE_ROTATE_RIGHT_90(S64);
+            PSIMAGE_ROTATE_RIGHT_90(F32);
+            PSIMAGE_ROTATE_RIGHT_90(F64);
+            PSIMAGE_ROTATE_RIGHT_90(C32);
+            PSIMAGE_ROTATE_RIGHT_90(C64);
+        default:
+            psError(__func__, "Unsupported type (%d)", type);
+            psFree(out);
+            return NULL;
+        }
+    } else if (fabsf(angle) < FLT_EPSILON) {
+        out = psImageCopy(out, in, in->type.type);
+    } else {
+        psElemType type = in->type.type;
+        int numRows = in->numRows;
+        int numCols = in->numCols;
+        double centerX = (float)(numCols) / 2.0f;
+        float centerY = (float)(numRows) / 2.0f;
+        float t = angle * (3.14159265358f / 180.0f);
+        float cosT = cosf(t);
+        float sinT = sinf(t);
+
+        // calculate the corners of the rotated
+        // image so we know the proper
+        // output image size.
+        // x' = x cos(t) + y sin(t); i.e, x' =
+        // (x-centerX)*cosT +
+        // (y-centerY)*sinT;
+        // y' = y cos(t) - x sin(t); i.e. y' =
+        // (y-centerY)*cosT -
+        // (x-centerX)*sinT;
+
+        int outCols = ceil(abs(numCols * cosT) + abs(numRows * sinT)) + 1;
+        int outRows = ceil(abs(numCols * sinT) + abs(numRows * cosT)) + 1;
+        float minX = (float)outCols / -2.0f;
+        int intMinY = outRows / -2;
+
+        out = psImageRecycle(out, outCols, outRows, type);
+
+        /* optimized public domain rotation routine by Karl Lager float cosT,sinT; cosT = cos(t); sinT =
+         * sin(t); for (y = min_y; y <= max_y; y++) { x' = min_x * cosT + y * sinT + x1'; y' = y * cosT -
+         * min_x * sinT + y1'; for (x = min_x; x <= max_x; x++) { if (x', y') * * * * * * * * is in the
+         * bounds of the bitmap, get pixel(x', y') and plot the pixel to (x, y) on screen. x' += cosT; y' -=
+         * sinT; } } */
+
+        // precalculate some figures that are
+        // used within loop
+        float minXTimesCosTPlusCenterX = minX * cosT + centerX;
+        float CenterYMinusminXTimesSinT = centerY - minX * sinT;
+
+        #define PSIMAGE_ROTATE_ARBITRARY_LOOP(TYPE,MODE) { \
+            if (unexposedValue < PS_MIN_##TYPE || unexposedValue > PS_MAX_##TYPE) { \
+                psError(__func__,"The given unexposedValue (%g) is outside of the " \
+                        "image type's range (%g->%g).", \
+                        unexposedValue, (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \
+                psFree(out); \
+                out = NULL; \
+                break; \
+            } \
+            float inX; \
+            float inY; \
+            ps##TYPE* outRow; \
+            for (int y = 0; y < outRows; y++) { \
+                inX = minXTimesCosTPlusCenterX + (y+intMinY) * sinT; \
+                inY = CenterYMinusminXTimesSinT + (y+intMinY) * cosT; \
+                outRow = out->data.TYPE[y]; \
+                for (int x = 0; x < outCols; x++) { \
+                    outRow[x] = p_psImagePixelInterpolate##MODE##_##TYPE(in,inX,inY,unexposedValue); \
+                    inX += cosT; \
+                    inY -= sinT; \
+                } \
+            } \
+        }
+
+        #define PSIMAGE_ROTATE_ARBITRARY_CASE(MODE) \
+    case PS_INTERPOLATE_##MODE: \
+        switch (type) { \
+        case PS_TYPE_U8: \
+            PSIMAGE_ROTATE_ARBITRARY_LOOP(U8,MODE); \
+            break; \
+        case PS_TYPE_U16: \
+            PSIMAGE_ROTATE_ARBITRARY_LOOP(U16,MODE); \
+            break; \
+        case PS_TYPE_U32: \
+            PSIMAGE_ROTATE_ARBITRARY_LOOP(U32,MODE); \
+            break; \
+        case PS_TYPE_U64: \
+            PSIMAGE_ROTATE_ARBITRARY_LOOP(U64,MODE); \
+            break; \
+        case PS_TYPE_S8: \
+            PSIMAGE_ROTATE_ARBITRARY_LOOP(S8,MODE); \
+            break; \
+        case PS_TYPE_S16: \
+            PSIMAGE_ROTATE_ARBITRARY_LOOP(S16,MODE); \
+            break; \
+        case PS_TYPE_S32: \
+            PSIMAGE_ROTATE_ARBITRARY_LOOP(S32,MODE); \
+            break; \
+        case PS_TYPE_S64: \
+            PSIMAGE_ROTATE_ARBITRARY_LOOP(S64,MODE); \
+            break; \
+        case PS_TYPE_F32: \
+            PSIMAGE_ROTATE_ARBITRARY_LOOP(F32,MODE); \
+            break; \
+        case PS_TYPE_F64: \
+            PSIMAGE_ROTATE_ARBITRARY_LOOP(F64,MODE); \
+            break; \
+        case PS_TYPE_C32: \
+            PSIMAGE_ROTATE_ARBITRARY_LOOP(C32,MODE); \
+            break; \
+        case PS_TYPE_C64: \
+            PSIMAGE_ROTATE_ARBITRARY_LOOP(C64,MODE); \
+            break; \
+        default: \
+            psError(__func__,"Image type (%d) not supported",type); \
+            psFree(out); \
+            out = NULL; \
+        } \
+        break;
+
+        switch (mode) {
+            PSIMAGE_ROTATE_ARBITRARY_CASE(FLAT);
+            PSIMAGE_ROTATE_ARBITRARY_CASE(BILINEAR);
+        default:
+            psError(__func__, "Unsupported interpolation mode (%d)", mode);
+            psFree(out);
+            out = NULL;
+        }
+    }
 
     return out;
 }
 
-psImage* psImageShift(psImage* out, const psImage* in, float dx, float dy, psF64 unexposedValue, psImageInterpolateMode mode)
+psImage *psImageShift(psImage * out,
+                      const psImage * in,
+                      float dx, float dy, psF64 unexposedValue, psImageInterpolateMode mode)
 {
     int outRows;
@@ -798,14 +813,14 @@
 
     if (in == NULL) {
-        psError(__func__,"Input image can not be NULL.");
+        psError(__func__, "Input image can not be NULL.");
         return NULL;
     }
-
-    // create an output image of the same size and type
+    // create an output image of the same size
+    // and type
     outRows = in->numRows;
     outCols = in->numCols;
     type = in->type.type;
     elementSize = PSELEMTYPE_SIZEOF(type);
-    out = psImageRecycle(out,outCols, outRows, type);
+    out = psImageRecycle(out, outCols, outRows, type);
 
     #define PSIMAGE_SHIFT_CASE(TYPE) \
@@ -842,5 +857,5 @@
         PSIMAGE_SHIFT_CASE(C64);
     default:
-        psError(__func__,"Image type (%d) not supported.",type);
+        psError(__func__, "Image type (%d) not supported.", type);
         psFree(out);
         out = NULL;
Index: /trunk/psLib/src/image/psImageManip.h
===================================================================
--- /trunk/psLib/src/image/psImageManip.h	(revision 1406)
+++ /trunk/psLib/src/image/psImageManip.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psImageManip.h
  *
@@ -10,13 +11,13 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-22 20:42:22 $
+ *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
 #ifndef PS_IMAGE_MANIP_H
-#define PS_IMAGE_MANIP_H
+#    define PS_IMAGE_MANIP_H
 
-#include "psImage.h"
+#    include "psImage.h"
 
 /// @addtogroup Image
@@ -31,11 +32,10 @@
  *  @return int     The number of clipped pixels
  */
-int psImageClip(
-    psImage* input,                 ///< the image to clip
-    psF64 min,                      ///< the minimum image value allowed
-    psF64 vmin,                     ///< the value pixels < min are set to
-    psF64 max,                      ///< the maximum image value allowed
-    psF64 vmax                      ///< the value pixels > max are set to
-);
+int psImageClip(psImage * input,        // /< the image to clip
+                psF64 min,      // /< the minimum image value allowed
+                psF64 vmin,     // /< the value pixels < min are set to
+                psF64 max,      // /< the maximum image value allowed
+                psF64 vmax      // /< the value pixels > max are set to
+               );
 
 /** Clip image values outside of a specified complex region
@@ -48,11 +48,10 @@
  *  @return int     The number of clipped pixels
  */
-int psImageClipComplexRegion(
-    psImage* input,                 ///< the image to clip
-    psC64 min,                      ///< the minimum image value allowed
-    psC64 vmin,                     ///< the value pixels < min are set to
-    psC64 max,                      ///< the maximum image value allowed
-    psC64 vmax                      ///< the value pixels > max are set to
-);
+int psImageClipComplexRegion(psImage * input,   // /< the image to clip
+                             psC64 min, // /< the minimum image value allowed
+                             psC64 vmin,        // /< the value pixels < min are set to
+                             psC64 max, // /< the maximum image value allowed
+                             psC64 vmax // /< the value pixels > max are set to
+                            );
 
 /** Clip NaN image pixels to given value.
@@ -63,8 +62,7 @@
  *  @return int     The number of clipped pixels
  */
-int psImageClipNaN(
-    psImage* input,                 ///< the image to clip
-    psF64 value                     ///< the value to set all NaN/Inf values to
-);
+int psImageClipNaN(psImage * input,     // /< the image to clip
+                   psF64 value  // /< the value to set all NaN/Inf values to
+                  );
 
 /** Overlay subregion of image with another image
@@ -79,11 +77,10 @@
  *  @return int         0 if success, non-zero if failed.
  */
-int psImageOverlaySection(
-    psImage* image,                 ///< target image
-    const psImage* overlay,         ///< the overlay image
-    int col0,                       ///< the column to start overlay
-    int row0,                       ///< the row to start overlay
-    const char* op                  ///< the operation to perform for overlay
-);
+int psImageOverlaySection(psImage * image,      // /< target image
+                          const psImage * overlay,      // /< the overlay image
+                          int col0,     // /< the column to start overlay
+                          int row0,     // /< the row to start overlay
+                          const char *op        // /< the operation to perform for overlay
+                         );
 
 /** Rebin image to new scale.
@@ -97,34 +94,22 @@
  *  @return psImage    new image formed by rebinning input image.
  */
-psImage* psImageRebin(
-    psImage* out,                   ///< an psImage to recycle.  If NULL, a new image is created
-    const psImage* in,              ///< input image
-    unsigned int scale,             ///< the scale to rebin for each dimension
-    const psStats* stats            ///< the statistic to perform when rebinning.  Only one method should be set.
-);
+psImage *psImageRebin(psImage * out,    // /< an psImage to recycle.  If NULL, a new image is created
+                      const psImage * in,       // /< input image
+                      unsigned int scale,       // /< the scale to rebin for each dimension
+                      const psStats * stats     // /< the statistic to perform when rebinning.  Only one
+                      // method should be set.
+                     );
 
-psImage* psImageResample(
-    psImage* out,                   ///< an psImage to recycle.  If NULL, a new image is created
-    const psImage* in,              ///< input image
-    int scale,
-    psImageInterpolateMode mode
-);
+psImage *psImageResample(psImage * out, // /< an psImage to recycle.  If NULL, a new image is created
+                         const psImage * in,    // /< input image
+                         int scale, psImageInterpolateMode mode);
 
-psImage* psImageRotate(
-    psImage* out,                   ///< an psImage to recycle.  If NULL, a new image is created
-    const psImage* in,              ///< input image
-    float angle,
-    float unexposedValue,
-    psImageInterpolateMode mode
-);
+psImage *psImageRotate(psImage * out,   // /< an psImage to recycle.  If NULL, a new image is created
+                       const psImage * in,      // /< input image
+                       float angle, float unexposedValue, psImageInterpolateMode mode);
 
-psImage* psImageShift(
-    psImage* out,                   ///< an psImage to recycle.  If NULL, a new image is created
-    const psImage* in,              ///< input image
-    float dx,
-    float dy,
-    float unexposedValue,
-    psImageInterpolateMode mode
-);
+psImage *psImageShift(psImage * out,    // /< an psImage to recycle.  If NULL, a new image is created
+                      const psImage * in,       // /< input image
+                      float dx, float dy, float unexposedValue, psImageInterpolateMode mode);
 
 /** Roll image by an integer number of pixels in either direction.
@@ -136,11 +121,9 @@
  *  @return psImage*    the rolled version of the input image.
  */
-psImage* psImageRoll(
-    psImage* out,                   ///< an psImage to recycle.  If NULL, a new image is created
-    const psImage* in,              ///< input image
-    int dx,                         ///< number of pixels to roll in the x-dimension
-    int dy                          ///< number of pixels to roll in the y-dimension
-);
+psImage *psImageRoll(psImage * out,     // /< an psImage to recycle.  If NULL, a new image is created
+                     const psImage * in,        // /< input image
+                     int dx,    // /< number of pixels to roll in the x-dimension
+                     int dy     // /< number of pixels to roll in the y-dimension
+                    );
 
 #endif
-
Index: /trunk/psLib/src/image/psImageStats.c
===================================================================
--- /trunk/psLib/src/image/psImageStats.c	(revision 1406)
+++ /trunk/psLib/src/image/psImageStats.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file psImageStats.c
 *  \brief Routines for calculating statistics on images.
@@ -9,6 +10,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 22:34:05 $
+*  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -32,49 +33,50 @@
 
 /// This routine must determine the various statistics for the image.
+
 /*****************************************************************************
     NOTE: verify that image/mask have the correct types, and sizes.
  *****************************************************************************/
-psStats *psImageStats(psStats *stats,
-                      psImage *in,
-                      psImage *mask,
-                      int maskVal)
-{
-    psVector* junkData=NULL;
-    psVector* junkMask=NULL;
+psStats *psImageStats(psStats * stats, psImage * in, psImage * mask, int maskVal)
+{
+    psVector *junkData = NULL;
+    psVector *junkMask = NULL;
 
     if (stats == NULL) {
-        psError(__func__,"The input psStats struct can not be NULL.");
+        psError(__func__, "The input psStats struct can not be NULL.");
         return NULL;
     }
 
     if (in == NULL) {
-        psError(__func__,"The input image can not be NULL.");
+        psError(__func__, "The input image can not be NULL.");
         return NULL;
     }
 
     if (stats->options == 0) {
-        psError(__func__,"No statistic option/operation was specified.");
+        psError(__func__, "No statistic option/operation was specified.");
         return stats;
     }
-
-    // stuff the image data into a psVector struct.
+    // stuff the image data into a psVector
+    // struct.
     junkData = psAlloc(sizeof(psVector));
     junkData->type = in->type;
-    junkData->nalloc = in->numRows*in->numCols;
+    junkData->nalloc = in->numRows * in->numCols;
     junkData->n = junkData->nalloc;
-    junkData->data.V = in->data.V[0];    // since psImage data is contiguous...
+    junkData->data.V = in->data.V[0];      // since
+    // psImage
+    // data
+    // is
+    // contiguous...
 
     if (mask != NULL) {
         if (mask->type.type != PS_TYPE_MASK) {
-            psError(__func__, "Expected the mask image type not found (type=%x)",
-                    mask->type.type);
+            psError(__func__, "Expected the mask image type not found (type=%x)", mask->type.type);
             psFree(junkData);
             return NULL;
         }
-
-        // stuff the mask data into a psVector struct.
+        // stuff the mask data into a psVector
+        // struct.
         junkMask = psAlloc(sizeof(psVector));
         junkMask->type = mask->type;
-        junkMask->nalloc = mask->numRows*mask->numCols;
+        junkMask->nalloc = mask->numRows * mask->numCols;
         junkMask->n = junkMask->nalloc;
         junkMask->data.V = mask->data.V[0];
@@ -85,5 +87,5 @@
     psFree(junkMask);
     psFree(junkData);
-    return(stats);
+    return (stats);
 }
 
@@ -93,36 +95,35 @@
     NOTE: verify that image/mask have the, correct types and  sizes.
  *****************************************************************************/
-psHistogram *psImageHistogram(psHistogram *out,
-                              psImage *in,
-                              psImage *mask,
-                              unsigned int maskVal)
-{
-    psVector *junkData=NULL;
-    psVector *junkMask=NULL;
+psHistogram *psImageHistogram(psHistogram * out, psImage * in, psImage * mask, unsigned int maskVal)
+{
+    psVector *junkData = NULL;
+    psVector *junkMask = NULL;
 
     // NOTE: Verify this action.
-    if ((out == NULL) ||
-            (in == NULL)) {
-        return(NULL);
+    if ((out == NULL) || (in == NULL)) {
+        return (NULL);
     }
 
     junkData = psAlloc(sizeof(psVector));
     junkData->type = in->type;
-    junkData->nalloc = in->numRows*in->numCols;
+    junkData->nalloc = in->numRows * in->numCols;
     junkData->n = junkData->nalloc;
-    junkData->data.V = in->data.V[0];    // since psImage data is contiguous...
+    junkData->data.V = in->data.V[0];      // since
+    // psImage
+    // data
+    // is
+    // contiguous...
 
     if (mask != NULL) {
         if (mask->type.type != PS_TYPE_MASK) {
-            psError(__func__, "Expected the mask image type not found (type=%x)",
-                    mask->type.type);
+            psError(__func__, "Expected the mask image type not found (type=%x)", mask->type.type);
             psFree(junkData);
             return NULL;
         }
-
-        // stuff the mask data into a psVector struct.
+        // stuff the mask data into a psVector
+        // struct.
         junkMask = psAlloc(sizeof(psVector));
         junkMask->type = mask->type;
-        junkMask->nalloc = mask->numRows*mask->numCols;
+        junkMask->nalloc = mask->numRows * mask->numCols;
         junkMask->n = junkMask->nalloc;
         junkMask->data.V = mask->data.V[0];
@@ -134,5 +135,5 @@
     psFree(junkData);
 
-    return(out);
+    return (out);
 }
 
@@ -141,15 +142,16 @@
     int i = 0;
     float tmp = 0.0;
-    float *scalingFactors = (float *) psAlloc(n * sizeof(float));
-
-    for (i=0;i<n;i++) {
-        //     ((2.0 * (float) i) / ((float) (n-1))) - 1.0;
-        //        tmp = (float) (i + 1);
-        tmp = (float) (n - i);
-        tmp = (M_PI * (tmp - 0.5)) / ((float) n);
+    float *scalingFactors = (float *)psAlloc(n * sizeof(float));
+
+    for (i = 0; i < n; i++) {
+        // ((2.0 * (float) i) / ((float) (n-1)))
+        // - 1.0;
+        // tmp = (float) (i + 1);
+        tmp = (float)(n - i);
+        tmp = (M_PI * (tmp - 0.5)) / ((float)n);
         scalingFactors[i] = cos(tmp);
     }
 
-    return(scalingFactors);
+    return (scalingFactors);
 }
 
@@ -165,15 +167,18 @@
     int i = 0;
     float tmp = 0.0;
+
     return p_psCalcScaleFactorsFit(n);
 
     printf("Should not get here\n");
-    float *scalingFactors = (float *) psAlloc(n * sizeof(float));
-    for (i=0;i<n;i++) {
-        //          scalingFactors[i] = ((2.0 * (float) i) / ((float) (n-1))) - 1.0;
-        tmp = (float) (n - i);
-        tmp = (M_PI * (tmp - 0.5)) / ((float) n);
+    float *scalingFactors = (float *)psAlloc(n * sizeof(float));
+
+    for (i = 0; i < n; i++) {
+        // scalingFactors[i] = ((2.0 * (float) i)
+        // / ((float) (n-1))) - 1.0;
+        tmp = (float)(n - i);
+        tmp = (M_PI * (tmp - 0.5)) / ((float)n);
         scalingFactors[i] = cos(tmp);
     }
-    return(scalingFactors);
+    return (scalingFactors);
 }
 
@@ -184,25 +189,24 @@
     int j = 0;
 
-    chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly *
-                                            sizeof(psPolynomial1D *));
-    for (i=0;i<maxChebyPoly;i++) {
-        chebPolys[i] = psPolynomial1DAlloc(i+1);
-    }
-
-    // Create the Chebyshev polynomials.  Polynomial i has i-th order.
+    chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *));
+    for (i = 0; i < maxChebyPoly; i++) {
+        chebPolys[i] = psPolynomial1DAlloc(i + 1);
+    }
+
+    // Create the Chebyshev polynomials.
+    // Polynomial i has i-th order.
     chebPolys[0]->coeff[0] = 1;
     chebPolys[1]->coeff[1] = 1;
-    for (i=2;i<maxChebyPoly;i++) {
-        for (j=0;j<chebPolys[i-1]->n;j++) {
-            chebPolys[i]->coeff[j+1] = 2 * chebPolys[i-1]->coeff[j];
-        }
-        for (j=0;j<chebPolys[i-2]->n;j++) {
-            chebPolys[i]->coeff[j]-= chebPolys[i-2]->coeff[j];
-        }
-    }
-
-    return(chebPolys);
-}
-
+    for (i = 2; i < maxChebyPoly; i++) {
+        for (j = 0; j < chebPolys[i - 1]->n; j++) {
+            chebPolys[i]->coeff[j + 1] = 2 * chebPolys[i - 1]->coeff[j];
+        }
+        for (j = 0; j < chebPolys[i - 2]->n; j++) {
+            chebPolys[i]->coeff[j] -= chebPolys[i - 2]->coeff[j];
+        }
+    }
+
+    return (chebPolys);
+}
 
 /*****************************************************************************
@@ -220,7 +224,5 @@
         over all pixels (x,y) in the image.
  *****************************************************************************/
-psPolynomial2D *
-psImageFitPolynomial(const psImage *input,
-                     psPolynomial2D *coeffs)
+psPolynomial2D *psImageFitPolynomial(const psImage * input, psPolynomial2D * coeffs)
 {
     int x = 0;
@@ -235,16 +237,21 @@
     float tmp = 0.0;
 
-    // Create the sums[][] data structure.  This will hold the LHS of equation
-    // 29 in the ADD: sums[k][l] = SUM { image(x,y) * Tk(x) * Tl(y) }
-    sums = (float **) psAlloc(coeffs->nX * sizeof(float *));
-    for (i=0;i<coeffs->nX;i++) {
-        sums[i] = (float *) psAlloc(coeffs->nY * sizeof(float));
-    }
-
-    // We scale the pixel positions to values between -1.0 and 1.0
+    // Create the sums[][] data structure.  This
+    // will hold the LHS of
+    // equation
+    // 29 in the ADD: sums[k][l] = SUM {
+    // image(x,y) * Tk(x) * Tl(y) }
+    sums = (float **)psAlloc(coeffs->nX * sizeof(float *));
+    for (i = 0; i < coeffs->nX; i++) {
+        sums[i] = (float *)psAlloc(coeffs->nY * sizeof(float));
+    }
+
+    // We scale the pixel positions to values
+    // between -1.0 and 1.0
     rScalingFactors = p_psCalcScaleFactorsFit(input->numRows);
     cScalingFactors = p_psCalcScaleFactorsFit(input->numCols);
 
-    // Determine how many Chebyshev polynomials are needed, then create them.
+    // Determine how many Chebyshev polynomials
+    // are needed, then create them.
     maxChebyPoly = coeffs->nX;
     if (coeffs->nY > coeffs->nX) {
@@ -254,25 +261,29 @@
 
     // Sanity check for the Chebyshevs.
-    for (i=0;i<coeffs->nX;i++) {
-        for (j=0;j<coeffs->nY;j++) {
+    for (i = 0; i < coeffs->nX; i++) {
+        for (j = 0; j < coeffs->nY; j++) {
             tmp = 0.0;
-            for (x=0;x<input->numRows;x++) {
-                tmp+= psPolynomial1DEval(rScalingFactors[x], chebPolys[i]) *
-                      psPolynomial1DEval(rScalingFactors[x], chebPolys[j]);
+            for (x = 0; x < input->numRows; x++) {
+                tmp +=
+                    psPolynomial1DEval
+                    (rScalingFactors[x], chebPolys[i]) * psPolynomial1DEval(rScalingFactors[x], chebPolys[j]);
 
             }
-            //printf("SUM(Cheby(%d) * Cheby(%d)) is %f\n", i, j, tmp);
+            // printf("SUM(Cheby(%d) * Cheby(%d))
+            // is %f\n", i, j, tmp);
         }
     }
 
     // Compute the sums[][] data structure.
-    for (i=0;i<coeffs->nX;i++) {
-        for (j=0;j<coeffs->nY;j++) {
+    for (i = 0; i < coeffs->nX; i++) {
+        for (j = 0; j < coeffs->nY; j++) {
             sums[i][j] = 0.0;
-            for (x=0;x<input->numRows;x++) {
-                for (y=0;y<input->numCols;y++) {
-                    sums[i][j]+= input->data.F32[x][y] *
-                                 psPolynomial1DEval(rScalingFactors[x], chebPolys[i]) *
-                                 psPolynomial1DEval(cScalingFactors[y], chebPolys[j]);
+            for (x = 0; x < input->numRows; x++) {
+                for (y = 0; y < input->numCols; y++) {
+                    sums[i][j] +=
+                        input->data.F32[x][y] *
+                        psPolynomial1DEval
+                        (rScalingFactors[x],
+                         chebPolys[i]) * psPolynomial1DEval(cScalingFactors[y], chebPolys[j]);
                 }
             }
@@ -280,22 +291,22 @@
     }
 
-    for (i=0;i<coeffs->nX;i++) {
-        for (j=0;j<coeffs->nY;j++) {
+    for (i = 0; i < coeffs->nX; i++) {
+        for (j = 0; j < coeffs->nY; j++) {
             coeffs->coeff[i][j] = sums[i][j];
-            coeffs->coeff[i][j]/= (float) (input->numRows * input->numCols);
+            coeffs->coeff[i][j] /= (float)(input->numRows * input->numCols);
 
             if ((i != 0) && (j != 0)) {
-                coeffs->coeff[i][j]*= 4.0;
-            } else
-                if ((i == 0) && (j == 0)) {
-                    coeffs->coeff[i][j]*= 1.0;
-                } else {
-                    coeffs->coeff[i][j]*= 2.0;
-                }
-        }
-    }
-
-    // Free the Chebyshev polynomials that were created in this routine.
-    for (i=0;i<maxChebyPoly;i++) {
+                coeffs->coeff[i][j] *= 4.0;
+            } else if ((i == 0) && (j == 0)) {
+                coeffs->coeff[i][j] *= 1.0;
+            } else {
+                coeffs->coeff[i][j] *= 2.0;
+            }
+        }
+    }
+
+    // Free the Chebyshev polynomials that were
+    // created in this routine.
+    for (i = 0; i < maxChebyPoly; i++) {
         psFree(chebPolys[i]);
     }
@@ -303,5 +314,5 @@
 
     // Free some data
-    for (i=0;i<coeffs->nX;i++) {
+    for (i = 0; i < coeffs->nX; i++) {
         psFree(sums[i]);
     }
@@ -310,5 +321,5 @@
     psFree(rScalingFactors);
 
-    return(coeffs);
+    return (coeffs);
 }
 
@@ -316,7 +327,5 @@
  
  *****************************************************************************/
-int
-psImageEvalPolynomial(const psImage *input,
-                      const psPolynomial2D *coeffs)
+int psImageEvalPolynomial(const psImage * input, const psPolynomial2D * coeffs)
 {
     int x = 0;
@@ -331,21 +340,26 @@
     float polySum = 0.0;
 
-    // Create the sums[][] data structure.  This will hold the LHS of equation
-    // 29 in the ADD: sums[k][l] = SUM { image(x,y) * Tk(x) * Tl(y) }
-    sums = (float **) psAlloc(coeffs->nX * sizeof(float *));
-    for (i=0;i<coeffs->nX;i++) {
-        sums[i] = (float *) psAlloc(coeffs->nY * sizeof(float));
-    }
-    for (i=0;i<coeffs->nX;i++) {
-        for (j=0;j<coeffs->nY;j++) {
+    // Create the sums[][] data structure.  This
+    // will hold the LHS of
+    // equation
+    // 29 in the ADD: sums[k][l] = SUM {
+    // image(x,y) * Tk(x) * Tl(y) }
+    sums = (float **)psAlloc(coeffs->nX * sizeof(float *));
+    for (i = 0; i < coeffs->nX; i++) {
+        sums[i] = (float *)psAlloc(coeffs->nY * sizeof(float));
+    }
+    for (i = 0; i < coeffs->nX; i++) {
+        for (j = 0; j < coeffs->nY; j++) {
             sums[i][j] = 0.0;
         }
     }
 
-    // We scale the pixel positions to values between -1.0 and 1.0
+    // We scale the pixel positions to values
+    // between -1.0 and 1.0
     rScalingFactors = p_psCalcScaleFactorsEval(input->numRows);
     cScalingFactors = p_psCalcScaleFactorsEval(input->numCols);
 
-    // Determine how many Chebyshev polynomials are needed, then create them.
+    // Determine how many Chebyshev polynomials
+    // are needed, then create them.
     maxChebyPoly = coeffs->nX;
     if (coeffs->nY > coeffs->nX) {
@@ -355,12 +369,14 @@
     chebPolys = p_psCreateChebyshevPolys(maxChebyPoly);
 
-    for (x=0;x<input->numRows;x++) {
-        for (y=0;y<input->numCols;y++) {
+    for (x = 0; x < input->numRows; x++) {
+        for (y = 0; y < input->numCols; y++) {
             polySum = 0.0;
-            for (i=0;i<coeffs->nX;i++) {
-                for (j=0;j<coeffs->nY;j++) {
-                    polySum+= psPolynomial1DEval(rScalingFactors[x], chebPolys[i]) *
-                              psPolynomial1DEval(cScalingFactors[y], chebPolys[j]) *
-                              coeffs->coeff[i][j];
+            for (i = 0; i < coeffs->nX; i++) {
+                for (j = 0; j < coeffs->nY; j++) {
+                    polySum +=
+                        psPolynomial1DEval
+                        (rScalingFactors[x],
+                         chebPolys[i]) *
+                        psPolynomial1DEval(cScalingFactors[y], chebPolys[j]) * coeffs->coeff[i][j];
 
                 }
@@ -370,6 +386,7 @@
     }
 
-    // Free the Chebyshev polynomials that were created in this routine.
-    for (i=0;i<maxChebyPoly;i++) {
+    // Free the Chebyshev polynomials that were
+    // created in this routine.
+    for (i = 0; i < maxChebyPoly; i++) {
         psFree(chebPolys[i]);
     }
@@ -377,5 +394,5 @@
 
     // Free some data
-    for (i=0;i<coeffs->nX;i++) {
+    for (i = 0; i < coeffs->nX; i++) {
         psFree(sums[i]);
     }
@@ -384,4 +401,4 @@
     psFree(rScalingFactors);
 
-    return(0);
-}
+    return (0);
+}
Index: /trunk/psLib/src/image/psImageStats.h
===================================================================
--- /trunk/psLib/src/image/psImageStats.h	(revision 1406)
+++ /trunk/psLib/src/image/psImageStats.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file psImageStats.h
 *  \brief Routines for calculating statistics on images.
@@ -9,18 +10,17 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 00:55:17 $
+*  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
 */
 #if !defined(PS_IMAGE_STATS_H)
-#define PS_IMAGE_STATS_H
+#    define PS_IMAGE_STATS_H
 
-
-#include "psType.h"
-#include "psVector.h"
-#include "psImage.h"
-#include "psStats.h"
-#include "psFunctions.h"
+#    include "psType.h"
+#    include "psVector.h"
+#    include "psImage.h"
+#    include "psStats.h"
+#    include "psFunctions.h"
 
 /// @addtogroup ImageStats
@@ -28,27 +28,25 @@
 
 /// This routine must determine the various statistics for the image.
-psStats *psImageStats( psStats *stats,  ///< defines statistics to be calculated
-                       psImage *in,     ///< image (or subimage) to calculate stats
-                       psImage *mask,   ///< mask data for image (NULL ok)
-                       int maskVal );   ///< mask Mask for mask
-                       
-                       
-psHistogram *psImageHistogram( psHistogram *out,   ///< input histogram description & target
-                               psImage *in,        ///< Image data to be histogramed.
-                               psImage *mask,      ///< mask data for image (NULL ok)
-                               unsigned int maskVal );  ///< mask Mask for mask
-                               
+psStats *psImageStats(psStats * stats,  // /< defines statistics to be calculated
+                      psImage * in,     // /< image (or subimage) to calculate stats
+                      psImage * mask,   // /< mask data for image (NULL ok)
+                      int maskVal);     // /< mask Mask for mask
+
+psHistogram *psImageHistogram(psHistogram * out,        // /< input histogram description & target
+                              psImage * in,     // /< Image data to be histogramed.
+                              psImage * mask,   // /< mask data for image (NULL ok)
+                              unsigned int maskVal);    // /< mask Mask for mask
+
 /// Fit a 2-D polynomial surface to an image.
-psPolynomial2D *
-psImageFitPolynomial( const psImage *input,  ///< image to fit
-                      psPolynomial2D *coeffs ///< coefficient structure carries in desired terms & target
-                    );
-                    
+psPolynomial2D *psImageFitPolynomial(const psImage * input,     // /< image to fit
+                                     psPolynomial2D * coeffs    // /< coefficient structure carries in
+                                     // desired terms & target
+                                    );
+
 /// Evaluate a 2-D polynomial surface to image pixels.
-int
-psImageEvalPolynomial( const psImage *input,  ///< image to fit
-                       const psPolynomial2D *coeffs ///< coefficient structure carries in desired terms
-                     );
-                     
+int psImageEvalPolynomial(const psImage * input,        // /< image to fit
+                          const psPolynomial2D * coeffs // /< coefficient structure carries in desired terms
+                         );
+
 /// @}
 
Index: /trunk/psLib/src/imageops/psImageStats.c
===================================================================
--- /trunk/psLib/src/imageops/psImageStats.c	(revision 1406)
+++ /trunk/psLib/src/imageops/psImageStats.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file psImageStats.c
 *  \brief Routines for calculating statistics on images.
@@ -9,6 +10,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 22:34:05 $
+*  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -32,49 +33,50 @@
 
 /// This routine must determine the various statistics for the image.
+
 /*****************************************************************************
     NOTE: verify that image/mask have the correct types, and sizes.
  *****************************************************************************/
-psStats *psImageStats(psStats *stats,
-                      psImage *in,
-                      psImage *mask,
-                      int maskVal)
-{
-    psVector* junkData=NULL;
-    psVector* junkMask=NULL;
+psStats *psImageStats(psStats * stats, psImage * in, psImage * mask, int maskVal)
+{
+    psVector *junkData = NULL;
+    psVector *junkMask = NULL;
 
     if (stats == NULL) {
-        psError(__func__,"The input psStats struct can not be NULL.");
+        psError(__func__, "The input psStats struct can not be NULL.");
         return NULL;
     }
 
     if (in == NULL) {
-        psError(__func__,"The input image can not be NULL.");
+        psError(__func__, "The input image can not be NULL.");
         return NULL;
     }
 
     if (stats->options == 0) {
-        psError(__func__,"No statistic option/operation was specified.");
+        psError(__func__, "No statistic option/operation was specified.");
         return stats;
     }
-
-    // stuff the image data into a psVector struct.
+    // stuff the image data into a psVector
+    // struct.
     junkData = psAlloc(sizeof(psVector));
     junkData->type = in->type;
-    junkData->nalloc = in->numRows*in->numCols;
+    junkData->nalloc = in->numRows * in->numCols;
     junkData->n = junkData->nalloc;
-    junkData->data.V = in->data.V[0];    // since psImage data is contiguous...
+    junkData->data.V = in->data.V[0];      // since
+    // psImage
+    // data
+    // is
+    // contiguous...
 
     if (mask != NULL) {
         if (mask->type.type != PS_TYPE_MASK) {
-            psError(__func__, "Expected the mask image type not found (type=%x)",
-                    mask->type.type);
+            psError(__func__, "Expected the mask image type not found (type=%x)", mask->type.type);
             psFree(junkData);
             return NULL;
         }
-
-        // stuff the mask data into a psVector struct.
+        // stuff the mask data into a psVector
+        // struct.
         junkMask = psAlloc(sizeof(psVector));
         junkMask->type = mask->type;
-        junkMask->nalloc = mask->numRows*mask->numCols;
+        junkMask->nalloc = mask->numRows * mask->numCols;
         junkMask->n = junkMask->nalloc;
         junkMask->data.V = mask->data.V[0];
@@ -85,5 +87,5 @@
     psFree(junkMask);
     psFree(junkData);
-    return(stats);
+    return (stats);
 }
 
@@ -93,36 +95,35 @@
     NOTE: verify that image/mask have the, correct types and  sizes.
  *****************************************************************************/
-psHistogram *psImageHistogram(psHistogram *out,
-                              psImage *in,
-                              psImage *mask,
-                              unsigned int maskVal)
-{
-    psVector *junkData=NULL;
-    psVector *junkMask=NULL;
+psHistogram *psImageHistogram(psHistogram * out, psImage * in, psImage * mask, unsigned int maskVal)
+{
+    psVector *junkData = NULL;
+    psVector *junkMask = NULL;
 
     // NOTE: Verify this action.
-    if ((out == NULL) ||
-            (in == NULL)) {
-        return(NULL);
+    if ((out == NULL) || (in == NULL)) {
+        return (NULL);
     }
 
     junkData = psAlloc(sizeof(psVector));
     junkData->type = in->type;
-    junkData->nalloc = in->numRows*in->numCols;
+    junkData->nalloc = in->numRows * in->numCols;
     junkData->n = junkData->nalloc;
-    junkData->data.V = in->data.V[0];    // since psImage data is contiguous...
+    junkData->data.V = in->data.V[0];      // since
+    // psImage
+    // data
+    // is
+    // contiguous...
 
     if (mask != NULL) {
         if (mask->type.type != PS_TYPE_MASK) {
-            psError(__func__, "Expected the mask image type not found (type=%x)",
-                    mask->type.type);
+            psError(__func__, "Expected the mask image type not found (type=%x)", mask->type.type);
             psFree(junkData);
             return NULL;
         }
-
-        // stuff the mask data into a psVector struct.
+        // stuff the mask data into a psVector
+        // struct.
         junkMask = psAlloc(sizeof(psVector));
         junkMask->type = mask->type;
-        junkMask->nalloc = mask->numRows*mask->numCols;
+        junkMask->nalloc = mask->numRows * mask->numCols;
         junkMask->n = junkMask->nalloc;
         junkMask->data.V = mask->data.V[0];
@@ -134,5 +135,5 @@
     psFree(junkData);
 
-    return(out);
+    return (out);
 }
 
@@ -141,15 +142,16 @@
     int i = 0;
     float tmp = 0.0;
-    float *scalingFactors = (float *) psAlloc(n * sizeof(float));
-
-    for (i=0;i<n;i++) {
-        //     ((2.0 * (float) i) / ((float) (n-1))) - 1.0;
-        //        tmp = (float) (i + 1);
-        tmp = (float) (n - i);
-        tmp = (M_PI * (tmp - 0.5)) / ((float) n);
+    float *scalingFactors = (float *)psAlloc(n * sizeof(float));
+
+    for (i = 0; i < n; i++) {
+        // ((2.0 * (float) i) / ((float) (n-1)))
+        // - 1.0;
+        // tmp = (float) (i + 1);
+        tmp = (float)(n - i);
+        tmp = (M_PI * (tmp - 0.5)) / ((float)n);
         scalingFactors[i] = cos(tmp);
     }
 
-    return(scalingFactors);
+    return (scalingFactors);
 }
 
@@ -165,15 +167,18 @@
     int i = 0;
     float tmp = 0.0;
+
     return p_psCalcScaleFactorsFit(n);
 
     printf("Should not get here\n");
-    float *scalingFactors = (float *) psAlloc(n * sizeof(float));
-    for (i=0;i<n;i++) {
-        //          scalingFactors[i] = ((2.0 * (float) i) / ((float) (n-1))) - 1.0;
-        tmp = (float) (n - i);
-        tmp = (M_PI * (tmp - 0.5)) / ((float) n);
+    float *scalingFactors = (float *)psAlloc(n * sizeof(float));
+
+    for (i = 0; i < n; i++) {
+        // scalingFactors[i] = ((2.0 * (float) i)
+        // / ((float) (n-1))) - 1.0;
+        tmp = (float)(n - i);
+        tmp = (M_PI * (tmp - 0.5)) / ((float)n);
         scalingFactors[i] = cos(tmp);
     }
-    return(scalingFactors);
+    return (scalingFactors);
 }
 
@@ -184,25 +189,24 @@
     int j = 0;
 
-    chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly *
-                                            sizeof(psPolynomial1D *));
-    for (i=0;i<maxChebyPoly;i++) {
-        chebPolys[i] = psPolynomial1DAlloc(i+1);
-    }
-
-    // Create the Chebyshev polynomials.  Polynomial i has i-th order.
+    chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *));
+    for (i = 0; i < maxChebyPoly; i++) {
+        chebPolys[i] = psPolynomial1DAlloc(i + 1);
+    }
+
+    // Create the Chebyshev polynomials.
+    // Polynomial i has i-th order.
     chebPolys[0]->coeff[0] = 1;
     chebPolys[1]->coeff[1] = 1;
-    for (i=2;i<maxChebyPoly;i++) {
-        for (j=0;j<chebPolys[i-1]->n;j++) {
-            chebPolys[i]->coeff[j+1] = 2 * chebPolys[i-1]->coeff[j];
-        }
-        for (j=0;j<chebPolys[i-2]->n;j++) {
-            chebPolys[i]->coeff[j]-= chebPolys[i-2]->coeff[j];
-        }
-    }
-
-    return(chebPolys);
-}
-
+    for (i = 2; i < maxChebyPoly; i++) {
+        for (j = 0; j < chebPolys[i - 1]->n; j++) {
+            chebPolys[i]->coeff[j + 1] = 2 * chebPolys[i - 1]->coeff[j];
+        }
+        for (j = 0; j < chebPolys[i - 2]->n; j++) {
+            chebPolys[i]->coeff[j] -= chebPolys[i - 2]->coeff[j];
+        }
+    }
+
+    return (chebPolys);
+}
 
 /*****************************************************************************
@@ -220,7 +224,5 @@
         over all pixels (x,y) in the image.
  *****************************************************************************/
-psPolynomial2D *
-psImageFitPolynomial(const psImage *input,
-                     psPolynomial2D *coeffs)
+psPolynomial2D *psImageFitPolynomial(const psImage * input, psPolynomial2D * coeffs)
 {
     int x = 0;
@@ -235,16 +237,21 @@
     float tmp = 0.0;
 
-    // Create the sums[][] data structure.  This will hold the LHS of equation
-    // 29 in the ADD: sums[k][l] = SUM { image(x,y) * Tk(x) * Tl(y) }
-    sums = (float **) psAlloc(coeffs->nX * sizeof(float *));
-    for (i=0;i<coeffs->nX;i++) {
-        sums[i] = (float *) psAlloc(coeffs->nY * sizeof(float));
-    }
-
-    // We scale the pixel positions to values between -1.0 and 1.0
+    // Create the sums[][] data structure.  This
+    // will hold the LHS of
+    // equation
+    // 29 in the ADD: sums[k][l] = SUM {
+    // image(x,y) * Tk(x) * Tl(y) }
+    sums = (float **)psAlloc(coeffs->nX * sizeof(float *));
+    for (i = 0; i < coeffs->nX; i++) {
+        sums[i] = (float *)psAlloc(coeffs->nY * sizeof(float));
+    }
+
+    // We scale the pixel positions to values
+    // between -1.0 and 1.0
     rScalingFactors = p_psCalcScaleFactorsFit(input->numRows);
     cScalingFactors = p_psCalcScaleFactorsFit(input->numCols);
 
-    // Determine how many Chebyshev polynomials are needed, then create them.
+    // Determine how many Chebyshev polynomials
+    // are needed, then create them.
     maxChebyPoly = coeffs->nX;
     if (coeffs->nY > coeffs->nX) {
@@ -254,25 +261,29 @@
 
     // Sanity check for the Chebyshevs.
-    for (i=0;i<coeffs->nX;i++) {
-        for (j=0;j<coeffs->nY;j++) {
+    for (i = 0; i < coeffs->nX; i++) {
+        for (j = 0; j < coeffs->nY; j++) {
             tmp = 0.0;
-            for (x=0;x<input->numRows;x++) {
-                tmp+= psPolynomial1DEval(rScalingFactors[x], chebPolys[i]) *
-                      psPolynomial1DEval(rScalingFactors[x], chebPolys[j]);
+            for (x = 0; x < input->numRows; x++) {
+                tmp +=
+                    psPolynomial1DEval
+                    (rScalingFactors[x], chebPolys[i]) * psPolynomial1DEval(rScalingFactors[x], chebPolys[j]);
 
             }
-            //printf("SUM(Cheby(%d) * Cheby(%d)) is %f\n", i, j, tmp);
+            // printf("SUM(Cheby(%d) * Cheby(%d))
+            // is %f\n", i, j, tmp);
         }
     }
 
     // Compute the sums[][] data structure.
-    for (i=0;i<coeffs->nX;i++) {
-        for (j=0;j<coeffs->nY;j++) {
+    for (i = 0; i < coeffs->nX; i++) {
+        for (j = 0; j < coeffs->nY; j++) {
             sums[i][j] = 0.0;
-            for (x=0;x<input->numRows;x++) {
-                for (y=0;y<input->numCols;y++) {
-                    sums[i][j]+= input->data.F32[x][y] *
-                                 psPolynomial1DEval(rScalingFactors[x], chebPolys[i]) *
-                                 psPolynomial1DEval(cScalingFactors[y], chebPolys[j]);
+            for (x = 0; x < input->numRows; x++) {
+                for (y = 0; y < input->numCols; y++) {
+                    sums[i][j] +=
+                        input->data.F32[x][y] *
+                        psPolynomial1DEval
+                        (rScalingFactors[x],
+                         chebPolys[i]) * psPolynomial1DEval(cScalingFactors[y], chebPolys[j]);
                 }
             }
@@ -280,22 +291,22 @@
     }
 
-    for (i=0;i<coeffs->nX;i++) {
-        for (j=0;j<coeffs->nY;j++) {
+    for (i = 0; i < coeffs->nX; i++) {
+        for (j = 0; j < coeffs->nY; j++) {
             coeffs->coeff[i][j] = sums[i][j];
-            coeffs->coeff[i][j]/= (float) (input->numRows * input->numCols);
+            coeffs->coeff[i][j] /= (float)(input->numRows * input->numCols);
 
             if ((i != 0) && (j != 0)) {
-                coeffs->coeff[i][j]*= 4.0;
-            } else
-                if ((i == 0) && (j == 0)) {
-                    coeffs->coeff[i][j]*= 1.0;
-                } else {
-                    coeffs->coeff[i][j]*= 2.0;
-                }
-        }
-    }
-
-    // Free the Chebyshev polynomials that were created in this routine.
-    for (i=0;i<maxChebyPoly;i++) {
+                coeffs->coeff[i][j] *= 4.0;
+            } else if ((i == 0) && (j == 0)) {
+                coeffs->coeff[i][j] *= 1.0;
+            } else {
+                coeffs->coeff[i][j] *= 2.0;
+            }
+        }
+    }
+
+    // Free the Chebyshev polynomials that were
+    // created in this routine.
+    for (i = 0; i < maxChebyPoly; i++) {
         psFree(chebPolys[i]);
     }
@@ -303,5 +314,5 @@
 
     // Free some data
-    for (i=0;i<coeffs->nX;i++) {
+    for (i = 0; i < coeffs->nX; i++) {
         psFree(sums[i]);
     }
@@ -310,5 +321,5 @@
     psFree(rScalingFactors);
 
-    return(coeffs);
+    return (coeffs);
 }
 
@@ -316,7 +327,5 @@
  
  *****************************************************************************/
-int
-psImageEvalPolynomial(const psImage *input,
-                      const psPolynomial2D *coeffs)
+int psImageEvalPolynomial(const psImage * input, const psPolynomial2D * coeffs)
 {
     int x = 0;
@@ -331,21 +340,26 @@
     float polySum = 0.0;
 
-    // Create the sums[][] data structure.  This will hold the LHS of equation
-    // 29 in the ADD: sums[k][l] = SUM { image(x,y) * Tk(x) * Tl(y) }
-    sums = (float **) psAlloc(coeffs->nX * sizeof(float *));
-    for (i=0;i<coeffs->nX;i++) {
-        sums[i] = (float *) psAlloc(coeffs->nY * sizeof(float));
-    }
-    for (i=0;i<coeffs->nX;i++) {
-        for (j=0;j<coeffs->nY;j++) {
+    // Create the sums[][] data structure.  This
+    // will hold the LHS of
+    // equation
+    // 29 in the ADD: sums[k][l] = SUM {
+    // image(x,y) * Tk(x) * Tl(y) }
+    sums = (float **)psAlloc(coeffs->nX * sizeof(float *));
+    for (i = 0; i < coeffs->nX; i++) {
+        sums[i] = (float *)psAlloc(coeffs->nY * sizeof(float));
+    }
+    for (i = 0; i < coeffs->nX; i++) {
+        for (j = 0; j < coeffs->nY; j++) {
             sums[i][j] = 0.0;
         }
     }
 
-    // We scale the pixel positions to values between -1.0 and 1.0
+    // We scale the pixel positions to values
+    // between -1.0 and 1.0
     rScalingFactors = p_psCalcScaleFactorsEval(input->numRows);
     cScalingFactors = p_psCalcScaleFactorsEval(input->numCols);
 
-    // Determine how many Chebyshev polynomials are needed, then create them.
+    // Determine how many Chebyshev polynomials
+    // are needed, then create them.
     maxChebyPoly = coeffs->nX;
     if (coeffs->nY > coeffs->nX) {
@@ -355,12 +369,14 @@
     chebPolys = p_psCreateChebyshevPolys(maxChebyPoly);
 
-    for (x=0;x<input->numRows;x++) {
-        for (y=0;y<input->numCols;y++) {
+    for (x = 0; x < input->numRows; x++) {
+        for (y = 0; y < input->numCols; y++) {
             polySum = 0.0;
-            for (i=0;i<coeffs->nX;i++) {
-                for (j=0;j<coeffs->nY;j++) {
-                    polySum+= psPolynomial1DEval(rScalingFactors[x], chebPolys[i]) *
-                              psPolynomial1DEval(cScalingFactors[y], chebPolys[j]) *
-                              coeffs->coeff[i][j];
+            for (i = 0; i < coeffs->nX; i++) {
+                for (j = 0; j < coeffs->nY; j++) {
+                    polySum +=
+                        psPolynomial1DEval
+                        (rScalingFactors[x],
+                         chebPolys[i]) *
+                        psPolynomial1DEval(cScalingFactors[y], chebPolys[j]) * coeffs->coeff[i][j];
 
                 }
@@ -370,6 +386,7 @@
     }
 
-    // Free the Chebyshev polynomials that were created in this routine.
-    for (i=0;i<maxChebyPoly;i++) {
+    // Free the Chebyshev polynomials that were
+    // created in this routine.
+    for (i = 0; i < maxChebyPoly; i++) {
         psFree(chebPolys[i]);
     }
@@ -377,5 +394,5 @@
 
     // Free some data
-    for (i=0;i<coeffs->nX;i++) {
+    for (i = 0; i < coeffs->nX; i++) {
         psFree(sums[i]);
     }
@@ -384,4 +401,4 @@
     psFree(rScalingFactors);
 
-    return(0);
-}
+    return (0);
+}
Index: /trunk/psLib/src/imageops/psImageStats.h
===================================================================
--- /trunk/psLib/src/imageops/psImageStats.h	(revision 1406)
+++ /trunk/psLib/src/imageops/psImageStats.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file psImageStats.h
 *  \brief Routines for calculating statistics on images.
@@ -9,18 +10,17 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 00:55:17 $
+*  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
 */
 #if !defined(PS_IMAGE_STATS_H)
-#define PS_IMAGE_STATS_H
+#    define PS_IMAGE_STATS_H
 
-
-#include "psType.h"
-#include "psVector.h"
-#include "psImage.h"
-#include "psStats.h"
-#include "psFunctions.h"
+#    include "psType.h"
+#    include "psVector.h"
+#    include "psImage.h"
+#    include "psStats.h"
+#    include "psFunctions.h"
 
 /// @addtogroup ImageStats
@@ -28,27 +28,25 @@
 
 /// This routine must determine the various statistics for the image.
-psStats *psImageStats( psStats *stats,  ///< defines statistics to be calculated
-                       psImage *in,     ///< image (or subimage) to calculate stats
-                       psImage *mask,   ///< mask data for image (NULL ok)
-                       int maskVal );   ///< mask Mask for mask
-                       
-                       
-psHistogram *psImageHistogram( psHistogram *out,   ///< input histogram description & target
-                               psImage *in,        ///< Image data to be histogramed.
-                               psImage *mask,      ///< mask data for image (NULL ok)
-                               unsigned int maskVal );  ///< mask Mask for mask
-                               
+psStats *psImageStats(psStats * stats,  // /< defines statistics to be calculated
+                      psImage * in,     // /< image (or subimage) to calculate stats
+                      psImage * mask,   // /< mask data for image (NULL ok)
+                      int maskVal);     // /< mask Mask for mask
+
+psHistogram *psImageHistogram(psHistogram * out,        // /< input histogram description & target
+                              psImage * in,     // /< Image data to be histogramed.
+                              psImage * mask,   // /< mask data for image (NULL ok)
+                              unsigned int maskVal);    // /< mask Mask for mask
+
 /// Fit a 2-D polynomial surface to an image.
-psPolynomial2D *
-psImageFitPolynomial( const psImage *input,  ///< image to fit
-                      psPolynomial2D *coeffs ///< coefficient structure carries in desired terms & target
-                    );
-                    
+psPolynomial2D *psImageFitPolynomial(const psImage * input,     // /< image to fit
+                                     psPolynomial2D * coeffs    // /< coefficient structure carries in
+                                     // desired terms & target
+                                    );
+
 /// Evaluate a 2-D polynomial surface to image pixels.
-int
-psImageEvalPolynomial( const psImage *input,  ///< image to fit
-                       const psPolynomial2D *coeffs ///< coefficient structure carries in desired terms
-                     );
-                     
+int psImageEvalPolynomial(const psImage * input,        // /< image to fit
+                          const psPolynomial2D * coeffs // /< coefficient structure carries in desired terms
+                         );
+
 /// @}
 
Index: /trunk/psLib/src/math/psCompare.c
===================================================================
--- /trunk/psLib/src/math/psCompare.c	(revision 1406)
+++ /trunk/psLib/src/math/psCompare.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file psCompare.c
  *  @brief Comparison functions for sorting routines
@@ -6,6 +7,6 @@
  *  @author Robert Daniel DeSonia, MHPCC
  *
- *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-05 19:38:52 $
+ *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/math/psCompare.h
===================================================================
--- /trunk/psLib/src/math/psCompare.h	(revision 1406)
+++ /trunk/psLib/src/math/psCompare.h	(revision 1407)
@@ -1,4 +1,4 @@
 #if !defined(PS_COMPARE_H)
-#define PS_COMPARE_H
+#    define PS_COMPARE_H
 
 /** @file psCompare.h
@@ -9,6 +9,6 @@
  *  @ingroup Compare
  *
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-28 20:36:37 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -26,5 +26,5 @@
  *                   than, equal to, or greater than the second. 
  */
-typedef int (*psComparePtrFcn)(const void** a, const void** b);
+typedef int (*psComparePtrFcn) (const void **a, const void **b);
 
 /** A comparison function for sorting.
@@ -34,5 +34,5 @@
  *                   than, equal to, or greater than the second. 
  */
-typedef int (*psCompareFcn)(const void* a, const void* b);
+typedef int (*psCompareFcn) (const void *a, const void *b);
 
 /** Compare function of psS8 data.  For use with psListSort.
@@ -42,5 +42,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareS8Ptr(const void** a, const void** b);
+int psCompareS8Ptr(const void **a, const void **b);
 
 /** Compare function of psS16 data.  For use with psListSort.
@@ -50,5 +50,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareS16Ptr(const void** a, const void** b);
+int psCompareS16Ptr(const void **a, const void **b);
 
 /** Compare function of psS32 data.  For use with psListSort.
@@ -58,5 +58,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareS32Ptr(const void** a, const void** b);
+int psCompareS32Ptr(const void **a, const void **b);
 
 /** Compare function of psS64 data.  For use with psListSort.
@@ -66,5 +66,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareS64Ptr(const void** a, const void** b);
+int psCompareS64Ptr(const void **a, const void **b);
 
 /** Compare function of psU8 data.  For use with psListSort.
@@ -74,5 +74,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareU8Ptr(const void** a, const void** b);
+int psCompareU8Ptr(const void **a, const void **b);
 
 /** Compare function of psU16 data.  For use with psListSort.
@@ -82,5 +82,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareU16Ptr(const void** a, const void** b);
+int psCompareU16Ptr(const void **a, const void **b);
 
 /** Compare function of psU32 data.  For use with psListSort.
@@ -90,5 +90,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareU32Ptr(const void** a, const void** b);
+int psCompareU32Ptr(const void **a, const void **b);
 
 /** Compare function of psU64 data.  For use with psListSort.
@@ -98,5 +98,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareU64Ptr(const void** a, const void** b);
+int psCompareU64Ptr(const void **a, const void **b);
 
 /** Compare function of psF32 data.  For use with psListSort.
@@ -106,5 +106,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareF32Ptr(const void** a, const void** b);
+int psCompareF32Ptr(const void **a, const void **b);
 
 /** Compare function of psF64 data.  For use with psListSort.
@@ -114,5 +114,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareF64Ptr(const void** a, const void** b);
+int psCompareF64Ptr(const void **a, const void **b);
 
 /** Compare function of psS8 data.  For use with psListSort for descending ordering.
@@ -122,5 +122,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingS8Ptr(const void** a, const void** b);
+int psCompareDescendingS8Ptr(const void **a, const void **b);
 
 /** Compare function of psS16 data.  For use with psListSort for descending ordering.
@@ -130,5 +130,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingS16Ptr(const void** a, const void** b);
+int psCompareDescendingS16Ptr(const void **a, const void **b);
 
 /** Compare function of psS32 data.  For use with psListSort for descending ordering.
@@ -138,5 +138,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingS32Ptr(const void** a, const void** b);
+int psCompareDescendingS32Ptr(const void **a, const void **b);
 
 /** Compare function of psS64 data.  For use with psListSort for descending ordering.
@@ -146,5 +146,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingS64Ptr(const void** a, const void** b);
+int psCompareDescendingS64Ptr(const void **a, const void **b);
 
 /** Compare function of psU8 data.  For use with psListSort for descending ordering.
@@ -154,5 +154,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingU8Ptr(const void** a, const void** b);
+int psCompareDescendingU8Ptr(const void **a, const void **b);
 
 /** Compare function of psU16 data.  For use with psListSort for descending ordering.
@@ -162,5 +162,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingU16Ptr(const void** a, const void** b);
+int psCompareDescendingU16Ptr(const void **a, const void **b);
 
 /** Compare function of psU32 data.  For use with psListSort for descending ordering.
@@ -170,5 +170,5 @@
  *                   than, equal to, or lessg than the second. 
  */
-int psCompareDescendingU32Ptr(const void** a, const void** b);
+int psCompareDescendingU32Ptr(const void **a, const void **b);
 
 /** Compare function of psU64 data.  For use with psListSort for descending ordering.
@@ -178,5 +178,5 @@
  *                   than, equal to, or lessg than the second. 
  */
-int psCompareDescendingU64Ptr(const void** a, const void** b);
+int psCompareDescendingU64Ptr(const void **a, const void **b);
 
 /** Compare function of psF32 data.  For use with psListSort for descending ordering.
@@ -186,5 +186,5 @@
  *                   than, equal to, or lessg than the second. 
  */
-int psCompareDescendingF32Ptr(const void** a, const void** b);
+int psCompareDescendingF32Ptr(const void **a, const void **b);
 
 /** Compare function of psF64 data.  For use with psListSort for descending ordering.
@@ -194,5 +194,5 @@
  *                   than, equal to, or lessg than the second. 
  */
-int psCompareDescendingF64Ptr(const void** a, const void** b);
+int psCompareDescendingF64Ptr(const void **a, const void **b);
 
 /** Compare function of psS8 data.
@@ -202,5 +202,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareS8(const void* a, const void* b);
+int psCompareS8(const void *a, const void *b);
 
 /** Compare function of psS16 data.
@@ -210,5 +210,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareS16(const void* a, const void* b);
+int psCompareS16(const void *a, const void *b);
 
 /** Compare function of psS32 data.
@@ -218,5 +218,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareS32(const void* a, const void* b);
+int psCompareS32(const void *a, const void *b);
 
 /** Compare function of psS64 data.
@@ -226,5 +226,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareS64(const void* a, const void* b);
+int psCompareS64(const void *a, const void *b);
 
 /** Compare function of psU8 data.
@@ -234,5 +234,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareU8(const void* a, const void* b);
+int psCompareU8(const void *a, const void *b);
 
 /** Compare function of psU16 data.
@@ -242,5 +242,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareU16(const void* a, const void* b);
+int psCompareU16(const void *a, const void *b);
 
 /** Compare function of psU32 data.
@@ -250,5 +250,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareU32(const void* a, const void* b);
+int psCompareU32(const void *a, const void *b);
 
 /** Compare function of psU64 data.
@@ -258,5 +258,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareU64(const void* a, const void* b);
+int psCompareU64(const void *a, const void *b);
 
 /** Compare function of psF32 data.
@@ -266,5 +266,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareF32(const void* a, const void* b);
+int psCompareF32(const void *a, const void *b);
 
 /** Compare function of psF64 data.
@@ -274,5 +274,5 @@
  *                   than, equal to, or greater than the second. 
  */
-int psCompareF64(const void* a, const void* b);
+int psCompareF64(const void *a, const void *b);
 
 /** Compare function of psS8 data.
@@ -282,5 +282,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingS8(const void* a, const void* b);
+int psCompareDescendingS8(const void *a, const void *b);
 
 /** Compare function of psS16 data.
@@ -290,5 +290,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingS16(const void* a, const void* b);
+int psCompareDescendingS16(const void *a, const void *b);
 
 /** Compare function of psS32 data.
@@ -298,5 +298,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingS32(const void* a, const void* b);
+int psCompareDescendingS32(const void *a, const void *b);
 
 /** Compare function of psS64 data.
@@ -306,5 +306,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingS64(const void* a, const void* b);
+int psCompareDescendingS64(const void *a, const void *b);
 
 /** Compare function of psU8 data.
@@ -314,5 +314,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingU8(const void* a, const void* b);
+int psCompareDescendingU8(const void *a, const void *b);
 
 /** Compare function of psU16 data.
@@ -322,5 +322,5 @@
  *                   than, equal to, or less than the second. 
  */
-int psCompareDescendingU16(const void* a, const void* b);
+int psCompareDescendingU16(const void *a, const void *b);
 
 /** Compare function of psU32 data.
@@ -330,5 +330,5 @@
  *                   than, equal to, or lessg than the second. 
  */
-int psCompareDescendingU32(const void* a, const void* b);
+int psCompareDescendingU32(const void *a, const void *b);
 
 /** Compare function of psU64 data.
@@ -338,5 +338,5 @@
  *                   than, equal to, or lessg than the second. 
  */
-int psCompareDescendingU64(const void* a, const void* b);
+int psCompareDescendingU64(const void *a, const void *b);
 
 /** Compare function of psF32 data.
@@ -346,5 +346,5 @@
  *                   than, equal to, or lessg than the second. 
  */
-int psCompareDescendingF32(const void* a, const void* b);
+int psCompareDescendingF32(const void *a, const void *b);
 
 /** Compare function of psF64 data.
@@ -354,7 +354,5 @@
  *                   than, equal to, or lessg than the second. 
  */
-int psCompareDescendingF64(const void* a, const void* b);
-
-
+int psCompareDescendingF64(const void *a, const void *b);
 
 /// @}
Index: /trunk/psLib/src/math/psMatrix.c
===================================================================
--- /trunk/psLib/src/math/psMatrix.c	(revision 1406)
+++ /trunk/psLib/src/math/psMatrix.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psMatrix.c
  *
@@ -20,6 +21,6 @@
  *  @author Ross Harman, MHPCC
  *   
- *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -27,5 +28,7 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 #include <string.h>
@@ -42,5 +45,7 @@
 
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
@@ -48,5 +53,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -54,5 +61,7 @@
 
 /*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
+
 /*****************************************************************************/
 
@@ -60,5 +69,7 @@
 
 /*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
+
 /*****************************************************************************/
 
@@ -66,5 +77,7 @@
 
 /*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
+
 /*****************************************************************************/
 
@@ -142,8 +155,10 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
-/*****************************************************************************/
-
-psImage *psMatrixLUD(psImage *outImage, psVector *outPerm, psImage *inImage)
+
+/*****************************************************************************/
+
+psImage *psMatrixLUD(psImage * outImage, psVector * outPerm, psImage * inImage)
 {
     int signum = 0;
@@ -169,5 +184,5 @@
     numRows = inImage->numRows;
     numCols = inImage->numCols;
-    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type)*numRows*numCols;
+    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type) * numRows * numCols;
 
     // Initialize GSL data
@@ -190,6 +205,6 @@
 }
 
-psVector *psMatrixLUSolve(psVector *outVector, const psImage *inImage, const psVector *inVector, const
-                          psVector *inPerm)
+psVector *psMatrixLUSolve(psVector * outVector, const psImage * inImage, const psVector * inVector, const
+                          psVector * inPerm)
 {
     int arraySize = 0;
@@ -219,5 +234,5 @@
     numRows = inImage->numRows;
     numCols = inImage->numCols;
-    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type)*numRows*numCols;
+    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type) * numRows * numCols;
 
     // Initialize GSL data
@@ -243,5 +258,5 @@
 }
 
-psImage *psMatrixInvert(psImage *outImage, const psImage *inImage, float *restrict det)
+psImage *psMatrixInvert(psImage * outImage, const psImage * inImage, float *restrict det)
 {
     int signum = 0;
@@ -254,5 +269,5 @@
 
     // Error checks
-    if(det == NULL) {
+    if (det == NULL) {
         psError(__func__, "Invalid operation: determinant argument is NULL.");
         return outImage;
@@ -269,5 +284,5 @@
     numRows = inImage->numRows;
     numCols = inImage->numCols;
-    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type)*numRows*numCols;
+    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type) * numRows * numCols;
 
     // Allocate GSL structs
@@ -297,5 +312,5 @@
 }
 
-float* psMatrixDeterminant(const psImage *restrict inImage)
+float *psMatrixDeterminant(const psImage * restrict inImage)
 {
     int signum = 0;
@@ -315,5 +330,5 @@
     numRows = inImage->numRows;
     numCols = inImage->numCols;
-    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type)*numRows*numCols;
+    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type) * numRows * numCols;
 
     // Allocate GSL structs
@@ -328,5 +343,5 @@
 
     // Calculate determinant
-    det = (float*)psAlloc(sizeof(float));
+    det = (float *)psAlloc(sizeof(float));
     gsl_linalg_LU_decomp(lu, perm, &signum);
     *det = (float)gsl_linalg_LU_det(lu, signum);
@@ -339,5 +354,5 @@
 }
 
-psImage* psMatrixMultiply(psImage *outImage, psImage *inImage1, psImage *inImage2)
+psImage *psMatrixMultiply(psImage * outImage, psImage * inImage1, psImage * inImage2)
 {
     int arraySize = 0;
@@ -364,5 +379,5 @@
     numRows = inImage1->numRows;
     numCols = inImage1->numCols;
-    arraySize = PSELEMTYPE_SIZEOF(outImage->type.type)*numRows*numCols;
+    arraySize = PSELEMTYPE_SIZEOF(outImage->type.type) * numRows * numCols;
 
     // Initialize GSL data
@@ -381,5 +396,5 @@
 }
 
-psImage* psMatrixTranspose(psImage *outImage, const psImage *inImage)
+psImage *psMatrixTranspose(psImage * outImage, const psImage * inImage)
 {
     int arraySize = 0;
@@ -400,5 +415,5 @@
     numRows = inImage->numRows;
     numCols = inImage->numCols;
-    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type)*numRows*numCols;
+    arraySize = PSELEMTYPE_SIZEOF(inImage->type.type) * numRows * numCols;
 
     // Initialize GSL data
@@ -418,5 +433,5 @@
 }
 
-psImage *psMatrixEigenvectors(psImage *outImage, psImage *inImage)
+psImage *psMatrixEigenvectors(psImage * outImage, psImage * inImage)
 {
     int numRows = 0;
@@ -462,5 +477,5 @@
 }
 
-psVector *psMatrixToVector(psVector *outVector, psImage *inImage)
+psVector *psMatrixToVector(psVector * outVector, psImage * inImage)
 {
     int size = 0;
@@ -471,52 +486,49 @@
     PS_CHECK_SIZE_IMAGE(inImage, outVector);
 
-    if(inImage->numRows == 1) {
+    if (inImage->numRows == 1) {
         // Create transposed row vector
         PS_CHECK_ALLOC_VECTOR(outVector, inImage->numCols, inImage->type.type);
         outVector->type.dimen = PS_DIMEN_TRANSV;
-    } else
-        if(inImage->numCols == 1) {
-            // Create non-transposed column vector
-            PS_CHECK_ALLOC_VECTOR(outVector, inImage->numRows, inImage->type.type);
-        } else {
-            psError(__func__, "Image does not have dim with 1 col or 1 row: (%d x %d).", inImage->numRows,
-                    inImage->numCols);
-            return outVector;
-        }
+    } else if (inImage->numCols == 1) {
+        // Create non-transposed column vector
+        PS_CHECK_ALLOC_VECTOR(outVector, inImage->numRows, inImage->type.type);
+    } else {
+        psError(__func__, "Image does not have dim with 1 col or 1 row: (%d x %d).", inImage->numRows,
+                inImage->numCols);
+        return outVector;
+    }
 
     PS_CHECK_NULL_VECTOR(outVector, outVector);
 
-
     // More checks
-    if(outVector->type.dimen == PS_DIMEN_VECTOR) {
+    if (outVector->type.dimen == PS_DIMEN_VECTOR) {
         PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_VECTOR, outVector);
 
-        if(outVector->n == 0) {
+        if (outVector->n == 0) {
             outVector->n = inImage->numRows;
         }
 
-        if(outVector->n != inImage->numRows) {
+        if (outVector->n != inImage->numRows) {
             psError(__func__, "Image and vector sizes differ: (%d vs %d).", inImage->numRows, outVector->n);
             return outVector;
         }
 
-        size = PSELEMTYPE_SIZEOF(inImage->type.type)*inImage->numRows;
-
-    } else
-        if(outVector->type.dimen == PS_DIMEN_TRANSV) {
-            PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_TRANSV, outVector);
-
-            if(outVector->n == 0) {
-                outVector->n = inImage->numCols;
-            }
-
-            if(outVector->n != inImage->numCols) {
-                psError(__func__, "Image and vector sizes differ: (%d vs %d).", inImage->numCols, outVector->n);
-                return outVector;
-            }
-
-            size = PSELEMTYPE_SIZEOF(inImage->type.type)*inImage->numCols;
+        size = PSELEMTYPE_SIZEOF(inImage->type.type) * inImage->numRows;
+
+    } else if (outVector->type.dimen == PS_DIMEN_TRANSV) {
+        PS_CHECK_DIMEN_AND_TYPE(outVector, PS_DIMEN_TRANSV, outVector);
+
+        if (outVector->n == 0) {
+            outVector->n = inImage->numCols;
         }
 
+        if (outVector->n != inImage->numCols) {
+            psError(__func__, "Image and vector sizes differ: (%d vs %d).", inImage->numCols, outVector->n);
+            return outVector;
+        }
+
+        size = PSELEMTYPE_SIZEOF(inImage->type.type) * inImage->numCols;
+    }
+
     memcpy(outVector->data.V, inImage->data.V[0], size);
 
@@ -524,5 +536,5 @@
 }
 
-psImage *psVectorToMatrix(psImage *outImage, psVector *inVector)
+psImage *psVectorToMatrix(psImage * outImage, psVector * inVector)
 {
     int size = 0;
@@ -531,39 +543,34 @@
     PS_CHECK_NULL_VECTOR(inVector, outImage);
 
-    if(inVector->type.dimen == PS_DIMEN_VECTOR) {
+    if (inVector->type.dimen == PS_DIMEN_VECTOR) {
         PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_VECTOR, outImage);
         PS_CHECK_SIZE_VECTOR(inVector, outImage);
         PS_CHECK_ALLOC_IMAGE(outImage, 1, inVector->n, PS_TYPE_F64)
-
         // More checks for PS_DIMEN_VECTOR
-        if(outImage->numCols > 1) {
+        if (outImage->numCols > 1) {
             psError(__func__, "Image has more than 1 column: numCols = %d.", outImage->numCols);
             return outImage;
-        } else
-            if(outImage->numRows != inVector->n) {
-                psError(__func__, "Image and vector sizes differ: (%d vs %d).", outImage->numRows, inVector->n);
-                return outImage;
-            }
-
-        size = PSELEMTYPE_SIZEOF(outImage->type.type)*outImage->numRows;
-
-    } else
-        if(inVector->type.dimen == PS_DIMEN_TRANSV) {
-            PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_TRANSV, outImage);
-            PS_CHECK_SIZE_VECTOR(inVector, outImage);
-            PS_CHECK_ALLOC_IMAGE(outImage, inVector->n, 1, PS_TYPE_F64)
-
-            // More checks for PS_DIMEN_TRANSV
-            if(outImage->numRows > 1) {
-                psError(__func__, "Image has more than 1 row: numRows = %d.", outImage->numRows);
-                return outImage;
-            } else
-                if(outImage->numCols != inVector->n) {
-                    psError(__func__, "Image and vector sizes differ: (%d vs %d).", outImage->numCols, inVector->n);
-                    return outImage;
-                }
-
-            size = PSELEMTYPE_SIZEOF(outImage->type.type)*outImage->numCols;
+        } else if (outImage->numRows != inVector->n) {
+            psError(__func__, "Image and vector sizes differ: (%d vs %d).", outImage->numRows, inVector->n);
+            return outImage;
         }
+
+        size = PSELEMTYPE_SIZEOF(outImage->type.type) * outImage->numRows;
+
+    } else if (inVector->type.dimen == PS_DIMEN_TRANSV) {
+        PS_CHECK_DIMEN_AND_TYPE(inVector, PS_DIMEN_TRANSV, outImage);
+        PS_CHECK_SIZE_VECTOR(inVector, outImage);
+        PS_CHECK_ALLOC_IMAGE(outImage, inVector->n, 1, PS_TYPE_F64)
+        // More checks for PS_DIMEN_TRANSV
+        if (outImage->numRows > 1) {
+            psError(__func__, "Image has more than 1 row: numRows = %d.", outImage->numRows);
+            return outImage;
+        } else if (outImage->numCols != inVector->n) {
+            psError(__func__, "Image and vector sizes differ: (%d vs %d).", outImage->numCols, inVector->n);
+            return outImage;
+        }
+
+        size = PSELEMTYPE_SIZEOF(outImage->type.type) * outImage->numCols;
+    }
 
     PS_CHECK_NULL_IMAGE(outImage, outImage);
@@ -574,3 +581,2 @@
     return outImage;
 }
-
Index: /trunk/psLib/src/math/psMatrix.h
===================================================================
--- /trunk/psLib/src/math/psMatrix.h	(revision 1406)
+++ /trunk/psLib/src/math/psMatrix.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psMatrix.h
  *
@@ -21,6 +22,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-10 01:58:06 $
+ *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -28,5 +29,5 @@
 
 #ifndef PSMATRIX_H
-#define PSMATRIX_H
+#    define PSMATRIX_H
 
 /// @addtogroup Matrix
@@ -42,9 +43,8 @@
  *  @return  psImage*: Pointer to LU decomposed psImage.
  */
-psImage *psMatrixLUD(
-    psImage *outImage,  ///< Image to return, or NULL.
-    psVector *outPerm,  ///< Output permutation vector used by psMatrixLUSolve.
-    psImage *inImage    ///< Image to decompose.
-);
+psImage *psMatrixLUD(psImage * outImage,        // /< Image to return, or NULL.
+                     psVector * outPerm,        // /< Output permutation vector used by psMatrixLUSolve.
+                     psImage * inImage  // /< Image to decompose.
+                    );
 
 /** LU Solution of psImage matrix.
@@ -57,10 +57,10 @@
  *  @return  psVector*: Pointer to psVector solution of matrix equation.
  */
-psVector *psMatrixLUSolve(
-    psVector *outVector,        ///< Vector to return, or NULL.
-    const psImage *luImage,     ///< LU-decomposed matrix.
-    const psVector *inVector,   ///< Vector right-hand-side of equation.
-    const psVector *inPerm      ///< Permutation vector resulting from psMatrixLUD function.
-);
+psVector *psMatrixLUSolve(psVector * outVector, // /< Vector to return, or NULL.
+                          const psImage * luImage,      // /< LU-decomposed matrix.
+                          const psVector * inVector,    // /< Vector right-hand-side of equation.
+                          const psVector * inPerm       // /< Permutation vector resulting from psMatrixLUD
+                          // function.
+                         );
 
 /** Invert psImage matrix.
@@ -73,9 +73,8 @@
  *  @return  psImage*: Pointer to inverted psImage.
  */
-psImage *psMatrixInvert(
-    psImage *outImage,      ///< Image to return, or NULL for in-place substitution.
-    const psImage *inImage, ///< Image to be inverted
-    float *restrict det     ///< Determinant to return, or NULL
-);
+psImage *psMatrixInvert(psImage * outImage,     // /< Image to return, or NULL for in-place substitution.
+                        const psImage * inImage,        // /< Image to be inverted
+                        float *restrict det     // /< Determinant to return, or NULL
+                       );
 
 /** Calculate psImage matrix determinant.
@@ -87,7 +86,6 @@
  *  @return  float: Determinant from psImage.
  */
-float* psMatrixDeterminant(
-    const psImage *restrict inMatrix    ///< Image used to calculate determinant.
-);
+float *psMatrixDeterminant(const psImage * restrict inMatrix    // /< Image used to calculate determinant.
+                          );
 
 /** Performs psImage matrix multiplication.
@@ -100,9 +98,8 @@
  *  @return  psImage*: Pointer to resulting psImage.
  */
-psImage *psMatrixMultiply(
-    psImage *outImage,  ///< Matrix to return, or NULL.
-    psImage *inImage1,  ///< First input image.
-    psImage *inImage2   ///< Second input image.
-);
+psImage *psMatrixMultiply(psImage * outImage,   // /< Matrix to return, or NULL.
+                          psImage * inImage1,   // /< First input image.
+                          psImage * inImage2    // /< Second input image.
+                         );
 
 /** Transpose matrix.
@@ -115,8 +112,7 @@
  *  @return  psImage*: Pointer to transposed psImage.
  */
-psImage *psMatrixTranspose(
-    psImage *outImage,      ///< Image to return, or NULL
-    const psImage *inImage  ///< Image to transpose
-);
+psImage *psMatrixTranspose(psImage * outImage,  // /< Image to return, or NULL
+                           const psImage * inImage      // /< Image to transpose
+                          );
 
 /** Calculate matrix eigenvectors.
@@ -128,8 +124,7 @@
  *  @return  psImage*: Pointer to matrix of Eigenvectors.
  */
-psImage *psMatrixEigenvectors(
-    psImage *outImage,  ///< Eigenvectors to return, or NULL.
-    psImage *inImage    ///< Input image.
-);
+psImage *psMatrixEigenvectors(psImage * outImage,       // /< Eigenvectors to return, or NULL.
+                              psImage * inImage // /< Input image.
+                             );
 
 /** Convert matrix to vector.
@@ -142,8 +137,7 @@
  *  @return  psVector*: Pointer to psVector.
  */
-psVector *psMatrixToVector(
-    psVector *outVector,    ///< Vector to return, or NULL.
-    psImage *inImage        ///< Image to convert.
-);
+psVector *psMatrixToVector(psVector * outVector,        // /< Vector to return, or NULL.
+                           psImage * inImage    // /< Image to convert.
+                          );
 
 /** Convert vector to matrix.
@@ -156,8 +150,7 @@
  *  @return  psVector*: Pointer to psIamge.
  */
-psImage *psVectorToMatrix(
-    psImage *outImage,  ///< Matrix to return, or NULL.
-    psVector *inVector  ///< Vector to convert.
-);
+psImage *psVectorToMatrix(psImage * outImage,   // /< Matrix to return, or NULL.
+                          psVector * inVector   // /< Vector to convert.
+                         );
 
 /// @}
Index: /trunk/psLib/src/math/psMinimize.c
===================================================================
--- /trunk/psLib/src/math/psMinimize.c	(revision 1406)
+++ /trunk/psLib/src/math/psMinimize.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psMinimize.c
  *  \brief basic minimization functions
@@ -9,11 +10,14 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
-/*****************************************************************************/
+
+/*****************************************************************************/
+
 /* INCLUDE FILES                                                             */
+
 /*****************************************************************************/
 #include <stdlib.h>
@@ -40,6 +44,9 @@
 #include "psMinimize.h"
 #include "psMatrix.h"
-/*****************************************************************************/
+
+/*****************************************************************************/
+
 /* DEFINE STATEMENTS                                                         */
+
 /*****************************************************************************/
 #define MAX_LMM_ITERATIONS 100
@@ -83,16 +90,17 @@
 }
 
-
-/*****************************************************************************/
+/*****************************************************************************/
+
 /* TYPE DEFINITIONS                                                          */
+
 /*****************************************************************************/
 typedef struct
 {
-    size_t n;   // Number of data points points in domain.
-    int paramCount;   // Number of non-masked parameters.
-    psVector *restrict       initialGuess;
-    const psImage *restrict  domain;
+    size_t n;                   // Number of data points points in domain.
+    int paramCount;             // Number of non-masked parameters.
+    psVector *restrict initialGuess;
+    const psImage *restrict domain;
     const psVector *restrict data;
-    const psVector *restrict  errors;
+    const psVector *restrict errors;
     const psVector *restrict paramMask;
     float (*evalModel) (const psVector *, const psVector *);
@@ -103,7 +111,7 @@
 typedef struct
 {
-    int paramCount;   // Number of non-masked parameters.
-    psVector *restrict       initialGuess;
-    const psVector *restrict  coord;
+    int paramCount;             // Number of non-masked parameters.
+    psVector *restrict initialGuess;
+    const psVector *restrict coord;
     const psVector *restrict paramMask;
     float (*evalModel) (const psVector *, const psVector *);
@@ -113,5 +121,7 @@
 
 /*****************************************************************************/
+
 /* GLOBAL VARIABLES                                                          */
+
 /*****************************************************************************/
 
@@ -119,5 +129,7 @@
 
 /*****************************************************************************/
+
 /* FILE STATIC VARIABLES                                                     */
+
 /*****************************************************************************/
 
@@ -125,5 +137,7 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - LOCAL                                           */
+
 /*****************************************************************************/
 
@@ -143,15 +157,13 @@
  guess at the parameters, an option parameter mask, etc.
  *****************************************************************************/
-double p_psMinFunc(const gsl_vector *params,
-                   void *funcData)
-{
-    int i;    // Loop index variable.
-    int j;    // Loop index variable.
-    float tmpf;    // Temporary floating point variable.
-    const psVector *restrict coord   = ((psMinimizeData *) funcData)->coord;
-    const psVector *restrict mask     = ((psMinimizeData *) funcData)->paramMask;
-    psVector *restrict initialGuess = ((psMinimizeData *)funcData)->initialGuess;
-    float (*evalModel)(const psVector *, const psVector *) =
-        ((psMinimizeData *) funcData)->evalModel;
+double p_psMinFunc(const gsl_vector * params, void *funcData)
+{
+    int i;                      // Loop index variable.
+    int j;                      // Loop index variable.
+    float tmpf;                 // Temporary floating point variable.
+    const psVector *restrict coord = ((psMinimizeData *) funcData)->coord;
+    const psVector *restrict mask = ((psMinimizeData *) funcData)->paramMask;
+    psVector *restrict initialGuess = ((psMinimizeData *) funcData)->initialGuess;
+    float (*evalModel) (const psVector *, const psVector *) = ((psMinimizeData *) funcData)->evalModel;
     psVector *inputParameterList = NULL;
 
@@ -163,5 +175,5 @@
     if (mask != NULL) {
         j = 0;
-        for (i=0;i<mask->n;i++) {
+        for (i = 0; i < mask->n; i++) {
             if (mask->data.U8[i] != 0) {
                 inputParameterList->data.F32[i] = initialGuess->data.F32[i];
@@ -171,5 +183,5 @@
         }
     } else {
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             inputParameterList->data.F32[i] = gsl_vector_get(params, i);
         }
@@ -181,5 +193,5 @@
     // Free allocated memory and return the value of the function.
     psFree(inputParameterList);
-    return(tmpf);
+    return (tmpf);
 }
 
@@ -199,15 +211,13 @@
  in "params" and return those derivatives in this psVector.
  *****************************************************************************/
-void p_psMinFuncDeriv(const gsl_vector *params,
-                      void *funcData,
-                      gsl_vector *df)
-{
-    int i;    // Loop index variable.
-    int j;    // Loop index variable.
-    float tmpf;    // Temporary floating point variable.
-    const psVector *restrict coord   = ((psMinimizeData *) funcData)->coord;
-    const psVector *restrict mask     = ((psMinimizeData *) funcData)->paramMask;
-    psVector *restrict initialGuess = ((psMinimizeData *)funcData)->initialGuess;
-    float (*d_evalModel)(const psVector *, const psVector *, int) =
+void p_psMinFuncDeriv(const gsl_vector * params, void *funcData, gsl_vector * df)
+{
+    int i;                      // Loop index variable.
+    int j;                      // Loop index variable.
+    float tmpf;                 // Temporary floating point variable.
+    const psVector *restrict coord = ((psMinimizeData *) funcData)->coord;
+    const psVector *restrict mask = ((psMinimizeData *) funcData)->paramMask;
+    psVector *restrict initialGuess = ((psMinimizeData *) funcData)->initialGuess;
+    float (*d_evalModel) (const psVector *, const psVector *, int) =
         ((psMinimizeData *) funcData)->d_evalModel;
     psVector *inputParameterList = NULL;
@@ -220,5 +230,5 @@
     if (mask != NULL) {
         j = 0;
-        for (i=0;i<mask->n;i++) {
+        for (i = 0; i < mask->n; i++) {
             if (mask->data.U8[i] != 0) {
                 inputParameterList->data.F32[i] = initialGuess->data.F32[i];
@@ -228,5 +238,5 @@
         }
     } else {
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             inputParameterList->data.F32[i] = gsl_vector_get(params, i);
         }
@@ -235,5 +245,5 @@
     // Evaluate the derivative w.r.t. each parameter.
     // NOTE: we can probably remove the calls for masked parameters.
-    for (i=0;i<initialGuess->n;i++) {
+    for (i = 0; i < initialGuess->n; i++) {
         tmpf = d_evalModel(inputParameterList, coord, i);
         gsl_vector_set(df, i, tmpf);
@@ -247,8 +257,5 @@
     Compute both p_psMinFunc and p_psMinFuncDeriv together.
  *****************************************************************************/
-void p_psMinFuncFuncDeriv(const gsl_vector *params,
-                          void *funcData,
-                          double *f,
-                          gsl_vector *df)
+void p_psMinFuncFuncDeriv(const gsl_vector * params, void *funcData, double *f, gsl_vector * df)
 {
     *f = p_psMinFunc(params, funcData);
@@ -281,17 +288,15 @@
   expected value and divide by the error.
  *****************************************************************************/
-int p_psMinChi2Func(const gsl_vector *params,
-                    void *funcData,
-                    gsl_vector *outData)
-{
-    int i;    // Loop index variable.
-    int j;    // Loop index variable.
-    float tmpf;    // Temporary floating point variable.
-    const psImage *restrict  domain   = ((psMinChi2Data *)funcData)->domain;
-    const psVector *restrict data     = ((psMinChi2Data *)funcData)->data;
-    const psVector *restrict errors   = ((psMinChi2Data *) funcData)->errors;
-    const psVector *restrict mask     = ((psMinChi2Data *) funcData)->paramMask;
-    psVector *restrict initialGuess = ((psMinChi2Data *)funcData)->initialGuess;
-    float (*evalModel)(const psVector *, const psVector *) = ((psMinChi2Data *) funcData)->evalModel;
+int p_psMinChi2Func(const gsl_vector * params, void *funcData, gsl_vector * outData)
+{
+    int i;                      // Loop index variable.
+    int j;                      // Loop index variable.
+    float tmpf;                 // Temporary floating point variable.
+    const psImage *restrict domain = ((psMinChi2Data *) funcData)->domain;
+    const psVector *restrict data = ((psMinChi2Data *) funcData)->data;
+    const psVector *restrict errors = ((psMinChi2Data *) funcData)->errors;
+    const psVector *restrict mask = ((psMinChi2Data *) funcData)->paramMask;
+    psVector *restrict initialGuess = ((psMinChi2Data *) funcData)->initialGuess;
+    float (*evalModel) (const psVector *, const psVector *) = ((psMinChi2Data *) funcData)->evalModel;
     psVector *inputParameterList = NULL;
     psVector *tmpVecPtr = NULL;
@@ -307,5 +312,5 @@
     if (mask != NULL) {
         j = 0;
-        for (i=0;i<mask->n;i++) {
+        for (i = 0; i < mask->n; i++) {
             if (mask->data.U8[i] != 0) {
                 inputParameterList->data.F32[i] = initialGuess->data.F32[i];
@@ -315,5 +320,5 @@
         }
     } else {
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             inputParameterList->data.F32[i] = gsl_vector_get(params, i);
         }
@@ -321,12 +326,11 @@
 
     // Evaluate the function at each data point.
-    for (i=0;i<domain->numRows;i++) {
-        for (j=0;j<domain->numCols;j++) {
+    for (i = 0; i < domain->numRows; i++) {
+        for (j = 0; j < domain->numCols; j++) {
             tmpVecPtr->data.F32[j] = domain->data.F32[i][j];
         }
         tmpf = evalModel(tmpVecPtr, inputParameterList);
 
-        gsl_vector_set(outData, i, (tmpf - data->data.F32[i])/
-                       errors->data.F32[i]);
+        gsl_vector_set(outData, i, (tmpf - data->data.F32[i]) / errors->data.F32[i]);
     }
 
@@ -354,15 +358,14 @@
  and returned in this data structure.
  *****************************************************************************/
-int p_psMinChi2FuncDeriv(const gsl_vector *params,
-                         void *funcData,
-                         gsl_matrix *J)
-{
-    const psImage *restrict domain   = ((psMinChi2Data *)funcData)->domain;
-    const psVector *restrict errors   = ((psMinChi2Data *) funcData)->errors;
-    const psVector *restrict mask     = ((psMinChi2Data *) funcData)->paramMask;
-    psVector *restrict initialGuess = ((psMinChi2Data *)funcData)->initialGuess;
+int p_psMinChi2FuncDeriv(const gsl_vector * params, void *funcData, gsl_matrix * J)
+{
+    const psImage *restrict domain = ((psMinChi2Data *) funcData)->domain;
+    const psVector *restrict errors = ((psMinChi2Data *) funcData)->errors;
+    const psVector *restrict mask = ((psMinChi2Data *) funcData)->paramMask;
+    psVector *restrict initialGuess = ((psMinChi2Data *) funcData)->initialGuess;
     psVector *inputParameterList = NULL;
     psVector *tmpVecPtr = NULL;
-    float (*d_evalModel)(const psVector *, const psVector *, int) = ((psMinChi2Data *) funcData)->d_evalModel;
+    float (*d_evalModel) (const psVector *, const psVector *, int) =
+        ((psMinChi2Data *) funcData)->d_evalModel;
 
     size_t i;
@@ -380,5 +383,5 @@
     if (mask != NULL) {
         j = 0;
-        for (i=0;i<mask->n;i++) {
+        for (i = 0; i < mask->n; i++) {
             if (mask->data.U8[i] != 0) {
                 inputParameterList->data.F32[i] = initialGuess->data.F32[i];
@@ -388,5 +391,5 @@
         }
     } else {
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             inputParameterList->data.F32[i] = gsl_vector_get(params, i);
         }
@@ -394,12 +397,12 @@
 
     // Evaluate the derivtaive at each data point, and w.r.t. each parameter.
-    for (i=0;i<domain->numRows;i++) {
-        for (j=0;j<tmpVecPtr->n;j++) {
+    for (i = 0; i < domain->numRows; i++) {
+        for (j = 0; j < tmpVecPtr->n; j++) {
             tmpVecPtr->data.F32[j] = domain->data.F32[i][j];
         }
 
-        for (j=0;j<inputParameterList->n;j++) {
+        for (j = 0; j < inputParameterList->n; j++) {
             tmpf = d_evalModel(tmpVecPtr, inputParameterList, j);
-            gsl_matrix_set(J, i, j, (tmpf/errors->data.F32[i]));
+            gsl_matrix_set(J, i, j, (tmpf / errors->data.F32[i]));
         }
     }
@@ -410,9 +413,5 @@
 }
 
-
-int p_psMinChi2FuncFuncDeriv(const gsl_vector *params,
-                             void *funcData,
-                             gsl_vector *f,
-                             gsl_matrix *J)
+int p_psMinChi2FuncFuncDeriv(const gsl_vector * params, void *funcData, gsl_vector * f, gsl_matrix * J)
 {
     p_psMinChi2Func(params, funcData, f);
@@ -421,5 +420,4 @@
     return GSL_SUCCESS;
 }
-
 
 /******************************************************************************
@@ -428,18 +426,15 @@
 returned as a psVector sums.
  *****************************************************************************/
-void p_psBuildSums1D(double x,
-                     int polyOrder,
-                     psVector *sums)
-{
-    int       i = 0;
-    double    xSum = 0.0;
+void p_psBuildSums1D(double x, int polyOrder, psVector * sums)
+{
+    int i = 0;
+    double xSum = 0.0;
 
     xSum = 1.0;
-    for(i=0;i<=polyOrder;i++) {
+    for (i = 0; i <= polyOrder; i++) {
         sums->data.F64[i] = xSum;
-        xSum*= x;
-    }
-}
-
+        xSum *= x;
+    }
+}
 
 /******************************************************************************
@@ -448,17 +443,15 @@
  *****************************************************************************/
 psVector *psBuildImageScalingFactors(int x)
-
 {
     int i = 0;                  // loop index variable.
     psVector *imageScalingFactors = NULL;
 
-
     imageScalingFactors = psVectorAlloc(x, PS_TYPE_F32);
 
-    for (i=0;i<x;i++) {
-        imageScalingFactors->data.F32[i] = (((float) 2*i) / ((float) x)) - 1.0;
-    }
-
-    return(imageScalingFactors);
+    for (i = 0; i < x; i++) {
+        imageScalingFactors->data.F32[i] = (((float)2 * i) / ((float)x)) - 1.0;
+    }
+
+    return (imageScalingFactors);
 }
 
@@ -481,41 +474,39 @@
     *flag   Set this to 1 if we must recalculate the coefficients.
  *****************************************************************************/
-void p_psPolyOrderCheck(float **A,
-                        int N,
-                        int *indx,
-                        float *B,
-                        int polyOrder,
-                        int *flag)
-{
-    float     **y = NULL;  // This 2-D matrix will hold A^-1
-    float      *col = NULL;             // misc NumerRecipes data structure
-    float      *error=NULL;             // will hold the sqrt() of the
+void p_psPolyOrderCheck(float **A, int N, int *indx, float *B, int polyOrder, int *flag)
+{
+    float **y = NULL;           // This 2-D matrix will hold A^-1
+    float *col = NULL;          // misc NumerRecipes data structure
+    float *error = NULL;        // will hold the sqrt() of the
+
     // diagonal of y[][].
-    int         i=0;                    // loop-index variable
-    int         j=0;                    // loop-index variable
-    int         numPolyTerms = 0;       // The number of terms in the
+    int i = 0;                  // loop-index variable
+    int j = 0;                  // loop-index variable
+    int numPolyTerms = 0;       // The number of terms in the
+
     // polynomial.
-    int         lastTerm = 0;           // The index location of the first
+    int lastTerm = 0;           // The index location of the first
+
     // n-th order term in array B[].
-    int         firstTerm = 0;          // Index location of last such term.
+    int firstTerm = 0;          // Index location of last such term.
 
     // Allocate the necessary data structures for this procedure...
-    error = (float *) psAlloc((N + 1) * sizeof(float));
-    col = (float *) psAlloc((N + 1) * sizeof(float));
-    y = (float **) psAlloc((N + 1) * sizeof(float *));
-    for(i=1;i<=N;i++) {
-        y[i] = (float *) psAlloc((N + 1) * sizeof(float));
+    error = (float *)psAlloc((N + 1) * sizeof(float));
+    col = (float *)psAlloc((N + 1) * sizeof(float));
+    y = (float **)psAlloc((N + 1) * sizeof(float *));
+    for (i = 1; i <= N; i++) {
+        y[i] = (float *)psAlloc((N + 1) * sizeof(float));
     }
 
     // Invert the matrix A and put the result in y[][].  This code is taken
     // from Numerical Recipes in C page 48.
-    for(j=1;j<=N;j++) {
-        for(i=1;i<=N;i++) {
+    for (j = 1; j <= N; j++) {
+        for (i = 1; i <= N; i++) {
             col[i] = 0.0;
         }
         col[j] = 1.0;
         // NOTE: substitue the LUD rotine
-        //        lubksb(A, N, indx, col);
-        for(i=1;i<=N;i++) {
+        // lubksb(A, N, indx, col);
+        for (i = 1; i <= N; i++) {
             y[i][j] = col[i];
         }
@@ -527,9 +518,9 @@
     // terms and check if they are consistent with zero.
 
-    numPolyTerms = (((polyOrder+1) * (polyOrder + 2)) / 2);
+    numPolyTerms = (((polyOrder + 1) * (polyOrder + 2)) / 2);
     lastTerm = numPolyTerms + 1;
     firstTerm = lastTerm - polyOrder;
     *flag = 1;
-    for (i=firstTerm; i<=lastTerm; i++) {
+    for (i = firstTerm; i <= lastTerm; i++) {
         #ifdef DARWIN
         error[i] = (float)sqrt(y[i][i]);
@@ -539,6 +530,5 @@
         #endif
 
-        if (!((B[i]  <= (2.0f * error[i])) &&
-                ((-2.0f * error[i]) <= B[i]))) {
+        if (!((B[i] <= (2.0f * error[i])) && ((-2.0f * error[i]) <= B[i]))) {
             *flag = 0;
         }
@@ -548,5 +538,5 @@
     psFree(error);
     psFree(col);
-    for(j=1;j<=N;j++) {
+    for (j = 1; j <= N; j++) {
         psFree(y[j]);
     }
@@ -554,12 +544,9 @@
 }
 
-
-
-
-/*****************************************************************************/
+/*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
-/*****************************************************************************/
-
-
+
+/*****************************************************************************/
 
 /******************************************************************************
@@ -569,10 +556,8 @@
 parameters of that function such that the ...
  *****************************************************************************/
-psVector *
-psMinimize(psVector *restrict initialGuess,
-           float (*myFunction)(const psVector *restrict, const psVector *restrict),
-           float (*myFunctionDeriv)(const psVector *restrict, const psVector *restrict, int),
-           const psVector *restrict coord,
-           const psVector *restrict paramMask)
+psVector *psMinimize(psVector * restrict initialGuess,
+                     float (*myFunction) (const psVector * restrict, const psVector * restrict),
+                     float (*myFunctionDeriv) (const psVector * restrict, const psVector * restrict, int),
+                     const psVector * restrict coord, const psVector * restrict paramMask)
 {
     int status;
@@ -607,5 +592,5 @@
     // for the parameters.
     if (paramMask != NULL) {
-        for (i=0;i<paramMask->n;i++) {
+        for (i = 0; i < paramMask->n; i++) {
             if (paramMask->data.U8[i] != 0) {
                 inputData.paramCount++;
@@ -613,5 +598,5 @@
         }
     } else {
-        inputData.paramCount= initialGuess->n;
+        inputData.paramCount = initialGuess->n;
     }
 
@@ -622,5 +607,5 @@
     if (paramMask != NULL) {
         j = 0;
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             if (paramMask->data.U8[i] == 0) {
                 gsl_vector_set(x, j++, initialGuess->data.F32[i]);
@@ -628,5 +613,5 @@
         }
     } else {
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             gsl_vector_set(x, i, initialGuess->data.F32[i]);
         }
@@ -651,5 +636,5 @@
 
         if (status == GSL_SUCCESS)
-            printf ("Minimum found at:\n");
+            printf("Minimum found at:\n");
 
     } while (status == GSL_CONTINUE && iter < MAX_MINIMIZE_ITERATIONS);
@@ -660,5 +645,5 @@
     if (paramMask != NULL) {
         j = 0;
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             if (paramMask->data.U8[i] == 0) {
                 initialGuess->data.F32[i] = gsl_vector_get(s->x, j++);
@@ -668,15 +653,10 @@
         }
     } else {
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             initialGuess->data.F32[i] = gsl_vector_get(s->x, i);
         }
     }
-    return(initialGuess);
-}
-
-
-
-
-
+    return (initialGuess);
+}
 
 /******************************************************************************
@@ -684,28 +664,28 @@
     such that they best fit the supplied data points.
  *****************************************************************************/
-psVector *
-psMinimizeChi2(float (*evalModel)(const psVector *restrict, const psVector *restrict),
-               float (*DevalModel)(const psVector *restrict, const psVector *restrict, int),
-               const psImage *restrict domain,
-               const psVector *restrict data,
-               const psVector *restrict errors,
-               psVector *restrict initialGuess,
-               const psVector *restrict paramMask,
-               float *chiSq)
-{
-    int numData = domain->numRows; // Number of data points
-    int status;    // Return status for the GSL solver.
-    int i = 0;    // Loop index variable.
-    int j = 0;    // Loop index variable.
-    int iter = 0;   // Iteration counter.
-    gsl_multifit_function_fdf f; // GSL structure that contains the
+psVector *psMinimizeChi2(float (*evalModel) (const psVector * restrict, const psVector * restrict),
+                         float (*DevalModel) (const psVector * restrict, const psVector * restrict, int),
+                         const psImage * restrict domain,
+                         const psVector * restrict data,
+                         const psVector * restrict errors,
+                         psVector * restrict initialGuess, const psVector * restrict paramMask, float *chiSq)
+{
+    int numData = domain->numRows;      // Number of data points
+    int status;                 // Return status for the GSL solver.
+    int i = 0;                  // Loop index variable.
+    int j = 0;                  // Loop index variable.
+    int iter = 0;               // Iteration counter.
+    gsl_multifit_function_fdf f;        // GSL structure that contains the
+
     // functions/derivative to be solved.
-    double *xInit = NULL;        // The initial guess at the parameters
+    double *xInit = NULL;       // The initial guess at the parameters
+
     // with masked parameters removed.
     const gsl_multifit_fdfsolver_type *T;
+
     // This tells GSL to use the Levenberg-
     // Marquardt algorithm for chi2
     // minimization.
-    gsl_multifit_fdfsolver *s; // GSL data structure.
+    gsl_multifit_fdfsolver *s;  // GSL data structure.
     psMinChi2Data inputData;
     float chiSqOld = 0.0;
@@ -721,5 +701,5 @@
     PS_CHECK_VECTOR_SIZE_EQUAL(data, errors);
     if (domain->numRows != data->n) {
-        psAbort(__func__,"Number of data points and data values not equal.");
+        psAbort(__func__, "Number of data points and data values not equal.");
     }
     if (paramMask != NULL) {
@@ -743,5 +723,5 @@
     // for the parameters.
     if (paramMask != NULL) {
-        for (i=0;i<paramMask->n;i++) {
+        for (i = 0; i < paramMask->n; i++) {
             if (paramMask->data.U8[i] != 0) {
                 inputData.paramCount++;
@@ -749,5 +729,5 @@
         }
     } else {
-        inputData.paramCount= initialGuess->n;
+        inputData.paramCount = initialGuess->n;
     }
 
@@ -755,8 +735,8 @@
     // the vector inputParameterList.  If the paramMask is not NULL, then those
     // parameters are masked out.
-    xInit = (double *) psAlloc(inputData.paramCount * sizeof(double));
+    xInit = (double *)psAlloc(inputData.paramCount * sizeof(double));
     if (paramMask != NULL) {
         j = 0;
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             if (paramMask->data.U8[i] == 0) {
                 xInit[j++] = initialGuess->data.F32[i];
@@ -764,5 +744,5 @@
         }
     } else {
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             xInit[i] = initialGuess->data.F32[i];
         }
@@ -771,4 +751,5 @@
     const gsl_rng_type *type;
     gsl_rng *r;
+
     gsl_rng_env_setup();
 
@@ -789,4 +770,5 @@
 
     gsl_vector_view x = gsl_vector_view_array(xInit, inputData.paramCount);
+
     T = gsl_multifit_fdfsolver_lmsder;
     s = gsl_multifit_fdfsolver_alloc(T, numData, inputData.paramCount);
@@ -796,5 +778,5 @@
     do {
         iter++;
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             printf("Iteration %d: parameter %d is %.3f\n", iter, i, gsl_vector_get(s->x, i));
         }
@@ -802,5 +784,5 @@
         status = gsl_multifit_fdfsolver_iterate(s);
         printf("gsl_multifit_fdfsolver_iterate() status is %s\n", gsl_strerror(status));
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             printf("Iteration %d: parameter %d is %.3f\n", iter, i, gsl_vector_get(s->x, i));
         }
@@ -810,9 +792,8 @@
             psAbort(__func__, "gsl_multifit_fdfsolver_iterate(%s)\n", gsl_strerror(status));
         }
-
         // Test if the parameters changed by a small enough amount.
         // NOTE: This wasn't working right when the parameters fit exactly.
         // Figure out why.
-        //        status = gsl_multifit_test_delta(s->dx, s->x, 1e-4, 1e-4);
+        // status = gsl_multifit_test_delta(s->dx, s->x, 1e-4, 1e-4);
 
         // We test for convergence if chiSquared changes by less than 1.0
@@ -829,5 +810,4 @@
     } while (status == GSL_CONTINUE && iter < MAX_LMM_ITERATIONS);
 
-
     // In the above steps we had removed the masked elements from the
     // the solver.  This next code blocks puts those masked elements
@@ -835,5 +815,5 @@
     if (paramMask != NULL) {
         j = 0;
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             if (paramMask->data.U8[i] == 0) {
                 initialGuess->data.F32[i] = gsl_vector_get(s->x, j++);
@@ -843,5 +823,5 @@
         }
     } else {
-        for (i=0;i<initialGuess->n;i++) {
+        for (i = 0; i < initialGuess->n; i++) {
             initialGuess->data.F32[i] = gsl_vector_get(s->x, i);
         }
@@ -857,7 +837,6 @@
 
     // Bye bye.
-    return(initialGuess);
-}
-
+    return (initialGuess);
+}
 
 /******************************************************************************
@@ -868,9 +847,7 @@
 NOTE: yErr is currently ignored.
  *****************************************************************************/
-psPolynomial1D *
-psVectorFitPolynomial1D(psPolynomial1D *myPoly,
-                        const psVector *restrict x,
-                        const psVector *restrict y,
-                        const psVector *restrict yErr)
+psPolynomial1D *psVectorFitPolynomial1D(psPolynomial1D * myPoly,
+                                        const psVector * restrict x,
+                                        const psVector * restrict y, const psVector * restrict yErr)
 {
     int polyOrder = myPoly->n;
@@ -879,5 +856,5 @@
     psVector *B = NULL;
     psVector *outPerm = NULL;
-    psVector *X = NULL;   // NOTE: do we need this?
+    psVector *X = NULL;         // NOTE: do we need this?
     psVector *coeffs = NULL;
     int i = 0;
@@ -886,8 +863,8 @@
     psVector *xSums = NULL;
 
-    //    printf("psVectorFitPolynomial1D()\n");
-    //    for (i=0;i<x->n;i++) {
-    //        printf("(x, y, yErr) is (%f, %f, %f)\n", x->data.F64[i], y->data.F64[i], yErr->data.F64[i]);
-    //    }
+    // printf("psVectorFitPolynomial1D()\n");
+    // for (i=0;i<x->n;i++) {
+    // printf("(x, y, yErr) is (%f, %f, %f)\n", x->data.F64[i], y->data.F64[i], yErr->data.F64[i]);
+    // }
 
     PS_CHECK_NULL_1DPOLY(myPoly);
@@ -901,37 +878,37 @@
     PS_CHECK_VECTOR_SIZE_EQUAL(y, yErr);
 
-    A       = psImageAlloc(polyOrder, polyOrder, PS_TYPE_F64);
-    ALUD    = psImageAlloc(polyOrder, polyOrder, PS_TYPE_F64);
-    B       = psVectorAlloc(polyOrder, PS_TYPE_F64);
-    coeffs  = psVectorAlloc(polyOrder, PS_TYPE_F64);
-    X       = psVectorAlloc(x->n, PS_TYPE_F64);
+    A = psImageAlloc(polyOrder, polyOrder, PS_TYPE_F64);
+    ALUD = psImageAlloc(polyOrder, polyOrder, PS_TYPE_F64);
+    B = psVectorAlloc(polyOrder, PS_TYPE_F64);
+    coeffs = psVectorAlloc(polyOrder, PS_TYPE_F64);
+    X = psVectorAlloc(x->n, PS_TYPE_F64);
     outPerm = psVectorAlloc(polyOrder, PS_TYPE_F64);
-    xSums   = psVectorAlloc(1+2*polyOrder, PS_TYPE_F64);
+    xSums = psVectorAlloc(1 + 2 * polyOrder, PS_TYPE_F64);
 
     // Initialize data structures.
-    for(i=0;i<(polyOrder);i++) {
+    for (i = 0; i < (polyOrder); i++) {
         B->data.F64[i] = 0.0;
         coeffs->data.F64[i] = 0.0;
         outPerm->data.F64[i] = 0.0;
-        for(j=0;j<(polyOrder);j++) {
+        for (j = 0; j < (polyOrder); j++) {
             A->data.F64[i][j] = 0.0;
             ALUD->data.F64[i][j] = 0.0;
         }
     }
-    for (i=0;i<X->n;i++) {
+    for (i = 0; i < X->n; i++) {
         X->data.F64[i] = x->data.F64[i];
     }
 
     // Build the B and A data structs.
-    for (i=0;i<X->n;i++) {
-        p_psBuildSums1D(X->data.F64[i], 2*polyOrder, xSums);
-
-        for(k=0;k<(polyOrder);k++) {
-            B->data.F64[k]+= y->data.F64[i] * xSums->data.F64[k];
-        }
-
-        for(k=0;k<(polyOrder);k++) {
-            for(j=0;j<(polyOrder);j++) {
-                A->data.F64[k][j]+= xSums->data.F64[k+j];
+    for (i = 0; i < X->n; i++) {
+        p_psBuildSums1D(X->data.F64[i], 2 * polyOrder, xSums);
+
+        for (k = 0; k < (polyOrder); k++) {
+            B->data.F64[k] += y->data.F64[i] * xSums->data.F64[k];
+        }
+
+        for (k = 0; k < (polyOrder); k++) {
+            for (j = 0; j < (polyOrder); j++) {
+                A->data.F64[k][j] += xSums->data.F64[k + j];
             }
         }
@@ -941,13 +918,13 @@
     coeffs = psMatrixLUSolve(coeffs, ALUD, B, outPerm);
 
-    for(k=0;k<(polyOrder);k++) {
+    for (k = 0; k < (polyOrder); k++) {
         myPoly->coeff[k] = coeffs->data.F64[k];
-        //        printf("myPoly->coeff[%d] is %f\n", k, myPoly->coeff[k]);
-    }
-
-
-    //    for (i=0;i<x->n;i++) {
-    //        printf("HMMM: psEvalPolynomial1D(%f) is %f\n", x->data.F64[i], psEvalPolynomial1D(x->data.F64[i], myPoly));
-    //    }
+        // printf("myPoly->coeff[%d] is %f\n", k, myPoly->coeff[k]);
+    }
+
+    // for (i=0;i<x->n;i++) {
+    // printf("HMMM: psEvalPolynomial1D(%f) is %f\n", x->data.F64[i], psEvalPolynomial1D(x->data.F64[i],
+    // myPoly));
+    // }
 
     psFree(A);
@@ -959,4 +936,4 @@
     psFree(xSums);
 
-    return(myPoly);
-}
+    return (myPoly);
+}
Index: /trunk/psLib/src/math/psMinimize.h
===================================================================
--- /trunk/psLib/src/math/psMinimize.h	(revision 1406)
+++ /trunk/psLib/src/math/psMinimize.h	(revision 1407)
@@ -1,6 +1,7 @@
 #if !defined(PS_MINIMIZE_H)
-#define PS_MINIMIZE_H
+#    define PS_MINIMIZE_H
 
-#include "psFunctions.h"
+#    include "psFunctions.h"
+
 /** \file psMinimize.h
  *  \brief minimization operations
@@ -9,4 +10,5 @@
 
 /** Functions **************************************************************/
+
 /** \addtogroup Stats
  *  \{
@@ -14,36 +16,44 @@
 
 /** This routine must minimize a non-linear function */
-psVector *
-psMinimize(psVector *restrict initialGuess,
-           float (*myFunction)(const psVector *restrict, const psVector *restrict),
-           float (*myFunctionDeriv)(const psVector *restrict, const psVector *restrict, int),
-           const psVector *restrict coord,
-           const psVector *restrict paramMask);
-
+psVector *psMinimize(psVector * restrict initialGuess,
+                     float (*myFunction) (const psVector * restrict, const psVector * restrict),
+                     float (*myFunctionDeriv) (const psVector * restrict, const psVector * restrict, int),
+                     const psVector * restrict coord, const psVector * restrict paramMask);
 
 /** Minimize chi^2 for input data */
-psVector *
-psMinimizeChi2(float (*evalModel)(const psVector *restrict,
-                                  const psVector *restrict), ///< Model to fit; (domain and params)
-               float (*DevalModel)(const psVector *restrict,
-                                   const psVector *restrict,
-                                   int), ///< Derivative of model to fit; (domain and params)
-               const psImage *restrict domain, ///< The domain values for the corresponding measurements
-               const psVector *restrict data, ///< Data to fit
-               const psVector *restrict errors, ///< Errors in the data
-               psVector *restrict initialGuess, ///< Initial guess
-               const psVector *restrict paramMask, ///< 1 = fit for parameter, 0 = hold parameter constant
-               float *chiSq
-              );
+psVector *psMinimizeChi2(float (*evalModel) (const psVector * restrict, const psVector * restrict),     // /<
+                         // Model
+                         // to
+                         // fit;
+                         // (domain
+                         // and
+                         // params)
+                         float (*DevalModel) (const psVector * restrict, const psVector * restrict, int),       // /<
+                         // Derivative
+                         // of
+                         // model
+                         // to
+                         // fit;
+                         // (domain
+                         // and
+                         // params)
+                         const psImage * restrict domain,       // /< The domain values for the corresponding
+                         // measurements
+                         const psVector * restrict data,        // /< Data to fit
+                         const psVector * restrict errors,      // /< Errors in the data
+                         psVector * restrict initialGuess,      // /< Initial guess
+                         const psVector * restrict paramMask,   // /< 1 = fit for parameter, 0 = hold
+                         // parameter constant
+                         float *chiSq);
 
 /** Derive a polynomial fit by chi^2 minimisation (analytically) */
-psPolynomial1D *
-psVectorFitPolynomial1D(psPolynomial1D *myPoly, ///< Polynomial to fit
-                        const psVector *restrict x, ///< Ordinates (or NULL to just use the indices)
-                        const psVector *restrict y, ///< Coordinates
-                        const psVector *restrict yErr ///< Errors in coordinates, or NULL
-                       );
+psPolynomial1D *psVectorFitPolynomial1D(psPolynomial1D * myPoly,        // /< Polynomial to fit
+                                        const psVector * restrict x,    // /< Ordinates (or NULL to just use
+                                        // the indices)
+                                        const psVector * restrict y,    // /< Coordinates
+                                        const psVector * restrict yErr  // /< Errors in coordinates, or NULL
+                                       );
 
-/* \} */ // End of MathGroup Functions
+/* \} */// End of MathGroup Functions
 
 #endif
Index: /trunk/psLib/src/math/psPolynomial.c
===================================================================
--- /trunk/psLib/src/math/psPolynomial.c	(revision 1406)
+++ /trunk/psLib/src/math/psPolynomial.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psFunctions.c
  *
@@ -7,11 +8,14 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
-/*****************************************************************************/
+
+/*****************************************************************************/
+
 /*  INCLUDE FILES                                                            */
+
 /*****************************************************************************/
 #include <stdlib.h>
@@ -31,6 +35,9 @@
 #include <gsl/gsl_rng.h>
 #include <gsl/gsl_randist.h>
-/*****************************************************************************/
+
+/*****************************************************************************/
+
 /* DEFINE STATEMENTS                                                         */
+
 /*****************************************************************************/
 
@@ -38,17 +45,21 @@
 
 /*****************************************************************************/
+
 /* TYPE DEFINITIONS                                                          */
-/*****************************************************************************/
-static void polynomial1DFree(psPolynomial1D *myPoly);
-static void polynomial2DFree(psPolynomial2D *myPoly);
-static void polynomial3DFree(psPolynomial3D *myPoly);
-static void polynomial4DFree(psPolynomial4D *myPoly);
-static void dPolynomial1DFree(psDPolynomial1D *myPoly);
-static void dPolynomial2DFree(psDPolynomial2D *myPoly);
-static void dPolynomial3DFree(psDPolynomial3D *myPoly);
-static void dPolynomial4DFree(psDPolynomial4D *myPoly);
-
-/*****************************************************************************/
+
+/*****************************************************************************/
+static void polynomial1DFree(psPolynomial1D * myPoly);
+static void polynomial2DFree(psPolynomial2D * myPoly);
+static void polynomial3DFree(psPolynomial3D * myPoly);
+static void polynomial4DFree(psPolynomial4D * myPoly);
+static void dPolynomial1DFree(psDPolynomial1D * myPoly);
+static void dPolynomial2DFree(psDPolynomial2D * myPoly);
+static void dPolynomial3DFree(psDPolynomial3D * myPoly);
+static void dPolynomial4DFree(psDPolynomial4D * myPoly);
+
+/*****************************************************************************/
+
 /* GLOBAL VARIABLES                                                          */
+
 /*****************************************************************************/
 
@@ -56,5 +67,7 @@
 
 /*****************************************************************************/
+
 /* FILE STATIC VARIABLES                                                     */
+
 /*****************************************************************************/
 
@@ -62,5 +75,7 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - LOCAL                                           */
+
 /*****************************************************************************/
 
@@ -68,5 +83,7 @@
 
 /*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - PUBLIC                                         */
+
 /*****************************************************************************/
 
@@ -76,9 +93,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, bool normal)
 {
     float tmp = 1.0;
@@ -94,5 +107,5 @@
     }
 
-    return(tmp * exp(-((x-mean) * (x-mean)) / (2.0 * sigma * sigma)));
+    return (tmp * exp(-((x - mean) * (x - mean)) / (2.0 * sigma * sigma)));
 }
 
@@ -107,7 +120,5 @@
  NOTE: There is no way to seed the random generator.
  *****************************************************************************/
-psVector *psGaussianDev(float mean,
-                        float sigma,
-                        int Npts)
+psVector *psGaussianDev(float mean, float sigma, int Npts)
 {
     psVector *gauss = NULL;
@@ -127,7 +138,6 @@
 
     // NOTE: Should I free r as well?
-    return(gauss);
-}
-
+    return (gauss);
+}
 
 /*****************************************************************************
@@ -140,10 +150,10 @@
 
     newPoly = (psPolynomial1D *) psAlloc(sizeof(psPolynomial1D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial1DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial1DFree);
     newPoly->n = n;
-    newPoly->coeff    = (float *) psAlloc(n * sizeof(float));
-    newPoly->coeffErr = (float *) psAlloc(n * sizeof(float));
-    newPoly->mask     = (char *)  psAlloc(n * sizeof(char));
-    for (i=0;i<n;i++) {
+    newPoly->coeff = (float *)psAlloc(n * sizeof(float));
+    newPoly->coeffErr = (float *)psAlloc(n * sizeof(float));
+    newPoly->mask = (char *)psAlloc(n * sizeof(char));
+    for (i = 0; i < n; i++) {
         newPoly->coeff[i] = 0.0;
         newPoly->coeffErr[i] = 0.0;
@@ -151,5 +161,5 @@
     }
 
-    return(newPoly);
+    return (newPoly);
 }
 
@@ -161,18 +171,18 @@
 
     newPoly = (psPolynomial2D *) psAlloc(sizeof(psPolynomial2D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial2DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial2DFree);
     newPoly->nX = nX;
     newPoly->nY = nY;
 
-    newPoly->coeff    = (float **) psAlloc(nX * sizeof(float *));
-    newPoly->coeffErr = (float **) psAlloc(nX * sizeof(float *));
-    newPoly->mask     = (char **)  psAlloc(nX * sizeof(char *));
-    for (x=0;x<nX;x++) {
-        newPoly->coeff[x]    = (float *) psAlloc(nY * sizeof(float));
-        newPoly->coeffErr[x] = (float *) psAlloc(nY * sizeof(float));
-        newPoly->mask[x]     = (char *)  psAlloc(nY * sizeof(char));
-    }
-    for (x=0;x<nX;x++) {
-        for (y=0;y<nY;y++) {
+    newPoly->coeff = (float **)psAlloc(nX * sizeof(float *));
+    newPoly->coeffErr = (float **)psAlloc(nX * sizeof(float *));
+    newPoly->mask = (char **)psAlloc(nX * sizeof(char *));
+    for (x = 0; x < nX; x++) {
+        newPoly->coeff[x] = (float *)psAlloc(nY * sizeof(float));
+        newPoly->coeffErr[x] = (float *)psAlloc(nY * sizeof(float));
+        newPoly->mask[x] = (char *)psAlloc(nY * sizeof(char));
+    }
+    for (x = 0; x < nX; x++) {
+        for (y = 0; y < nY; y++) {
             newPoly->coeff[x][y] = 0.0;
             newPoly->coeffErr[x][y] = 0.0;
@@ -181,5 +191,5 @@
     }
 
-    return(newPoly);
+    return (newPoly);
 }
 
@@ -192,25 +202,25 @@
 
     newPoly = (psPolynomial3D *) psAlloc(sizeof(psPolynomial3D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial3DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial3DFree);
     newPoly->nX = nX;
     newPoly->nY = nY;
     newPoly->nZ = nZ;
 
-    newPoly->coeff    = (float ***) psAlloc(nX * sizeof(float **));
-    newPoly->coeffErr = (float ***) psAlloc(nX * sizeof(float **));
-    newPoly->mask     = (char ***)  psAlloc(nX * sizeof(char **));
-    for (x=0;x<nX;x++) {
-        newPoly->coeff[x]    = (float **) psAlloc(nY * sizeof(float *));
-        newPoly->coeffErr[x] = (float **) psAlloc(nY * sizeof(float *));
-        newPoly->mask[x]     = (char **)  psAlloc(nY * sizeof(char *));
-        for (y=0;y<nY;y++) {
-            newPoly->coeff[x][y]    = (float *) psAlloc(nZ * sizeof(float));
-            newPoly->coeffErr[x][y] = (float *) psAlloc(nZ * sizeof(float));
-            newPoly->mask[x][y]     = (char *)  psAlloc(nZ * sizeof(char));
-        }
-    }
-    for (x=0;x<nX;x++) {
-        for (y=0;y<nY;y++) {
-            for (z=0;z<nZ;z++) {
+    newPoly->coeff = (float ***)psAlloc(nX * sizeof(float **));
+    newPoly->coeffErr = (float ***)psAlloc(nX * sizeof(float **));
+    newPoly->mask = (char ***)psAlloc(nX * sizeof(char **));
+    for (x = 0; x < nX; x++) {
+        newPoly->coeff[x] = (float **)psAlloc(nY * sizeof(float *));
+        newPoly->coeffErr[x] = (float **)psAlloc(nY * sizeof(float *));
+        newPoly->mask[x] = (char **)psAlloc(nY * sizeof(char *));
+        for (y = 0; y < nY; y++) {
+            newPoly->coeff[x][y] = (float *)psAlloc(nZ * sizeof(float));
+            newPoly->coeffErr[x][y] = (float *)psAlloc(nZ * sizeof(float));
+            newPoly->mask[x][y] = (char *)psAlloc(nZ * sizeof(char));
+        }
+    }
+    for (x = 0; x < nX; x++) {
+        for (y = 0; y < nY; y++) {
+            for (z = 0; z < nZ; z++) {
                 newPoly->coeff[x][y][z] = 0.0;
                 newPoly->coeffErr[x][y][z] = 0.0;
@@ -220,5 +230,5 @@
     }
 
-    return(newPoly);
+    return (newPoly);
 }
 
@@ -232,5 +242,5 @@
 
     newPoly = (psPolynomial4D *) psAlloc(sizeof(psPolynomial4D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial4DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial4DFree);
     newPoly->nW = nW;
     newPoly->nX = nX;
@@ -238,26 +248,26 @@
     newPoly->nZ = nZ;
 
-    newPoly->coeff    = (float ****) psAlloc(nW * sizeof(float ***));
-    newPoly->coeffErr = (float ****) psAlloc(nW * sizeof(float ***));
-    newPoly->mask     = (char ****)  psAlloc(nW * sizeof(char ***));
-    for (w=0;w<nW;w++) {
-        newPoly->coeff[w]    = (float ***) psAlloc(nX * sizeof(float **));
-        newPoly->coeffErr[w] = (float ***) psAlloc(nX * sizeof(float **));
-        newPoly->mask[w]     = (char ***)  psAlloc(nX * sizeof(char **));
-        for (x=0;x<nX;x++) {
-            newPoly->coeff[w][x]    = (float **) psAlloc(nY * sizeof(float *));
-            newPoly->coeffErr[w][x] = (float **) psAlloc(nY * sizeof(float *));
-            newPoly->mask[w][x]     = (char **) psAlloc(nY * sizeof(char *));
-            for (y=0;y<nY;y++) {
-                newPoly->coeff[w][x][y]    = (float *) psAlloc(nZ * sizeof(float));
-                newPoly->coeffErr[w][x][y] = (float *) psAlloc(nZ * sizeof(float));
-                newPoly->mask[w][x][y]     = (char *) psAlloc(nZ * sizeof(char));
-            }
-        }
-    }
-    for (w=0;w<nW;w++) {
-        for (x=0;x<nX;x++) {
-            for (y=0;y<nY;y++) {
-                for (z=0;z<nZ;z++) {
+    newPoly->coeff = (float ****)psAlloc(nW * sizeof(float ***));
+    newPoly->coeffErr = (float ****)psAlloc(nW * sizeof(float ***));
+    newPoly->mask = (char ****)psAlloc(nW * sizeof(char ***));
+    for (w = 0; w < nW; w++) {
+        newPoly->coeff[w] = (float ***)psAlloc(nX * sizeof(float **));
+        newPoly->coeffErr[w] = (float ***)psAlloc(nX * sizeof(float **));
+        newPoly->mask[w] = (char ***)psAlloc(nX * sizeof(char **));
+        for (x = 0; x < nX; x++) {
+            newPoly->coeff[w][x] = (float **)psAlloc(nY * sizeof(float *));
+            newPoly->coeffErr[w][x] = (float **)psAlloc(nY * sizeof(float *));
+            newPoly->mask[w][x] = (char **)psAlloc(nY * sizeof(char *));
+            for (y = 0; y < nY; y++) {
+                newPoly->coeff[w][x][y] = (float *)psAlloc(nZ * sizeof(float));
+                newPoly->coeffErr[w][x][y] = (float *)psAlloc(nZ * sizeof(float));
+                newPoly->mask[w][x][y] = (char *)psAlloc(nZ * sizeof(char));
+            }
+        }
+    }
+    for (w = 0; w < nW; w++) {
+        for (x = 0; x < nX; x++) {
+            for (y = 0; y < nY; y++) {
+                for (z = 0; z < nZ; z++) {
                     newPoly->coeff[w][x][y][z] = 0.0;
                     newPoly->coeffErr[w][x][y][z] = 0.0;
@@ -268,8 +278,8 @@
     }
 
-    return(newPoly);
-}
-
-static void polynomial1DFree(psPolynomial1D *myPoly)
+    return (newPoly);
+}
+
+static void polynomial1DFree(psPolynomial1D * myPoly)
 {
     psFree(myPoly->coeff);
@@ -278,9 +288,9 @@
 }
 
-static void polynomial2DFree(psPolynomial2D *myPoly)
-{
-    int x = 0;
-
-    for (x=0;x<myPoly->nX;x++) {
+static void polynomial2DFree(psPolynomial2D * myPoly)
+{
+    int x = 0;
+
+    for (x = 0; x < myPoly->nX; x++) {
         psFree(myPoly->coeff[x]);
         psFree(myPoly->coeffErr[x]);
@@ -292,11 +302,11 @@
 }
 
-static void polynomial3DFree(psPolynomial3D *myPoly)
-{
-    int x = 0;
-    int y = 0;
-
-    for (x=0;x<myPoly->nX;x++) {
-        for (y=0;y<myPoly->nY;y++) {
+static void polynomial3DFree(psPolynomial3D * myPoly)
+{
+    int x = 0;
+    int y = 0;
+
+    for (x = 0; x < myPoly->nX; x++) {
+        for (y = 0; y < myPoly->nY; y++) {
             psFree(myPoly->coeff[x][y]);
             psFree(myPoly->coeffErr[x][y]);
@@ -313,5 +323,5 @@
 }
 
-static void polynomial4DFree(psPolynomial4D *myPoly)
+static void polynomial4DFree(psPolynomial4D * myPoly)
 {
     int w = 0;
@@ -319,7 +329,7 @@
     int y = 0;
 
-    for (w=0;w<myPoly->nW;w++) {
-        for (x=0;x<myPoly->nX;x++) {
-            for (y=0;y<myPoly->nY;y++) {
+    for (w = 0; w < myPoly->nW; w++) {
+        for (x = 0; x < myPoly->nX; x++) {
+            for (y = 0; y < myPoly->nY; y++) {
                 psFree(myPoly->coeff[w][x][y]);
                 psFree(myPoly->coeffErr[w][x][y]);
@@ -343,7 +353,5 @@
     Polynomial coefficients will be accessed in [w][x][y][z] fashion.
  *****************************************************************************/
-float
-psPolynomial1DEval(float x,
-                   const psPolynomial1D *myPoly)
+float psPolynomial1DEval(float x, const psPolynomial1D * myPoly)
 {
     int loop_x = 0;
@@ -355,8 +363,7 @@
     }
 
-
     // NOTE: Do we want to flag this case?
     if (myPoly->n == 0) {
-        return(1.0);
+        return (1.0);
     }
 
@@ -365,17 +372,13 @@
     }
 
-    for (loop_x=0;loop_x<myPoly->n;loop_x++) {
-        polySum+= xSum * myPoly->coeff[loop_x];
-        xSum*=x;
-    }
-
-    return(polySum);
-}
-
-
-float
-psPolynomial2DEval(float x,
-                   float y,
-                   const psPolynomial2D *myPoly)
+    for (loop_x = 0; loop_x < myPoly->n; loop_x++) {
+        polySum += xSum * myPoly->coeff[loop_x];
+        xSum *= x;
+    }
+
+    return (polySum);
+}
+
+float psPolynomial2DEval(float x, float y, const psPolynomial2D * myPoly)
 {
     int loop_x = 0;
@@ -385,21 +388,17 @@
     float ySum = 1.0;
 
-    for (loop_x=0;loop_x<myPoly->nX;loop_x++) {
+    for (loop_x = 0; loop_x < myPoly->nX; loop_x++) {
         ySum = xSum;
-        for (loop_y=0;loop_y<myPoly->nY;loop_y++) {
-            polySum+= ySum * myPoly->coeff[loop_x][loop_y];
-            ySum*=y;
-        }
-        xSum*=x;
-    }
-
-    return(polySum);
-}
-
-float
-psPolynomial3DEval(float x,
-                   float y,
-                   float z,
-                   const psPolynomial3D *myPoly)
+        for (loop_y = 0; loop_y < myPoly->nY; loop_y++) {
+            polySum += ySum * myPoly->coeff[loop_x][loop_y];
+            ySum *= y;
+        }
+        xSum *= x;
+    }
+
+    return (polySum);
+}
+
+float psPolynomial3DEval(float x, float y, float z, const psPolynomial3D * myPoly)
 {
     int loop_x = 0;
@@ -411,26 +410,21 @@
     float zSum = 1.0;
 
-    for (loop_x=0;loop_x<myPoly->nX;loop_x++) {
+    for (loop_x = 0; loop_x < myPoly->nX; loop_x++) {
         ySum = xSum;
-        for (loop_y=0;loop_y<myPoly->nY;loop_y++) {
+        for (loop_y = 0; loop_y < myPoly->nY; loop_y++) {
             zSum = ySum;
-            for (loop_z=0;loop_z<myPoly->nZ;loop_z++) {
-                polySum+= zSum * myPoly->coeff[loop_x][loop_y][loop_z];
-                zSum*=z;
-            }
-            ySum*=y;
-        }
-        xSum*=x;
-    }
-
-    return(polySum);
-}
-
-float
-psPolynomial4DEval(float w,
-                   float x,
-                   float y,
-                   float z,
-                   const psPolynomial4D *myPoly)
+            for (loop_z = 0; loop_z < myPoly->nZ; loop_z++) {
+                polySum += zSum * myPoly->coeff[loop_x][loop_y][loop_z];
+                zSum *= z;
+            }
+            ySum *= y;
+        }
+        xSum *= x;
+    }
+
+    return (polySum);
+}
+
+float psPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D * myPoly)
 {
     int loop_w = 0;
@@ -444,27 +438,23 @@
     float zSum = 1.0;
 
-    for (loop_w=0;loop_w<myPoly->nW;loop_w++) {
+    for (loop_w = 0; loop_w < myPoly->nW; loop_w++) {
         xSum = wSum;
-        for (loop_x=0;loop_x<myPoly->nX;loop_x++) {
+        for (loop_x = 0; loop_x < myPoly->nX; loop_x++) {
             ySum = xSum;
-            for (loop_y=0;loop_y<myPoly->nY;loop_y++) {
+            for (loop_y = 0; loop_y < myPoly->nY; loop_y++) {
                 zSum = ySum;
-                for (loop_z=0;loop_z<myPoly->nZ;loop_z++) {
-                    polySum+= zSum *
-                              myPoly->coeff[loop_w][loop_x][loop_y][loop_z];
-                    zSum*=z;
+                for (loop_z = 0; loop_z < myPoly->nZ; loop_z++) {
+                    polySum += zSum * myPoly->coeff[loop_w][loop_x][loop_y][loop_z];
+                    zSum *= z;
                 }
-                ySum*=y;
-            }
-            xSum*=x;
-        }
-        wSum*=w;
-    }
-
-    return(polySum);
-}
-
-
-
+                ySum *= y;
+            }
+            xSum *= x;
+        }
+        wSum *= w;
+    }
+
+    return (polySum);
+}
 
 psDPolynomial1D *psDPolynomial1DAlloc(int n)
@@ -474,10 +464,10 @@
 
     newPoly = (psDPolynomial1D *) psAlloc(sizeof(psDPolynomial1D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial1DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial1DFree);
     newPoly->n = n;
-    newPoly->coeff    = (double *) psAlloc(n * sizeof(double));
-    newPoly->coeffErr = (double *) psAlloc(n * sizeof(double));
-    newPoly->mask     = (char *)  psAlloc(n * sizeof(char));
-    for (i=0;i<n;i++) {
+    newPoly->coeff = (double *)psAlloc(n * sizeof(double));
+    newPoly->coeffErr = (double *)psAlloc(n * sizeof(double));
+    newPoly->mask = (char *)psAlloc(n * sizeof(char));
+    for (i = 0; i < n; i++) {
         newPoly->coeff[i] = 0.0;
         newPoly->coeffErr[i] = 0.0;
@@ -485,5 +475,5 @@
     }
 
-    return(newPoly);
+    return (newPoly);
 }
 
@@ -495,18 +485,18 @@
 
     newPoly = (psDPolynomial2D *) psAlloc(sizeof(psDPolynomial2D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial2DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial2DFree);
     newPoly->nX = nX;
     newPoly->nY = nY;
 
-    newPoly->coeff    = (double **) psAlloc(nX * sizeof(double *));
-    newPoly->coeffErr = (double **) psAlloc(nX * sizeof(double *));
-    newPoly->mask     = (char **)  psAlloc(nX * sizeof(char *));
-    for (x=0;x<nX;x++) {
-        newPoly->coeff[x]    = (double *) psAlloc(nY * sizeof(double));
-        newPoly->coeffErr[x] = (double *) psAlloc(nY * sizeof(double));
-        newPoly->mask[x]     = (char *)  psAlloc(nY * sizeof(char));
-    }
-    for (x=0;x<nX;x++) {
-        for (y=0;y<nY;y++) {
+    newPoly->coeff = (double **)psAlloc(nX * sizeof(double *));
+    newPoly->coeffErr = (double **)psAlloc(nX * sizeof(double *));
+    newPoly->mask = (char **)psAlloc(nX * sizeof(char *));
+    for (x = 0; x < nX; x++) {
+        newPoly->coeff[x] = (double *)psAlloc(nY * sizeof(double));
+        newPoly->coeffErr[x] = (double *)psAlloc(nY * sizeof(double));
+        newPoly->mask[x] = (char *)psAlloc(nY * sizeof(char));
+    }
+    for (x = 0; x < nX; x++) {
+        for (y = 0; y < nY; y++) {
             newPoly->coeff[x][y] = 0.0;
             newPoly->coeffErr[x][y] = 0.0;
@@ -515,5 +505,5 @@
     }
 
-    return(newPoly);
+    return (newPoly);
 }
 
@@ -526,25 +516,25 @@
 
     newPoly = (psDPolynomial3D *) psAlloc(sizeof(psDPolynomial3D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial3DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial3DFree);
     newPoly->nX = nX;
     newPoly->nY = nY;
     newPoly->nZ = nZ;
 
-    newPoly->coeff    = (double ***) psAlloc(nX * sizeof(double **));
-    newPoly->coeffErr = (double ***) psAlloc(nX * sizeof(double **));
-    newPoly->mask     = (char ***)  psAlloc(nX * sizeof(char **));
-    for (x=0;x<nX;x++) {
-        newPoly->coeff[x]    = (double **) psAlloc(nY * sizeof(double *));
-        newPoly->coeffErr[x] = (double **) psAlloc(nY * sizeof(double *));
-        newPoly->mask[x]     = (char **)  psAlloc(nY * sizeof(char *));
-        for (y=0;y<nY;y++) {
-            newPoly->coeff[x][y]    = (double *) psAlloc(nZ * sizeof(double));
-            newPoly->coeffErr[x][y] = (double *) psAlloc(nZ * sizeof(double));
-            newPoly->mask[x][y]     = (char *)  psAlloc(nZ * sizeof(char));
-        }
-    }
-    for (x=0;x<nX;x++) {
-        for (y=0;y<nY;y++) {
-            for (z=0;z<nZ;z++) {
+    newPoly->coeff = (double ***)psAlloc(nX * sizeof(double **));
+    newPoly->coeffErr = (double ***)psAlloc(nX * sizeof(double **));
+    newPoly->mask = (char ***)psAlloc(nX * sizeof(char **));
+    for (x = 0; x < nX; x++) {
+        newPoly->coeff[x] = (double **)psAlloc(nY * sizeof(double *));
+        newPoly->coeffErr[x] = (double **)psAlloc(nY * sizeof(double *));
+        newPoly->mask[x] = (char **)psAlloc(nY * sizeof(char *));
+        for (y = 0; y < nY; y++) {
+            newPoly->coeff[x][y] = (double *)psAlloc(nZ * sizeof(double));
+            newPoly->coeffErr[x][y] = (double *)psAlloc(nZ * sizeof(double));
+            newPoly->mask[x][y] = (char *)psAlloc(nZ * sizeof(char));
+        }
+    }
+    for (x = 0; x < nX; x++) {
+        for (y = 0; y < nY; y++) {
+            for (z = 0; z < nZ; z++) {
                 newPoly->coeff[x][y][z] = 0.0;
                 newPoly->coeffErr[x][y][z] = 0.0;
@@ -554,5 +544,5 @@
     }
 
-    return(newPoly);
+    return (newPoly);
 }
 
@@ -566,5 +556,5 @@
 
     newPoly = (psDPolynomial4D *) psAlloc(sizeof(psDPolynomial4D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial4DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial4DFree);
     newPoly->nW = nW;
     newPoly->nX = nX;
@@ -572,26 +562,26 @@
     newPoly->nZ = nZ;
 
-    newPoly->coeff    = (double ****) psAlloc(nW * sizeof(double ***));
-    newPoly->coeffErr = (double ****) psAlloc(nW * sizeof(double ***));
-    newPoly->mask     = (char ****)  psAlloc(nW * sizeof(char ***));
-    for (w=0;w<nW;w++) {
-        newPoly->coeff[w]    = (double ***) psAlloc(nX * sizeof(double **));
-        newPoly->coeffErr[w] = (double ***) psAlloc(nX * sizeof(double **));
-        newPoly->mask[w]     = (char ***)  psAlloc(nX * sizeof(char **));
-        for (x=0;x<nX;x++) {
-            newPoly->coeff[w][x]    = (double **) psAlloc(nY * sizeof(double *));
-            newPoly->coeffErr[w][x] = (double **) psAlloc(nY * sizeof(double *));
-            newPoly->mask[w][x]     = (char **) psAlloc(nY * sizeof(char *));
-            for (y=0;y<nY;y++) {
-                newPoly->coeff[w][x][y]    = (double *) psAlloc(nZ * sizeof(double));
-                newPoly->coeffErr[w][x][y] = (double *) psAlloc(nZ * sizeof(double));
-                newPoly->mask[w][x][y]     = (char *) psAlloc(nZ * sizeof(char));
-            }
-        }
-    }
-    for (w=0;w<nW;w++) {
-        for (x=0;x<nX;x++) {
-            for (y=0;y<nY;y++) {
-                for (z=0;z<nZ;z++) {
+    newPoly->coeff = (double ****)psAlloc(nW * sizeof(double ***));
+    newPoly->coeffErr = (double ****)psAlloc(nW * sizeof(double ***));
+    newPoly->mask = (char ****)psAlloc(nW * sizeof(char ***));
+    for (w = 0; w < nW; w++) {
+        newPoly->coeff[w] = (double ***)psAlloc(nX * sizeof(double **));
+        newPoly->coeffErr[w] = (double ***)psAlloc(nX * sizeof(double **));
+        newPoly->mask[w] = (char ***)psAlloc(nX * sizeof(char **));
+        for (x = 0; x < nX; x++) {
+            newPoly->coeff[w][x] = (double **)psAlloc(nY * sizeof(double *));
+            newPoly->coeffErr[w][x] = (double **)psAlloc(nY * sizeof(double *));
+            newPoly->mask[w][x] = (char **)psAlloc(nY * sizeof(char *));
+            for (y = 0; y < nY; y++) {
+                newPoly->coeff[w][x][y] = (double *)psAlloc(nZ * sizeof(double));
+                newPoly->coeffErr[w][x][y] = (double *)psAlloc(nZ * sizeof(double));
+                newPoly->mask[w][x][y] = (char *)psAlloc(nZ * sizeof(char));
+            }
+        }
+    }
+    for (w = 0; w < nW; w++) {
+        for (x = 0; x < nX; x++) {
+            for (y = 0; y < nY; y++) {
+                for (z = 0; z < nZ; z++) {
                     newPoly->coeff[w][x][y][z] = 0.0;
                     newPoly->coeffErr[w][x][y][z] = 0.0;
@@ -602,8 +592,8 @@
     }
 
-    return(newPoly);
-}
-
-static void dPolynomial1DFree(psDPolynomial1D *myPoly)
+    return (newPoly);
+}
+
+static void dPolynomial1DFree(psDPolynomial1D * myPoly)
 {
     psFree(myPoly->coeff);
@@ -612,9 +602,9 @@
 }
 
-static void dPolynomial2DFree(psDPolynomial2D *myPoly)
-{
-    int x = 0;
-
-    for (x=0;x<myPoly->nX;x++) {
+static void dPolynomial2DFree(psDPolynomial2D * myPoly)
+{
+    int x = 0;
+
+    for (x = 0; x < myPoly->nX; x++) {
         psFree(myPoly->coeff[x]);
         psFree(myPoly->coeffErr[x]);
@@ -626,11 +616,11 @@
 }
 
-static void dPolynomial3DFree(psDPolynomial3D *myPoly)
-{
-    int x = 0;
-    int y = 0;
-
-    for (x=0;x<myPoly->nX;x++) {
-        for (y=0;y<myPoly->nY;y++) {
+static void dPolynomial3DFree(psDPolynomial3D * myPoly)
+{
+    int x = 0;
+    int y = 0;
+
+    for (x = 0; x < myPoly->nX; x++) {
+        for (y = 0; y < myPoly->nY; y++) {
             psFree(myPoly->coeff[x][y]);
             psFree(myPoly->coeffErr[x][y]);
@@ -647,5 +637,5 @@
 }
 
-static void dPolynomial4DFree(psDPolynomial4D *myPoly)
+static void dPolynomial4DFree(psDPolynomial4D * myPoly)
 {
     int w = 0;
@@ -653,7 +643,7 @@
     int y = 0;
 
-    for (w=0;w<myPoly->nW;w++) {
-        for (x=0;x<myPoly->nX;x++) {
-            for (y=0;y<myPoly->nY;y++) {
+    for (w = 0; w < myPoly->nW; w++) {
+        for (x = 0; x < myPoly->nX; x++) {
+            for (y = 0; y < myPoly->nY; y++) {
                 psFree(myPoly->coeff[w][x][y]);
                 psFree(myPoly->coeffErr[w][x][y]);
@@ -677,7 +667,5 @@
     Polynomial coefficients will be accessed in [w][x][y][z] fashion.
  *****************************************************************************/
-double
-psDPolynomial1DEval(double x,
-                    const psDPolynomial1D *myPoly)
+double psDPolynomial1DEval(double x, const psDPolynomial1D * myPoly)
 {
     int loop_x = 0;
@@ -687,20 +675,16 @@
     // NOTE: Do we want to flag this case?
     if (myPoly->n == 0) {
-        return(1.0);
-    }
-
-    for (loop_x=0;loop_x<myPoly->n;loop_x++) {
-        polySum+= xSum * myPoly->coeff[loop_x];
-        xSum*=x;
-    }
-
-    return(polySum);
-}
-
-
-double
-psDPolynomial2DEval(double x,
-                    double y,
-                    const psDPolynomial2D *myPoly)
+        return (1.0);
+    }
+
+    for (loop_x = 0; loop_x < myPoly->n; loop_x++) {
+        polySum += xSum * myPoly->coeff[loop_x];
+        xSum *= x;
+    }
+
+    return (polySum);
+}
+
+double psDPolynomial2DEval(double x, double y, const psDPolynomial2D * myPoly)
 {
     int loop_x = 0;
@@ -710,21 +694,17 @@
     double ySum = 1.0;
 
-    for (loop_x=0;loop_x<myPoly->nX;loop_x++) {
+    for (loop_x = 0; loop_x < myPoly->nX; loop_x++) {
         ySum = xSum;
-        for (loop_y=0;loop_y<myPoly->nY;loop_y++) {
-            polySum+= ySum * myPoly->coeff[loop_x][loop_y];
-            ySum*=y;
-        }
-        xSum*=x;
-    }
-
-    return(polySum);
-}
-
-double
-psDPolynomial3DEval(double x,
-                    double y,
-                    double z,
-                    const psDPolynomial3D *myPoly)
+        for (loop_y = 0; loop_y < myPoly->nY; loop_y++) {
+            polySum += ySum * myPoly->coeff[loop_x][loop_y];
+            ySum *= y;
+        }
+        xSum *= x;
+    }
+
+    return (polySum);
+}
+
+double psDPolynomial3DEval(double x, double y, double z, const psDPolynomial3D * myPoly)
 {
     int loop_x = 0;
@@ -736,26 +716,21 @@
     double zSum = 1.0;
 
-    for (loop_x=0;loop_x<myPoly->nX;loop_x++) {
+    for (loop_x = 0; loop_x < myPoly->nX; loop_x++) {
         ySum = xSum;
-        for (loop_y=0;loop_y<myPoly->nY;loop_y++) {
+        for (loop_y = 0; loop_y < myPoly->nY; loop_y++) {
             zSum = ySum;
-            for (loop_z=0;loop_z<myPoly->nZ;loop_z++) {
-                polySum+= zSum * myPoly->coeff[loop_x][loop_y][loop_z];
-                zSum*=z;
-            }
-            ySum*=y;
-        }
-        xSum*=x;
-    }
-
-    return(polySum);
-}
-
-double
-psDPolynomial4DEval(double w,
-                    double x,
-                    double y,
-                    double z,
-                    const psDPolynomial4D *myPoly)
+            for (loop_z = 0; loop_z < myPoly->nZ; loop_z++) {
+                polySum += zSum * myPoly->coeff[loop_x][loop_y][loop_z];
+                zSum *= z;
+            }
+            ySum *= y;
+        }
+        xSum *= x;
+    }
+
+    return (polySum);
+}
+
+double psDPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D * myPoly)
 {
     int loop_w = 0;
@@ -769,22 +744,21 @@
     double zSum = 1.0;
 
-    for (loop_w=0;loop_w<myPoly->nW;loop_w++) {
+    for (loop_w = 0; loop_w < myPoly->nW; loop_w++) {
         xSum = wSum;
-        for (loop_x=0;loop_x<myPoly->nX;loop_x++) {
+        for (loop_x = 0; loop_x < myPoly->nX; loop_x++) {
             ySum = xSum;
-            for (loop_y=0;loop_y<myPoly->nY;loop_y++) {
+            for (loop_y = 0; loop_y < myPoly->nY; loop_y++) {
                 zSum = ySum;
-                for (loop_z=0;loop_z<myPoly->nZ;loop_z++) {
-                    polySum+= zSum *
-                              myPoly->coeff[loop_w][loop_x][loop_y][loop_z];
-                    zSum*=z;
+                for (loop_z = 0; loop_z < myPoly->nZ; loop_z++) {
+                    polySum += zSum * myPoly->coeff[loop_w][loop_x][loop_y][loop_z];
+                    zSum *= z;
                 }
-                ySum*=y;
-            }
-            xSum*=x;
-        }
-        wSum*=w;
-    }
-
-    return(polySum);
-}
+                ySum *= y;
+            }
+            xSum *= x;
+        }
+        wSum *= w;
+    }
+
+    return (polySum);
+}
Index: /trunk/psLib/src/math/psPolynomial.h
===================================================================
--- /trunk/psLib/src/math/psPolynomial.h	(revision 1406)
+++ /trunk/psLib/src/math/psPolynomial.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file psFunctions.h
 *  \brief Standard Mathematical Functions.
@@ -12,6 +13,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 22:34:05 $
+*  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -19,9 +20,9 @@
 
 #if !defined(PS_FUNCTIONS_H)
-#define PS_FUNCTIONS_H
-
-#include <stdbool.h>
-
-#include "psVector.h"
+#    define PS_FUNCTIONS_H
+
+#    include <stdbool.h>
+
+#    include "psVector.h"
 
 /** \addtogroup Stats
@@ -33,29 +34,23 @@
     evaluated Gaussian is: \f[ exp(-\frac{(x-mean)^2}{2\sigma^2}) \f] */
 
-float
-psGaussian( float x,         ///< Value at which to evaluate
-            float mean,      ///< Mean for the Gaussian
-            float stddev,    ///< Standard deviation for the Gaussian
-            bool normal      ///< Indicates whether result should be normalized
-          );
-
+float psGaussian(float x,       // /< Value at which to evaluate
+                 float mean,    // /< Mean for the Gaussian
+                 float stddev,  // /< Standard deviation for the Gaussian
+                 bool normal    // /< Indicates whether result should be normalized
+                );
 
 /** Produce a vector of random numbers from a Gaussian distribution with
     the specified mean and sigma */
-psVector *psGaussianDev( float mean,     ///< The mean of the Gaussian
-                         float sigma,    ///< The sigma of the Gaussian
-                         int Npts );     ///< The size of the vector
-
-
-
-
+psVector *psGaussianDev(float mean,     // /< The mean of the Gaussian
+                        float sigma,    // /< The sigma of the Gaussian
+                        int Npts);      // /< The size of the vector
 
 /** One-dimensional polynomial */
 typedef struct
 {
-    int n;           ///< Number of terms
-    float *coeff;    ///< Coefficients
-    float *coeffErr; ///< Error in coefficients
-    char *mask;      ///< Coefficient mask
+    int n;                      // /< Number of terms
+    float *coeff;               // /< Coefficients
+    float *coeffErr;            // /< Error in coefficients
+    char *mask;                 // /< Coefficient mask
 }
 psPolynomial1D;
@@ -64,8 +59,9 @@
 typedef struct
 {
-    int nX, nY;    ///< Number of terms in x and y
-    float **coeff;   ///< Coefficients
-    float **coeffErr;   ///< Error in coefficients
-    char **mask;   ///< Coefficients mask
+    int nX,
+    nY;                       // /< Number of terms in x and y
+    float **coeff;              // /< Coefficients
+    float **coeffErr;           // /< Error in coefficients
+    char **mask;                // /< Coefficients mask
 }
 psPolynomial2D;
@@ -74,8 +70,10 @@
 typedef struct
 {
-    int nX, nY, nZ;   ///< Number of terms in x, y and z
-    float ***coeff;    ///< Coefficients
-    float ***coeffErr;    ///< Error in coefficients
-    char ***mask;    ///< Coefficients mask
+    int nX,
+    nY,
+    nZ;                       // /< Number of terms in x, y and z
+    float ***coeff;             // /< Coefficients
+    float ***coeffErr;          // /< Error in coefficients
+    char ***mask;               // /< Coefficients mask
 }
 psPolynomial3D;
@@ -84,56 +82,58 @@
 typedef struct
 {
-    int nW, nX, nY, nZ;   ///< Number of terms in w, x, y and z
-    float ****coeff;    ///< Coefficients
-    float ****coeffErr;   ///< Error in coefficients
-    char ****mask;    ///< Coefficients mask
+    int nW,
+    nX,
+    nY,
+    nZ;                       // /< Number of terms in w, x, y and z
+    float ****coeff;            // /< Coefficients
+    float ****coeffErr;         // /< Error in coefficients
+    char ****mask;              // /< Coefficients mask
 }
 psPolynomial4D;
 
-
 /** Functions **************************************************************/
 
 /** Constructor */
-psPolynomial1D *psPolynomial1DAlloc( int n ///< Number of terms
-                                   );
-/** Constructor */
-psPolynomial2D *psPolynomial2DAlloc( int nX, int nY ///< Number of terms in x and y
-                                   );
-/** Constructor */
-psPolynomial3D *psPolynomial3DAlloc( int nX, int nY, int nZ ///< Number of terms in x, y and z
-                                   );
-/** Constructor */
-psPolynomial4D *psPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z
+psPolynomial1D *psPolynomial1DAlloc(int n       // /< Number of terms
+                                   );
+
+/** Constructor */
+psPolynomial2D *psPolynomial2DAlloc(int nX, int nY      // /< Number of terms in x and y
+                                   );
+
+/** Constructor */
+psPolynomial3D *psPolynomial3DAlloc(int nX, int nY, int nZ      // /< Number of terms in x, y and z
+                                   );
+
+/** Constructor */
+psPolynomial4D *psPolynomial4DAlloc(int nW, int nX, int nY, int nZ      // /< Number of terms in w, x, y and
+                                    // z
                                    );
 
 /** Evaluate 1D polynomial */
-float
-psPolynomial1DEval( float x,   ///< Value at which to evaluate
-                    const psPolynomial1D *myPoly ///< Coefficients for the polynomial
-                  );
+float psPolynomial1DEval(float x,       // /< Value at which to evaluate
+                         const psPolynomial1D * myPoly  // /< Coefficients for the polynomial
+                        );
 
 /** Evaluate 2D polynomial */
-float
-psPolynomial2DEval( float x,   ///< Value x at which to evaluate
-                    float y,   ///< Value y at which to evaluate
-                    const psPolynomial2D *myPoly ///< Coefficients for the polynomial
-                  );
+float psPolynomial2DEval(float x,       // /< Value x at which to evaluate
+                         float y,       // /< Value y at which to evaluate
+                         const psPolynomial2D * myPoly  // /< Coefficients for the polynomial
+                        );
 
 /** Evaluate 3D polynomial */
-float
-psPolynomial3DEval( float x,   ///< Value x at which to evaluate
-                    float y,   ///< Value y at which to evaluate
-                    float z,   ///< Value z at which to evaluate
-                    const psPolynomial3D *myPoly ///< Coefficients for the polynomial
-                  );
+float psPolynomial3DEval(float x,       // /< Value x at which to evaluate
+                         float y,       // /< Value y at which to evaluate
+                         float z,       // /< Value z at which to evaluate
+                         const psPolynomial3D * myPoly  // /< Coefficients for the polynomial
+                        );
 
 /** Evaluate 4D polynomial */
-float
-psPolynomial4DEval( float w,   ///< Value w at which to evaluate
-                    float x,   ///< Value x at which to evaluate
-                    float y,   ///< Value y at which to evaluate
-                    float z,   ///< Value z at which to evaluate
-                    const psPolynomial4D *myPoly ///< Coefficients for the polynomial
-                  );
+float psPolynomial4DEval(float w,       // /< Value w at which to evaluate
+                         float x,       // /< Value x at which to evaluate
+                         float y,       // /< Value y at which to evaluate
+                         float z,       // /< Value z at which to evaluate
+                         const psPolynomial4D * myPoly  // /< Coefficients for the polynomial
+                        );
 
 /*****************************************************************************/
@@ -144,8 +144,8 @@
 typedef struct
 {
-    int n;    ///< Number of terms
-    double *coeff;   ///< Coefficients
-    double *coeffErr;   ///< Error in coefficients
-    char *mask;    ///< Coefficient mask
+    int n;                      // /< Number of terms
+    double *coeff;              // /< Coefficients
+    double *coeffErr;           // /< Error in coefficients
+    char *mask;                 // /< Coefficient mask
 }
 psDPolynomial1D;
@@ -154,8 +154,9 @@
 typedef struct
 {
-    int nX, nY;    ///< Number of terms in x and y
-    double **coeff;   ///< Coefficients
-    double **coeffErr;    ///< Error in coefficients
-    char **mask;   ///< Coefficients mask
+    int nX,
+    nY;                       // /< Number of terms in x and y
+    double **coeff;             // /< Coefficients
+    double **coeffErr;          // /< Error in coefficients
+    char **mask;                // /< Coefficients mask
 }
 psDPolynomial2D;
@@ -164,8 +165,10 @@
 typedef struct
 {
-    int nX, nY, nZ;   ///< Number of terms in x, y and z
-    double ***coeff;   ///< Coefficients
-    double ***coeffErr;   ///< Error in coefficients
-    char ***mask;    ///< Coefficient mask
+    int nX,
+    nY,
+    nZ;                       // /< Number of terms in x, y and z
+    double ***coeff;            // /< Coefficients
+    double ***coeffErr;         // /< Error in coefficients
+    char ***mask;               // /< Coefficient mask
 }
 psDPolynomial3D;
@@ -174,55 +177,58 @@
 typedef struct
 {
-    int nW, nX, nY, nZ;   ///< Number of terms in w, x, y and z
-    double ****coeff;    ///< Coefficients
-    double ****coeffErr;   ///< Error in coefficients
-    char ****mask;    ///< Coefficients mask
+    int nW,
+    nX,
+    nY,
+    nZ;                       // /< Number of terms in w, x, y and z
+    double ****coeff;           // /< Coefficients
+    double ****coeffErr;        // /< Error in coefficients
+    char ****mask;              // /< Coefficients mask
 }
 psDPolynomial4D;
 
 /** Constructor */
-psDPolynomial1D *psDPolynomial1DAlloc( int n ///< Number of terms
-                                     );
-/** Constructor */
-psDPolynomial2D *psDPolynomial2DAlloc( int nX, int nY ///< Number of terms in x and y
-                                     );
-/** Constructor */
-psDPolynomial3D *psDPolynomial3DAlloc( int nX, int nY, int nZ ///< Number of terms in x, y and z
-                                     );
-/** Constructor */
-psDPolynomial4D *psDPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z
+psDPolynomial1D *psDPolynomial1DAlloc(int n     // /< Number of terms
+                                     );
+
+/** Constructor */
+psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY    // /< Number of terms in x and y
+                                     );
+
+/** Constructor */
+psDPolynomial3D *psDPolynomial3DAlloc(int nX, int nY, int nZ    // /< Number of terms in x, y and z
+                                     );
+
+/** Constructor */
+psDPolynomial4D *psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ    // /< Number of terms in w, x, y and
+                                      // z
                                      );
 
 /** Evaluate 1D polynomial (double precision) */
-double
-psDPolynomial1DEval( double x,   ///< Value at which to evaluate
-                     const psDPolynomial1D *myPoly ///< Coefficients for the polynomial
-                   );
+double psDPolynomial1DEval(double x,    // /< Value at which to evaluate
+                           const psDPolynomial1D * myPoly       // /< Coefficients for the polynomial
+                          );
 
 /** Evaluate 2D polynomial (double precision) */
-double
-psDPolynomial2DEval( double x,   ///< Value x at which to evaluate
-                     double y,   ///< Value y at which to evaluate
-                     const psDPolynomial2D *myPoly ///< Coefficients for the polynomial
-                   );
+double psDPolynomial2DEval(double x,    // /< Value x at which to evaluate
+                           double y,    // /< Value y at which to evaluate
+                           const psDPolynomial2D * myPoly       // /< Coefficients for the polynomial
+                          );
 
 /** Evaluate 3D polynomial (double precision) */
-double
-psDPolynomial3DEval( double x,   ///< Value x at which to evaluate
-                     double y,   ///< Value y at which to evaluate
-                     double z,   ///< Value z at which to evaluate
-                     const psDPolynomial3D *myPoly ///< Coefficients for the polynomial
-                   );
+double psDPolynomial3DEval(double x,    // /< Value x at which to evaluate
+                           double y,    // /< Value y at which to evaluate
+                           double z,    // /< Value z at which to evaluate
+                           const psDPolynomial3D * myPoly       // /< Coefficients for the polynomial
+                          );
 
 /** Evaluate 4D polynomial (double precision) */
-double
-psDPolynomial4DEval( double w,   ///< Value w at which to evaluate
-                     double x,   ///< Value x at which to evaluate
-                     double y,   ///< Value y at which to evaluate
-                     double z,   ///< Value z at which to evaluate
-                     const psDPolynomial4D *myPoly ///< Coefficients for the polynomial
-                   );
-
-/* \} */ // End of MathGroup Functions
+double psDPolynomial4DEval(double w,    // /< Value w at which to evaluate
+                           double x,    // /< Value x at which to evaluate
+                           double y,    // /< Value y at which to evaluate
+                           double z,    // /< Value z at which to evaluate
+                           const psDPolynomial4D * myPoly       // /< Coefficients for the polynomial
+                          );
+
+/* \} */// End of MathGroup Functions
 
 #endif
Index: /trunk/psLib/src/math/psSpline.c
===================================================================
--- /trunk/psLib/src/math/psSpline.c	(revision 1406)
+++ /trunk/psLib/src/math/psSpline.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psFunctions.c
  *
@@ -7,11 +8,14 @@
  *  polynomials.  It also contains a Gaussian functions.
  *
- *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
-/*****************************************************************************/
+
+/*****************************************************************************/
+
 /*  INCLUDE FILES                                                            */
+
 /*****************************************************************************/
 #include <stdlib.h>
@@ -31,6 +35,9 @@
 #include <gsl/gsl_rng.h>
 #include <gsl/gsl_randist.h>
-/*****************************************************************************/
+
+/*****************************************************************************/
+
 /* DEFINE STATEMENTS                                                         */
+
 /*****************************************************************************/
 
@@ -38,17 +45,21 @@
 
 /*****************************************************************************/
+
 /* TYPE DEFINITIONS                                                          */
-/*****************************************************************************/
-static void polynomial1DFree(psPolynomial1D *myPoly);
-static void polynomial2DFree(psPolynomial2D *myPoly);
-static void polynomial3DFree(psPolynomial3D *myPoly);
-static void polynomial4DFree(psPolynomial4D *myPoly);
-static void dPolynomial1DFree(psDPolynomial1D *myPoly);
-static void dPolynomial2DFree(psDPolynomial2D *myPoly);
-static void dPolynomial3DFree(psDPolynomial3D *myPoly);
-static void dPolynomial4DFree(psDPolynomial4D *myPoly);
-
-/*****************************************************************************/
+
+/*****************************************************************************/
+static void polynomial1DFree(psPolynomial1D * myPoly);
+static void polynomial2DFree(psPolynomial2D * myPoly);
+static void polynomial3DFree(psPolynomial3D * myPoly);
+static void polynomial4DFree(psPolynomial4D * myPoly);
+static void dPolynomial1DFree(psDPolynomial1D * myPoly);
+static void dPolynomial2DFree(psDPolynomial2D * myPoly);
+static void dPolynomial3DFree(psDPolynomial3D * myPoly);
+static void dPolynomial4DFree(psDPolynomial4D * myPoly);
+
+/*****************************************************************************/
+
 /* GLOBAL VARIABLES                                                          */
+
 /*****************************************************************************/
 
@@ -56,5 +67,7 @@
 
 /*****************************************************************************/
+
 /* FILE STATIC VARIABLES                                                     */
+
 /*****************************************************************************/
 
@@ -62,5 +75,7 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - LOCAL                                           */
+
 /*****************************************************************************/
 
@@ -68,5 +83,7 @@
 
 /*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - PUBLIC                                         */
+
 /*****************************************************************************/
 
@@ -76,9 +93,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, bool normal)
 {
     float tmp = 1.0;
@@ -94,5 +107,5 @@
     }
 
-    return(tmp * exp(-((x-mean) * (x-mean)) / (2.0 * sigma * sigma)));
+    return (tmp * exp(-((x - mean) * (x - mean)) / (2.0 * sigma * sigma)));
 }
 
@@ -107,7 +120,5 @@
  NOTE: There is no way to seed the random generator.
  *****************************************************************************/
-psVector *psGaussianDev(float mean,
-                        float sigma,
-                        int Npts)
+psVector *psGaussianDev(float mean, float sigma, int Npts)
 {
     psVector *gauss = NULL;
@@ -127,7 +138,6 @@
 
     // NOTE: Should I free r as well?
-    return(gauss);
-}
-
+    return (gauss);
+}
 
 /*****************************************************************************
@@ -140,10 +150,10 @@
 
     newPoly = (psPolynomial1D *) psAlloc(sizeof(psPolynomial1D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial1DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial1DFree);
     newPoly->n = n;
-    newPoly->coeff    = (float *) psAlloc(n * sizeof(float));
-    newPoly->coeffErr = (float *) psAlloc(n * sizeof(float));
-    newPoly->mask     = (char *)  psAlloc(n * sizeof(char));
-    for (i=0;i<n;i++) {
+    newPoly->coeff = (float *)psAlloc(n * sizeof(float));
+    newPoly->coeffErr = (float *)psAlloc(n * sizeof(float));
+    newPoly->mask = (char *)psAlloc(n * sizeof(char));
+    for (i = 0; i < n; i++) {
         newPoly->coeff[i] = 0.0;
         newPoly->coeffErr[i] = 0.0;
@@ -151,5 +161,5 @@
     }
 
-    return(newPoly);
+    return (newPoly);
 }
 
@@ -161,18 +171,18 @@
 
     newPoly = (psPolynomial2D *) psAlloc(sizeof(psPolynomial2D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial2DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial2DFree);
     newPoly->nX = nX;
     newPoly->nY = nY;
 
-    newPoly->coeff    = (float **) psAlloc(nX * sizeof(float *));
-    newPoly->coeffErr = (float **) psAlloc(nX * sizeof(float *));
-    newPoly->mask     = (char **)  psAlloc(nX * sizeof(char *));
-    for (x=0;x<nX;x++) {
-        newPoly->coeff[x]    = (float *) psAlloc(nY * sizeof(float));
-        newPoly->coeffErr[x] = (float *) psAlloc(nY * sizeof(float));
-        newPoly->mask[x]     = (char *)  psAlloc(nY * sizeof(char));
-    }
-    for (x=0;x<nX;x++) {
-        for (y=0;y<nY;y++) {
+    newPoly->coeff = (float **)psAlloc(nX * sizeof(float *));
+    newPoly->coeffErr = (float **)psAlloc(nX * sizeof(float *));
+    newPoly->mask = (char **)psAlloc(nX * sizeof(char *));
+    for (x = 0; x < nX; x++) {
+        newPoly->coeff[x] = (float *)psAlloc(nY * sizeof(float));
+        newPoly->coeffErr[x] = (float *)psAlloc(nY * sizeof(float));
+        newPoly->mask[x] = (char *)psAlloc(nY * sizeof(char));
+    }
+    for (x = 0; x < nX; x++) {
+        for (y = 0; y < nY; y++) {
             newPoly->coeff[x][y] = 0.0;
             newPoly->coeffErr[x][y] = 0.0;
@@ -181,5 +191,5 @@
     }
 
-    return(newPoly);
+    return (newPoly);
 }
 
@@ -192,25 +202,25 @@
 
     newPoly = (psPolynomial3D *) psAlloc(sizeof(psPolynomial3D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial3DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial3DFree);
     newPoly->nX = nX;
     newPoly->nY = nY;
     newPoly->nZ = nZ;
 
-    newPoly->coeff    = (float ***) psAlloc(nX * sizeof(float **));
-    newPoly->coeffErr = (float ***) psAlloc(nX * sizeof(float **));
-    newPoly->mask     = (char ***)  psAlloc(nX * sizeof(char **));
-    for (x=0;x<nX;x++) {
-        newPoly->coeff[x]    = (float **) psAlloc(nY * sizeof(float *));
-        newPoly->coeffErr[x] = (float **) psAlloc(nY * sizeof(float *));
-        newPoly->mask[x]     = (char **)  psAlloc(nY * sizeof(char *));
-        for (y=0;y<nY;y++) {
-            newPoly->coeff[x][y]    = (float *) psAlloc(nZ * sizeof(float));
-            newPoly->coeffErr[x][y] = (float *) psAlloc(nZ * sizeof(float));
-            newPoly->mask[x][y]     = (char *)  psAlloc(nZ * sizeof(char));
-        }
-    }
-    for (x=0;x<nX;x++) {
-        for (y=0;y<nY;y++) {
-            for (z=0;z<nZ;z++) {
+    newPoly->coeff = (float ***)psAlloc(nX * sizeof(float **));
+    newPoly->coeffErr = (float ***)psAlloc(nX * sizeof(float **));
+    newPoly->mask = (char ***)psAlloc(nX * sizeof(char **));
+    for (x = 0; x < nX; x++) {
+        newPoly->coeff[x] = (float **)psAlloc(nY * sizeof(float *));
+        newPoly->coeffErr[x] = (float **)psAlloc(nY * sizeof(float *));
+        newPoly->mask[x] = (char **)psAlloc(nY * sizeof(char *));
+        for (y = 0; y < nY; y++) {
+            newPoly->coeff[x][y] = (float *)psAlloc(nZ * sizeof(float));
+            newPoly->coeffErr[x][y] = (float *)psAlloc(nZ * sizeof(float));
+            newPoly->mask[x][y] = (char *)psAlloc(nZ * sizeof(char));
+        }
+    }
+    for (x = 0; x < nX; x++) {
+        for (y = 0; y < nY; y++) {
+            for (z = 0; z < nZ; z++) {
                 newPoly->coeff[x][y][z] = 0.0;
                 newPoly->coeffErr[x][y][z] = 0.0;
@@ -220,5 +230,5 @@
     }
 
-    return(newPoly);
+    return (newPoly);
 }
 
@@ -232,5 +242,5 @@
 
     newPoly = (psPolynomial4D *) psAlloc(sizeof(psPolynomial4D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)polynomial4DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) polynomial4DFree);
     newPoly->nW = nW;
     newPoly->nX = nX;
@@ -238,26 +248,26 @@
     newPoly->nZ = nZ;
 
-    newPoly->coeff    = (float ****) psAlloc(nW * sizeof(float ***));
-    newPoly->coeffErr = (float ****) psAlloc(nW * sizeof(float ***));
-    newPoly->mask     = (char ****)  psAlloc(nW * sizeof(char ***));
-    for (w=0;w<nW;w++) {
-        newPoly->coeff[w]    = (float ***) psAlloc(nX * sizeof(float **));
-        newPoly->coeffErr[w] = (float ***) psAlloc(nX * sizeof(float **));
-        newPoly->mask[w]     = (char ***)  psAlloc(nX * sizeof(char **));
-        for (x=0;x<nX;x++) {
-            newPoly->coeff[w][x]    = (float **) psAlloc(nY * sizeof(float *));
-            newPoly->coeffErr[w][x] = (float **) psAlloc(nY * sizeof(float *));
-            newPoly->mask[w][x]     = (char **) psAlloc(nY * sizeof(char *));
-            for (y=0;y<nY;y++) {
-                newPoly->coeff[w][x][y]    = (float *) psAlloc(nZ * sizeof(float));
-                newPoly->coeffErr[w][x][y] = (float *) psAlloc(nZ * sizeof(float));
-                newPoly->mask[w][x][y]     = (char *) psAlloc(nZ * sizeof(char));
-            }
-        }
-    }
-    for (w=0;w<nW;w++) {
-        for (x=0;x<nX;x++) {
-            for (y=0;y<nY;y++) {
-                for (z=0;z<nZ;z++) {
+    newPoly->coeff = (float ****)psAlloc(nW * sizeof(float ***));
+    newPoly->coeffErr = (float ****)psAlloc(nW * sizeof(float ***));
+    newPoly->mask = (char ****)psAlloc(nW * sizeof(char ***));
+    for (w = 0; w < nW; w++) {
+        newPoly->coeff[w] = (float ***)psAlloc(nX * sizeof(float **));
+        newPoly->coeffErr[w] = (float ***)psAlloc(nX * sizeof(float **));
+        newPoly->mask[w] = (char ***)psAlloc(nX * sizeof(char **));
+        for (x = 0; x < nX; x++) {
+            newPoly->coeff[w][x] = (float **)psAlloc(nY * sizeof(float *));
+            newPoly->coeffErr[w][x] = (float **)psAlloc(nY * sizeof(float *));
+            newPoly->mask[w][x] = (char **)psAlloc(nY * sizeof(char *));
+            for (y = 0; y < nY; y++) {
+                newPoly->coeff[w][x][y] = (float *)psAlloc(nZ * sizeof(float));
+                newPoly->coeffErr[w][x][y] = (float *)psAlloc(nZ * sizeof(float));
+                newPoly->mask[w][x][y] = (char *)psAlloc(nZ * sizeof(char));
+            }
+        }
+    }
+    for (w = 0; w < nW; w++) {
+        for (x = 0; x < nX; x++) {
+            for (y = 0; y < nY; y++) {
+                for (z = 0; z < nZ; z++) {
                     newPoly->coeff[w][x][y][z] = 0.0;
                     newPoly->coeffErr[w][x][y][z] = 0.0;
@@ -268,8 +278,8 @@
     }
 
-    return(newPoly);
-}
-
-static void polynomial1DFree(psPolynomial1D *myPoly)
+    return (newPoly);
+}
+
+static void polynomial1DFree(psPolynomial1D * myPoly)
 {
     psFree(myPoly->coeff);
@@ -278,9 +288,9 @@
 }
 
-static void polynomial2DFree(psPolynomial2D *myPoly)
-{
-    int x = 0;
-
-    for (x=0;x<myPoly->nX;x++) {
+static void polynomial2DFree(psPolynomial2D * myPoly)
+{
+    int x = 0;
+
+    for (x = 0; x < myPoly->nX; x++) {
         psFree(myPoly->coeff[x]);
         psFree(myPoly->coeffErr[x]);
@@ -292,11 +302,11 @@
 }
 
-static void polynomial3DFree(psPolynomial3D *myPoly)
-{
-    int x = 0;
-    int y = 0;
-
-    for (x=0;x<myPoly->nX;x++) {
-        for (y=0;y<myPoly->nY;y++) {
+static void polynomial3DFree(psPolynomial3D * myPoly)
+{
+    int x = 0;
+    int y = 0;
+
+    for (x = 0; x < myPoly->nX; x++) {
+        for (y = 0; y < myPoly->nY; y++) {
             psFree(myPoly->coeff[x][y]);
             psFree(myPoly->coeffErr[x][y]);
@@ -313,5 +323,5 @@
 }
 
-static void polynomial4DFree(psPolynomial4D *myPoly)
+static void polynomial4DFree(psPolynomial4D * myPoly)
 {
     int w = 0;
@@ -319,7 +329,7 @@
     int y = 0;
 
-    for (w=0;w<myPoly->nW;w++) {
-        for (x=0;x<myPoly->nX;x++) {
-            for (y=0;y<myPoly->nY;y++) {
+    for (w = 0; w < myPoly->nW; w++) {
+        for (x = 0; x < myPoly->nX; x++) {
+            for (y = 0; y < myPoly->nY; y++) {
                 psFree(myPoly->coeff[w][x][y]);
                 psFree(myPoly->coeffErr[w][x][y]);
@@ -343,7 +353,5 @@
     Polynomial coefficients will be accessed in [w][x][y][z] fashion.
  *****************************************************************************/
-float
-psPolynomial1DEval(float x,
-                   const psPolynomial1D *myPoly)
+float psPolynomial1DEval(float x, const psPolynomial1D * myPoly)
 {
     int loop_x = 0;
@@ -355,8 +363,7 @@
     }
 
-
     // NOTE: Do we want to flag this case?
     if (myPoly->n == 0) {
-        return(1.0);
+        return (1.0);
     }
 
@@ -365,17 +372,13 @@
     }
 
-    for (loop_x=0;loop_x<myPoly->n;loop_x++) {
-        polySum+= xSum * myPoly->coeff[loop_x];
-        xSum*=x;
-    }
-
-    return(polySum);
-}
-
-
-float
-psPolynomial2DEval(float x,
-                   float y,
-                   const psPolynomial2D *myPoly)
+    for (loop_x = 0; loop_x < myPoly->n; loop_x++) {
+        polySum += xSum * myPoly->coeff[loop_x];
+        xSum *= x;
+    }
+
+    return (polySum);
+}
+
+float psPolynomial2DEval(float x, float y, const psPolynomial2D * myPoly)
 {
     int loop_x = 0;
@@ -385,21 +388,17 @@
     float ySum = 1.0;
 
-    for (loop_x=0;loop_x<myPoly->nX;loop_x++) {
+    for (loop_x = 0; loop_x < myPoly->nX; loop_x++) {
         ySum = xSum;
-        for (loop_y=0;loop_y<myPoly->nY;loop_y++) {
-            polySum+= ySum * myPoly->coeff[loop_x][loop_y];
-            ySum*=y;
-        }
-        xSum*=x;
-    }
-
-    return(polySum);
-}
-
-float
-psPolynomial3DEval(float x,
-                   float y,
-                   float z,
-                   const psPolynomial3D *myPoly)
+        for (loop_y = 0; loop_y < myPoly->nY; loop_y++) {
+            polySum += ySum * myPoly->coeff[loop_x][loop_y];
+            ySum *= y;
+        }
+        xSum *= x;
+    }
+
+    return (polySum);
+}
+
+float psPolynomial3DEval(float x, float y, float z, const psPolynomial3D * myPoly)
 {
     int loop_x = 0;
@@ -411,26 +410,21 @@
     float zSum = 1.0;
 
-    for (loop_x=0;loop_x<myPoly->nX;loop_x++) {
+    for (loop_x = 0; loop_x < myPoly->nX; loop_x++) {
         ySum = xSum;
-        for (loop_y=0;loop_y<myPoly->nY;loop_y++) {
+        for (loop_y = 0; loop_y < myPoly->nY; loop_y++) {
             zSum = ySum;
-            for (loop_z=0;loop_z<myPoly->nZ;loop_z++) {
-                polySum+= zSum * myPoly->coeff[loop_x][loop_y][loop_z];
-                zSum*=z;
-            }
-            ySum*=y;
-        }
-        xSum*=x;
-    }
-
-    return(polySum);
-}
-
-float
-psPolynomial4DEval(float w,
-                   float x,
-                   float y,
-                   float z,
-                   const psPolynomial4D *myPoly)
+            for (loop_z = 0; loop_z < myPoly->nZ; loop_z++) {
+                polySum += zSum * myPoly->coeff[loop_x][loop_y][loop_z];
+                zSum *= z;
+            }
+            ySum *= y;
+        }
+        xSum *= x;
+    }
+
+    return (polySum);
+}
+
+float psPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D * myPoly)
 {
     int loop_w = 0;
@@ -444,27 +438,23 @@
     float zSum = 1.0;
 
-    for (loop_w=0;loop_w<myPoly->nW;loop_w++) {
+    for (loop_w = 0; loop_w < myPoly->nW; loop_w++) {
         xSum = wSum;
-        for (loop_x=0;loop_x<myPoly->nX;loop_x++) {
+        for (loop_x = 0; loop_x < myPoly->nX; loop_x++) {
             ySum = xSum;
-            for (loop_y=0;loop_y<myPoly->nY;loop_y++) {
+            for (loop_y = 0; loop_y < myPoly->nY; loop_y++) {
                 zSum = ySum;
-                for (loop_z=0;loop_z<myPoly->nZ;loop_z++) {
-                    polySum+= zSum *
-                              myPoly->coeff[loop_w][loop_x][loop_y][loop_z];
-                    zSum*=z;
+                for (loop_z = 0; loop_z < myPoly->nZ; loop_z++) {
+                    polySum += zSum * myPoly->coeff[loop_w][loop_x][loop_y][loop_z];
+                    zSum *= z;
                 }
-                ySum*=y;
-            }
-            xSum*=x;
-        }
-        wSum*=w;
-    }
-
-    return(polySum);
-}
-
-
-
+                ySum *= y;
+            }
+            xSum *= x;
+        }
+        wSum *= w;
+    }
+
+    return (polySum);
+}
 
 psDPolynomial1D *psDPolynomial1DAlloc(int n)
@@ -474,10 +464,10 @@
 
     newPoly = (psDPolynomial1D *) psAlloc(sizeof(psDPolynomial1D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial1DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial1DFree);
     newPoly->n = n;
-    newPoly->coeff    = (double *) psAlloc(n * sizeof(double));
-    newPoly->coeffErr = (double *) psAlloc(n * sizeof(double));
-    newPoly->mask     = (char *)  psAlloc(n * sizeof(char));
-    for (i=0;i<n;i++) {
+    newPoly->coeff = (double *)psAlloc(n * sizeof(double));
+    newPoly->coeffErr = (double *)psAlloc(n * sizeof(double));
+    newPoly->mask = (char *)psAlloc(n * sizeof(char));
+    for (i = 0; i < n; i++) {
         newPoly->coeff[i] = 0.0;
         newPoly->coeffErr[i] = 0.0;
@@ -485,5 +475,5 @@
     }
 
-    return(newPoly);
+    return (newPoly);
 }
 
@@ -495,18 +485,18 @@
 
     newPoly = (psDPolynomial2D *) psAlloc(sizeof(psDPolynomial2D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial2DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial2DFree);
     newPoly->nX = nX;
     newPoly->nY = nY;
 
-    newPoly->coeff    = (double **) psAlloc(nX * sizeof(double *));
-    newPoly->coeffErr = (double **) psAlloc(nX * sizeof(double *));
-    newPoly->mask     = (char **)  psAlloc(nX * sizeof(char *));
-    for (x=0;x<nX;x++) {
-        newPoly->coeff[x]    = (double *) psAlloc(nY * sizeof(double));
-        newPoly->coeffErr[x] = (double *) psAlloc(nY * sizeof(double));
-        newPoly->mask[x]     = (char *)  psAlloc(nY * sizeof(char));
-    }
-    for (x=0;x<nX;x++) {
-        for (y=0;y<nY;y++) {
+    newPoly->coeff = (double **)psAlloc(nX * sizeof(double *));
+    newPoly->coeffErr = (double **)psAlloc(nX * sizeof(double *));
+    newPoly->mask = (char **)psAlloc(nX * sizeof(char *));
+    for (x = 0; x < nX; x++) {
+        newPoly->coeff[x] = (double *)psAlloc(nY * sizeof(double));
+        newPoly->coeffErr[x] = (double *)psAlloc(nY * sizeof(double));
+        newPoly->mask[x] = (char *)psAlloc(nY * sizeof(char));
+    }
+    for (x = 0; x < nX; x++) {
+        for (y = 0; y < nY; y++) {
             newPoly->coeff[x][y] = 0.0;
             newPoly->coeffErr[x][y] = 0.0;
@@ -515,5 +505,5 @@
     }
 
-    return(newPoly);
+    return (newPoly);
 }
 
@@ -526,25 +516,25 @@
 
     newPoly = (psDPolynomial3D *) psAlloc(sizeof(psDPolynomial3D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial3DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial3DFree);
     newPoly->nX = nX;
     newPoly->nY = nY;
     newPoly->nZ = nZ;
 
-    newPoly->coeff    = (double ***) psAlloc(nX * sizeof(double **));
-    newPoly->coeffErr = (double ***) psAlloc(nX * sizeof(double **));
-    newPoly->mask     = (char ***)  psAlloc(nX * sizeof(char **));
-    for (x=0;x<nX;x++) {
-        newPoly->coeff[x]    = (double **) psAlloc(nY * sizeof(double *));
-        newPoly->coeffErr[x] = (double **) psAlloc(nY * sizeof(double *));
-        newPoly->mask[x]     = (char **)  psAlloc(nY * sizeof(char *));
-        for (y=0;y<nY;y++) {
-            newPoly->coeff[x][y]    = (double *) psAlloc(nZ * sizeof(double));
-            newPoly->coeffErr[x][y] = (double *) psAlloc(nZ * sizeof(double));
-            newPoly->mask[x][y]     = (char *)  psAlloc(nZ * sizeof(char));
-        }
-    }
-    for (x=0;x<nX;x++) {
-        for (y=0;y<nY;y++) {
-            for (z=0;z<nZ;z++) {
+    newPoly->coeff = (double ***)psAlloc(nX * sizeof(double **));
+    newPoly->coeffErr = (double ***)psAlloc(nX * sizeof(double **));
+    newPoly->mask = (char ***)psAlloc(nX * sizeof(char **));
+    for (x = 0; x < nX; x++) {
+        newPoly->coeff[x] = (double **)psAlloc(nY * sizeof(double *));
+        newPoly->coeffErr[x] = (double **)psAlloc(nY * sizeof(double *));
+        newPoly->mask[x] = (char **)psAlloc(nY * sizeof(char *));
+        for (y = 0; y < nY; y++) {
+            newPoly->coeff[x][y] = (double *)psAlloc(nZ * sizeof(double));
+            newPoly->coeffErr[x][y] = (double *)psAlloc(nZ * sizeof(double));
+            newPoly->mask[x][y] = (char *)psAlloc(nZ * sizeof(char));
+        }
+    }
+    for (x = 0; x < nX; x++) {
+        for (y = 0; y < nY; y++) {
+            for (z = 0; z < nZ; z++) {
                 newPoly->coeff[x][y][z] = 0.0;
                 newPoly->coeffErr[x][y][z] = 0.0;
@@ -554,5 +544,5 @@
     }
 
-    return(newPoly);
+    return (newPoly);
 }
 
@@ -566,5 +556,5 @@
 
     newPoly = (psDPolynomial4D *) psAlloc(sizeof(psDPolynomial4D));
-    p_psMemSetDeallocator(newPoly,(psFreeFcn)dPolynomial4DFree);
+    p_psMemSetDeallocator(newPoly, (psFreeFcn) dPolynomial4DFree);
     newPoly->nW = nW;
     newPoly->nX = nX;
@@ -572,26 +562,26 @@
     newPoly->nZ = nZ;
 
-    newPoly->coeff    = (double ****) psAlloc(nW * sizeof(double ***));
-    newPoly->coeffErr = (double ****) psAlloc(nW * sizeof(double ***));
-    newPoly->mask     = (char ****)  psAlloc(nW * sizeof(char ***));
-    for (w=0;w<nW;w++) {
-        newPoly->coeff[w]    = (double ***) psAlloc(nX * sizeof(double **));
-        newPoly->coeffErr[w] = (double ***) psAlloc(nX * sizeof(double **));
-        newPoly->mask[w]     = (char ***)  psAlloc(nX * sizeof(char **));
-        for (x=0;x<nX;x++) {
-            newPoly->coeff[w][x]    = (double **) psAlloc(nY * sizeof(double *));
-            newPoly->coeffErr[w][x] = (double **) psAlloc(nY * sizeof(double *));
-            newPoly->mask[w][x]     = (char **) psAlloc(nY * sizeof(char *));
-            for (y=0;y<nY;y++) {
-                newPoly->coeff[w][x][y]    = (double *) psAlloc(nZ * sizeof(double));
-                newPoly->coeffErr[w][x][y] = (double *) psAlloc(nZ * sizeof(double));
-                newPoly->mask[w][x][y]     = (char *) psAlloc(nZ * sizeof(char));
-            }
-        }
-    }
-    for (w=0;w<nW;w++) {
-        for (x=0;x<nX;x++) {
-            for (y=0;y<nY;y++) {
-                for (z=0;z<nZ;z++) {
+    newPoly->coeff = (double ****)psAlloc(nW * sizeof(double ***));
+    newPoly->coeffErr = (double ****)psAlloc(nW * sizeof(double ***));
+    newPoly->mask = (char ****)psAlloc(nW * sizeof(char ***));
+    for (w = 0; w < nW; w++) {
+        newPoly->coeff[w] = (double ***)psAlloc(nX * sizeof(double **));
+        newPoly->coeffErr[w] = (double ***)psAlloc(nX * sizeof(double **));
+        newPoly->mask[w] = (char ***)psAlloc(nX * sizeof(char **));
+        for (x = 0; x < nX; x++) {
+            newPoly->coeff[w][x] = (double **)psAlloc(nY * sizeof(double *));
+            newPoly->coeffErr[w][x] = (double **)psAlloc(nY * sizeof(double *));
+            newPoly->mask[w][x] = (char **)psAlloc(nY * sizeof(char *));
+            for (y = 0; y < nY; y++) {
+                newPoly->coeff[w][x][y] = (double *)psAlloc(nZ * sizeof(double));
+                newPoly->coeffErr[w][x][y] = (double *)psAlloc(nZ * sizeof(double));
+                newPoly->mask[w][x][y] = (char *)psAlloc(nZ * sizeof(char));
+            }
+        }
+    }
+    for (w = 0; w < nW; w++) {
+        for (x = 0; x < nX; x++) {
+            for (y = 0; y < nY; y++) {
+                for (z = 0; z < nZ; z++) {
                     newPoly->coeff[w][x][y][z] = 0.0;
                     newPoly->coeffErr[w][x][y][z] = 0.0;
@@ -602,8 +592,8 @@
     }
 
-    return(newPoly);
-}
-
-static void dPolynomial1DFree(psDPolynomial1D *myPoly)
+    return (newPoly);
+}
+
+static void dPolynomial1DFree(psDPolynomial1D * myPoly)
 {
     psFree(myPoly->coeff);
@@ -612,9 +602,9 @@
 }
 
-static void dPolynomial2DFree(psDPolynomial2D *myPoly)
-{
-    int x = 0;
-
-    for (x=0;x<myPoly->nX;x++) {
+static void dPolynomial2DFree(psDPolynomial2D * myPoly)
+{
+    int x = 0;
+
+    for (x = 0; x < myPoly->nX; x++) {
         psFree(myPoly->coeff[x]);
         psFree(myPoly->coeffErr[x]);
@@ -626,11 +616,11 @@
 }
 
-static void dPolynomial3DFree(psDPolynomial3D *myPoly)
-{
-    int x = 0;
-    int y = 0;
-
-    for (x=0;x<myPoly->nX;x++) {
-        for (y=0;y<myPoly->nY;y++) {
+static void dPolynomial3DFree(psDPolynomial3D * myPoly)
+{
+    int x = 0;
+    int y = 0;
+
+    for (x = 0; x < myPoly->nX; x++) {
+        for (y = 0; y < myPoly->nY; y++) {
             psFree(myPoly->coeff[x][y]);
             psFree(myPoly->coeffErr[x][y]);
@@ -647,5 +637,5 @@
 }
 
-static void dPolynomial4DFree(psDPolynomial4D *myPoly)
+static void dPolynomial4DFree(psDPolynomial4D * myPoly)
 {
     int w = 0;
@@ -653,7 +643,7 @@
     int y = 0;
 
-    for (w=0;w<myPoly->nW;w++) {
-        for (x=0;x<myPoly->nX;x++) {
-            for (y=0;y<myPoly->nY;y++) {
+    for (w = 0; w < myPoly->nW; w++) {
+        for (x = 0; x < myPoly->nX; x++) {
+            for (y = 0; y < myPoly->nY; y++) {
                 psFree(myPoly->coeff[w][x][y]);
                 psFree(myPoly->coeffErr[w][x][y]);
@@ -677,7 +667,5 @@
     Polynomial coefficients will be accessed in [w][x][y][z] fashion.
  *****************************************************************************/
-double
-psDPolynomial1DEval(double x,
-                    const psDPolynomial1D *myPoly)
+double psDPolynomial1DEval(double x, const psDPolynomial1D * myPoly)
 {
     int loop_x = 0;
@@ -687,20 +675,16 @@
     // NOTE: Do we want to flag this case?
     if (myPoly->n == 0) {
-        return(1.0);
-    }
-
-    for (loop_x=0;loop_x<myPoly->n;loop_x++) {
-        polySum+= xSum * myPoly->coeff[loop_x];
-        xSum*=x;
-    }
-
-    return(polySum);
-}
-
-
-double
-psDPolynomial2DEval(double x,
-                    double y,
-                    const psDPolynomial2D *myPoly)
+        return (1.0);
+    }
+
+    for (loop_x = 0; loop_x < myPoly->n; loop_x++) {
+        polySum += xSum * myPoly->coeff[loop_x];
+        xSum *= x;
+    }
+
+    return (polySum);
+}
+
+double psDPolynomial2DEval(double x, double y, const psDPolynomial2D * myPoly)
 {
     int loop_x = 0;
@@ -710,21 +694,17 @@
     double ySum = 1.0;
 
-    for (loop_x=0;loop_x<myPoly->nX;loop_x++) {
+    for (loop_x = 0; loop_x < myPoly->nX; loop_x++) {
         ySum = xSum;
-        for (loop_y=0;loop_y<myPoly->nY;loop_y++) {
-            polySum+= ySum * myPoly->coeff[loop_x][loop_y];
-            ySum*=y;
-        }
-        xSum*=x;
-    }
-
-    return(polySum);
-}
-
-double
-psDPolynomial3DEval(double x,
-                    double y,
-                    double z,
-                    const psDPolynomial3D *myPoly)
+        for (loop_y = 0; loop_y < myPoly->nY; loop_y++) {
+            polySum += ySum * myPoly->coeff[loop_x][loop_y];
+            ySum *= y;
+        }
+        xSum *= x;
+    }
+
+    return (polySum);
+}
+
+double psDPolynomial3DEval(double x, double y, double z, const psDPolynomial3D * myPoly)
 {
     int loop_x = 0;
@@ -736,26 +716,21 @@
     double zSum = 1.0;
 
-    for (loop_x=0;loop_x<myPoly->nX;loop_x++) {
+    for (loop_x = 0; loop_x < myPoly->nX; loop_x++) {
         ySum = xSum;
-        for (loop_y=0;loop_y<myPoly->nY;loop_y++) {
+        for (loop_y = 0; loop_y < myPoly->nY; loop_y++) {
             zSum = ySum;
-            for (loop_z=0;loop_z<myPoly->nZ;loop_z++) {
-                polySum+= zSum * myPoly->coeff[loop_x][loop_y][loop_z];
-                zSum*=z;
-            }
-            ySum*=y;
-        }
-        xSum*=x;
-    }
-
-    return(polySum);
-}
-
-double
-psDPolynomial4DEval(double w,
-                    double x,
-                    double y,
-                    double z,
-                    const psDPolynomial4D *myPoly)
+            for (loop_z = 0; loop_z < myPoly->nZ; loop_z++) {
+                polySum += zSum * myPoly->coeff[loop_x][loop_y][loop_z];
+                zSum *= z;
+            }
+            ySum *= y;
+        }
+        xSum *= x;
+    }
+
+    return (polySum);
+}
+
+double psDPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D * myPoly)
 {
     int loop_w = 0;
@@ -769,22 +744,21 @@
     double zSum = 1.0;
 
-    for (loop_w=0;loop_w<myPoly->nW;loop_w++) {
+    for (loop_w = 0; loop_w < myPoly->nW; loop_w++) {
         xSum = wSum;
-        for (loop_x=0;loop_x<myPoly->nX;loop_x++) {
+        for (loop_x = 0; loop_x < myPoly->nX; loop_x++) {
             ySum = xSum;
-            for (loop_y=0;loop_y<myPoly->nY;loop_y++) {
+            for (loop_y = 0; loop_y < myPoly->nY; loop_y++) {
                 zSum = ySum;
-                for (loop_z=0;loop_z<myPoly->nZ;loop_z++) {
-                    polySum+= zSum *
-                              myPoly->coeff[loop_w][loop_x][loop_y][loop_z];
-                    zSum*=z;
+                for (loop_z = 0; loop_z < myPoly->nZ; loop_z++) {
+                    polySum += zSum * myPoly->coeff[loop_w][loop_x][loop_y][loop_z];
+                    zSum *= z;
                 }
-                ySum*=y;
-            }
-            xSum*=x;
-        }
-        wSum*=w;
-    }
-
-    return(polySum);
-}
+                ySum *= y;
+            }
+            xSum *= x;
+        }
+        wSum *= w;
+    }
+
+    return (polySum);
+}
Index: /trunk/psLib/src/math/psSpline.h
===================================================================
--- /trunk/psLib/src/math/psSpline.h	(revision 1406)
+++ /trunk/psLib/src/math/psSpline.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file psFunctions.h
 *  \brief Standard Mathematical Functions.
@@ -12,6 +13,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 22:34:05 $
+*  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -19,9 +20,9 @@
 
 #if !defined(PS_FUNCTIONS_H)
-#define PS_FUNCTIONS_H
-
-#include <stdbool.h>
-
-#include "psVector.h"
+#    define PS_FUNCTIONS_H
+
+#    include <stdbool.h>
+
+#    include "psVector.h"
 
 /** \addtogroup Stats
@@ -33,29 +34,23 @@
     evaluated Gaussian is: \f[ exp(-\frac{(x-mean)^2}{2\sigma^2}) \f] */
 
-float
-psGaussian( float x,         ///< Value at which to evaluate
-            float mean,      ///< Mean for the Gaussian
-            float stddev,    ///< Standard deviation for the Gaussian
-            bool normal      ///< Indicates whether result should be normalized
-          );
-
+float psGaussian(float x,       // /< Value at which to evaluate
+                 float mean,    // /< Mean for the Gaussian
+                 float stddev,  // /< Standard deviation for the Gaussian
+                 bool normal    // /< Indicates whether result should be normalized
+                );
 
 /** Produce a vector of random numbers from a Gaussian distribution with
     the specified mean and sigma */
-psVector *psGaussianDev( float mean,     ///< The mean of the Gaussian
-                         float sigma,    ///< The sigma of the Gaussian
-                         int Npts );     ///< The size of the vector
-
-
-
-
+psVector *psGaussianDev(float mean,     // /< The mean of the Gaussian
+                        float sigma,    // /< The sigma of the Gaussian
+                        int Npts);      // /< The size of the vector
 
 /** One-dimensional polynomial */
 typedef struct
 {
-    int n;           ///< Number of terms
-    float *coeff;    ///< Coefficients
-    float *coeffErr; ///< Error in coefficients
-    char *mask;      ///< Coefficient mask
+    int n;                      // /< Number of terms
+    float *coeff;               // /< Coefficients
+    float *coeffErr;            // /< Error in coefficients
+    char *mask;                 // /< Coefficient mask
 }
 psPolynomial1D;
@@ -64,8 +59,9 @@
 typedef struct
 {
-    int nX, nY;    ///< Number of terms in x and y
-    float **coeff;   ///< Coefficients
-    float **coeffErr;   ///< Error in coefficients
-    char **mask;   ///< Coefficients mask
+    int nX,
+    nY;                       // /< Number of terms in x and y
+    float **coeff;              // /< Coefficients
+    float **coeffErr;           // /< Error in coefficients
+    char **mask;                // /< Coefficients mask
 }
 psPolynomial2D;
@@ -74,8 +70,10 @@
 typedef struct
 {
-    int nX, nY, nZ;   ///< Number of terms in x, y and z
-    float ***coeff;    ///< Coefficients
-    float ***coeffErr;    ///< Error in coefficients
-    char ***mask;    ///< Coefficients mask
+    int nX,
+    nY,
+    nZ;                       // /< Number of terms in x, y and z
+    float ***coeff;             // /< Coefficients
+    float ***coeffErr;          // /< Error in coefficients
+    char ***mask;               // /< Coefficients mask
 }
 psPolynomial3D;
@@ -84,56 +82,58 @@
 typedef struct
 {
-    int nW, nX, nY, nZ;   ///< Number of terms in w, x, y and z
-    float ****coeff;    ///< Coefficients
-    float ****coeffErr;   ///< Error in coefficients
-    char ****mask;    ///< Coefficients mask
+    int nW,
+    nX,
+    nY,
+    nZ;                       // /< Number of terms in w, x, y and z
+    float ****coeff;            // /< Coefficients
+    float ****coeffErr;         // /< Error in coefficients
+    char ****mask;              // /< Coefficients mask
 }
 psPolynomial4D;
 
-
 /** Functions **************************************************************/
 
 /** Constructor */
-psPolynomial1D *psPolynomial1DAlloc( int n ///< Number of terms
-                                   );
-/** Constructor */
-psPolynomial2D *psPolynomial2DAlloc( int nX, int nY ///< Number of terms in x and y
-                                   );
-/** Constructor */
-psPolynomial3D *psPolynomial3DAlloc( int nX, int nY, int nZ ///< Number of terms in x, y and z
-                                   );
-/** Constructor */
-psPolynomial4D *psPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z
+psPolynomial1D *psPolynomial1DAlloc(int n       // /< Number of terms
+                                   );
+
+/** Constructor */
+psPolynomial2D *psPolynomial2DAlloc(int nX, int nY      // /< Number of terms in x and y
+                                   );
+
+/** Constructor */
+psPolynomial3D *psPolynomial3DAlloc(int nX, int nY, int nZ      // /< Number of terms in x, y and z
+                                   );
+
+/** Constructor */
+psPolynomial4D *psPolynomial4DAlloc(int nW, int nX, int nY, int nZ      // /< Number of terms in w, x, y and
+                                    // z
                                    );
 
 /** Evaluate 1D polynomial */
-float
-psPolynomial1DEval( float x,   ///< Value at which to evaluate
-                    const psPolynomial1D *myPoly ///< Coefficients for the polynomial
-                  );
+float psPolynomial1DEval(float x,       // /< Value at which to evaluate
+                         const psPolynomial1D * myPoly  // /< Coefficients for the polynomial
+                        );
 
 /** Evaluate 2D polynomial */
-float
-psPolynomial2DEval( float x,   ///< Value x at which to evaluate
-                    float y,   ///< Value y at which to evaluate
-                    const psPolynomial2D *myPoly ///< Coefficients for the polynomial
-                  );
+float psPolynomial2DEval(float x,       // /< Value x at which to evaluate
+                         float y,       // /< Value y at which to evaluate
+                         const psPolynomial2D * myPoly  // /< Coefficients for the polynomial
+                        );
 
 /** Evaluate 3D polynomial */
-float
-psPolynomial3DEval( float x,   ///< Value x at which to evaluate
-                    float y,   ///< Value y at which to evaluate
-                    float z,   ///< Value z at which to evaluate
-                    const psPolynomial3D *myPoly ///< Coefficients for the polynomial
-                  );
+float psPolynomial3DEval(float x,       // /< Value x at which to evaluate
+                         float y,       // /< Value y at which to evaluate
+                         float z,       // /< Value z at which to evaluate
+                         const psPolynomial3D * myPoly  // /< Coefficients for the polynomial
+                        );
 
 /** Evaluate 4D polynomial */
-float
-psPolynomial4DEval( float w,   ///< Value w at which to evaluate
-                    float x,   ///< Value x at which to evaluate
-                    float y,   ///< Value y at which to evaluate
-                    float z,   ///< Value z at which to evaluate
-                    const psPolynomial4D *myPoly ///< Coefficients for the polynomial
-                  );
+float psPolynomial4DEval(float w,       // /< Value w at which to evaluate
+                         float x,       // /< Value x at which to evaluate
+                         float y,       // /< Value y at which to evaluate
+                         float z,       // /< Value z at which to evaluate
+                         const psPolynomial4D * myPoly  // /< Coefficients for the polynomial
+                        );
 
 /*****************************************************************************/
@@ -144,8 +144,8 @@
 typedef struct
 {
-    int n;    ///< Number of terms
-    double *coeff;   ///< Coefficients
-    double *coeffErr;   ///< Error in coefficients
-    char *mask;    ///< Coefficient mask
+    int n;                      // /< Number of terms
+    double *coeff;              // /< Coefficients
+    double *coeffErr;           // /< Error in coefficients
+    char *mask;                 // /< Coefficient mask
 }
 psDPolynomial1D;
@@ -154,8 +154,9 @@
 typedef struct
 {
-    int nX, nY;    ///< Number of terms in x and y
-    double **coeff;   ///< Coefficients
-    double **coeffErr;    ///< Error in coefficients
-    char **mask;   ///< Coefficients mask
+    int nX,
+    nY;                       // /< Number of terms in x and y
+    double **coeff;             // /< Coefficients
+    double **coeffErr;          // /< Error in coefficients
+    char **mask;                // /< Coefficients mask
 }
 psDPolynomial2D;
@@ -164,8 +165,10 @@
 typedef struct
 {
-    int nX, nY, nZ;   ///< Number of terms in x, y and z
-    double ***coeff;   ///< Coefficients
-    double ***coeffErr;   ///< Error in coefficients
-    char ***mask;    ///< Coefficient mask
+    int nX,
+    nY,
+    nZ;                       // /< Number of terms in x, y and z
+    double ***coeff;            // /< Coefficients
+    double ***coeffErr;         // /< Error in coefficients
+    char ***mask;               // /< Coefficient mask
 }
 psDPolynomial3D;
@@ -174,55 +177,58 @@
 typedef struct
 {
-    int nW, nX, nY, nZ;   ///< Number of terms in w, x, y and z
-    double ****coeff;    ///< Coefficients
-    double ****coeffErr;   ///< Error in coefficients
-    char ****mask;    ///< Coefficients mask
+    int nW,
+    nX,
+    nY,
+    nZ;                       // /< Number of terms in w, x, y and z
+    double ****coeff;           // /< Coefficients
+    double ****coeffErr;        // /< Error in coefficients
+    char ****mask;              // /< Coefficients mask
 }
 psDPolynomial4D;
 
 /** Constructor */
-psDPolynomial1D *psDPolynomial1DAlloc( int n ///< Number of terms
-                                     );
-/** Constructor */
-psDPolynomial2D *psDPolynomial2DAlloc( int nX, int nY ///< Number of terms in x and y
-                                     );
-/** Constructor */
-psDPolynomial3D *psDPolynomial3DAlloc( int nX, int nY, int nZ ///< Number of terms in x, y and z
-                                     );
-/** Constructor */
-psDPolynomial4D *psDPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z
+psDPolynomial1D *psDPolynomial1DAlloc(int n     // /< Number of terms
+                                     );
+
+/** Constructor */
+psDPolynomial2D *psDPolynomial2DAlloc(int nX, int nY    // /< Number of terms in x and y
+                                     );
+
+/** Constructor */
+psDPolynomial3D *psDPolynomial3DAlloc(int nX, int nY, int nZ    // /< Number of terms in x, y and z
+                                     );
+
+/** Constructor */
+psDPolynomial4D *psDPolynomial4DAlloc(int nW, int nX, int nY, int nZ    // /< Number of terms in w, x, y and
+                                      // z
                                      );
 
 /** Evaluate 1D polynomial (double precision) */
-double
-psDPolynomial1DEval( double x,   ///< Value at which to evaluate
-                     const psDPolynomial1D *myPoly ///< Coefficients for the polynomial
-                   );
+double psDPolynomial1DEval(double x,    // /< Value at which to evaluate
+                           const psDPolynomial1D * myPoly       // /< Coefficients for the polynomial
+                          );
 
 /** Evaluate 2D polynomial (double precision) */
-double
-psDPolynomial2DEval( double x,   ///< Value x at which to evaluate
-                     double y,   ///< Value y at which to evaluate
-                     const psDPolynomial2D *myPoly ///< Coefficients for the polynomial
-                   );
+double psDPolynomial2DEval(double x,    // /< Value x at which to evaluate
+                           double y,    // /< Value y at which to evaluate
+                           const psDPolynomial2D * myPoly       // /< Coefficients for the polynomial
+                          );
 
 /** Evaluate 3D polynomial (double precision) */
-double
-psDPolynomial3DEval( double x,   ///< Value x at which to evaluate
-                     double y,   ///< Value y at which to evaluate
-                     double z,   ///< Value z at which to evaluate
-                     const psDPolynomial3D *myPoly ///< Coefficients for the polynomial
-                   );
+double psDPolynomial3DEval(double x,    // /< Value x at which to evaluate
+                           double y,    // /< Value y at which to evaluate
+                           double z,    // /< Value z at which to evaluate
+                           const psDPolynomial3D * myPoly       // /< Coefficients for the polynomial
+                          );
 
 /** Evaluate 4D polynomial (double precision) */
-double
-psDPolynomial4DEval( double w,   ///< Value w at which to evaluate
-                     double x,   ///< Value x at which to evaluate
-                     double y,   ///< Value y at which to evaluate
-                     double z,   ///< Value z at which to evaluate
-                     const psDPolynomial4D *myPoly ///< Coefficients for the polynomial
-                   );
-
-/* \} */ // End of MathGroup Functions
+double psDPolynomial4DEval(double w,    // /< Value w at which to evaluate
+                           double x,    // /< Value x at which to evaluate
+                           double y,    // /< Value y at which to evaluate
+                           double z,    // /< Value z at which to evaluate
+                           const psDPolynomial4D * myPoly       // /< Coefficients for the polynomial
+                          );
+
+/* \} */// End of MathGroup Functions
 
 #endif
Index: /trunk/psLib/src/math/psStats.c
===================================================================
--- /trunk/psLib/src/math/psStats.c	(revision 1406)
+++ /trunk/psLib/src/math/psStats.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psStats.c
  *  \brief basic statistical operations
@@ -9,6 +10,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.51 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -21,6 +22,9 @@
 #include <float.h>
 #include <math.h>
+
 /*****************************************************************************/
+
 /* INCLUDE FILES                                                             */
+
 /*****************************************************************************/
 #include "psMemory.h"
@@ -35,8 +39,10 @@
 
 /*****************************************************************************/
+
 /* DEFINE STATEMENTS                                                         */
+
 /*****************************************************************************/
 // will use robust statistical methods.
-#define GAUSS_WIDTH 20                  // The width of the Gaussian or boxcar smoothing.
+#define GAUSS_WIDTH 20                     // The width of the Gaussian or boxcar smoothing.
 #define CLIPPED_NUM_ITER_LB 1
 #define CLIPPED_NUM_ITER_UB 10
@@ -48,8 +54,6 @@
 #define MAX_ITERATIONS 10
 
-void p_psVectorRobustStats( const psVector *restrict myVector,
-                            const psVector *restrict maskVector,
-                            unsigned int maskVal,
-                            psStats *stats );
+void p_psVectorRobustStats(const psVector * restrict myVector,
+                           const psVector * restrict maskVector, unsigned int maskVal, psStats * stats);
 
 /** Preprocessor macro to generate error on an incorrect type */
@@ -83,10 +87,15 @@
 printf("\n"); \
 
+
 /*****************************************************************************/
+
 /* TYPE DEFINITIONS                                                          */
+
 /*****************************************************************************/
 
 /*****************************************************************************/
+
 /* GLOBAL VARIABLES                                                          */
+
 /*****************************************************************************/
 
@@ -94,5 +103,7 @@
 
 /*****************************************************************************/
+
 /* FILE STATIC VARIABLES                                                     */
+
 /*****************************************************************************/
 
@@ -100,12 +111,13 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - LOCAL                                           */
+
 /*****************************************************************************/
 
-bool p_psGetStatValue( const psStats* stats, double* value )
-{
-
-    switch ( stats->options &
-             ~ ( PS_STAT_USE_RANGE | PS_STAT_USE_BINSIZE | PS_STAT_ROBUST_FOR_SAMPLE ) ) {
+bool p_psGetStatValue(const psStats * stats, double *value)
+{
+
+    switch (stats->options & ~(PS_STAT_USE_RANGE | PS_STAT_USE_BINSIZE | PS_STAT_ROBUST_FOR_SAMPLE)) {
     case PS_STAT_SAMPLE_MEAN:
         *value = stats->sampleMean;
@@ -163,16 +175,13 @@
  *****************************************************************************/
 
-void p_psVectorPrint( psVector *myVector,
-                      psVector *maskVector,
-                      unsigned int maskVal,
-                      psStats *stats )
-{
-    int i = 0;                                  // Loop index variable.
-
-    for ( i = 0;i < myVector->n;i++ ) {
-        if ( maskVector != NULL )
-            printf( "Element %d is %f (mask is %d)\n", i, myVector->data.F32[ i ], maskVector->data.U8[ i ] );
+void p_psVectorPrint(psVector * myVector, psVector * maskVector, unsigned int maskVal, psStats * stats)
+{
+    int i = 0;                  // Loop index variable.
+
+    for (i = 0; i < myVector->n; i++) {
+        if (maskVector != NULL)
+            printf("Element %d is %f (mask is %d)\n", i, myVector->data.F32[i], maskVector->data.U8[i]);
         else
-            printf( "Element %d is %f\n", i, myVector->data.F32[ i ] );
+            printf("Element %d is %f\n", i, myVector->data.F32[i]);
     }
 }
@@ -195,5 +204,4 @@
  *****************************************************************************/
 
-
 /******************************************************************************
 p_psVectorSampleMean(myVector, maskVector, maskVal, stats): calculates the
@@ -210,55 +218,51 @@
  *****************************************************************************/
 
-void p_psVectorSampleMean( const psVector *restrict myVector,
-                           const psVector *restrict maskVector,
-                           unsigned int maskVal,
-                           psStats *stats )
-{
-    int i = 0;                                  // Loop index variable
-    float mean = 0.0;                           // The mean
-    int count = 0;                              // # of points in this mean?
-    float rangeMin = 0.0;                       // Exclude data below this
-    float rangeMax = 0.0;                       // Exclude date above this
+void p_psVectorSampleMean(const psVector * restrict myVector,
+                          const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+{
+    int i = 0;                  // Loop index variable
+    float mean = 0.0;           // The mean
+    int count = 0;              // # of points in this mean?
+    float rangeMin = 0.0;       // Exclude data below this
+    float rangeMax = 0.0;       // Exclude date above this
 
     // If PS_STAT_USE_RANGE is requested, then we enter a slightly different
     // loop.
-    if ( stats->options & PS_STAT_USE_RANGE ) {
+    if (stats->options & PS_STAT_USE_RANGE) {
         rangeMin = stats->min;
         rangeMax = stats->max;
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
                 // Check if the data is with the specified range
-                if ( !( maskVal & maskVector->data.U8[ i ] ) &&
-                        ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                    mean += myVector->data.F32[ i ];
+                if (!(maskVal & maskVector->data.U8[i]) &&
+                        (rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                    mean += myVector->data.F32[i];
                     count++;
                 }
             }
-            mean /= ( float ) count;
+            mean /= (float)count;
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                    mean += myVector->data.F32[ i ];
+            for (i = 0; i < myVector->n; i++) {
+                if ((rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                    mean += myVector->data.F32[i];
                     count++;
                 }
             }
-            mean /= ( float ) count;
+            mean /= (float)count;
         }
     } else {
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                    mean += myVector->data.F32[ i ];
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i])) {
+                    mean += myVector->data.F32[i];
                     count++;
                 }
             }
-            mean /= ( float ) count;
+            mean /= (float)count;
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                mean += myVector->data.F32[ i ];
-            }
-            mean /= ( float ) myVector->n;
+            for (i = 0; i < myVector->n; i++) {
+                mean += myVector->data.F32[i];
+            }
+            mean /= (float)myVector->n;
         }
     }
@@ -278,50 +282,46 @@
     NULL
  *****************************************************************************/
-void p_psVectorMax( const psVector *restrict myVector,
-                    const psVector *restrict maskVector,
-                    unsigned int maskVal,
-                    psStats *stats )
-{
-    int i = 0;                                  // Loop index variable
-    float max = -MY_MAX_FLOAT;                    // The calculated maximum
-    float rangeMin = 0.0;                       // Exclude data below this
-    float rangeMax = 0.0;                       // Exclude date above this
+void p_psVectorMax(const psVector * restrict myVector,
+                   const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+{
+    int i = 0;                  // Loop index variable
+    float max = -MY_MAX_FLOAT;  // The calculated maximum
+    float rangeMin = 0.0;       // Exclude data below this
+    float rangeMax = 0.0;       // Exclude date above this
 
     // If PS_STAT_USE_RANGE is requested, then we enter a different loop.
-    if ( stats->options & PS_STAT_USE_RANGE ) {
+    if (stats->options & PS_STAT_USE_RANGE) {
         rangeMin = stats->min;
         rangeMax = stats->max;
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                    if ( ( myVector->data.F32[ i ] > max ) &&
-                            ( rangeMin <= myVector->data.F32[ i ] ) &&
-                            ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                        max = myVector->data.F32[ i ];
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i])) {
+                    if ((myVector->data.F32[i] > max) &&
+                            (rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                        max = myVector->data.F32[i];
                     }
                 }
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( ( myVector->data.F32[ i ] > max ) &&
-                        ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                    max = myVector->data.F32[ i ];
+            for (i = 0; i < myVector->n; i++) {
+                if ((myVector->data.F32[i] > max) &&
+                        (rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                    max = myVector->data.F32[i];
                 }
             }
         }
     } else {
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                    if ( myVector->data.F32[ i ] > max ) {
-                        max = myVector->data.F32[ i ];
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i])) {
+                    if (myVector->data.F32[i] > max) {
+                        max = myVector->data.F32[i];
                     }
                 }
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( myVector->data.F32[ i ] > max ) {
-                    max = myVector->data.F32[ i ];
+            for (i = 0; i < myVector->n; i++) {
+                if (myVector->data.F32[i] > max) {
+                    max = myVector->data.F32[i];
                 }
             }
@@ -343,49 +343,45 @@
     NULL
  *****************************************************************************/
-void p_psVectorMin( const psVector *restrict myVector,
-                    const psVector *restrict maskVector,
-                    unsigned int maskVal,
-                    psStats *stats )
-{
-    int i = 0;                                  // Loop index variable
-    float min = MY_MAX_FLOAT;                     // The calculated maximum
-    float rangeMin = 0.0;                       // Exclude data below this
-    float rangeMax = 0.0;                       // Exclude date above this
-
-    if ( stats->options & PS_STAT_USE_RANGE ) {
+void p_psVectorMin(const psVector * restrict myVector,
+                   const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+{
+    int i = 0;                  // Loop index variable
+    float min = MY_MAX_FLOAT;   // The calculated maximum
+    float rangeMin = 0.0;       // Exclude data below this
+    float rangeMax = 0.0;       // Exclude date above this
+
+    if (stats->options & PS_STAT_USE_RANGE) {
         rangeMin = stats->min;
         rangeMax = stats->max;
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                    if ( ( myVector->data.F32[ i ] < min ) &&
-                            ( rangeMin <= myVector->data.F32[ i ] ) &&
-                            ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                        min = myVector->data.F32[ i ];
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i])) {
+                    if ((myVector->data.F32[i] < min) &&
+                            (rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                        min = myVector->data.F32[i];
                     }
                 }
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( ( myVector->data.F32[ i ] < min ) &&
-                        ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                    min = myVector->data.F32[ i ];
+            for (i = 0; i < myVector->n; i++) {
+                if ((myVector->data.F32[i] < min) &&
+                        (rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                    min = myVector->data.F32[i];
                 }
             }
         }
     } else {
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                    if ( myVector->data.F32[ i ] < min ) {
-                        min = myVector->data.F32[ i ];
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i])) {
+                    if (myVector->data.F32[i] < min) {
+                        min = myVector->data.F32[i];
                     }
                 }
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( myVector->data.F32[ i ] < min ) {
-                    min = myVector->data.F32[ i ];
+            for (i = 0; i < myVector->n; i++) {
+                if (myVector->data.F32[i] < min) {
+                    min = myVector->data.F32[i];
                 }
             }
@@ -408,29 +404,25 @@
     NULL
  *****************************************************************************/
-int p_psVectorNValues( const psVector *restrict myVector,
-                       const psVector *restrict maskVector,
-                       unsigned int maskVal,
-                       psStats *stats )
-{
-    int i = 0;                                  // Loop index variable
-    int numData = 0;                            // The number of data points
-    float rangeMin = 0.0;                       // Exclude data below this
-    float rangeMax = 0.0;                       // Exclude date above this
-
-    if ( stats->options & PS_STAT_USE_RANGE ) {
+int p_psVectorNValues(const psVector * restrict myVector,
+                      const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+{
+    int i = 0;                  // Loop index variable
+    int numData = 0;            // The number of data points
+    float rangeMin = 0.0;       // Exclude data below this
+    float rangeMax = 0.0;       // Exclude date above this
+
+    if (stats->options & PS_STAT_USE_RANGE) {
         rangeMin = stats->min;
         rangeMax = stats->max;
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) &&
-                        ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i]) &&
+                        (rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
                     numData++;
                 }
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
+            for (i = 0; i < myVector->n; i++) {
+                if ((rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
                     numData++;
                 }
@@ -440,7 +432,7 @@
         rangeMin = stats->min;
         rangeMax = stats->max;
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i])) {
                     numData++;
                 }
@@ -450,8 +442,6 @@
         }
     }
-    return ( numData );
-}
-
-
+    return (numData);
+}
 
 /******************************************************************************
@@ -466,17 +456,14 @@
     NULL
  *****************************************************************************/
-void p_psVectorSampleMedian( const psVector *restrict myVector,
-                             const psVector *restrict maskVector,
-                             unsigned int maskVal,
-                             psStats *stats )
-{
-    psVector * unsortedVector = NULL;            // Temporary vector
-    psVector *sortedVector = NULL;              // Temporary vector
-    int i = 0;                                  // Loop index variable
-    int count = 0;                              // # of points in this mean?
-    int nValues = 0;                            // # of points in vector
-    float rangeMin = 0.0;                       // Exclude data below this
-    float rangeMax = 0.0;                       // Exclude date above this
-
+void p_psVectorSampleMedian(const psVector * restrict myVector,
+                            const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+{
+    psVector *unsortedVector = NULL;    // Temporary vector
+    psVector *sortedVector = NULL;      // Temporary vector
+    int i = 0;                  // Loop index variable
+    int count = 0;              // # of points in this mean?
+    int nValues = 0;            // # of points in vector
+    float rangeMin = 0.0;       // Exclude data below this
+    float rangeMax = 0.0;       // Exclude date above this
 
     // Determine if the number of data points exceed a threshold which will
@@ -485,37 +472,33 @@
     // regardless of the vector size.
     /*
-        if (myVector->n > stats->sampleLimit) {
-            psAbort(__func__, "Robust Statistic Algorithms have not yet been defined or implemented.");
-     
-            // Calculate the robust quartiles.
-            stats2 = psStatsAlloc(PS_STAT_ROBUST_MEDIAN);
-            p_psVectorRobustStats(myVector, maskVector, maskVal, stats2);
-     
-            // Store the robust quartiles into the sample quartile members.
-            stats->sampleMedian = stats2->robustMedian;
-     
-            // Free temporary data buffers.
-            psFree(stats2);
-     
-            // Set the PS_STAT_ROBUST_FOR_SAMPLE bit in the stats structure.
-            stats->options = stats->options | PS_STAT_ROBUST_FOR_SAMPLE;
-     
-            return;
-        }
-    */
+     * if (myVector->n > stats->sampleLimit) { psAbort(__func__, "Robust Statistic Algorithms have not yet
+     * been defined or implemented.");
+     * 
+     * // Calculate the robust quartiles. stats2 = psStatsAlloc(PS_STAT_ROBUST_MEDIAN);
+     * p_psVectorRobustStats(myVector, maskVector, maskVal, stats2);
+     * 
+     * // Store the robust quartiles into the sample quartile members. stats->sampleMedian =
+     * stats2->robustMedian;
+     * 
+     * // Free temporary data buffers. psFree(stats2);
+     * 
+     * // Set the PS_STAT_ROBUST_FOR_SAMPLE bit in the stats structure. stats->options = stats->options |
+     * PS_STAT_ROBUST_FOR_SAMPLE;
+     * 
+     * return; } */
 
     // Determine how many data points fit inside this min/max range
     // and are not masked, IF the maskVector is not NULL>
-    nValues = p_psVectorNValues( myVector, maskVector, maskVal, stats );
+    nValues = p_psVectorNValues(myVector, maskVector, maskVal, stats);
 
     // Allocate temporary vectors for the data.
-    unsortedVector = psVectorAlloc( nValues, PS_TYPE_F32 );
+    unsortedVector = psVectorAlloc(nValues, PS_TYPE_F32);
     unsortedVector->n = unsortedVector->nalloc;
 
-    sortedVector = psVectorAlloc( nValues, PS_TYPE_F32 );
+    sortedVector = psVectorAlloc(nValues, PS_TYPE_F32);
     sortedVector->n = sortedVector->nalloc;
 
     // Determine if we must only use data points within a min/max range.
-    if ( stats->options & PS_STAT_USE_RANGE ) {
+    if (stats->options & PS_STAT_USE_RANGE) {
         rangeMin = stats->min;
         rangeMax = stats->max;
@@ -524,17 +507,15 @@
         // into the temporary vectors.
         count = 0;
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) &&
-                        ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                    unsortedVector->data.F32[ count++ ] = maskVector->data.F32[ i ];
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i]) &&
+                        (rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                    unsortedVector->data.F32[count++] = maskVector->data.F32[i];
                 }
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
+            for (i = 0; i < myVector->n; i++) {
+                if ((rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                    unsortedVector->data.F32[count++] = myVector->data.F32[i];
                 }
             }
@@ -543,31 +524,31 @@
         // Store all non-masked data points into the temporary vectors.
         count = 0;
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i])) {
+                    unsortedVector->data.F32[count++] = myVector->data.F32[i];
                 }
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                unsortedVector->data.F32[ i ] = myVector->data.F32[ i ];
+            for (i = 0; i < myVector->n; i++) {
+                unsortedVector->data.F32[i] = myVector->data.F32[i];
             }
         }
     }
     // Sort the temporary vectors.
-    psVectorSort( sortedVector, unsortedVector );
+    psVectorSort(sortedVector, unsortedVector);
 
     // Calculate the median exactly.
     // XXX: Is this the correct action?
-    if ( 0 == ( nValues % 2 ) ) {
-        stats->sampleMedian = 0.5 * ( sortedVector->data.F32[ ( nValues / 2 ) - 1 ] +
-                                      sortedVector->data.F32[ nValues / 2 ] );
+    if (0 == (nValues % 2)) {
+        stats->sampleMedian = 0.5 * (sortedVector->data.F32[(nValues / 2) - 1] +
+                                     sortedVector->data.F32[nValues / 2]);
     } else {
-        stats->sampleMedian = sortedVector->data.F32[ nValues / 2 ];
+        stats->sampleMedian = sortedVector->data.F32[nValues / 2];
     }
 
     // Free the temporary data structures.
-    psFree( unsortedVector );
-    psFree( sortedVector );
+    psFree(unsortedVector);
+    psFree(sortedVector);
 }
 
@@ -584,27 +565,26 @@
     XXX: use a static variable for gaussianCoefs[] and compute them once.
  *****************************************************************************/
-psVector *p_psVectorsmoothHistGaussian( psHistogram *robustHistogram,
-                                        float sigma )
-{
-    int i = 0;                                  // Loop index variable
-    int j = 0;                                  // Loop index variable
-    float denom = 0.0;                           // Temporary variable
-    float expo = 0.0;                            // Temporary variable
-    float gaussianCoefs[ 1 + ( 2 * GAUSS_WIDTH ) ]; // The Gaussian Coefficients
-    psVector *smooth = psVectorAlloc( robustHistogram->nums->n, PS_TYPE_F32 );
-
-    for ( i = 0;i < ( 1 + ( 2 * GAUSS_WIDTH ) );i++ ) {
-        if ( fabs( sigma ) >= FLT_EPSILON ) {
+psVector *p_psVectorsmoothHistGaussian(psHistogram * robustHistogram, float sigma)
+{
+    int i = 0;                  // Loop index variable
+    int j = 0;                  // Loop index variable
+    float denom = 0.0;          // Temporary variable
+    float expo = 0.0;           // Temporary variable
+    float gaussianCoefs[1 + (2 * GAUSS_WIDTH)]; // The Gaussian Coefficients
+    psVector *smooth = psVectorAlloc(robustHistogram->nums->n, PS_TYPE_F32);
+
+    for (i = 0; i < (1 + (2 * GAUSS_WIDTH)); i++) {
+        if (fabs(sigma) >= FLT_EPSILON) {
             // If sigma does not equal zero, then we use Gaussian smoothing.
             #ifdef  DARWIN
-            denom = ( float ) sqrt( 2.0 * M_PI * sigma * sigma );
+            denom = (float)sqrt(2.0 * M_PI * sigma * sigma);
             #else
 
-            denom = sqrtf( 2.0 * M_PI * sigma * sigma );
+            denom = sqrtf(2.0 * M_PI * sigma * sigma);
             #endif
 
-            expo = - ( float ) ( ( i - GAUSS_WIDTH ) * ( i - GAUSS_WIDTH ) );
-            expo /= ( 2.0 * sigma * sigma );
-            gaussianCoefs[ i ] = exp( expo / denom );
+            expo = -(float)((i - GAUSS_WIDTH) * (i - GAUSS_WIDTH));
+            expo /= (2.0 * sigma * sigma);
+            gaussianCoefs[i] = exp(expo / denom);
 
             // NOTE: Gaussian smoothing just isn't working with low sigma
@@ -612,29 +592,27 @@
             // all zero, except for the middle coefficient, which is exactly
             // one.  Therefore, I'm using boxcar smoothing.
-            gaussianCoefs[ i ] = 1.0 / ( 1.0 + ( 2.0 * ( float ) GAUSS_WIDTH ) );
-            //            printf("gaussianCoefs[%d] is %f\n", i, gaussianCoefs[i]);
+            gaussianCoefs[i] = 1.0 / (1.0 + (2.0 * (float)GAUSS_WIDTH));
+            // printf("gaussianCoefs[%d] is %f\n", i, gaussianCoefs[i]);
         } else {
-            /* If sigma equals zero (all pixels have the same value)
-             * the above code will divide by zero.  Therefore, we don't need
-             * to smooth the data.
-             */
-            for ( i = 0;i < robustHistogram->nums->n;i++ ) {
-                smooth->data.F32[ i ] = ( float ) robustHistogram->nums->data.S32[ i ];
-            }
-            return ( smooth );
+            /* If sigma equals zero (all pixels have the same value) the above code will divide by zero.
+             * Therefore, we don't need to smooth the data. */
+            for (i = 0; i < robustHistogram->nums->n; i++) {
+                smooth->data.F32[i] = (float)robustHistogram->nums->data.S32[i];
+            }
+            return (smooth);
         }
     }
 
     // Perform the actual smoothing.
-    for ( i = 0;i < robustHistogram->nums->n;i++ ) {
-        smooth->data.F32[ i ] = 0.0;
-        for ( j = -GAUSS_WIDTH;j <= + GAUSS_WIDTH;j++ ) {
-            if ( ( ( j + i ) >= 0 ) && ( ( j + i ) < smooth->n ) ) {
-                smooth->data.F32[ i ] += ( gaussianCoefs[ j + GAUSS_WIDTH ] *
-                                           ( float ) robustHistogram->nums->data.S32[ j + i ] );
-            }
-        }
-    }
-    return ( smooth );
+    for (i = 0; i < robustHistogram->nums->n; i++) {
+        smooth->data.F32[i] = 0.0;
+        for (j = -GAUSS_WIDTH; j <= +GAUSS_WIDTH; j++) {
+            if (((j + i) >= 0) && ((j + i) < smooth->n)) {
+                smooth->data.F32[i] += (gaussianCoefs[j + GAUSS_WIDTH] *
+                                        (float)robustHistogram->nums->data.S32[j + i]);
+            }
+        }
+    }
+    return (smooth);
 }
 
@@ -650,29 +628,27 @@
     NULL
  *****************************************************************************/
-void p_psVectorSampleQuartiles( const psVector *restrict myVector,
-                                const psVector *restrict maskVector,
-                                unsigned int maskVal,
-                                psStats *stats )
-{
-    psVector * unsortedVector = NULL;            // Temporary vector
-    psVector *sortedVector = NULL;              // Temporary vector
-    int i = 0;                                  // Loop index variable
-    int count = 0;                              // # of points in this mean?
-    int nValues = 0;                            // # data points
-    float rangeMin = 0.0;                       // Exclude data below this
-    float rangeMax = 0.0;                       // Exclude date above this
+void p_psVectorSampleQuartiles(const psVector * restrict myVector,
+                               const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+{
+    psVector *unsortedVector = NULL;    // Temporary vector
+    psVector *sortedVector = NULL;      // Temporary vector
+    int i = 0;                  // Loop index variable
+    int count = 0;              // # of points in this mean?
+    int nValues = 0;            // # data points
+    float rangeMin = 0.0;       // Exclude data below this
+    float rangeMax = 0.0;       // Exclude date above this
 
     // Determine how many data points fit inside this min/max range
     // and are not maxed, IF the maskVector is not NULL>
-    nValues = p_psVectorNValues( myVector, maskVector, maskVal, stats );
+    nValues = p_psVectorNValues(myVector, maskVector, maskVal, stats);
 
     // Allocate temporary vectors for the data.
-    unsortedVector = psVectorAlloc( nValues, PS_TYPE_F32 );
+    unsortedVector = psVectorAlloc(nValues, PS_TYPE_F32);
     unsortedVector->n = unsortedVector->nalloc;
-    sortedVector = psVectorAlloc( nValues, PS_TYPE_F32 );
+    sortedVector = psVectorAlloc(nValues, PS_TYPE_F32);
     sortedVector->n = sortedVector->nalloc;
 
     // Determine if we must only use data points within a min/max range.
-    if ( stats->options & PS_STAT_USE_RANGE ) {
+    if (stats->options & PS_STAT_USE_RANGE) {
         rangeMin = stats->min;
         rangeMax = stats->max;
@@ -680,17 +656,15 @@
         // into the temporary vectors.
         count = 0;
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) &&
-                        ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i]) &&
+                        (rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                    unsortedVector->data.F32[count++] = myVector->data.F32[i];
                 }
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
+            for (i = 0; i < myVector->n; i++) {
+                if ((rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                    unsortedVector->data.F32[count++] = myVector->data.F32[i];
                 }
             }
@@ -699,13 +673,13 @@
         // Store all non-masked data points into the temporary vectors.
         count = 0;
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                    unsortedVector->data.F32[ count++ ] = myVector->data.F32[ i ];
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i])) {
+                    unsortedVector->data.F32[count++] = myVector->data.F32[i];
                 }
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                unsortedVector->data.F32[ i ] = myVector->data.F32[ i ];
+            for (i = 0; i < myVector->n; i++) {
+                unsortedVector->data.F32[i] = myVector->data.F32[i];
             }
         }
@@ -713,15 +687,14 @@
 
     // Sort the temporary vectors.
-    psVectorSort( sortedVector, unsortedVector );
+    psVectorSort(sortedVector, unsortedVector);
 
     // Calculate the quartile points exactly.
-    stats->sampleUQ = sortedVector->data.F32[ 3 * ( nValues / 4 ) ];
-    stats->sampleLQ = sortedVector->data.F32[ nValues / 4 ];
+    stats->sampleUQ = sortedVector->data.F32[3 * (nValues / 4)];
+    stats->sampleLQ = sortedVector->data.F32[nValues / 4];
 
     // Free the temporary data structures.
-    psFree( unsortedVector );
-    psFree( sortedVector );
-}
-
+    psFree(unsortedVector);
+    psFree(sortedVector);
+}
 
 /******************************************************************************
@@ -737,34 +710,31 @@
  
  *****************************************************************************/
-void p_psVectorSampleStdev( const psVector *restrict myVector,
-                            const psVector *restrict maskVector,
-                            unsigned int maskVal,
-                            psStats *stats )
-{
-    int i = 0;                                  // Loop index variable
-    int countInt = 0;                           // # of data points being used
-    float countFloat = 0.0;                     // # of data points being used
-    float mean = 0.0;                           // The mean
-    float diff = 0.0;                           // Used in calculating stdev
-    float sumSquares = 0.0;                     // temporary variable
-    float sumDiffs = 0.0;                       // temporary variable
-    float rangeMin = 0.0;                       // Exclude data below this
-    float rangeMax = 0.0;                       // Exclude date above this
+void p_psVectorSampleStdev(const psVector * restrict myVector,
+                           const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+{
+    int i = 0;                  // Loop index variable
+    int countInt = 0;           // # of data points being used
+    float countFloat = 0.0;     // # of data points being used
+    float mean = 0.0;           // The mean
+    float diff = 0.0;           // Used in calculating stdev
+    float sumSquares = 0.0;     // temporary variable
+    float sumDiffs = 0.0;       // temporary variable
+    float rangeMin = 0.0;       // Exclude data below this
+    float rangeMax = 0.0;       // Exclude date above this
 
     // This procedure requires the mean.  If it has not been already
     // calculated, then call p_psVectorSampleMean()
-    if ( 0 != isnan( stats->sampleMean ) ) {
-        p_psVectorSampleMean( myVector, maskVector, maskVal, stats );
+    if (0 != isnan(stats->sampleMean)) {
+        p_psVectorSampleMean(myVector, maskVector, maskVal, stats);
     }
     mean = stats->sampleMean;
 
-    if ( stats->options & PS_STAT_USE_RANGE ) {
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) &&
-                        ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                    diff = myVector->data.F32[ i ] - mean;
-                    sumSquares += ( diff * diff );
+    if (stats->options & PS_STAT_USE_RANGE) {
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i]) &&
+                        (rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                    diff = myVector->data.F32[i] - mean;
+                    sumSquares += (diff * diff);
                     sumDiffs += diff;
                     countInt++;
@@ -772,9 +742,8 @@
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( ( rangeMin <= myVector->data.F32[ i ] ) &&
-                        ( myVector->data.F32[ i ] <= rangeMax ) ) {
-                    diff = myVector->data.F32[ i ] - mean;
-                    sumSquares += ( diff * diff );
+            for (i = 0; i < myVector->n; i++) {
+                if ((rangeMin <= myVector->data.F32[i]) && (myVector->data.F32[i] <= rangeMax)) {
+                    diff = myVector->data.F32[i] - mean;
+                    sumSquares += (diff * diff);
                     sumDiffs += diff;
                     countInt++;
@@ -784,9 +753,9 @@
         }
     } else {
-        if ( maskVector != NULL ) {
-            for ( i = 0;i < myVector->n;i++ ) {
-                if ( !( maskVal & maskVector->data.U8[ i ] ) ) {
-                    diff = myVector->data.F32[ i ] - mean;
-                    sumSquares += ( diff * diff );
+        if (maskVector != NULL) {
+            for (i = 0; i < myVector->n; i++) {
+                if (!(maskVal & maskVector->data.U8[i])) {
+                    diff = myVector->data.F32[i] - mean;
+                    sumSquares += (diff * diff);
                     sumDiffs += diff;
                     countInt++;
@@ -794,7 +763,7 @@
             }
         } else {
-            for ( i = 0;i < myVector->n;i++ ) {
-                diff = myVector->data.F32[ i ] - mean;
-                sumSquares += ( diff * diff );
+            for (i = 0; i < myVector->n; i++) {
+                diff = myVector->data.F32[i] - mean;
+                sumSquares += (diff * diff);
                 sumDiffs += diff;
                 countInt++;
@@ -803,14 +772,12 @@
         }
     }
-    countFloat = ( float ) countInt;
+    countFloat = (float)countInt;
 
     #ifdef DARWIN
 
-    stats->sampleStdev = ( float ) sqrt( ( sumSquares - ( sumDiffs *
-                                           sumDiffs / countFloat ) ) / ( countFloat - 1 ) );
+    stats->sampleStdev = (float)sqrt((sumSquares - (sumDiffs * sumDiffs / countFloat)) / (countFloat - 1));
     #else
 
-    stats->sampleStdev = sqrtf( ( sumSquares - ( sumDiffs *
-                                  sumDiffs / countFloat ) ) / ( countFloat - 1 ) );
+    stats->sampleStdev = sqrtf((sumSquares - (sumDiffs * sumDiffs / countFloat)) / (countFloat - 1));
     #endif
 }
@@ -828,52 +795,43 @@
     NULL
  *****************************************************************************/
-void p_psVectorClippedStats( const psVector *restrict myVector,
-                             const psVector *restrict maskVector,
-                             unsigned int maskVal,
-                             psStats *stats )
-{
-    int i = 0;                                  // Loop index variable
-    int j = 0;                                  // Loop index variable
-    float clippedMean = 0.0;                    // self-explanatory
-    float clippedStdev = 0.0;                   // self-explanatory
-    float oldStanMean = 0.0;                    // Temporary variable
-    float oldStanStdev = 0.0;                   // Temporary variable
-    psVector *tmpMask = NULL;                   // Temporary vector
+void p_psVectorClippedStats(const psVector * restrict myVector,
+                            const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+{
+    int i = 0;                  // Loop index variable
+    int j = 0;                  // Loop index variable
+    float clippedMean = 0.0;    // self-explanatory
+    float clippedStdev = 0.0;   // self-explanatory
+    float oldStanMean = 0.0;    // Temporary variable
+    float oldStanStdev = 0.0;   // Temporary variable
+    psVector *tmpMask = NULL;   // Temporary vector
 
     // Endure that stats->clipIter is within the proper range.
-    if ( !( ( CLIPPED_NUM_ITER_LB <= stats->clipIter ) &&
-            ( stats->clipIter <= CLIPPED_NUM_ITER_UB ) ) ) {
-        psAbort( __func__, "Unallowed value for clipIter (%d).\n",
-                 stats->clipIter );
-    }
-
+    if (!((CLIPPED_NUM_ITER_LB <= stats->clipIter) && (stats->clipIter <= CLIPPED_NUM_ITER_UB))) {
+        psAbort(__func__, "Unallowed value for clipIter (%d).\n", stats->clipIter);
+    }
     // Endure that stats->clipSigma is within the proper range.
-    if ( !( ( CLIPPED_SIGMA_LB <= stats->clipSigma ) &&
-            ( stats->clipSigma <= CLIPPED_SIGMA_UB ) ) ) {
-        psAbort( __func__, "Unallowed value for clipSigma (%f).\n",
-                 stats->clipSigma );
-    }
-
+    if (!((CLIPPED_SIGMA_LB <= stats->clipSigma) && (stats->clipSigma <= CLIPPED_SIGMA_UB))) {
+        psAbort(__func__, "Unallowed value for clipSigma (%f).\n", stats->clipSigma);
+    }
     // We allocate a temporary mask vector since during the iterative
     // steps that follow, we will be masking off additional data points.
     // However, we do no want to modify the original mask vector.
-    tmpMask = psVectorAlloc( myVector->n, PS_TYPE_U8 );
+    tmpMask = psVectorAlloc(myVector->n, PS_TYPE_U8);
     tmpMask->n = myVector->n;
 
     // If we were called with a mask vector, then initialize the temporary
     // mask vector with those values.
-    if ( maskVector != NULL ) {
-        for ( i = 0;i < tmpMask->n;i++ ) {
-            tmpMask->data.U8[ i ] = maskVector->data.U8[ i ];
-        }
-    }
-
+    if (maskVector != NULL) {
+        for (i = 0; i < tmpMask->n; i++) {
+            tmpMask->data.U8[i] = maskVector->data.U8[i];
+        }
+    }
     // 1. Compute the sample median.
     // NOTE: This seems odd.  Verify with IfA that we want to calculate the
     // median here, not the mean.
-    p_psVectorSampleMedian( myVector, maskVector, maskVal, stats );
+    p_psVectorSampleMedian(myVector, maskVector, maskVal, stats);
 
     // 2. Compute the sample standard deviation.
-    p_psVectorSampleStdev( myVector, maskVector, maskVal, stats );
+    p_psVectorSampleStdev(myVector, maskVector, maskVal, stats);
 
     // 3. Use the sample median as the first estimator of the mean X.
@@ -889,14 +847,13 @@
 
     // 5. Repeat N times:
-    for ( i = 0;i < stats->clipIter;i++ ) {
-        for ( j = 0;j < myVector->n;j++ ) {
+    for (i = 0; i < stats->clipIter; i++) {
+        for (j = 0; j < myVector->n; j++) {
             // a) Exclude all values x_i for which |x_i - x| > K * stdev
-            if ( fabs( myVector->data.F32[ j ] - clippedMean ) >
-                    ( stats->clipSigma * clippedStdev ) ) {
-                tmpMask->data.U8[ i ] = 0xff;
+            if (fabs(myVector->data.F32[j] - clippedMean) > (stats->clipSigma * clippedStdev)) {
+                tmpMask->data.U8[i] = 0xff;
             }
             // b) compute new mean and stdev
-            p_psVectorSampleMedian( myVector, tmpMask, maskVal, stats );
-            p_psVectorSampleStdev( myVector, tmpMask, maskVal, stats );
+            p_psVectorSampleMedian(myVector, tmpMask, maskVal, stats);
+            p_psVectorSampleStdev(myVector, tmpMask, maskVal, stats);
 
             // c) Use the new mean for x
@@ -912,14 +869,13 @@
 
     // 7. The last calcuated value of x is the cliped mean.
-    if ( stats->options & PS_STAT_CLIPPED_MEAN ) {
+    if (stats->options & PS_STAT_CLIPPED_MEAN) {
         stats->clippedMean = clippedMean;
     }
-
     // 8. The last calcuated value of stdev is the cliped stdev.
-    if ( stats->options & PS_STAT_CLIPPED_STDEV ) {
+    if (stats->options & PS_STAT_CLIPPED_STDEV) {
         stats->clippedStdev = clippedStdev;
     }
 
-    psFree( tmpMask );
+    psFree(tmpMask);
 }
 
@@ -928,26 +884,25 @@
 elements of a vector to a range between 0.0 and 1.0.
  *****************************************************************************/
-void p_psNormalizeVector( psVector *myData )
-{
-    float min = ( float ) HUGE;
-    float max = ( float ) - HUGE;
+void p_psNormalizeVector(psVector * myData)
+{
+    float min = (float)HUGE;
+    float max = (float)-HUGE;
     float range = 0.0;
     int i = 0;
 
-    for ( i = 0;i < myData->n;i++ ) {
-        if ( myData->data.F32[ i ] < min ) {
-            min = myData->data.F32[ i ];
-        }
-        if ( myData->data.F32[ i ] > max ) {
-            max = myData->data.F32[ i ];
+    for (i = 0; i < myData->n; i++) {
+        if (myData->data.F32[i] < min) {
+            min = myData->data.F32[i];
+        }
+        if (myData->data.F32[i] > max) {
+            max = myData->data.F32[i];
         }
     }
 
     range = max - min;
-    for ( i = 0;i < myData->n;i++ ) {
-        myData->data.F32[ i ] = ( myData->data.F32[ i ] - min ) / range;
-    }
-}
-
+    for (i = 0; i < myData->n; i++) {
+        myData->data.F32[i] = (myData->data.F32[i] - min) / range;
+    }
+}
 
 /*****************************************************************************
@@ -956,15 +911,15 @@
 specified data point.
  *****************************************************************************/
-float p_psGaussian( const psVector *restrict myData,
-                    const psVector *restrict myParams )
-{
-    float x = myData->data.F32[ 0 ];
-    float mean = myParams->data.F32[ 0 ];
-    float stdev = myParams->data.F32[ 1 ];
-    float tmp = exp( -( ( x - mean ) * ( x - mean ) ) / ( 2.0 * stdev * stdev ) );
-    tmp /= ( ( float ) sqrt( 2.0 * M_PI * ( stdev * stdev ) ) );
-
-    //    printf("p_psGaussian((%.2f), %.2f, %.2f) is %.2f\n", x, mean, stdev, tmp);
-    return ( tmp );
+float p_psGaussian(const psVector * restrict myData, const psVector * restrict myParams)
+{
+    float x = myData->data.F32[0];
+    float mean = myParams->data.F32[0];
+    float stdev = myParams->data.F32[1];
+    float tmp = exp(-((x - mean) * (x - mean)) / (2.0 * stdev * stdev));
+
+    tmp /= ((float)sqrt(2.0 * M_PI * (stdev * stdev)));
+
+    // printf("p_psGaussian((%.2f), %.2f, %.2f) is %.2f\n", x, mean, stdev, tmp);
+    return (tmp);
 }
 
@@ -973,28 +928,24 @@
 calculates the specified partial derivative of the above Gaussian function.
  *****************************************************************************/
-float p_psGaussianDeriv( const psVector *restrict myData,
-                         const psVector *restrict myParams,
-                         int whichParam )
-{
-    float x = myData->data.F32[ 0 ];
-    float mean = myParams->data.F32[ 0 ];
-    float stdev = myParams->data.F32[ 1 ];
+float p_psGaussianDeriv(const psVector * restrict myData, const psVector * restrict myParams, int whichParam)
+{
+    float x = myData->data.F32[0];
+    float mean = myParams->data.F32[0];
+    float stdev = myParams->data.F32[1];
     float tmp = 0.0;
 
-    if ( whichParam == 0 ) {
+    if (whichParam == 0) {
         // Return the derivative w.r.t. the mean.
-        tmp = ( x - mean ) * p_psGaussian( myData, myParams );
-        tmp /= ( stdev * stdev );
-    } else
-        if ( whichParam == 1 ) {
-            // Return the derivative w.r.t. the stdev.
-            tmp = ( x - mean ) * ( x - mean ) * p_psGaussian( myData, myParams );
-            tmp /= ( stdev * stdev * stdev );
-        }
-    printf( "p_psGaussianDeriv((%.2f), %.2f, %.2f, (%d)) is %.2f\n", x, mean, stdev, whichParam, tmp );
-
-    return ( tmp );
-}
-
+        tmp = (x - mean) * p_psGaussian(myData, myParams);
+        tmp /= (stdev * stdev);
+    } else if (whichParam == 1) {
+        // Return the derivative w.r.t. the stdev.
+        tmp = (x - mean) * (x - mean) * p_psGaussian(myData, myParams);
+        tmp /= (stdev * stdev * stdev);
+    }
+    printf("p_psGaussianDeriv((%.2f), %.2f, %.2f, (%d)) is %.2f\n", x, mean, stdev, whichParam, tmp);
+
+    return (tmp);
+}
 
 /*****************************************************************************
@@ -1003,15 +954,14 @@
 specified data point.
  *****************************************************************************/
-float p_psQuadratic( const psVector *restrict myParams,
-                     const psVector *restrict myCoords )
-{
-    float x = myCoords->data.F32[ 0 ];
-    float A = myParams->data.F32[ 0 ];
-    float B = myParams->data.F32[ 1 ];
-    float C = myParams->data.F32[ 2 ];
+float p_psQuadratic(const psVector * restrict myParams, const psVector * restrict myCoords)
+{
+    float x = myCoords->data.F32[0];
+    float A = myParams->data.F32[0];
+    float B = myParams->data.F32[1];
+    float C = myParams->data.F32[2];
     float tmp = 0.0;
 
-    tmp = ( A * x * x ) + ( B * x ) + C;
-    return ( tmp );
+    tmp = (A * x * x) + (B * x) + C;
+    return (tmp);
 }
 
@@ -1020,22 +970,19 @@
 calculates the specified partial derivative of the above quadratic function.
  *****************************************************************************/
-float p_psQuadraticDeriv( const psVector *restrict myParams,
-                          const psVector *restrict myCoords,
-                          int whichParamDeriv )
-{
-    float x = myCoords->data.F32[ 0 ];
+float p_psQuadraticDeriv(const psVector * restrict myParams,
+                         const psVector * restrict myCoords, int whichParamDeriv)
+{
+    float x = myCoords->data.F32[0];
     float tmp = 0.0;
 
-    if ( whichParamDeriv == 0 ) {
+    if (whichParamDeriv == 0) {
         tmp = x * x;
-    } else
-        if ( whichParamDeriv == 1 ) {
-            tmp = x;
-        } else
-            if ( whichParamDeriv == 2 ) {
-                tmp = 1.0;
-            }
-
-    return ( tmp );
+    } else if (whichParamDeriv == 1) {
+        tmp = x;
+    } else if (whichParamDeriv == 2) {
+        tmp = 1.0;
+    }
+
+    return (tmp);
 }
 
@@ -1049,8 +996,5 @@
 decreasing within that range.
  *****************************************************************************/
-float p_ps1DPolyMedian( psPolynomial1D *myPoly,
-                        float rangeLow,
-                        float rangeHigh,
-                        float getThisValue )
+float p_ps1DPolyMedian(psPolynomial1D * myPoly, float rangeLow, float rangeHigh, float getThisValue)
 {
     int numIterations = 0;
@@ -1059,20 +1003,20 @@
     float f = 0.0;
 
-    //  printf("p_ps1DPolyMedian(%f, %f, %f) \n", rangeLow, rangeHigh, getThisValue);
-
-    while ( numIterations < MAX_ITERATIONS ) {
-        midpoint = ( rangeHigh + rangeLow ) / 2.0;
-        if ( fabs( midpoint - oldMidpoint ) <= FLT_EPSILON ) {
-            return ( midpoint );
+    // printf("p_ps1DPolyMedian(%f, %f, %f) \n", rangeLow, rangeHigh, getThisValue);
+
+    while (numIterations < MAX_ITERATIONS) {
+        midpoint = (rangeHigh + rangeLow) / 2.0;
+        if (fabs(midpoint - oldMidpoint) <= FLT_EPSILON) {
+            return (midpoint);
         }
         oldMidpoint = midpoint;
 
-        f = psPolynomial1DEval( midpoint, myPoly );
-        //        printf("p_ps1DPolyMedian() iteration %d.  f(%f) is %f\n", numIterations, midpoint, f);
-        if ( fabs( f - getThisValue ) <= FLT_EPSILON ) {
-            return ( midpoint );
-        }
-
-        if ( f > getThisValue ) {
+        f = psPolynomial1DEval(midpoint, myPoly);
+        // printf("p_ps1DPolyMedian() iteration %d.  f(%f) is %f\n", numIterations, midpoint, f);
+        if (fabs(f - getThisValue) <= FLT_EPSILON) {
+            return (midpoint);
+        }
+
+        if (f > getThisValue) {
             rangeHigh = midpoint;
         } else {
@@ -1081,5 +1025,5 @@
         numIterations++;
     }
-    return ( midpoint );
+    return (midpoint);
 }
 
@@ -1092,52 +1036,42 @@
 XXX: This function is currently not being used.
  *****************************************************************************/
-float p_psFitQuadratic( psHistogram *histogram,
-                        psVector *cumulativeSums,
-                        int binNum,
-                        float fitFloat )
-{
-    psVector * x = psVectorAlloc( 3, PS_TYPE_F64 );
-    psVector *y = psVectorAlloc( 3, PS_TYPE_F64 );
-    psVector *yErr = psVectorAlloc( 3, PS_TYPE_F64 );
-    psPolynomial1D *myPoly = psPolynomial1DAlloc( 2 );
-
-    if ( ( binNum > 0 ) &&
-            ( binNum < ( histogram->nums->n + 1 ) ) ) {
-        x->data.F64[ 0 ] = ( double ) 0.5 *
-                           ( histogram->bounds->data.F32[ binNum - 1 ] +
-                             histogram->bounds->data.F32[ binNum ] );
-        x->data.F64[ 1 ] = ( double ) 0.5 *
-                           ( histogram->bounds->data.F32[ binNum ] +
-                             histogram->bounds->data.F32[ binNum + 1 ] );
-        x->data.F64[ 2 ] = ( double ) 0.5 *
-                           ( histogram->bounds->data.F32[ binNum + 1 ] +
-                             histogram->bounds->data.F32[ binNum + 2 ] );
-
-        y->data.F64[ 0 ] = cumulativeSums->data.F32[ binNum - 1 ];
-        y->data.F64[ 1 ] = cumulativeSums->data.F32[ binNum ];
-        y->data.F64[ 2 ] = cumulativeSums->data.F32[ binNum + 1 ];
-
-        if ( !( ( y->data.F64[ 0 ] <= fitFloat ) &&
-                ( fitFloat <= y->data.F64[ 2 ] ) ) ) {
-            psAbort( __func__, "p_psVectorRobustStats(0): midpoint not within y-range\n" );
-        }
-
-        yErr->data.F64[ 0 ] = 1.0;
-        yErr->data.F64[ 1 ] = 1.0;
-        yErr->data.F64[ 2 ] = 1.0;
-
-        myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
-        return ( p_ps1DPolyMedian( myPoly, x->data.F64[ 0 ], x->data.F64[ 2 ],
-                                   fitFloat ) );
+float p_psFitQuadratic(psHistogram * histogram, psVector * cumulativeSums, int binNum, float fitFloat)
+{
+    psVector *x = psVectorAlloc(3, PS_TYPE_F64);
+    psVector *y = psVectorAlloc(3, PS_TYPE_F64);
+    psVector *yErr = psVectorAlloc(3, PS_TYPE_F64);
+    psPolynomial1D *myPoly = psPolynomial1DAlloc(2);
+
+    if ((binNum > 0) && (binNum < (histogram->nums->n + 1))) {
+        x->data.F64[0] = (double)0.5 *
+                         (histogram->bounds->data.F32[binNum - 1] + histogram->bounds->data.F32[binNum]);
+        x->data.F64[1] = (double)0.5 *
+                         (histogram->bounds->data.F32[binNum] + histogram->bounds->data.F32[binNum + 1]);
+        x->data.F64[2] = (double)0.5 *
+                         (histogram->bounds->data.F32[binNum + 1] + histogram->bounds->data.F32[binNum + 2]);
+
+        y->data.F64[0] = cumulativeSums->data.F32[binNum - 1];
+        y->data.F64[1] = cumulativeSums->data.F32[binNum];
+        y->data.F64[2] = cumulativeSums->data.F32[binNum + 1];
+
+        if (!((y->data.F64[0] <= fitFloat) && (fitFloat <= y->data.F64[2]))) {
+            psAbort(__func__, "p_psVectorRobustStats(0): midpoint not within y-range\n");
+        }
+
+        yErr->data.F64[0] = 1.0;
+        yErr->data.F64[1] = 1.0;
+        yErr->data.F64[2] = 1.0;
+
+        myPoly = psVectorFitPolynomial1D(myPoly, x, y, yErr);
+        return (p_ps1DPolyMedian(myPoly, x->data.F64[0], x->data.F64[2], fitFloat));
     } else {
-        return ( 0.5 * ( histogram->bounds->data.F32[ binNum + 1 ] +
-                         histogram->bounds->data.F32[ binNum ] ) );
-    }
-
-    psFree( x );
-    psFree( y );
-    psFree( yErr );
-    psFree( myPoly );
-    return ( 0.0 );
+        return (0.5 * (histogram->bounds->data.F32[binNum + 1] + histogram->bounds->data.F32[binNum]));
+    }
+
+    psFree(x);
+    psFree(y);
+    psFree(yErr);
+    psFree(myPoly);
+    return (0.0);
 }
 
@@ -1166,28 +1100,27 @@
     NULL
 *****************************************************************************/
-void p_psVectorRobustStats( const psVector *restrict myVector,
-                            const psVector *restrict maskVector,
-                            unsigned int maskVal,
-                            psStats *stats )
-{
-    psHistogram * robustHistogram = NULL;
+void p_psVectorRobustStats(const psVector * restrict myVector,
+                           const psVector * restrict maskVector, unsigned int maskVal, psStats * stats)
+{
+    psHistogram *robustHistogram = NULL;
     psVector *robustHistogramVector = NULL;
-    float binSize = 0.0;                        // Size of the histogram bins
-    int LQBinNum = -1;                          // Bin num for lower quartile
-    int UQBinNum = -1;                          // Bin num for upper quartile
-    int i = 0;                                  // Loop index variable
+    float binSize = 0.0;        // Size of the histogram bins
+    int LQBinNum = -1;          // Bin num for lower quartile
+    int UQBinNum = -1;          // Bin num for upper quartile
+    int i = 0;                  // Loop index variable
     int maxBinNum = 0;
     float maxBinCount = 0.0;
     float dL = 0.0;
     int numBins = 0;
-    psStats *tmpStats = psStatsAlloc( PS_STAT_CLIPPED_STDEV | PS_STAT_CLIPPED_MEAN );
-    //    psImage *domain;
-    //    psVector *errors;
-    //    psVector *data;
-    //    psVector *initialGuess;
-    //    psVector *theParams;
-    //    float chiSq=0.0;
-    //    float max = -HUGE;
-    //    float max_pos;
+    psStats *tmpStats = psStatsAlloc(PS_STAT_CLIPPED_STDEV | PS_STAT_CLIPPED_MEAN);
+
+    // psImage *domain;
+    // psVector *errors;
+    // psVector *data;
+    // psVector *initialGuess;
+    // psVector *theParams;
+    // float chiSq=0.0;
+    // float max = -HUGE;
+    // float max_pos;
     float myMean = 0.0;
     float myStdev = 0.0;
@@ -1196,8 +1129,8 @@
     float sumSquares = 0.0;
     float sumDiffs = 0.0;
-    psVector *x = psVectorAlloc( 3, PS_TYPE_F64 );
-    psVector *y = psVectorAlloc( 3, PS_TYPE_F64 );
-    psVector *yErr = psVectorAlloc( 3, PS_TYPE_F64 );
-    psPolynomial1D *myPoly = psPolynomial1DAlloc( 2 );
+    psVector *x = psVectorAlloc(3, PS_TYPE_F64);
+    psVector *y = psVectorAlloc(3, PS_TYPE_F64);
+    psVector *yErr = psVectorAlloc(3, PS_TYPE_F64);
+    psPolynomial1D *myPoly = psPolynomial1DAlloc(2);
     psVector *cumulativeRobustSumsFullRange = NULL;
     psVector *cumulativeRobustSumsDlRange = NULL;
@@ -1210,23 +1143,23 @@
     // by computing the clipped standard deviation of the vector, and dividing
     // that by 10.0;
-    p_psVectorClippedStats( myVector, maskVector, maskVal, tmpStats );
+    p_psVectorClippedStats(myVector, maskVector, maskVal, tmpStats);
     binSize = tmpStats->clippedStdev / 10.0f;
 
     // If stats->clippedStdev == 0.0, then all data elements have the same
     // value.  Therefore, we can set the appropiate results and return.
-    if ( fabs( binSize ) <= FLT_EPSILON ) {
-        if ( stats->options & PS_STAT_ROBUST_MEAN ) {
+    if (fabs(binSize) <= FLT_EPSILON) {
+        if (stats->options & PS_STAT_ROBUST_MEAN) {
             stats->robustMean = stats->clippedMean;
         }
-        if ( stats->options & PS_STAT_ROBUST_MEDIAN ) {
+        if (stats->options & PS_STAT_ROBUST_MEDIAN) {
             stats->robustMedian = stats->clippedMean;
         }
-        if ( stats->options & PS_STAT_ROBUST_MODE ) {
+        if (stats->options & PS_STAT_ROBUST_MODE) {
             stats->robustMode = stats->clippedMean;
         }
-        if ( stats->options & PS_STAT_ROBUST_STDEV ) {
+        if (stats->options & PS_STAT_ROBUST_STDEV) {
             stats->robustStdev = 0.0;
         }
-        if ( stats->options & PS_STAT_ROBUST_QUARTILE ) {
+        if (stats->options & PS_STAT_ROBUST_QUARTILE) {
             stats->robustUQ = stats->clippedMean;
             stats->robustLQ = stats->clippedMean;
@@ -1235,32 +1168,27 @@
         stats->robustNfit = 0.0;
         stats->robustN50 = 0.0;
-        psFree( tmpStats );
-        return ;
-    }
-
+        psFree(tmpStats);
+        return;
+    }
     // Determine minimum and maximum values in the data vector.
-    if ( isnan( stats->min ) ) {
-        p_psVectorMin( myVector, maskVector, maskVal, stats );
-    }
-    if ( isnan( stats->max ) ) {
-        p_psVectorMax( myVector, maskVector, maskVal, stats );
-    }
-
+    if (isnan(stats->min)) {
+        p_psVectorMin(myVector, maskVector, maskVal, stats);
+    }
+    if (isnan(stats->max)) {
+        p_psVectorMax(myVector, maskVector, maskVal, stats);
+    }
     // Create the histogram structure.  NOTE: we can not specify the bin size
     // precisely since the argument to psHistogramAlloc() is the number of
     // bins, not the binSize.  Also, if we get here, we know that
     // binSize != 0.0.
-    numBins = ( int ) ( ( stats->max - stats->min ) / binSize );
-    robustHistogram = psHistogramAlloc( stats->min,
-                                        stats->max,
-                                        numBins );
+    numBins = (int)((stats->max - stats->min) / binSize);
+    robustHistogram = psHistogramAlloc(stats->min, stats->max, numBins);
 
     // Populate the histogram array.
-    psVectorHistogram( robustHistogram, myVector, maskVector, maskVal );
+    psVectorHistogram(robustHistogram, myVector, maskVector, maskVal);
 
     // Smooth the histogram.
     // XXX: is that the right stdev?
-    robustHistogramVector = p_psVectorsmoothHistGaussian( robustHistogram,
-                            tmpStats->clippedStdev / 4.0f );
+    robustHistogramVector = p_psVectorsmoothHistGaussian(robustHistogram, tmpStats->clippedStdev / 4.0f);
 
     // The following was necessary to fit a gaussian to the data, since
@@ -1274,17 +1202,16 @@
     // index position i is equal to the sum of bins 0:i.  This will be used
     // now and later in determining the lower/upper quartiles.
-    cumulativeRobustSumsFullRange = psVectorAlloc( robustHistogramVector->n, PS_TYPE_F32 );
-    cumulativeRobustSumsFullRange->data.F32[ 0 ] = robustHistogramVector->data.F32[ 0 ];
-    for ( i = 1;i < robustHistogramVector->n;i++ ) {
-        cumulativeRobustSumsFullRange->data.F32[ i ] =
-            cumulativeRobustSumsFullRange->data.F32[ i - 1 ] +
-            robustHistogramVector->data.F32[ i ];
-    }
-    sumRobust = cumulativeRobustSumsFullRange->data.F32[ robustHistogramVector->n - 1 ];
+    cumulativeRobustSumsFullRange = psVectorAlloc(robustHistogramVector->n, PS_TYPE_F32);
+    cumulativeRobustSumsFullRange->data.F32[0] = robustHistogramVector->data.F32[0];
+    for (i = 1; i < robustHistogramVector->n; i++) {
+        cumulativeRobustSumsFullRange->data.F32[i] =
+            cumulativeRobustSumsFullRange->data.F32[i - 1] + robustHistogramVector->data.F32[i];
+    }
+    sumRobust = cumulativeRobustSumsFullRange->data.F32[robustHistogramVector->n - 1];
 
     // Determine the bin number containing the lower quartile point.
     LQBinNum = -1;
-    for ( i = 0;i < cumulativeRobustSumsFullRange->n;i++ ) {
-        if ( cumulativeRobustSumsFullRange->data.F32[ i ] >= ( sumRobust / 4.0 ) ) {
+    for (i = 0; i < cumulativeRobustSumsFullRange->n; i++) {
+        if (cumulativeRobustSumsFullRange->data.F32[i] >= (sumRobust / 4.0)) {
             LQBinNum = i;
             break;
@@ -1294,6 +1221,6 @@
     // Determine the bin number containing the upper quartile point.
     UQBinNum = -1;
-    for ( i = cumulativeRobustSumsFullRange->n - 1;i >= 0;i-- ) {
-        if ( cumulativeRobustSumsFullRange->data.F32[ i ] <= ( 3.0 * sumRobust / 4.0 ) ) {
+    for (i = cumulativeRobustSumsFullRange->n - 1; i >= 0; i--) {
+        if (cumulativeRobustSumsFullRange->data.F32[i] <= (3.0 * sumRobust / 4.0)) {
             UQBinNum = i;
             break;
@@ -1301,8 +1228,8 @@
     }
 
-    if ( ( LQBinNum == -1 ) ||
-            ( UQBinNum == -1 ) ) {
-        psAbort( __func__, "Could not determine the robust lower/upper quartiles." );
-    }
+    if ((LQBinNum == -1) || (UQBinNum == -1)) {
+        psAbort(__func__, "Could not determine the robust lower/upper quartiles.");
+    }
+
     /**************************************************************************
     Determine the mode in the range LQ:UQ.
@@ -1310,35 +1237,34 @@
     // Determine the bin with the peak value in the range LQ to UQ.
     maxBinNum = LQBinNum;
-    maxBinCount = robustHistogramVector->data.F32[ LQBinNum ];
-    sumN50 = ( float ) robustHistogram->nums->data.S32[ LQBinNum ];
-    for ( i = LQBinNum + 1;i <= UQBinNum;i++ ) {
-        if ( robustHistogramVector->data.F32[ i ] > maxBinCount ) {
+    maxBinCount = robustHistogramVector->data.F32[LQBinNum];
+    sumN50 = (float)robustHistogram->nums->data.S32[LQBinNum];
+    for (i = LQBinNum + 1; i <= UQBinNum; i++) {
+        if (robustHistogramVector->data.F32[i] > maxBinCount) {
             maxBinNum = i;
-            maxBinCount = robustHistogramVector->data.F32[ i ];
-        }
-        sumN50 += ( float ) robustHistogram->nums->data.S32[ i ];
+            maxBinCount = robustHistogramVector->data.F32[i];
+        }
+        sumN50 += (float)robustHistogram->nums->data.S32[i];
     }
 
     // XXX: is dL defined as the value at the LQ/UQ, or the bin number?
-    dL = ( UQBinNum - LQBinNum ) / 4;
-
-    printf( "(LQBinNum, UQBinNum, maxBinNum) is (%d, %d, %d)\n", LQBinNum, UQBinNum, maxBinNum );
+    dL = (UQBinNum - LQBinNum) / 4;
+
+    printf("(LQBinNum, UQBinNum, maxBinNum) is (%d, %d, %d)\n", LQBinNum, UQBinNum, maxBinNum);
 
     /**************************************************************************
     Determine the mean/stdev for the bins in the range mode-dL to mode+dL
     **************************************************************************/
-    cumulativeRobustSumsDlRange = psVectorAlloc( robustHistogramVector->n, PS_TYPE_F32 );
-    for ( i = 0;i < robustHistogramVector->n;i++ ) {
-        cumulativeRobustSumsDlRange->data.F32[ i ] = 0.0;
+    cumulativeRobustSumsDlRange = psVectorAlloc(robustHistogramVector->n, PS_TYPE_F32);
+    for (i = 0; i < robustHistogramVector->n; i++) {
+        cumulativeRobustSumsDlRange->data.F32[i] = 0.0;
     }
     sumNfit = 0.0;
     cumulativeMedian = 0.0;
-    for ( i = maxBinNum - dL;i <= maxBinNum + dL;i++ ) {
-        if ( ( 0 <= i ) && ( i < robustHistogramVector->n ) ) {
-            cumulativeRobustSumsDlRange->data.F32[ i ] =
-                cumulativeRobustSumsDlRange->data.F32[ i - 1 ] +
-                robustHistogramVector->data.F32[ i ];
-            cumulativeMedian += robustHistogramVector->data.F32[ i ];
-            sumNfit += ( float ) robustHistogram->nums->data.S32[ i ];
+    for (i = maxBinNum - dL; i <= maxBinNum + dL; i++) {
+        if ((0 <= i) && (i < robustHistogramVector->n)) {
+            cumulativeRobustSumsDlRange->data.F32[i] =
+                cumulativeRobustSumsDlRange->data.F32[i - 1] + robustHistogramVector->data.F32[i];
+            cumulativeMedian += robustHistogramVector->data.F32[i];
+            sumNfit += (float)robustHistogram->nums->data.S32[i];
         }
     }
@@ -1348,10 +1274,9 @@
     // that bin (this is a non-exact approximation).
     myMean = 0.0;
-    for ( i = maxBinNum - dL;i <= maxBinNum + dL;i++ ) {
-        if ( ( 0 <= i ) && ( i < robustHistogramVector->n ) ) {
-            myMean += ( robustHistogramVector->data.F32[ i ] ) * 0.5 *
-                      ( robustHistogram->bounds->data.F32[ i + 1 ] +
-                        robustHistogram->bounds->data.F32[ i ] );
-            countFloat += robustHistogramVector->data.F32[ i ];
+    for (i = maxBinNum - dL; i <= maxBinNum + dL; i++) {
+        if ((0 <= i) && (i < robustHistogramVector->n)) {
+            myMean += (robustHistogramVector->data.F32[i]) * 0.5 *
+                      (robustHistogram->bounds->data.F32[i + 1] + robustHistogram->bounds->data.F32[i]);
+            countFloat += robustHistogramVector->data.F32[i];
         }
     }
@@ -1361,31 +1286,29 @@
     // mode-dL to mode+dL.  We use the midpoint of each bin as the mean for
     // that bin.
-    for ( i = maxBinNum - dL;i <= maxBinNum + dL;i++ ) {
-        if ( ( 0 <= i ) && ( i < robustHistogramVector->n ) ) {
-            diff = ( 0.5 * ( robustHistogram->bounds->data.F32[ i + 1 ] +
-                             robustHistogram->bounds->data.F32[ i ] ) ) - myMean;
-            sumSquares += diff * diff * robustHistogramVector->data.F32[ i ];
-            sumDiffs += diff * robustHistogramVector->data.F32[ i ];
-        }
-    }
-    myStdev = sqrt( ( sumSquares - ( sumDiffs * sumDiffs / countFloat ) ) / ( countFloat - 1 ) );
+    for (i = maxBinNum - dL; i <= maxBinNum + dL; i++) {
+        if ((0 <= i) && (i < robustHistogramVector->n)) {
+            diff = (0.5 * (robustHistogram->bounds->data.F32[i + 1] +
+                           robustHistogram->bounds->data.F32[i])) - myMean;
+            sumSquares += diff * diff * robustHistogramVector->data.F32[i];
+            sumDiffs += diff * robustHistogramVector->data.F32[i];
+        }
+    }
+    myStdev = sqrt((sumSquares - (sumDiffs * sumDiffs / countFloat)) / (countFloat - 1));
 
     /**************************************************************************
     Set the appropriate members in the output stats struct.
     **************************************************************************/
-    if ( stats->options & PS_STAT_ROBUST_MEAN ) {
+    if (stats->options & PS_STAT_ROBUST_MEAN) {
         stats->robustMean = myMean;
     }
 
-    if ( stats->options & PS_STAT_ROBUST_MODE ) {
+    if (stats->options & PS_STAT_ROBUST_MODE) {
         stats->robustMode = 0.5 *
-                            ( robustHistogram->bounds->data.F32[ maxBinNum ] +
-                              robustHistogram->bounds->data.F32[ maxBinNum + 1 ] );
-    }
-
-    if ( stats->options & PS_STAT_ROBUST_STDEV ) {
+                            (robustHistogram->bounds->data.F32[maxBinNum] + robustHistogram->bounds->data.F32[maxBinNum + 1]);
+    }
+
+    if (stats->options & PS_STAT_ROBUST_STDEV) {
         stats->robustStdev = myStdev;
     }
-
     // To determine the median (and later, the lower/upper quartile), we fit
     // a quadratic to the three bins surrounding the bin containing the median.
@@ -1394,49 +1317,46 @@
     // this bin.  We then solve the quadratic for
 
-    if ( stats->options & PS_STAT_ROBUST_MEDIAN ) {
-        if ( ( maxBinNum > 0 ) && ( maxBinNum < ( robustHistogram->nums->n - 1 ) ) ) {
-            x->data.F64[ 0 ] = ( double ) 0.5 *
-                               ( robustHistogram->bounds->data.F32[ maxBinNum - 1 ] +
-                                 robustHistogram->bounds->data.F32[ maxBinNum ] );
-            x->data.F64[ 1 ] = ( double ) 0.5 *
-                               ( robustHistogram->bounds->data.F32[ maxBinNum ] +
-                                 robustHistogram->bounds->data.F32[ maxBinNum + 1 ] );
-            x->data.F64[ 2 ] = ( double ) 0.5 *
-                               ( robustHistogram->bounds->data.F32[ maxBinNum + 1 ] +
-                                 robustHistogram->bounds->data.F32[ maxBinNum + 2 ] );
-
-            y->data.F64[ 0 ] = cumulativeRobustSumsDlRange->data.F32[ maxBinNum - 1 ];
-            y->data.F64[ 1 ] = cumulativeRobustSumsDlRange->data.F32[ maxBinNum ];
-            y->data.F64[ 2 ] = cumulativeRobustSumsDlRange->data.F32[ maxBinNum + 1 ];
+    if (stats->options & PS_STAT_ROBUST_MEDIAN) {
+        if ((maxBinNum > 0) && (maxBinNum < (robustHistogram->nums->n - 1))) {
+            x->data.F64[0] = (double)0.5 *
+                             (robustHistogram->bounds->data.F32[maxBinNum - 1] +
+                              robustHistogram->bounds->data.F32[maxBinNum]);
+            x->data.F64[1] = (double)0.5 *
+                             (robustHistogram->bounds->data.F32[maxBinNum] +
+                              robustHistogram->bounds->data.F32[maxBinNum + 1]);
+            x->data.F64[2] = (double)0.5 *
+                             (robustHistogram->bounds->data.F32[maxBinNum + 1] +
+                              robustHistogram->bounds->data.F32[maxBinNum + 2]);
+
+            y->data.F64[0] = cumulativeRobustSumsDlRange->data.F32[maxBinNum - 1];
+            y->data.F64[1] = cumulativeRobustSumsDlRange->data.F32[maxBinNum];
+            y->data.F64[2] = cumulativeRobustSumsDlRange->data.F32[maxBinNum + 1];
 
             // Ensure that cumulativeMedian/2 is actually within the range of the bins
             // we are using.
             cumulativeMedian *= 0.5;
-            if ( !( ( y->data.F64[ 0 ] <= cumulativeMedian ) &&
-                    ( cumulativeMedian <= y->data.F64[ 2 ] ) ) ) {
-                printf( "((%f), %f, %f)\n", cumulativeMedian, y->data.F64[ 0 ], y->data.F64[ 2 ] );
-                psAbort( __func__, "p_psVectorRobustStats(1): midpoint not within y-range\n" );
+            if (!((y->data.F64[0] <= cumulativeMedian) && (cumulativeMedian <= y->data.F64[2]))) {
+                printf("((%f), %f, %f)\n", cumulativeMedian, y->data.F64[0], y->data.F64[2]);
+                psAbort(__func__, "p_psVectorRobustStats(1): midpoint not within y-range\n");
             }
             // XXX: yErr is not currently used by psVectorFitPolynomial1D().  We
             // may have to set this meaningfully later.
-            yErr->data.F64[ 0 ] = 1.0;
-            yErr->data.F64[ 1 ] = 1.0;
-            yErr->data.F64[ 2 ] = 1.0;
+            yErr->data.F64[0] = 1.0;
+            yErr->data.F64[1] = 1.0;
+            yErr->data.F64[2] = 1.0;
 
             // Determine the coefficients of the polynomial.
-            myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
+            myPoly = psVectorFitPolynomial1D(myPoly, x, y, yErr);
             // Call p_ps1DPolyMedian(), which does a binary search on the
             // polynomial, looking for the value x such that
             // f(x) = cumulativeMedian.
-            stats->robustMedian = p_ps1DPolyMedian( myPoly, x->data.F64[ 0 ],
-                                                    x->data.F64[ 2 ], cumulativeMedian );
+            stats->robustMedian = p_ps1DPolyMedian(myPoly, x->data.F64[0], x->data.F64[2], cumulativeMedian);
         } else {
             // If the mode is the first/last histogram bin, then simply use
             // the midpoint of that bin.
-            stats->robustMedian = 0.5 * ( robustHistogram->bounds->data.F32[ maxBinNum + 1 ] +
-                                          robustHistogram->bounds->data.F32[ maxBinNum ] );
-        }
-    }
-
+            stats->robustMedian = 0.5 * (robustHistogram->bounds->data.F32[maxBinNum + 1] +
+                                         robustHistogram->bounds->data.F32[maxBinNum]);
+        }
+    }
     // The lower/upper quartile calculations are very similar to the median
     // calculations.  We fit a quadratic to the array containing the
@@ -1444,78 +1364,72 @@
     // f(x) equals the lower/upper quartile exactly.
     //
-    if ( stats->options & PS_STAT_ROBUST_QUARTILE ) {
-        countFloat = cumulativeRobustSumsFullRange->data.F32[ robustHistogramVector->n - 1 ];
-
-        if ( ( LQBinNum > 0 ) && ( LQBinNum < ( robustHistogram->nums->n - 1 ) ) ) {
-            x->data.F64[ 0 ] = ( double ) 0.5 *
-                               ( robustHistogram->bounds->data.F32[ LQBinNum - 1 ] +
-                                 robustHistogram->bounds->data.F32[ LQBinNum ] );
-            x->data.F64[ 1 ] = ( double ) 0.5 *
-                               ( robustHistogram->bounds->data.F32[ LQBinNum ] +
-                                 robustHistogram->bounds->data.F32[ LQBinNum + 1 ] );
-            x->data.F64[ 2 ] = ( double ) 0.5 *
-                               ( robustHistogram->bounds->data.F32[ LQBinNum + 1 ] +
-                                 robustHistogram->bounds->data.F32[ LQBinNum + 2 ] );
-
-            y->data.F64[ 0 ] = cumulativeRobustSumsFullRange->data.F32[ LQBinNum - 1 ];
-            y->data.F64[ 1 ] = cumulativeRobustSumsFullRange->data.F32[ LQBinNum ];
-            y->data.F64[ 2 ] = cumulativeRobustSumsFullRange->data.F32[ LQBinNum + 1 ];
-
-            if ( !( ( y->data.F64[ 0 ] <= ( countFloat / 4.0 ) ) &&
-                    ( ( countFloat / 4.0 ) <= y->data.F64[ 2 ] ) ) ) {
-                psAbort( __func__, "p_psVectorRobustStats(2): midpoint not within y-range\n" );
-            }
-
-            yErr->data.F64[ 0 ] = 1.0;
-            yErr->data.F64[ 1 ] = 1.0;
-            yErr->data.F64[ 2 ] = 1.0;
-
-            myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
-            stats->robustLQ = p_ps1DPolyMedian( myPoly,
-                                                x->data.F64[ 0 ],
-                                                x->data.F64[ 2 ],
-                                                countFloat / 4.0 );
+    if (stats->options & PS_STAT_ROBUST_QUARTILE) {
+        countFloat = cumulativeRobustSumsFullRange->data.F32[robustHistogramVector->n - 1];
+
+        if ((LQBinNum > 0) && (LQBinNum < (robustHistogram->nums->n - 1))) {
+            x->data.F64[0] = (double)0.5 *
+                             (robustHistogram->bounds->data.F32[LQBinNum - 1] +
+                              robustHistogram->bounds->data.F32[LQBinNum]);
+            x->data.F64[1] = (double)0.5 *
+                             (robustHistogram->bounds->data.F32[LQBinNum] +
+                              robustHistogram->bounds->data.F32[LQBinNum + 1]);
+            x->data.F64[2] = (double)0.5 *
+                             (robustHistogram->bounds->data.F32[LQBinNum + 1] +
+                              robustHistogram->bounds->data.F32[LQBinNum + 2]);
+
+            y->data.F64[0] = cumulativeRobustSumsFullRange->data.F32[LQBinNum - 1];
+            y->data.F64[1] = cumulativeRobustSumsFullRange->data.F32[LQBinNum];
+            y->data.F64[2] = cumulativeRobustSumsFullRange->data.F32[LQBinNum + 1];
+
+            if (!((y->data.F64[0] <= (countFloat / 4.0)) && ((countFloat / 4.0) <= y->data.F64[2]))) {
+                psAbort(__func__, "p_psVectorRobustStats(2): midpoint not within y-range\n");
+            }
+
+            yErr->data.F64[0] = 1.0;
+            yErr->data.F64[1] = 1.0;
+            yErr->data.F64[2] = 1.0;
+
+            myPoly = psVectorFitPolynomial1D(myPoly, x, y, yErr);
+            stats->robustLQ = p_ps1DPolyMedian(myPoly, x->data.F64[0], x->data.F64[2], countFloat / 4.0);
 
         } else {
             // If the LQ is the first/last histogram bin, then simply use
             // the midpoint of that bin.
-            stats->robustLQ = 0.5 * ( robustHistogram->bounds->data.F32[ LQBinNum + 1 ] +
-                                      robustHistogram->bounds->data.F32[ LQBinNum ] );
-        }
-
-        if ( ( UQBinNum > 0 ) && ( UQBinNum < ( robustHistogram->nums->n - 1 ) ) ) {
-            x->data.F64[ 0 ] = ( double ) 0.5 *
-                               ( robustHistogram->bounds->data.F32[ UQBinNum - 1 ] +
-                                 robustHistogram->bounds->data.F32[ UQBinNum ] );
-            x->data.F64[ 1 ] = ( double ) 0.5 *
-                               ( robustHistogram->bounds->data.F32[ UQBinNum ] +
-                                 robustHistogram->bounds->data.F32[ UQBinNum + 1 ] );
-            x->data.F64[ 2 ] = ( double ) 0.5 *
-                               ( robustHistogram->bounds->data.F32[ UQBinNum + 1 ] +
-                                 robustHistogram->bounds->data.F32[ UQBinNum + 2 ] );
-
-            y->data.F64[ 0 ] = cumulativeRobustSumsFullRange->data.F32[ UQBinNum - 1 ];
-            y->data.F64[ 1 ] = cumulativeRobustSumsFullRange->data.F32[ UQBinNum ];
-            y->data.F64[ 2 ] = cumulativeRobustSumsFullRange->data.F32[ UQBinNum + 1 ];
-
-            if ( !( ( y->data.F64[ 0 ] <= ( 3.0 * countFloat / 4.0 ) ) &&
-                    ( ( 3.0 * countFloat / 4.0 ) <= y->data.F64[ 2 ] ) ) ) {
-                psAbort( __func__, "p_psVectorRobustStats(3): midpoint not within y-range\n" );
-            }
-
-            yErr->data.F64[ 0 ] = 1.0;
-            yErr->data.F64[ 1 ] = 1.0;
-            yErr->data.F64[ 2 ] = 1.0;
-
-            myPoly = psVectorFitPolynomial1D( myPoly, x, y, yErr );
-            stats->robustUQ = p_ps1DPolyMedian( myPoly,
-                                                x->data.F64[ 0 ],
-                                                x->data.F64[ 2 ],
-                                                3.0 * countFloat / 4.0 );
+            stats->robustLQ = 0.5 * (robustHistogram->bounds->data.F32[LQBinNum + 1] +
+                                     robustHistogram->bounds->data.F32[LQBinNum]);
+        }
+
+        if ((UQBinNum > 0) && (UQBinNum < (robustHistogram->nums->n - 1))) {
+            x->data.F64[0] = (double)0.5 *
+                             (robustHistogram->bounds->data.F32[UQBinNum - 1] +
+                              robustHistogram->bounds->data.F32[UQBinNum]);
+            x->data.F64[1] = (double)0.5 *
+                             (robustHistogram->bounds->data.F32[UQBinNum] +
+                              robustHistogram->bounds->data.F32[UQBinNum + 1]);
+            x->data.F64[2] = (double)0.5 *
+                             (robustHistogram->bounds->data.F32[UQBinNum + 1] +
+                              robustHistogram->bounds->data.F32[UQBinNum + 2]);
+
+            y->data.F64[0] = cumulativeRobustSumsFullRange->data.F32[UQBinNum - 1];
+            y->data.F64[1] = cumulativeRobustSumsFullRange->data.F32[UQBinNum];
+            y->data.F64[2] = cumulativeRobustSumsFullRange->data.F32[UQBinNum + 1];
+
+            if (!((y->data.F64[0] <= (3.0 * countFloat / 4.0)) &&
+                    ((3.0 * countFloat / 4.0) <= y->data.F64[2]))) {
+                psAbort(__func__, "p_psVectorRobustStats(3): midpoint not within y-range\n");
+            }
+
+            yErr->data.F64[0] = 1.0;
+            yErr->data.F64[1] = 1.0;
+            yErr->data.F64[2] = 1.0;
+
+            myPoly = psVectorFitPolynomial1D(myPoly, x, y, yErr);
+            stats->robustUQ = p_ps1DPolyMedian(myPoly,
+                                               x->data.F64[0], x->data.F64[2], 3.0 * countFloat / 4.0);
         } else {
             // If the UQ is the first/last histogram bin, then simply use
             // the midpoint of that bin.
-            stats->robustUQ = 0.5 * ( robustHistogram->bounds->data.F32[ UQBinNum + 1 ] +
-                                      robustHistogram->bounds->data.F32[ UQBinNum ] );
+            stats->robustUQ = 0.5 * (robustHistogram->bounds->data.F32[UQBinNum + 1] +
+                                     robustHistogram->bounds->data.F32[UQBinNum]);
         }
     }
@@ -1523,15 +1437,13 @@
     stats->robustN50 = sumN50;
 
-    psFree( x );
-    psFree( y );
-    psFree( yErr );
-    psFree( tmpStats );
-    psFree( robustHistogram );
-    psFree( myPoly );
-    psFree( cumulativeRobustSumsFullRange );
-    psFree( cumulativeRobustSumsDlRange );
-}
-
-
+    psFree(x);
+    psFree(y);
+    psFree(yErr);
+    psFree(tmpStats);
+    psFree(robustHistogram);
+    psFree(myPoly);
+    psFree(cumulativeRobustSumsFullRange);
+    psFree(cumulativeRobustSumsDlRange);
+}
 
 /*
@@ -1582,19 +1494,20 @@
 */
 
-
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
+
 /*****************************************************************************/
 
-static void histogramFree( psHistogram *myHist );
+static void histogramFree(psHistogram * myHist);
 
 /******************************************************************************
     psStatsAlloc(): This routine must create a new psStats data structure.
  *****************************************************************************/
-psStats *psStatsAlloc( psStatsOptions options )
-{
-    psStats * newStruct = NULL;
-
-    newStruct = ( psStats * ) psAlloc( sizeof( psStats ) );
+psStats *psStatsAlloc(psStatsOptions options)
+{
+    psStats *newStruct = NULL;
+
+    newStruct = (psStats *) psAlloc(sizeof(psStats));
     newStruct->sampleMean = NAN;
     newStruct->sampleMedian = NAN;
@@ -1620,5 +1533,5 @@
     newStruct->options = options;
 
-    return ( newStruct );
+    return (newStruct);
 }
 
@@ -1635,46 +1548,42 @@
     The histogram structure
  *****************************************************************************/
-psHistogram *psHistogramAlloc( float lower,
-                               float upper,
-                               int n )
-{
-    int i = 0;                          // Loop index variable
+psHistogram *psHistogramAlloc(float lower, float upper, int n)
+{
+    int i = 0;                  // Loop index variable
     psHistogram *newHist = NULL;        // The new histogram structure
-    float binSize = 0.0;                // The histogram bin size
+    float binSize = 0.0;        // The histogram bin size
 
     // NOTE: Verify that this is the correct action.
-    if ( n == 0 ) {
-        return ( NULL );
-    }
-    if ( n < 0 ) {
-        psAbort( __func__, "psHistogramAlloc() called with bin size %d.\n", n );
-    }
-
+    if (n == 0) {
+        return (NULL);
+    }
+    if (n < 0) {
+        psAbort(__func__, "psHistogramAlloc() called with bin size %d.\n", n);
+    }
     // NOTE: Verify that this is the correct action.
-    if ( lower > upper ) {
-        return ( NULL );
-    }
-
+    if (lower > upper) {
+        return (NULL);
+    }
     // Allocate memory for the new histogram structure.  If there are N
     // bins, then there are N+1 bounds to those bins.
-    newHist = ( psHistogram * ) psAlloc( sizeof( psHistogram ) );
-    p_psMemSetDeallocator( newHist, ( psFreeFcn ) histogramFree );
-    newHist->bounds = psVectorAlloc( n + 1, PS_TYPE_F32 );
+    newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
+    p_psMemSetDeallocator(newHist, (psFreeFcn) histogramFree);
+    newHist->bounds = psVectorAlloc(n + 1, PS_TYPE_F32);
     newHist->bounds->n = newHist->bounds->nalloc;
 
     // Calculate the bounds for each bin.
-    binSize = ( upper - lower ) / ( float ) n;
-    // NOTE: Is the following necessary?  It prevents the max data point
+    binSize = (upper - lower) / (float)n;
+    // NOTE: Is the following necessary? It prevents the max data point
     // from being in a non-existant bin.
     binSize += FLT_EPSILON;
-    for ( i = 0;i < n + 1;i++ ) {
-        newHist->bounds->data.F32[ i ] = lower + ( binSize * ( float ) i );
+    for (i = 0; i < n + 1; i++) {
+        newHist->bounds->data.F32[i] = lower + (binSize * (float)i);
     }
 
     // Allocate the bins, and initialize them to zero.
-    newHist->nums = psVectorAlloc( n, PS_TYPE_U32 );
+    newHist->nums = psVectorAlloc(n, PS_TYPE_U32);
     newHist->nums->n = newHist->nums->nalloc;
-    for ( i = 0;i < newHist->nums->n;i++ ) {
-        newHist->nums->data.U32[ i ] = 0;
+    for (i = 0; i < newHist->nums->n; i++) {
+        newHist->nums->data.U32[i] = 0;
     }
 
@@ -1684,5 +1593,5 @@
     newHist->uniform = true;
 
-    return ( newHist );
+    return (newHist);
 }
 
@@ -1696,41 +1605,39 @@
     The histogram structure
  *****************************************************************************/
-psHistogram *psHistogramAllocGeneric( const psVector *restrict bounds )
-{
-    psHistogram * newHist = NULL;        // The new histogram structure
-    int i;                              // Loop index variable
+psHistogram *psHistogramAllocGeneric(const psVector * restrict bounds)
+{
+    psHistogram *newHist = NULL;        // The new histogram structure
+    int i;                      // Loop index variable
 
     // NOTE: Verify that this is the correct action.
-    if ( bounds == NULL ) {
+    if (bounds == NULL) {
         // psAbort(__func__, "psHistogram requested with NULL bounds");
-        return ( NULL );
-    }
-
+        return (NULL);
+    }
     // NOTE: Verify that this is the correct action.
-    if ( bounds->n <= 1 ) {
+    if (bounds->n <= 1) {
         // psAbort(__func__, "psHistogram requested with NULL bounds");
-        return ( NULL );
-    }
-
-    if ( bounds->type.type != PS_TYPE_F32 ) {
+        return (NULL);
+    }
+
+    if (bounds->type.type != PS_TYPE_F32) {
         // psAbort(__func__, "psHistogram request a bound which is not type F32");
-        return ( NULL );
-    }
-
+        return (NULL);
+    }
     // Allocate memory for the new histogram structure.
-    newHist = ( psHistogram * ) psAlloc( sizeof( psHistogram ) );
-    p_psMemSetDeallocator( newHist, ( psFreeFcn ) histogramFree );
-    newHist->bounds = psVectorAlloc( bounds->n, PS_TYPE_F32 );
+    newHist = (psHistogram *) psAlloc(sizeof(psHistogram));
+    p_psMemSetDeallocator(newHist, (psFreeFcn) histogramFree);
+    newHist->bounds = psVectorAlloc(bounds->n, PS_TYPE_F32);
     newHist->bounds->n = newHist->bounds->nalloc;
-    for ( i = 0;i < bounds->n;i++ ) {
-        newHist->bounds->data.F32[ i ] = bounds->data.F32[ i ];
+    for (i = 0; i < bounds->n; i++) {
+        newHist->bounds->data.F32[i] = bounds->data.F32[i];
     }
 
     // Allocate the bins, and initialize them to zero.  If there are N bounds,
     // then there are N-1 bins.
-    newHist->nums = psVectorAlloc( ( bounds->n ) - 1, PS_TYPE_U32 );
+    newHist->nums = psVectorAlloc((bounds->n) - 1, PS_TYPE_U32);
     newHist->nums->n = newHist->nums->nalloc;
-    for ( i = 0;i < newHist->nums->n;i++ ) {
-        newHist->nums->data.U32[ i ] = 0;
+    for (i = 0; i < newHist->nums->n; i++) {
+        newHist->nums->data.U32[i] = 0;
     }
 
@@ -1740,13 +1647,12 @@
     newHist->uniform = false;
 
-    return ( newHist );
-}
-
-static void histogramFree( psHistogram *myHist )
-{
-    psFree( myHist->bounds );
-    psFree( myHist->nums );
-}
-
+    return (newHist);
+}
+
+static void histogramFree(psHistogram * myHist)
+{
+    psFree(myHist->bounds);
+    psFree(myHist->nums);
+}
 
 /*****************************************************************************
@@ -1764,49 +1670,41 @@
     The histogram structure "out".
  *****************************************************************************/
-psHistogram *psVectorHistogram( psHistogram *out,
-                                const psVector *restrict in,
-                                const psVector *restrict mask,
-                                unsigned int maskVal )
-{
-    int i = 0;                                  // Loop index variable
-    int j = 0;                                  // Loop index variable
-    float binSize = 0.0;                        // Histogram bin size
-    int binNum = 0;                             // A temporary bin number
-    int numBins = 0;                            // The total number of bins
+psHistogram *psVectorHistogram(psHistogram * out,
+                               const psVector * restrict in,
+                               const psVector * restrict mask, unsigned int maskVal)
+{
+    int i = 0;                  // Loop index variable
+    int j = 0;                  // Loop index variable
+    float binSize = 0.0;        // Histogram bin size
+    int binNum = 0;             // A temporary bin number
+    int numBins = 0;            // The total number of bins
 
     // NOTE: Verify that this is the correct action.
-    if ( out == NULL ) {
-        return ( NULL );
-    }
-
+    if (out == NULL) {
+        return (NULL);
+    }
     // Check the specified output histogram for type psF32
-    if ( out->bounds->type.type != PS_TYPE_F32 ) {
-        psAbort( __func__,
-                 "Only data type PS_TYPE_F32 for the output.bounds member." );
-    }
-
-    if ( out->nums->type.type != PS_TYPE_U32 ) {
-        psAbort( __func__,
-                 "Only data type PS_TYPE_U32 for output.nums member." );
-    }
-
+    if (out->bounds->type.type != PS_TYPE_F32) {
+        psAbort(__func__, "Only data type PS_TYPE_F32 for the output.bounds member.");
+    }
+
+    if (out->nums->type.type != PS_TYPE_U32) {
+        psAbort(__func__, "Only data type PS_TYPE_U32 for output.nums member.");
+    }
     // NOTE: Verify that this is the correct action.
-    if ( in == NULL ) {
-        return ( out );
-    }
-
-    if ( in->type.type != PS_TYPE_F32 ) {
-        psAbort( __func__,
-                 "Only data type PS_TYPE_F32 is currently supported (0x%x).",
-                 in->type.type );
-    }
-
-    if ( mask != NULL ) {
-        if ( in->n != mask->n ) {
-            psAbort( __func__,
-                     "Vector data and vector mask are of different sizes." );
-        }
-        if ( mask->type.type != PS_TYPE_U8 ) {
-            psAbort( __func__, "Vector mask must be type PS_TYPE_U8" );
+    if (in == NULL) {
+        return (out);
+    }
+
+    if (in->type.type != PS_TYPE_F32) {
+        psAbort(__func__, "Only data type PS_TYPE_F32 is currently supported (0x%x).", in->type.type);
+    }
+
+    if (mask != NULL) {
+        if (in->n != mask->n) {
+            psAbort(__func__, "Vector data and vector mask are of different sizes.");
+        }
+        if (mask->type.type != PS_TYPE_U8) {
+            psAbort(__func__, "Vector mask must be type PS_TYPE_U8");
         }
     }
@@ -1815,50 +1713,47 @@
 
     numBins = out->nums->n;
-    for ( i = 0;i < in->n;i++ ) {
+    for (i = 0; i < in->n; i++) {
         // Check if this pixel is masked, and if so, skip it.
-        if ( ( mask == NULL ) ||
-                ( ( mask != NULL ) && ( !( mask->data.U8[ i ] & maskVal ) ) ) ) {
+        if ((mask == NULL) || ((mask != NULL) && (!(mask->data.U8[i] & maskVal)))) {
             // Check if this pixel is below the minimum value, and if so
             // count it, then skip it.
-            if ( in->data.F32[ i ] < out->bounds->data.F32[ 0 ] ) {
+            if (in->data.F32[i] < out->bounds->data.F32[0]) {
                 out->minNum++;
                 // Check if this pixel is above the maximum value, and if so
                 // count it, then skip it.
-            } else
-                if ( in->data.F32[ i ] > out->bounds->data.F32[ numBins ] ) {
-                    out->maxNum++;
+            } else if (in->data.F32[i] > out->bounds->data.F32[numBins]) {
+                out->maxNum++;
+            } else {
+                // If this is a uniform histogram, determining the correct
+                // number is trivial.
+                if (out->uniform == true) {
+                    binSize = out->bounds->data.F32[1] - out->bounds->data.F32[0];
+                    binNum = (int)((in->data.F32[i] - out->bounds->data.F32[0]) / binSize);
+
+                    // NOTE: This next if-statement really shouldn't be necessary.
+                    // However, do to numerical lack of precision, we occasionally
+                    // produce a binNum outside the range of bins.
+                    if (binNum >= out->nums->n) {
+                        binNum = out->nums->n - 1;
+                    }
+
+                    (out->nums->data.S32[binNum])++;
+
+                    // If this is a non-uniform histogram, determining the correct
+                    // bin number requires a bit more work.
                 } else {
-                    // If this is a uniform histogram, determining the correct
-                    // number is trivial.
-                    if ( out->uniform == true ) {
-                        binSize = out->bounds->data.F32[ 1 ] - out->bounds->data.F32[ 0 ];
-                        binNum = ( int ) ( ( in->data.F32[ i ] - out->bounds->data.F32[ 0 ] ) /
-                                           binSize );
-
-                        // NOTE: This next if-statement really shouldn't be necessary.
-                        // However, do to numerical lack of precision, we occasionally
-                        // produce a binNum outside the range of bins.
-                        if ( binNum >= out->nums->n ) {
-                            binNum = out->nums->n - 1;
-                        }
-
-                        ( out->nums->data.S32[ binNum ] ) ++;
-
-                        // If this is a non-uniform histogram, determining the correct
-                        // bin number requires a bit more work.
-                    } else {
-                        // NOTE: This is slow.  Put a smarter algorithm here to
-                        // find the correct bin number (bin search, probably)
-                        for ( j = 0;j < ( out->bounds->n ) - 1;j++ ) {
-                            if ( ( out->bounds->data.S32[ j ] <= in->data.F32[ i ] ) &&
-                                    ( in->data.F32[ i ] <= out->bounds->data.S32[ j + 1 ] ) ) {
-                                ( out->nums->data.S32[ j ] ) ++;
-                            }
+                    // NOTE: This is slow.  Put a smarter algorithm here to
+                    // find the correct bin number (bin search, probably)
+                    for (j = 0; j < (out->bounds->n) - 1; j++) {
+                        if ((out->bounds->data.S32[j] <= in->data.F32[i]) &&
+                                (in->data.F32[i] <= out->bounds->data.S32[j + 1])) {
+                            (out->nums->data.S32[j])++;
                         }
                     }
                 }
-        }
-    }
-    return ( out );
+            }
+        }
+    }
+    return (out);
 }
 
@@ -1872,38 +1767,31 @@
 the various stat functions.
  *****************************************************************************/
-psVector *p_psConvertToF32( psStats *stats,
-                            psVector *in,
-                            psVector *mask,
-                            unsigned int maskVal )
+psVector *p_psConvertToF32(psStats * stats, psVector * in, psVector * mask, unsigned int maskVal)
 {
     int i = 0;
     psVector *tmp = NULL;
 
-    if ( in->type.type == PS_TYPE_S32 ) {
-        tmp = psVectorAlloc( in->n, PS_TYPE_F32 );
-        for ( i = 0;i < in->n;i++ ) {
-            tmp->data.F32[ i ] = ( float ) in->data.S32[ i ];
-        }
-    } else
-        if ( in->type.type == PS_TYPE_U32 ) {
-            tmp = psVectorAlloc( in->n, PS_TYPE_F32 );
-            for ( i = 0;i < in->n;i++ ) {
-                tmp->data.F32[ i ] = ( float ) in->data.U32[ i ];
-            }
-        } else
-            if ( in->type.type == PS_TYPE_F64 ) {
-                tmp = psVectorAlloc( in->n, PS_TYPE_F32 );
-                for ( i = 0;i < in->n;i++ ) {
-                    tmp->data.F32[ i ] = ( float ) in->data.F64[ i ];
-                }
-            } else
-                if ( in->type.type == PS_TYPE_F32 ) {
-                    // do nothing
-                } else {
-                    psAbort( __func__, "unsupported vector type 0x%x\n", in->type.type );
-                }
-    return ( tmp );
-}
-
+    if (in->type.type == PS_TYPE_S32) {
+        tmp = psVectorAlloc(in->n, PS_TYPE_F32);
+        for (i = 0; i < in->n; i++) {
+            tmp->data.F32[i] = (float)in->data.S32[i];
+        }
+    } else if (in->type.type == PS_TYPE_U32) {
+        tmp = psVectorAlloc(in->n, PS_TYPE_F32);
+        for (i = 0; i < in->n; i++) {
+            tmp->data.F32[i] = (float)in->data.U32[i];
+        }
+    } else if (in->type.type == PS_TYPE_F64) {
+        tmp = psVectorAlloc(in->n, PS_TYPE_F32);
+        for (i = 0; i < in->n; i++) {
+            tmp->data.F32[i] = (float)in->data.F64[i];
+        }
+    } else if (in->type.type == PS_TYPE_F32) {
+        // do nothing
+    } else {
+        psAbort(__func__, "unsupported vector type 0x%x\n", in->type.type);
+    }
+    return (tmp);
+}
 
 /******************************************************************************
@@ -1924,93 +1812,77 @@
 macro-ize everything and add PS_TYPE_U16 and PS_TYPE_F64.
  *****************************************************************************/
-psStats *psVectorStats( psStats *stats,
-                        psVector *in,
-                        psVector *mask,
-                        unsigned int maskVal )
-{
-    psVector * inF32;
+psStats *psVectorStats(psStats * stats, psVector * in, psVector * mask, unsigned int maskVal)
+{
+    psVector *inF32;
     int mustFreeTmp = 1;
 
     // NOTE: Verify that this is the correct action.
-    if ( in == NULL ) {
-        return ( stats );
-    }
-    if ( stats == NULL ) {
-        return ( NULL );
-    }
-
-    inF32 = p_psConvertToF32( stats, in, mask, maskVal );
-    if ( inF32 == NULL ) {
+    if (in == NULL) {
+        return (stats);
+    }
+    if (stats == NULL) {
+        return (NULL);
+    }
+
+    inF32 = p_psConvertToF32(stats, in, mask, maskVal);
+    if (inF32 == NULL) {
         inF32 = in;
         mustFreeTmp = 0;
     }
-
     // XXX: Should we abort if (stats->min == stats->max)?
-    if ( ( stats->options & PS_STAT_USE_RANGE ) &&
-            ( stats->min >= stats->max ) ) {
-        psAbort( __func__, "psVectorStats() called with range: %f to %f\n",
-                 stats->min, stats->max );
-    }
-
-    //    PS_CHECK_VECTOR_TYPE(in, PS_TYPE_F32);
-    if ( mask != NULL ) {
-        PS_CHECK_NULL_VECTOR( mask );
-        PS_CHECK_EMPTY_VECTOR( mask );
-        PS_CHECK_VECTOR_SIZE_EQUAL( mask, in );
-        PS_CHECK_VECTOR_TYPE( mask, PS_TYPE_U8 );
-    }
-
+    if ((stats->options & PS_STAT_USE_RANGE) && (stats->min >= stats->max)) {
+        psAbort(__func__, "psVectorStats() called with range: %f to %f\n", stats->min, stats->max);
+    }
+    // PS_CHECK_VECTOR_TYPE(in, PS_TYPE_F32);
+    if (mask != NULL) {
+        PS_CHECK_NULL_VECTOR(mask);
+        PS_CHECK_EMPTY_VECTOR(mask);
+        PS_CHECK_VECTOR_SIZE_EQUAL(mask, in);
+        PS_CHECK_VECTOR_TYPE(mask, PS_TYPE_U8);
+    }
     // ************************************************************************
-    if ( stats->options & PS_STAT_SAMPLE_MEAN ) {
-        p_psVectorSampleMean( in, mask, maskVal, stats );
-    }
-
+    if (stats->options & PS_STAT_SAMPLE_MEAN) {
+        p_psVectorSampleMean(in, mask, maskVal, stats);
+    }
     // ************************************************************************
-    if ( stats->options & PS_STAT_SAMPLE_MEDIAN ) {
-        p_psVectorSampleMedian( in, mask, maskVal, stats );
-    }
-
+    if (stats->options & PS_STAT_SAMPLE_MEDIAN) {
+        p_psVectorSampleMedian(in, mask, maskVal, stats);
+    }
     // ************************************************************************
     // NOTE: The Stdev calculation requires the mean.  Should we assume the
-    // mean has already been calculated?  Or should we always calculate it?
-    if ( stats->options & PS_STAT_SAMPLE_STDEV ) {
-        p_psVectorSampleMean( in, mask, maskVal, stats );
-        p_psVectorSampleStdev( in, mask, maskVal, stats );
-    }
-
+    // mean has already been calculated? Or should we always calculate it?
+    if (stats->options & PS_STAT_SAMPLE_STDEV) {
+        p_psVectorSampleMean(in, mask, maskVal, stats);
+        p_psVectorSampleStdev(in, mask, maskVal, stats);
+    }
     // ************************************************************************
-    if ( stats->options & PS_STAT_SAMPLE_QUARTILE ) {
-        p_psVectorSampleQuartiles( in, mask, maskVal, stats );
-    }
-
+    if (stats->options & PS_STAT_SAMPLE_QUARTILE) {
+        p_psVectorSampleQuartiles(in, mask, maskVal, stats);
+    }
     // Since the various robust stats quantities share much computation, they
     // are grouped together in a single private function:
     // p_psVectorRobustStats()
-    if ( ( stats->options & PS_STAT_ROBUST_MEAN ) ||
-            ( stats->options & PS_STAT_ROBUST_MEDIAN ) ||
-            ( stats->options & PS_STAT_ROBUST_MODE ) ||
-            ( stats->options & PS_STAT_ROBUST_STDEV ) ||
-            ( stats->options & PS_STAT_ROBUST_QUARTILE ) ) {
-        p_psVectorRobustStats( in, mask, maskVal, stats );
-    }
-
-    if ( ( stats->options & PS_STAT_CLIPPED_MEAN ) ||
-            ( stats->options & PS_STAT_CLIPPED_STDEV ) ) {
-        p_psVectorClippedStats( in, mask, maskVal, stats );
-    }
-
+    if ((stats->options & PS_STAT_ROBUST_MEAN) ||
+            (stats->options & PS_STAT_ROBUST_MEDIAN) ||
+            (stats->options & PS_STAT_ROBUST_MODE) ||
+            (stats->options & PS_STAT_ROBUST_STDEV) || (stats->options & PS_STAT_ROBUST_QUARTILE)) {
+        p_psVectorRobustStats(in, mask, maskVal, stats);
+    }
+
+    if ((stats->options & PS_STAT_CLIPPED_MEAN) || (stats->options & PS_STAT_CLIPPED_STDEV)) {
+        p_psVectorClippedStats(in, mask, maskVal, stats);
+    }
     // ************************************************************************
-    if ( stats->options & PS_STAT_MAX ) {
-        p_psVectorMax( in, mask, maskVal, stats );
-    }
-
+    if (stats->options & PS_STAT_MAX) {
+        p_psVectorMax(in, mask, maskVal, stats);
+    }
     // ************************************************************************
-    if ( stats->options & PS_STAT_MIN ) {
-        p_psVectorMin( in, mask, maskVal, stats );
-    }
-
-    if ( mustFreeTmp == 1 ) {
-        psFree( inF32 );
-    }
-    return ( stats );
-}
+    if (stats->options & PS_STAT_MIN) {
+        p_psVectorMin(in, mask, maskVal, stats);
+    }
+
+    if (mustFreeTmp == 1) {
+        psFree(inF32);
+    }
+    return (stats);
+}
Index: /trunk/psLib/src/math/psStats.h
===================================================================
--- /trunk/psLib/src/math/psStats.h	(revision 1406)
+++ /trunk/psLib/src/math/psStats.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psStats.h
  *  \brief basic statistical operations
@@ -9,13 +10,13 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
 #if !defined(PS_STATS_H)
-#define PS_STATS_H
+#    define PS_STATS_H
 
-#include "psVector.h"
+#    include "psVector.h"
 
 /// @addtogroup Stats
@@ -26,22 +27,21 @@
  *****************************************************************************/
 typedef enum {
-    PS_STAT_SAMPLE_MEAN           = 0x000001,
-    PS_STAT_SAMPLE_MEDIAN         = 0x000002,
-    PS_STAT_SAMPLE_STDEV          = 0x000004,
-    PS_STAT_SAMPLE_QUARTILE       = 0x000008,
-    PS_STAT_ROBUST_MEAN           = 0x000010,
-    PS_STAT_ROBUST_MEDIAN         = 0x000020,
-    PS_STAT_ROBUST_MODE           = 0x000040,
-    PS_STAT_ROBUST_STDEV          = 0x000080,
-    PS_STAT_ROBUST_QUARTILE       = 0x000100,
-    PS_STAT_CLIPPED_MEAN          = 0x000200,
-    PS_STAT_CLIPPED_STDEV         = 0x000400,
-    PS_STAT_MAX                   = 0x000800,
-    PS_STAT_MIN                   = 0x001000,
-    PS_STAT_USE_RANGE             = 0x002000,
-    PS_STAT_USE_BINSIZE           = 0x004000,
-    PS_STAT_ROBUST_FOR_SAMPLE     = 0x008000
+    PS_STAT_SAMPLE_MEAN = 0x000001,
+    PS_STAT_SAMPLE_MEDIAN = 0x000002,
+    PS_STAT_SAMPLE_STDEV = 0x000004,
+    PS_STAT_SAMPLE_QUARTILE = 0x000008,
+    PS_STAT_ROBUST_MEAN = 0x000010,
+    PS_STAT_ROBUST_MEDIAN = 0x000020,
+    PS_STAT_ROBUST_MODE = 0x000040,
+    PS_STAT_ROBUST_STDEV = 0x000080,
+    PS_STAT_ROBUST_QUARTILE = 0x000100,
+    PS_STAT_CLIPPED_MEAN = 0x000200,
+    PS_STAT_CLIPPED_STDEV = 0x000400,
+    PS_STAT_MAX = 0x000800,
+    PS_STAT_MIN = 0x001000,
+    PS_STAT_USE_RANGE = 0x002000,
+    PS_STAT_USE_BINSIZE = 0x004000,
+    PS_STAT_ROBUST_FOR_SAMPLE = 0x008000
 } psStatsOptions;
-
 
 /** This is the generic statistics structure.  It contails the data members
@@ -50,80 +50,74 @@
 typedef struct
 {
-    double sampleMean;          ///< formal mean of sample
-    double sampleMedian;        ///< formal median of sample
-    double sampleStdev;         ///< standard deviation of sample
-    double sampleUQ;            ///< upper quartile of sample
-    double sampleLQ;            ///< lower quartile of sample
-    double sampleLimit;         ///<
-    double robustMean;          ///< robust mean of array
-    double robustMedian;        ///< robust median of array
-    double robustMode;          ///< Robust mode of array
-    double robustStdev;         ///< robust standard deviation of array
-    double robustUQ;            ///< robust upper quartile
-    double robustLQ;            ///< robust lower quartile
+    double sampleMean;          // /< formal mean of sample
+    double sampleMedian;        // /< formal median of sample
+    double sampleStdev;         // /< standard deviation of sample
+    double sampleUQ;            // /< upper quartile of sample
+    double sampleLQ;            // /< lower quartile of sample
+    double sampleLimit;         // /<
+    double robustMean;          // /< robust mean of array
+    double robustMedian;        // /< robust median of array
+    double robustMode;          // /< Robust mode of array
+    double robustStdev;         // /< robust standard deviation of array
+    double robustUQ;            // /< robust upper quartile
+    double robustLQ;            // /< robust lower quartile
     double XXX;
-    double robustN50;           ///<
-    double robustNfit;          ///<
-    double clippedMean;         ///< Nsigma clipped mean
-    double clippedStdev;        ///< standard deviation after clipping
-    double clipSigma;           ///< Nsigma used for clipping; user input
-    int    clipIter;            ///< Number of clipping iterations; user input
-    double min;                 ///< minimum data value in array
-    double max;                 ///< maximum data value in array
-    double binsize;             ///<
-    psStatsOptions options;     ///< bitmask of calculated values
+    double robustN50;           // /<
+    double robustNfit;          // /<
+    double clippedMean;         // /< Nsigma clipped mean
+    double clippedStdev;        // /< standard deviation after clipping
+    double clipSigma;           // /< Nsigma used for clipping; user input
+    int clipIter;               // /< Number of clipping iterations; user input
+    double min;                 // /< minimum data value in array
+    double max;                 // /< maximum data value in array
+    double binsize;             // /<
+    psStatsOptions options;     // /< bitmask of calculated values
 }
 psStats;
 
-
 /** Do Statistics on an array.  Returns a status value. \ingroup MathGroup */
-psStats *
-psVectorStats(psStats *stats,       ///< stats structure defines stats to be calculated and how
-              psVector *in,         ///< Vector to be analysed: must be F32
-              psVector *mask,       ///< Ignore elements where (maskVector & maskVal) != 0: must be INT or NULL
-              unsigned int maskVal ///< Only mask elements with one of these bits set in maskVector
-             );
+psStats *psVectorStats(psStats * stats, // /< stats structure defines stats to be calculated and how
+                       psVector * in,   // /< Vector to be analysed: must be F32
+                       psVector * mask, // /< Ignore elements where (maskVector & maskVal) != 0: must be INT
+                       // or NULL
+                       unsigned int maskVal     // /< Only mask elements with one of these bits set in
+                       // maskVector
+                      );
 
 /** A constructor for the stats structure.*/
-psStats *psStatsAlloc(psStatsOptions options); ///< Statistics to measure
+psStats *psStatsAlloc(psStatsOptions options);  // /< Statistics to measure
 
 /******************************************************************************
     Histogram functions and data structures.
  *****************************************************************************/
+
 /** The basic histogram structure which contains bounds and bins. */
 typedef struct
 {
-    psVector *bounds;                ///< Bounds for the bins (type F32)
-    psVector *nums;                  ///< Number in each of the bins (INT)
-    int minNum;                      ///< Number below the minimum
-    int maxNum;                      ///< Number above the maximum
-    bool uniform;                     ///< Is it a uniform distribution?
+    psVector *bounds;           // /< Bounds for the bins (type F32)
+    psVector *nums;             // /< Number in each of the bins (INT)
+    int minNum;                 // /< Number below the minimum
+    int maxNum;                 // /< Number above the maximum
+    bool uniform;               // /< Is it a uniform distribution?
 }
 psHistogram;
 
-
 /** Constructor \ingroup MathGroup */
-psHistogram *
-psHistogramAlloc(float lower,  ///< Lower limit for the bins
-                 float upper,  ///< Upper limit for the bins
-                 int n);       ///< Number of bins
-
+psHistogram *psHistogramAlloc(float lower,      // /< Lower limit for the bins
+                              float upper,      // /< Upper limit for the bins
+                              int n);   // /< Number of bins
 
 /** Generic constructor \ingroup MathGroup */
-psHistogram * psHistogramAllocGeneric(const psVector *restrict bounds); ///< Bounds for the bins
+psHistogram *psHistogramAllocGeneric(const psVector * restrict bounds); // /< Bounds for the bins
 
 /** Calculate a histogram \ingroup MathGroup **/
-psHistogram *psVectorHistogram (psHistogram *out,   ///< Histogram data
-                                const psVector *restrict in,       ///< Vector to analyse
-                                const psVector *restrict mask,     ///< Mask dat for input vector
-                                unsigned int maskVal);       ///< Mask value
+psHistogram *psVectorHistogram(psHistogram * out,       // /< Histogram data
+                               const psVector * restrict in,    // /< Vector to analyse
+                               const psVector * restrict mask,  // /< Mask dat for input vector
+                               unsigned int maskVal);   // /< Mask value
 
-bool p_psGetStatValue(
-    const psStats* stats,
-    double* value
-);
+bool p_psGetStatValue(const psStats * stats, double *value);
 
 /// @}
 
 #endif
-
Index: /trunk/psLib/src/mathtypes/psImage.c
===================================================================
--- /trunk/psLib/src/mathtypes/psImage.c	(revision 1406)
+++ /trunk/psLib/src/mathtypes/psImage.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psImage.c
  *
@@ -9,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.37 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -18,5 +19,7 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 
@@ -29,53 +32,61 @@
 #include "psImage.h"
 
-static void imageFree(psImage* image);
+static void imageFree(psImage * image);
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
+
 /*****************************************************************************/
 
-psImage *psImageAlloc(unsigned int numCols, unsigned int numRows,
-                      const psElemType type)
+psImage *psImageAlloc(unsigned int numCols, unsigned int numRows, const psElemType type)
 {
     int area = 0;
-    int elementSize = PSELEMTYPE_SIZEOF(type); // element size in bytes
-    int rowSize = numCols*elementSize;  // row size in bytes.
-
-    area = numCols*numRows;
+    int elementSize = PSELEMTYPE_SIZEOF(type);  // element
+
+    // size in
+    // bytes
+    int rowSize = numCols * elementSize;        // row
+
+    // size
+
+    // in bytes.
+
+    area = numCols * numRows;
 
     if (area < 1) {
-        psError(__func__, "Invalid value for number of rows or columns "
-                "(numRows=%d, numCols=%d).", numRows, numCols);
+        psError(__func__,
+                "Invalid value for number of rows or columns " "(numRows=%d, numCols=%d).", numRows, numCols);
         return NULL;
     }
 
-    psImage *image = (psImage *)psAlloc(sizeof(psImage));
-    if(image == NULL) {
-        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
-    }
-
-    p_psMemSetDeallocator(image,(psFreeFcn)imageFree);
-
-    image->data.V = psAlloc(sizeof(void*)*numRows);
-    if(image->data.V == NULL) {
-        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
-    }
-
-
-    image->data.V[0] = psAlloc(area*elementSize);
-    if(image->data.V[0] == NULL) {
-        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
-    }
-
-    for(int i = 1; i < numRows; i++) {
-        image->data.V[i] = (void*)((int8_t*)image->data.V[i-1]+rowSize);
-    }
-
-    *(int*)&image->col0 = 0;
-    *(int*)&image->row0 = 0;
-    *(unsigned int*)&image->numCols = numCols;
-    *(unsigned int*)&image->numRows = numRows;
-    *(psDimen*)&image->type.dimen = PS_DIMEN_IMAGE;
-    *(psElemType*)&image->type.type = type;
+    psImage *image = (psImage *) psAlloc(sizeof(psImage));
+
+    if (image == NULL) {
+        psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
+    }
+
+    p_psMemSetDeallocator(image, (psFreeFcn) imageFree);
+
+    image->data.V = psAlloc(sizeof(void *) * numRows);
+    if (image->data.V == NULL) {
+        psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
+    }
+
+    image->data.V[0] = psAlloc(area * elementSize);
+    if (image->data.V[0] == NULL) {
+        psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
+    }
+
+    for (int i = 1; i < numRows; i++) {
+        image->data.V[i] = (void *)((int8_t *) image->data.V[i - 1] + rowSize);
+    }
+
+    *(int *)&image->col0 = 0;
+    *(int *)&image->row0 = 0;
+    *(unsigned int *)&image->numCols = numCols;
+    *(unsigned int *)&image->numRows = numRows;
+    *(psDimen *) & image->type.dimen = PS_DIMEN_IMAGE;
+    *(psElemType *) & image->type.type = type;
     image->parent = NULL;
     image->nChildren = 0;
@@ -85,5 +96,5 @@
 }
 
-static void imageFree(psImage* image)
+static void imageFree(psImage * image)
 {
     if (image == NULL) {
@@ -92,12 +103,13 @@
 
     if (image->type.type == PS_TYPE_PTR) {
-        // 2-D array of pointers -- must dereference
+        // 2-D array of pointers -- must
+        // dereference
         unsigned int oldNumRows = image->numRows;
         unsigned int oldNumCols = image->numCols;
-        psPTR* rowPtr;
-
-        for(unsigned int row=0;row<oldNumRows;row++) {
+        psPTR *rowPtr;
+
+        for (unsigned int row = 0; row < oldNumRows; row++) {
             rowPtr = image->data.PTR[row];
-            for (unsigned int col=0;col<oldNumCols;col++) {
+            for (unsigned int col = 0; col < oldNumCols; col++) {
                 psMemDecrRefCounter(rowPtr[col]);
             }
@@ -112,31 +124,36 @@
 }
 
-psImage* psImageRecycle(psImage* old,
-                        unsigned int numCols,
-                        unsigned int numRows,
-                        const psElemType type)
+psImage *psImageRecycle(psImage * old, unsigned int numCols, unsigned int numRows, const psElemType type)
 {
-    int elementSize = PSELEMTYPE_SIZEOF(type); // element size in bytes
-    int rowSize = numCols*elementSize;  // row size in bytes.
+    int elementSize = PSELEMTYPE_SIZEOF(type);  // element
+
+    // size in
+    // bytes
+    int rowSize = numCols * elementSize;        // row
+
+    // size
+
+    // in bytes.
 
     if (old == NULL) {
-        old = psImageAlloc(numCols,numRows,type);
+        old = psImageAlloc(numCols, numRows, type);
         return old;
     }
 
     if (old->type.dimen != PS_DIMEN_IMAGE) {
-        psError(__func__,"Can not realloc image because input is not an image.");
+        psError(__func__, "Can not realloc image because input is not an image.");
         return NULL;
     }
 
     if (old->type.type == PS_TYPE_PTR) {
-        // 2-D array of pointers -- must dereference
+        // 2-D array of pointers -- must
+        // dereference
         unsigned int oldNumRows = old->numRows;
         unsigned int oldNumCols = old->numCols;
-        psPTR* rowPtr;
-
-        for(unsigned int row=0;row<oldNumRows;row++) {
+        psPTR *rowPtr;
+
+        for (unsigned int row = 0; row < oldNumRows; row++) {
             rowPtr = old->data.PTR[row];
-            for (unsigned int col=0;col<oldNumCols;col++) {
+            for (unsigned int col = 0; col < oldNumCols; col++) {
                 psMemDecrRefCounter(rowPtr[col]);
                 rowPtr[col] = NULL;
@@ -146,26 +163,24 @@
 
     /* image already the right size/type? */
-    if (numCols == old->numCols && numRows == old->numRows &&
-            type == old->type.type) {
+    if (numCols == old->numCols && numRows == old->numRows && type == old->type.type) {
         return old;
     }
-
     // Resize the image buffer
-    old->data.V[0] = psRealloc(old->data.V[0],numCols * numRows * elementSize);
-    old->data.V = (void**) psRealloc(old->data.V,numRows * sizeof(void*));
+    old->data.V[0] = psRealloc(old->data.V[0], numCols * numRows * elementSize);
+    old->data.V = (void **)psRealloc(old->data.V, numRows * sizeof(void *));
 
     // recreate the row pointers
-    for(int i = 1; i < numRows; i++) {
-        old->data.V[i] = (void*)((int8_t*)old->data.V[i-1]+rowSize);
-    }
-
-    *(unsigned int*)&old->numCols = numCols;
-    *(unsigned int*)&old->numRows = numRows;
-    *(psElemType*)&old->type.type = type;
+    for (int i = 1; i < numRows; i++) {
+        old->data.V[i] = (void *)((int8_t *) old->data.V[i - 1] + rowSize);
+    }
+
+    *(unsigned int *)&old->numCols = numCols;
+    *(unsigned int *)&old->numRows = numRows;
+    *(psElemType *) & old->type.type = type;
 
     return old;
 }
 
-int psImageFreeChildren(psImage* image)
+int psImageFreeChildren(psImage * image)
 {
     int i = 0;
@@ -181,5 +196,5 @@
     children = image->children;
 
-    for(i=0; i<nChildren; i++) {
+    for (i = 0; i < nChildren; i++) {
         if (children[i] != NULL) {
             numFreed++;
@@ -191,5 +206,4 @@
     image->nChildren = 0;
     image->children = NULL;
-
 
     return numFreed;
@@ -202,17 +216,12 @@
 linear interpolation is performed on the image.
  *****************************************************************************/
-psF32 psImagePixelInterpolate(
-    const psImage *input,
-    float x,
-    float y,
-    psF32 unexposedValue,
-    psImageInterpolateMode mode)
+psF32 psImagePixelInterpolate(const psImage * input,
+                              float x, float y, psF32 unexposedValue, psImageInterpolateMode mode)
 {
 
     if (input == NULL) {
-        psError(__func__,"Image can not be NULL.");
+        psError(__func__, "Image can not be NULL.");
         return unexposedValue;
     }
-
     #define PSIMAGE_PIXEL_INTERPOLATE_CASE(TYPE) \
 case PS_TYPE_##TYPE: \
@@ -243,5 +252,5 @@
         PSIMAGE_PIXEL_INTERPOLATE_CASE(C64);
     default:
-        psError(__func__,"Unsupported image datatype (%d)",input->type.type);
+        psError(__func__, "Unsupported image datatype (%d)", input->type.type);
     }
 
@@ -303,5 +312,4 @@
 PSIMAGE_PIXEL_INTERPOLATE_FLAT_COMPLEX(C32)
 PSIMAGE_PIXEL_INTERPOLATE_FLAT_COMPLEX(C64)
-
 #define PSIMAGE_PIXEL_INTERPOLATE_BILINEAR(TYPE) \
 inline psF64 p_psImagePixelInterpolateBILINEAR_##TYPE(const psImage *input, \
@@ -359,5 +367,4 @@
     return(pixel); \
 }
-
 #define PSIMAGE_PIXEL_INTERPOLATE_BILINEAR_COMPLEX(TYPE) \
 inline psC64 p_psImagePixelInterpolateBILINEAR_##TYPE(const psImage *input, \
@@ -428,4 +435,2 @@
 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR_COMPLEX(C32)
 PSIMAGE_PIXEL_INTERPOLATE_BILINEAR_COMPLEX(C64)
-
-
Index: /trunk/psLib/src/mathtypes/psImage.h
===================================================================
--- /trunk/psLib/src/mathtypes/psImage.h	(revision 1406)
+++ /trunk/psLib/src/mathtypes/psImage.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psImage.h
  *
@@ -11,15 +12,15 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
-# ifndef PS_IMAGE_H
-# define PS_IMAGE_H
+#ifndef PS_IMAGE_H
+#    define PS_IMAGE_H
 
-#include <complex.h>
+#    include <complex.h>
 
-#include "psType.h"
+#    include "psType.h"
 
 /// @addtogroup Image
@@ -39,36 +40,37 @@
 typedef struct psImage
 {
-    const psType type;                  ///< Image data type and dimension.
-    const unsigned int numCols;         ///< Number of columns in image
-    const unsigned int numRows;         ///< Number of rows in image.
-    const int col0;                     ///< Column position relative to parent.
-    const int row0;                     ///< Row position relative to parent.
+    const psType type;          // /< Image data type and dimension.
+    const unsigned int numCols; // /< Number of columns in image
+    const unsigned int numRows; // /< Number of rows in image.
+    const int col0;             // /< Column position relative to parent.
+    const int row0;             // /< Row position relative to parent.
 
     union {
-        psU8    **U8;                   ///< Unsigned 8-bit integer data.
-        psU16   **U16;                  ///< Unsigned 16-bit integer data.
-        psU32   **U32;                  ///< Unsigned 32-bit integer data.
-        psU64   **U64;                  ///< Unsigned 64-bit integer data.
-        psS8    **S8;                   ///< Signed 8-bit integer data.
-        psS16   **S16;                  ///< Signed 16-bit integer data.
-        psS32   **S32;                  ///< Signed 32-bit integer data.
-        psS64   **S64;                  ///< Signed 64-bit integer data.
-        psF32   **F32;                  ///< Single-precision float data.
-        psF64   **F64;                  ///< Double-precision float data.
-        psC32   **C32;                  ///< Single-precision complex data.
-        psC64   **C64;                  ///< Double-precision complex data.
-        psPTR   **PTR;                  ///< Void pointers.
-        psPTR    *V;                    ///< Pointer to data.
-    } data;                             ///< Union for data types.
-    const struct psImage *parent;       ///< Parent, if a subimage.
-    int nChildren;                      ///< Number of subimages.
-    struct psImage** children;          ///< Children of this region.
+        psU8 **U8;              // /< Unsigned 8-bit integer data.
+        psU16 **U16;            // /< Unsigned 16-bit integer data.
+        psU32 **U32;            // /< Unsigned 32-bit integer data.
+        psU64 **U64;            // /< Unsigned 64-bit integer data.
+        psS8 **S8;              // /< Signed 8-bit integer data.
+        psS16 **S16;            // /< Signed 16-bit integer data.
+        psS32 **S32;            // /< Signed 32-bit integer data.
+        psS64 **S64;            // /< Signed 64-bit integer data.
+        psF32 **F32;            // /< Single-precision float data.
+        psF64 **F64;            // /< Double-precision float data.
+        psC32 **C32;            // /< Single-precision complex data.
+        psC64 **C64;            // /< Double-precision complex data.
+        psPTR **PTR;            // /< Void pointers.
+        psPTR *V;               // /< Pointer to data.
+    } data;                     // /< Union for data types.
+    const struct psImage *parent;       // /< Parent, if a subimage.
+    int nChildren;              // /< Number of subimages.
+    struct psImage **children;  // /< Children of this region.
 }
 psImage;
 
 /*****************************************************************************/
+
 /* FUNCTION PROTOTYPES                                                       */
+
 /*****************************************************************************/
-
 
 /** Create an image of the specified size and type.
@@ -80,9 +82,8 @@
  *
  */
-psImage *psImageAlloc(
-    unsigned int numCols,               ///< Number of rows in image.
-    unsigned int numRows,               ///< Number of columns in image.
-    const psElemType type               ///< Type of data for image.
-);
+psImage *psImageAlloc(unsigned int numCols,     // /< Number of rows in image.
+                      unsigned int numRows,     // /< Number of columns in image.
+                      const psElemType type     // /< Type of data for image.
+                     );
 
 /** Resize a given image to the given size/type.
@@ -91,11 +92,9 @@
  *
  */
-psImage* psImageRecycle(
-    psImage* old,                       ///< the psImage to recycle by resizing image buffer
-    unsigned int numCols,               ///< the desired number of columns in image
-    unsigned int numRows,               ///< the desired number of rows in image
-    const psElemType type               ///< the desired datatype of the image
-);
-
+psImage *psImageRecycle(psImage * old,  // /< the psImage to recycle by resizing image buffer
+                        unsigned int numCols,   // /< the desired number of columns in image
+                        unsigned int numRows,   // /< the desired number of rows in image
+                        const psElemType type   // /< the desired datatype of the image
+                       );
 
 /** Frees all children of a psImage.
@@ -104,18 +103,13 @@
  *
  */
-int psImageFreeChildren(
-    psImage* image
-    /**< psImage in which all children shall be deallocated */
-);
+int psImageFreeChildren(psImage * image
 
-psF32 psImagePixelInterpolate(
-    const psImage *input,
-    float x,
-    float y,
-    psF32 unexposedValue,
-    psImageInterpolateMode mode
-);
+                        /**< psImage in which all children shall be deallocated */
+                       );
 
-#define p_psImagePixelInterpolateFcns(TYPE) \
+psF32 psImagePixelInterpolate(const psImage * input,
+                              float x, float y, psF32 unexposedValue, psImageInterpolateMode mode);
+
+#    define p_psImagePixelInterpolateFcns(TYPE) \
 inline psF64 p_psImagePixelInterpolateFLAT_##TYPE( \
         const psImage *input, \
@@ -131,5 +125,5 @@
                                                      );
 
-#define p_psImagePixelInterpolateComplexFcns(TYPE) \
+#    define p_psImagePixelInterpolateComplexFcns(TYPE) \
 inline psC64 p_psImagePixelInterpolateFLAT_##TYPE( \
         const psImage *input, \
@@ -157,6 +151,4 @@
 p_psImagePixelInterpolateComplexFcns(C32)
 p_psImagePixelInterpolateComplexFcns(C64)
-
 /// @}
-
 #endif
Index: /trunk/psLib/src/mathtypes/psScalar.c
===================================================================
--- /trunk/psLib/src/mathtypes/psScalar.c	(revision 1406)
+++ /trunk/psLib/src/mathtypes/psScalar.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psScalar.c
  *
@@ -8,6 +9,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -15,5 +16,7 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 #include "psMemory.h"
@@ -24,5 +27,7 @@
 
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
@@ -30,5 +35,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -36,5 +43,7 @@
 
 /*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
+
 /*****************************************************************************/
 
@@ -42,5 +51,7 @@
 
 /*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
+
 /*****************************************************************************/
 
@@ -48,5 +59,7 @@
 
 /*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
+
 /*****************************************************************************/
 
@@ -54,5 +67,7 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
+
 /*****************************************************************************/
 psScalar *psScalarAlloc(psC64 value, psElemType dataType)
@@ -61,7 +76,7 @@
 
     // Create scalar
-    scalar = (psScalar *)psAlloc(sizeof(psScalar));
-    if(scalar == NULL) {
-        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
+    scalar = (psScalar *) psAlloc(sizeof(psScalar));
+    if (scalar == NULL) {
+        psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
     }
 
@@ -71,38 +86,38 @@
     switch (dataType) {
     case PS_TYPE_S8:
-        scalar->data.S8 = (psS8)value;
+        scalar->data.S8 = (psS8) value;
         break;
     case PS_TYPE_U8:
-        scalar->data.U8 = (psU8)value;
+        scalar->data.U8 = (psU8) value;
         break;
     case PS_TYPE_S16:
-        scalar->data.S16 = (psS16)value;
+        scalar->data.S16 = (psS16) value;
         break;
     case PS_TYPE_U16:
-        scalar->data.U16 = (psU16)value;
+        scalar->data.U16 = (psU16) value;
         break;
     case PS_TYPE_S32:
-        scalar->data.S32 = (psS32)value;
+        scalar->data.S32 = (psS32) value;
         break;
     case PS_TYPE_U32:
-        scalar->data.U32 = (psU32)value;
+        scalar->data.U32 = (psU32) value;
         break;
     case PS_TYPE_S64:
-        scalar->data.S64 = (psS64)value;
+        scalar->data.S64 = (psS64) value;
         break;
     case PS_TYPE_U64:
-        scalar->data.U64 = (psU64)value;
+        scalar->data.U64 = (psU64) value;
         break;
     case PS_TYPE_F32:
-        scalar->data.F32 = (psF32)value;
+        scalar->data.F32 = (psF32) value;
         break;
     case PS_TYPE_F64:
-        scalar->data.F64 = (psF64)value;
+        scalar->data.F64 = (psF64) value;
         break;
     case PS_TYPE_C32:
-        scalar->data.C32 = (psC32)value;
+        scalar->data.C32 = (psC32) value;
         break;
     case PS_TYPE_C64:
-        scalar->data.C64 = (psC64)value;
+        scalar->data.C64 = (psC64) value;
         break;
     default:
@@ -110,9 +125,8 @@
     }
 
-
     return scalar;
 }
 
-void psScalarFree(psScalar *restrict scalar)
+void psScalarFree(psScalar * restrict scalar)
 {
     if (scalar == NULL) {
@@ -122,4 +136,2 @@
     psFree(scalar);
 }
-
-
Index: /trunk/psLib/src/mathtypes/psScalar.h
===================================================================
--- /trunk/psLib/src/mathtypes/psScalar.h	(revision 1406)
+++ /trunk/psLib/src/mathtypes/psScalar.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psScalar.h
  *
@@ -10,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -17,7 +18,7 @@
 
 #ifndef PS_SCALAR_H
-#define PS_SCALAR_H
+#    define PS_SCALAR_H
 
-#include "psType.h"
+#    include "psType.h"
 
 /// @addtogroup Scalar
@@ -31,25 +32,27 @@
 typedef struct
 {
-    psType type;                       ///< Type of data.
+    psType type;                // /< Type of data.
 
     union {
-        psU8    U8;                    ///< Unsigned 8-bit integer data.
-        psU16   U16;                   ///< Unsigned 16-bit integer data.
-        psU32   U32;                   ///< Unsigned 32-bit integer data.
-        psU64   U64;                   ///< Unsigned 64-bit integer data.
-        psS8    S8;                    ///< Signed 8-bit integer data.
-        psS16   S16;                   ///< Signed 16-bit integer data.
-        psS32   S32;                   ///< Signed 32-bit integer data.
-        psS64   S64;                   ///< Signed 64-bit integer data.
-        psF32   F32;                   ///< Single-precision float data.
-        psF64   F64;                   ///< Double-precision float data.
-        psC32   C32;                   ///< Single-precision complex data.
-        psC64   C64;                   ///< Double-precision complex data.
-    } data;                            ///< Union for data types.
+        psU8 U8;                // /< Unsigned 8-bit integer data.
+        psU16 U16;              // /< Unsigned 16-bit integer data.
+        psU32 U32;              // /< Unsigned 32-bit integer data.
+        psU64 U64;              // /< Unsigned 64-bit integer data.
+        psS8 S8;                // /< Signed 8-bit integer data.
+        psS16 S16;              // /< Signed 16-bit integer data.
+        psS32 S32;              // /< Signed 32-bit integer data.
+        psS64 S64;              // /< Signed 64-bit integer data.
+        psF32 F32;              // /< Single-precision float data.
+        psF64 F64;              // /< Double-precision float data.
+        psC32 C32;              // /< Single-precision complex data.
+        psC64 C64;              // /< Double-precision complex data.
+    } data;                     // /< Union for data types.
 }
 psScalar;
 
 /*****************************************************************************/
+
 /* FUNCTION PROTOTYPES                                                       */
+
 /*****************************************************************************/
 
@@ -62,9 +65,7 @@
  *
  */
-psScalar *psScalarAlloc(
-    psC64 value,            ///< Data to be put into psScalar.
-    psElemType dataType     ///< Type of data to be held by psScalar.
-);
-
+psScalar *psScalarAlloc(psC64 value,    // /< Data to be put into psScalar.
+                        psElemType dataType     // /< Type of data to be held by psScalar.
+                       );
 
 /** Deallocate a scalar.
@@ -75,7 +76,6 @@
  *
  */
-void psScalarFree(
-    psScalar *restrict scalar  ///< Scalar to free.
-);
+void psScalarFree(psScalar * restrict scalar    // /< Scalar to free.
+                 );
 
 /// @}
Index: /trunk/psLib/src/mathtypes/psVector.c
===================================================================
--- /trunk/psLib/src/mathtypes/psVector.c	(revision 1406)
+++ /trunk/psLib/src/mathtypes/psVector.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psVector.c
 *
@@ -8,6 +9,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 22:34:05 $
+*  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -15,7 +16,9 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
-/******************************************************************************/
-#include <string.h>        // for memcpy
+
+/******************************************************************************/
+#include <string.h>                        // for memcpy
 #include <stdlib.h>
 #include <math.h>
@@ -28,5 +31,7 @@
 
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
@@ -34,5 +39,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -40,5 +47,7 @@
 
 /*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
+
 /*****************************************************************************/
 
@@ -46,5 +55,7 @@
 
 /*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
+
 /*****************************************************************************/
 
@@ -52,27 +63,31 @@
 
 /*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
-/*****************************************************************************/
-static void vectorFree( psVector *restrict psVec );
-
-/*****************************************************************************/
+
+/*****************************************************************************/
+static void vectorFree(psVector * restrict psVec);
+
+/*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
-/*****************************************************************************/
-psVector* psVectorAlloc( unsigned int nalloc, psElemType elemType )
-{
-    psVector * psVec = NULL;
+
+/*****************************************************************************/
+psVector *psVectorAlloc(unsigned int nalloc, psElemType elemType)
+{
+    psVector *psVec = NULL;
     int elementSize = 0;
 
     // Invalid nalloc
-    if ( nalloc < 1 ) {
-        psError( __func__, "Invalid value for nalloc. nalloc: %d\n", nalloc );
+    if (nalloc < 1) {
+        psError(__func__, "Invalid value for nalloc. nalloc: %d\n", nalloc);
         return NULL;
     }
 
-    elementSize = PSELEMTYPE_SIZEOF( elemType );
+    elementSize = PSELEMTYPE_SIZEOF(elemType);
 
     // Create vector struct
-    psVec = ( psVector * ) psAlloc( sizeof( psVector ) );
-    p_psMemSetDeallocator( psVec, ( psFreeFcn ) vectorFree );
+    psVec = (psVector *) psAlloc(sizeof(psVector));
+    p_psMemSetDeallocator(psVec, (psFreeFcn) vectorFree);
 
     psVec->type.dimen = PS_DIMEN_VECTOR;
@@ -82,10 +97,10 @@
 
     // Create vector data array
-    psVec->data.V = psAlloc( nalloc * elementSize );
+    psVec->data.V = psAlloc(nalloc * elementSize);
 
     return psVec;
 }
 
-psVector *psVectorRealloc( unsigned int nalloc, psVector *restrict in )
+psVector *psVectorRealloc(unsigned int nalloc, psVector * restrict in)
 {
     int elementSize = 0;
@@ -93,52 +108,48 @@
 
     // Invalid nalloc
-    if ( nalloc < 1 ) {
-        psError( __func__, "Invalid value for realloc (%d)\n", nalloc );
+    if (nalloc < 1) {
+        psError(__func__, "Invalid value for realloc (%d)\n", nalloc);
         return NULL;
     }
 
-    if ( in == NULL ) {
-        psError( __func__, "Null input vector\n" );
+    if (in == NULL) {
+        psError(__func__, "Null input vector\n");
         return NULL;
-    } else
-        if ( in->nalloc != nalloc ) {                    // No need to realloc to same size
-            elemType = in->type.type;
-            elementSize = PSELEMTYPE_SIZEOF( elemType );
-            if ( nalloc < in->n ) {
-                in->n = nalloc;
-            }
-
-            // Realloc after decrementation to avoid accessing freed array elements
-            in->data.V = psRealloc( in->data.V, nalloc * elementSize );
-            in->nalloc = nalloc;
+    } else if (in->nalloc != nalloc) {     // No need to realloc to same size
+        elemType = in->type.type;
+        elementSize = PSELEMTYPE_SIZEOF(elemType);
+        if (nalloc < in->n) {
+            in->n = nalloc;
         }
+        // Realloc after decrementation to avoid accessing freed array elements
+        in->data.V = psRealloc(in->data.V, nalloc * elementSize);
+        in->nalloc = nalloc;
+    }
 
     return in;
 }
 
-psVector *psVectorRecycle( psVector *restrict in, unsigned int nalloc, psElemType type )
+psVector *psVectorRecycle(psVector * restrict in, unsigned int nalloc, psElemType type)
 {
     psElemType elemType;
 
-    if ( in == NULL ) {
-        return psVectorAlloc( nalloc, type );
+    if (in == NULL) {
+        return psVectorAlloc(nalloc, type);
     }
 
     elemType = in->type.type;
 
-    if ( in->nalloc == nalloc && elemType == type ) {
+    if (in->nalloc == nalloc && elemType == type) {
         // it is proper size/type already
         return in;
     }
-
     // Invalid nalloc
-    if ( nalloc < 1 ) {
-        psError( __func__, "Invalid value for nalloc (%d)\n", nalloc );
-        psFree( in );
+    if (nalloc < 1) {
+        psError(__func__, "Invalid value for nalloc (%d)\n", nalloc);
+        psFree(in);
         return NULL;
     }
 
-
-    in->data.V = psRealloc( in->data.V, nalloc * PSELEMTYPE_SIZEOF( type ) );
+    in->data.V = psRealloc(in->data.V, nalloc * PSELEMTYPE_SIZEOF(type));
 
     in->type.type = type;
@@ -149,5 +160,5 @@
 }
 
-psVector *psVectorSort( psVector *restrict outVector, const psVector *restrict inVector )
+psVector *psVectorSort(psVector * restrict outVector, const psVector * restrict inVector)
 {
     int inN = 0;
@@ -158,6 +169,6 @@
     psElemType inType = 0;
 
-    if ( inVector == NULL ) {
-        psError( __func__, " : Line %d - Null input vector\n", __LINE__ );
+    if (inVector == NULL) {
+        psError(__func__, " : Line %d - Null input vector\n", __LINE__);
         return outVector;
     }
@@ -166,8 +177,8 @@
     inN = inVector->n;
     inVec = inVector->data.V;
-    elSize = PSELEMTYPE_SIZEOF( inType );
-
-    if ( outVector == NULL ) {
-        outVector = psVectorAlloc( inN, inType );
+    elSize = PSELEMTYPE_SIZEOF(inType);
+
+    if (outVector == NULL) {
+        outVector = psVectorAlloc(inN, inType);
         outVector->n = inVector->n;
     }
@@ -176,63 +187,62 @@
     outVec = outVector->data.V;
 
-    if ( inN != outN ) {
-        psError( __func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n", __LINE__,
-                 inN, outN );
-        return outVector;
-    }
-
-    if ( inType != outVector->type.type ) {
-        psError( __func__, " : Line %d - Input and output vectors are not same type: in=%d out=%d\n", __LINE__,
-                 inType, outVector->type.type );
-        return outVector;
-    }
-
-    if ( inN == 0 ) {
-        psError( __func__, " : Line %d - No elements in use for input vector\n", __LINE__ );
-        return outVector;
-    }
-
-    if ( outN == 0 ) {
-        psError( __func__, " : Line %d - No elements in use for output vector\n", __LINE__ );
-        return outVector;
-    }
-
+    if (inN != outN) {
+        psError(__func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n",
+                __LINE__, inN, outN);
+        return outVector;
+    }
+
+    if (inType != outVector->type.type) {
+        psError(__func__, " : Line %d - Input and output vectors are not same type: in=%d out=%d\n", __LINE__,
+                inType, outVector->type.type);
+        return outVector;
+    }
+
+    if (inN == 0) {
+        psError(__func__, " : Line %d - No elements in use for input vector\n", __LINE__);
+        return outVector;
+    }
+
+    if (outN == 0) {
+        psError(__func__, " : Line %d - No elements in use for output vector\n", __LINE__);
+        return outVector;
+    }
     // Copy input vector values into output vector
-    memcpy( outVec, inVec, elSize * outN );
+    memcpy(outVec, inVec, elSize * outN);
 
     // Sort output vector
-    switch ( inType ) {
+    switch (inType) {
     case PS_TYPE_U8:
-        qsort( outVec, inN, elSize, psCompareU8 );
+        qsort(outVec, inN, elSize, psCompareU8);
         break;
     case PS_TYPE_U16:
-        qsort( outVec, inN, elSize, psCompareU16 );
+        qsort(outVec, inN, elSize, psCompareU16);
         break;
     case PS_TYPE_U32:
-        qsort( outVec, inN, elSize, psCompareU32 );
+        qsort(outVec, inN, elSize, psCompareU32);
         break;
     case PS_TYPE_U64:
-        qsort( outVec, inN, elSize, psCompareU64 );
+        qsort(outVec, inN, elSize, psCompareU64);
         break;
     case PS_TYPE_S8:
-        qsort( outVec, inN, elSize, psCompareS8 );
+        qsort(outVec, inN, elSize, psCompareS8);
         break;
     case PS_TYPE_S16:
-        qsort( outVec, inN, elSize, psCompareS16 );
+        qsort(outVec, inN, elSize, psCompareS16);
         break;
     case PS_TYPE_S32:
-        qsort( outVec, inN, elSize, psCompareS32 );
+        qsort(outVec, inN, elSize, psCompareS32);
         break;
     case PS_TYPE_S64:
-        qsort( outVec, inN, elSize, psCompareS64 );
+        qsort(outVec, inN, elSize, psCompareS64);
         break;
     case PS_TYPE_F32:
-        qsort( outVec, inN, elSize, psCompareF32 );
+        qsort(outVec, inN, elSize, psCompareF32);
         break;
     case PS_TYPE_F64:
-        qsort( outVec, inN, elSize, psCompareF64 );
+        qsort(outVec, inN, elSize, psCompareF64);
         break;
     default:
-        psError( __func__, " : Line %d - Invalid psType\n", __LINE__ );
+        psError(__func__, " : Line %d - Invalid psType\n", __LINE__);
     }
 
@@ -251,5 +261,5 @@
 }
 
-psVector *psVectorSortIndex( psVector *restrict outVector, const psVector *restrict inVector )
+psVector *psVectorSortIndex(psVector * restrict outVector, const psVector * restrict inVector)
 {
     int inN = 0;
@@ -263,6 +273,6 @@
     psElemType inType = 0;
 
-    if ( inVector == NULL ) {
-        psError( __func__, " : Line %d - Null input vector\n", __LINE__ );
+    if (inVector == NULL) {
+        psError(__func__, " : Line %d - Null input vector\n", __LINE__);
         return outVector;
     }
@@ -272,6 +282,6 @@
     inType = inVector->type.type;
 
-    if ( outVector == NULL ) {
-        outVector = psVectorAlloc( inN, PS_TYPE_U32 );
+    if (outVector == NULL) {
+        outVector = psVectorAlloc(inN, PS_TYPE_U32);
         outVector->n = inN;
     }
@@ -280,68 +290,68 @@
     outVec = outVector->data.V;
 
-    if ( inN != outN ) {
-        psError( __func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n",
-                 __LINE__, inN, outN );
-        return outVector;
-    }
-
-    if ( outVector->type.type != PS_TYPE_U32 ) {
-        psError( __func__, " : Line %d - Output vector is not of type U32: out=%d\n",
-                 __LINE__, outVector->type.type );
-        return outVector;
-    }
-
-    tmpVector = psVectorAlloc( inN, inType );
+    if (inN != outN) {
+        psError(__func__, " : Line %d - Input and output vector sizes are not equal: in=%d out=%d\n",
+                __LINE__, inN, outN);
+        return outVector;
+    }
+
+    if (outVector->type.type != PS_TYPE_U32) {
+        psError(__func__, " : Line %d - Output vector is not of type U32: out=%d\n",
+                __LINE__, outVector->type.type);
+        return outVector;
+    }
+
+    tmpVector = psVectorAlloc(inN, inType);
     tmpVector->n = inN;
-    tmpVector = psVectorSort( tmpVector, inVector );
+    tmpVector = psVectorSort(tmpVector, inVector);
 
     // Sort output vector
-    switch ( inType ) {
+    switch (inType) {
     case PS_TYPE_U8:
-        SORT_INDICES( U8 );
+        SORT_INDICES(U8);
         break;
     case PS_TYPE_U16:
-        SORT_INDICES( U16 );
+        SORT_INDICES(U16);
         break;
     case PS_TYPE_U32:
-        SORT_INDICES( U32 );
+        SORT_INDICES(U32);
         break;
     case PS_TYPE_U64:
-        SORT_INDICES( U64 );
+        SORT_INDICES(U64);
         break;
     case PS_TYPE_S8:
-        SORT_INDICES( S8 );
+        SORT_INDICES(S8);
         break;
     case PS_TYPE_S16:
-        SORT_INDICES( S16 );
+        SORT_INDICES(S16);
         break;
     case PS_TYPE_S32:
-        SORT_INDICES( S32 );
+        SORT_INDICES(S32);
         break;
     case PS_TYPE_S64:
-        SORT_INDICES( S64 );
+        SORT_INDICES(S64);
         break;
     case PS_TYPE_F32:
-        SORT_INDICES( F32 );
+        SORT_INDICES(F32);
         break;
     case PS_TYPE_F64:
-        SORT_INDICES( F64 );
+        SORT_INDICES(F64);
         break;
     default:
-        psError( __func__, " : Line %d - Invalid psType\n", __LINE__ );
+        psError(__func__, " : Line %d - Invalid psType\n", __LINE__);
     }
 
     // Free temp memory
-    psFree( tmpVector );
+    psFree(tmpVector);
 
     return outVector;
 }
 
-static void vectorFree( psVector *restrict psVec )
-{
-    if ( psVec == NULL ) {
-        return ;
-    }
-
-    psFree( psVec->data.V );
-}
+static void vectorFree(psVector * restrict psVec)
+{
+    if (psVec == NULL) {
+        return;
+    }
+
+    psFree(psVec->data.V);
+}
Index: /trunk/psLib/src/mathtypes/psVector.h
===================================================================
--- /trunk/psLib/src/mathtypes/psVector.h	(revision 1406)
+++ /trunk/psLib/src/mathtypes/psVector.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psVector.h
  *
@@ -11,6 +12,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -18,7 +19,7 @@
 
 #ifndef PS_VECTOR_H
-#define PS_VECTOR_H
+#    define PS_VECTOR_H
 
-#include "psType.h"
+#    include "psType.h"
 
 /// @addtogroup Vector
@@ -32,28 +33,30 @@
 typedef struct
 {
-    psType type;                        ///< Type of data.
-    unsigned int nalloc;                ///< Total number of elements available.
-    unsigned int n;                     ///< Number of elements in use.
+    psType type;                // /< Type of data.
+    unsigned int nalloc;        // /< Total number of elements available.
+    unsigned int n;             // /< Number of elements in use.
 
     union {
-        psU8    *U8;                    ///< Unsigned 8-bit integer data.
-        psU16   *U16;                   ///< Unsigned 16-bit integer data.
-        psU32   *U32;                   ///< Unsigned 32-bit integer data.
-        psU64   *U64;                   ///< Unsigned 64-bit integer data.
-        psS8    *S8;                    ///< Signed 8-bit integer data.
-        psS16   *S16;                   ///< Signed 16-bit integer data.
-        psS32   *S32;                   ///< Signed 32-bit integer data.
-        psS64   *S64;                   ///< Signed 64-bit integer data.
-        psF32   *F32;                   ///< Single-precision float data.
-        psF64   *F64;                   ///< Double-precision float data.
-        psC32   *C32;                   ///< Single-precision complex data.
-        psC64   *C64;                   ///< Double-precision complex data.
-        psPTR    V;                     ///< Pointer to data.
-    } data;                             ///< Union for data types.
+        psU8 *U8;               // /< Unsigned 8-bit integer data.
+        psU16 *U16;             // /< Unsigned 16-bit integer data.
+        psU32 *U32;             // /< Unsigned 32-bit integer data.
+        psU64 *U64;             // /< Unsigned 64-bit integer data.
+        psS8 *S8;               // /< Signed 8-bit integer data.
+        psS16 *S16;             // /< Signed 16-bit integer data.
+        psS32 *S32;             // /< Signed 32-bit integer data.
+        psS64 *S64;             // /< Signed 64-bit integer data.
+        psF32 *F32;             // /< Single-precision float data.
+        psF64 *F64;             // /< Double-precision float data.
+        psC32 *C32;             // /< Single-precision complex data.
+        psC64 *C64;             // /< Double-precision complex data.
+        psPTR V;                // /< Pointer to data.
+    } data;                     // /< Union for data types.
 }
 psVector;
 
 /*****************************************************************************/
+
 /* FUNCTION PROTOTYPES                                                       */
+
 /*****************************************************************************/
 
@@ -65,8 +68,7 @@
  *
  */
-psVector *psVectorAlloc(
-    unsigned int nalloc,                ///< Total number of elements to make available.
-    psElemType dataType                 ///< Type of data to be held by vector.
-);
+psVector *psVectorAlloc(unsigned int nalloc,    // /< Total number of elements to make available.
+                        psElemType dataType     // /< Type of data to be held by vector.
+                       );
 
 /** Reallocate a vector.
@@ -78,8 +80,7 @@
  *
  */
-psVector *psVectorRealloc(
-    unsigned int nalloc,                ///< Total number of elements to make available.
-    psVector *restrict psVec            ///< Vector to reallocate.
-);
+psVector *psVectorRealloc(unsigned int nalloc,  // /< Total number of elements to make available.
+                          psVector * restrict psVec     // /< Vector to reallocate.
+                         );
 
 /** Recycle a vector.
@@ -91,11 +92,10 @@
  *
  */
-psVector *psVectorRecycle(
-    psVector *restrict psVec,
-    ///< Vector to recycle.  If NULL, a new vector is created.  No effort taken to preserve the values.
-
-    unsigned int nalloc,                ///< Total number of elements to make available.
-    psElemType type                     ///< the datatype of the returned vector
-);
+psVector *psVectorRecycle(psVector * restrict psVec,
+                          // /< Vector to recycle.  If NULL, a new vector is created.  No effort taken to
+                          // preserve the values.
+                          unsigned int nalloc,  // /< Total number of elements to make available.
+                          psElemType type       // /< the datatype of the returned vector
+                         );
 
 /** Sort an array of floats.
@@ -107,8 +107,8 @@
  */
 
-psVector *psVectorSort(
-    psVector *restrict outVector,  ///< the output vector to recycle, or NULL if new vector desired.
-    const psVector *restrict inVector ///< the vector to sort.
-);
+psVector *psVectorSort(psVector * restrict outVector,   // /< the output vector to recycle, or NULL if new
+                       // vector desired.
+                       const psVector * restrict inVector       // /< the vector to sort.
+                      );
 
 /** Creates an array of indices based on sort odred of float array.
@@ -120,9 +120,5 @@
  */
 
-psVector *psVectorSortIndex(
-    psVector *restrict outVector,
-    const psVector *restrict inVector
-);
-
+psVector *psVectorSortIndex(psVector * restrict outVector, const psVector * restrict inVector);
 
 /// @}
Index: /trunk/psLib/src/pslib.h
===================================================================
--- /trunk/psLib/src/pslib.h	(revision 1406)
+++ /trunk/psLib/src/pslib.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  pslib.h
 *
@@ -8,6 +9,6 @@
 *  @author Eric Van Alst, MHPCC
 *
-*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-05 17:52:05 $
+*  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -15,8 +16,10 @@
 
 #ifndef PS_LIB_H
-#define PS_LIB_H
+#    define PS_LIB_H
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 
@@ -35,19 +38,19 @@
  */
 
-#include "fitsio.h"
+#    include "fitsio.h"
 
-#include "psMemory.h"
+#    include "psMemory.h"
 
 /// @defgroup LogTrace Tracing and Logging
 /// @ingroup SysUtils
-#include "psLogMsg.h"
-#include "psTrace.h"
+#    include "psLogMsg.h"
+#    include "psTrace.h"
 
 /// @defgroup ErrorHandling Error Handling
 /// @ingroup SysUtils
-#include "psAbort.h"
-#include "psError.h"
+#    include "psAbort.h"
+#    include "psError.h"
 
-#include "psString.h"
+#    include "psString.h"
 
 /// @}
@@ -57,41 +60,40 @@
 /// @{
 
-#include "psType.h"
+#    include "psType.h"
 
 /// @defgroup LinkedList Linked List
 /// @ingroup DataContainer
-#include "psList.h"
+#    include "psList.h"
 
 /// @defgroup HashTable Hash Table
 /// @ingroup DataContainer
-#include "psHash.h"
+#    include "psHash.h"
 
 /// @defgroup Scalar Scalar
 /// @ingroup DataContainer
-#include "psScalar.h"
+#    include "psScalar.h"
 
 /// @defgroup Vector Vector Container
 /// @ingroup DataContainer
-#include "psVector.h"
+#    include "psVector.h"
 
 /// @defgroup Array Array Container
 /// @ingroup DataContainer
-#include "psArray.h"
+#    include "psArray.h"
 
 /// @defgroup Image Image Container
 /// @ingroup DataContainer
 /// @{
-#include "psImage.h"
-#include "psImageExtraction.h"
-#include "psImageManip.h"
+#    include "psImage.h"
+#    include "psImageExtraction.h"
+#    include "psImageManip.h"
 
 /// @defgroup ImageIO Image File I/O Functions
 /// @ingroup Image
-#include "psImageIO.h"
-
+#    include "psImageIO.h"
 
 /// @defgroup ImageStats Image Statistical Functions
 /// @ingroup Image
-#include "psImageStats.h"
+#    include "psImageStats.h"
 
 /// @}
@@ -99,5 +101,5 @@
 /// @defgroup BitSet Bit Set Container
 /// @ingroup DataContainer
-#include "psBitSet.h"
+#    include "psBitSet.h"
 
 /// @}
@@ -109,24 +111,24 @@
 /// @defgroup Compare Comparison Functions
 /// @ingroup DataManip
-#include "psCompare.h"
+#    include "psCompare.h"
 
 /// @defgroup Stats Statistic Functions
 /// @ingroup DataManip
-#include "psStats.h"
+#    include "psStats.h"
 
 /// @defgroup Matrix Matrix Operations
 /// @ingroup DataManip
-#include "psMatrix.h"
+#    include "psMatrix.h"
 
 /// @defgroup MatrixVectorArithmetic Matrix Vector Arithmetic Operations
 /// @ingroup DataManip
-#include "psMatrixVectorArithmetic.h"
+#    include "psMatrixVectorArithmetic.h"
 
 /// @defgroup Transform Fourier Transform Operations
 /// @ingroup DataManip
-#include "psFFT.h"
+#    include "psFFT.h"
 
-#include "psFunctions.h"
-#include "psMinimize.h"
+#    include "psFunctions.h"
+#    include "psMinimize.h"
 
 /// @}
@@ -138,20 +140,19 @@
 /// @defgroup CoordinateTransform Coordinate Functions
 /// @ingroup Astronomy
-#include "psCoord.h"
+#    include "psCoord.h"
 
 /// @defgroup Photometry Photometry
 /// @ingroup Astronomy
-#include "psPhotometry.h"
+#    include "psPhotometry.h"
 
 /// @defgroup Time Time Functions
 /// @ingroup Astronomy
-#include "psTime.h"
+#    include "psTime.h"
 
 /// @defgroup Metadata Metadata Functions
 /// @ingroup Astronomy
-#include "psMetadata.h"
+#    include "psMetadata.h"
 
 /// @}
 
 #endif
-
Index: /trunk/psLib/src/sys/psAbort.c
===================================================================
--- /trunk/psLib/src/sys/psAbort.c	(revision 1406)
+++ /trunk/psLib/src/sys/psAbort.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psAbort.c
  *
@@ -9,6 +10,6 @@
  *  @author Eric Van Alst, MHPCC
  *   
- *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -16,5 +17,7 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 #include <stdarg.h>
@@ -24,5 +27,7 @@
 
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
@@ -30,5 +35,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -36,5 +43,7 @@
 
 /*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
+
 /*****************************************************************************/
 
@@ -42,5 +51,7 @@
 
 /*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
+
 /*****************************************************************************/
 
@@ -48,5 +59,7 @@
 
 /*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
+
 /*****************************************************************************/
 
@@ -54,10 +67,12 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
+
 /*****************************************************************************/
 
-void psAbort(const char *name, const char *fmt,... )
+void psAbort(const char *name, const char *fmt, ...)
 {
-    va_list    argPtr;     // variable list arguement pointer
+    va_list argPtr;             // variable list arguement pointer
 
     // Get the variable list parameters to pass to logging function
@@ -73,3 +88,2 @@
     abort();
 }
-
Index: /trunk/psLib/src/sys/psAbort.h
===================================================================
--- /trunk/psLib/src/sys/psAbort.h	(revision 1406)
+++ /trunk/psLib/src/sys/psAbort.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psAbort.h
  *
@@ -11,6 +12,6 @@
  *  @author Eric Van Alst, MHPCC
  *
- *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-10 01:58:06 $
+ *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -18,8 +19,8 @@
 
 #ifndef PS_ABORT_H
-#define PS_ABORT_H
-
+#    define PS_ABORT_H
 
 // Doxygen grouping tags
+
 /** @addtogroup ErrorHandling
  *  @{
@@ -36,12 +37,10 @@
  *
  */
-void psAbort(
-    const char* name,                   ///< Source of abort such as file or function detected
-    const char* fmt,                    ///< A printf style formatting statement defining msg
-    ...
-);
+void psAbort(const char *name,  // /< Source of abort such as file or function detected
+             const char *fmt,   // /< A printf style formatting statement defining msg
+             ...
+            );
 
-/* @} */  // Doxygen - End of SystemGroup Functions
+/* @} */// Doxygen - End of SystemGroup Functions
 
 #endif
-
Index: /trunk/psLib/src/sys/psError.c
===================================================================
--- /trunk/psLib/src/sys/psError.c	(revision 1406)
+++ /trunk/psLib/src/sys/psError.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psError.c
  *
@@ -10,6 +11,6 @@
  *  @author Eric Van Alst, MHPCC
  *   
- *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -17,5 +18,7 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 #include <stdarg.h>
@@ -24,5 +27,7 @@
 
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
@@ -30,5 +35,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -36,5 +43,7 @@
 
 /*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
+
 /*****************************************************************************/
 
@@ -42,5 +51,7 @@
 
 /*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
+
 /*****************************************************************************/
 
@@ -48,5 +59,7 @@
 
 /*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATIONS - LOCAL                                         */
+
 /*****************************************************************************/
 
@@ -54,12 +67,14 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATIONS - PUBLIC                                         */
+
 /*****************************************************************************/
 
-void psError(const char *name,const char *fmt, ...)
+void psError(const char *name, const char *fmt, ...)
 {
-    va_list    argPtr;        // variable list arguement pointer
+    va_list argPtr;             // variable list arguement pointer
 
-    // Get the variable list parameters  to pass to logging function
+    // Get the variable list parameters to pass to logging function
     va_start(argPtr, fmt);
 
@@ -70,3 +85,2 @@
     va_end(argPtr);
 }
-
Index: /trunk/psLib/src/sys/psError.h
===================================================================
--- /trunk/psLib/src/sys/psError.h	(revision 1406)
+++ /trunk/psLib/src/sys/psError.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psError.h
  *
@@ -12,6 +13,6 @@
  *  @author Eric Van Alst, MHPCC
  *
- *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-10 01:58:06 $
+ *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -19,5 +20,5 @@
 
 #ifndef PS_ERROR_H
-#define PS_ERROR_H
+#    define PS_ERROR_H
 
 /** @addtogroup ErrorHandling
@@ -34,12 +35,10 @@
  *
  */
-void psError(
-    const char *name,                   ///< Source of error such as file or function detected
-    const char *fmt,                    ///< A printf style formatting statement defining msg
-    ...
-);
+void psError(const char *name,  // /< Source of error such as file or function detected
+             const char *fmt,   // /< A printf style formatting statement defining msg
+             ...
+            );
 
-/* @} */  // End of SysUtils Functions
+/* @} */// End of SysUtils Functions
 
 #endif
-
Index: /trunk/psLib/src/sys/psLogMsg.c
===================================================================
--- /trunk/psLib/src/sys/psLogMsg.c	(revision 1406)
+++ /trunk/psLib/src/sys/psLogMsg.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psLogMsg.c
  *  @brief Procedures for logging messages.
@@ -11,6 +12,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -44,11 +45,11 @@
 
 #define MAX_LOG_LINE_LENGTH 128
-static FILE* logDest = (FILE*)1;       // flag to initialize to stderr before using.
-static int globalLogLevel = PS_LOG_INFO; // log all messages at this or above
-static bool logTime = true;            // Flag to include time info
-static bool logHost = true;            // Flag to include host info
-static bool logLevel = true;           // Flag to include level info
-static bool logName = true;            // Flag to include name info
-static bool logMsg = true;             // Flag to include message info
+static FILE *logDest = (FILE *) 1;      // flag to initialize to stderr before using.
+static int globalLogLevel = PS_LOG_INFO;        // log all messages at this or above
+static bool logTime = true;     // Flag to include time info
+static bool logHost = true;     // Flag to include host info
+static bool logLevel = true;    // Flag to include level info
+static bool logName = true;     // Flag to include name info
+static bool logMsg = true;      // Flag to include message info
 
 /*****************************************************************************
@@ -67,9 +68,7 @@
 
     if ((level < MIN_LOG_LEVEL) || (level > MAX_LOG_LEVEL)) {
-        psLogMsg("logmsg", PS_LOG_WARN,
-                 "Attempt to set invalid logMsg level: %d", level);
+        psLogMsg("logmsg", PS_LOG_WARN, "Attempt to set invalid logMsg level: %d", level);
         level = (level < MIN_LOG_LEVEL) ? MIN_LOG_LEVEL : MAX_LOG_LEVEL;
     }
-
     // Set new global log level
     globalLogLevel = level;
@@ -78,5 +77,4 @@
     return oldLevel;
 }
-
 
 /*****************************************************************************
@@ -91,5 +89,5 @@
  An integer specifying the old log destination.
  *****************************************************************************/
-int psLogSetDestination(const char* dest)
+int psLogSetDestination(const char *dest)
 {
     char protocol[5];
@@ -97,9 +95,9 @@
 
     // if logDest has not been initialized, do so before using it
-    if (logDest==(FILE*)1) {
+    if (logDest == (FILE *) 1) {
         logDest = stderr;
     }
 
-    if (dest == NULL || strcmp(dest,"none")==0) {
+    if (dest == NULL || strcmp(dest, "none") == 0) {
         if (logDest != NULL && logDest != stderr && logDest != stdout) {
             fclose(logDest);
@@ -109,11 +107,11 @@
     }
 
-    if (sscanf(dest,"%4s:%256s",protocol,location) < 2) {
-        psError(__func__,"The specified destination, %s, is malformed.", dest);
+    if (sscanf(dest, "%4s:%256s", protocol, location) < 2) {
+        psError(__func__, "The specified destination, %s, is malformed.", dest);
         return 1;
     }
 
-    if (strcmp(protocol,"dest") == 0) {
-        if (strcmp(location,"stderr") == 0) {
+    if (strcmp(protocol, "dest") == 0) {
+        if (strcmp(location, "stderr") == 0) {
             if (logDest != NULL && logDest != stderr && logDest != stdout) {
                 fclose(logDest);
@@ -122,5 +120,5 @@
             return 0;
         }
-        if (strcmp(location,"stdout") == 0) {
+        if (strcmp(location, "stdout") == 0) {
             if (logDest != NULL && logDest != stderr && logDest != stdout) {
                 fclose(logDest);
@@ -129,21 +127,21 @@
             return 0;
         }
-        psError(__func__,"The location, %s, for protocol 'dest' is invalid.",location);
+        psError(__func__, "The location, %s, for protocol 'dest' is invalid.", location);
         return 1;
-    } else
-        if (strcmp(protocol,"file") == 0) {
-            FILE* file = fopen(location,"w");
-            if (file == NULL) {
-                psError(__func__,"Could not open file '%s' for output.",location);
-                return 1;
-            }
-            if (logDest != NULL && logDest != stderr && logDest != stdout) {
-                fclose(logDest);
-            }
-            logDest = file;
-            return 0;
-        }
-
-    psError(__func__,"Do not know how to handle the protocol '%s'.",protocol);
+    } else if (strcmp(protocol, "file") == 0) {
+        FILE *file = fopen(location, "w");
+
+        if (file == NULL) {
+            psError(__func__, "Could not open file '%s' for output.", location);
+            return 1;
+        }
+        if (logDest != NULL && logDest != stderr && logDest != stdout) {
+            fclose(logDest);
+        }
+        logDest = file;
+        return 0;
+    }
+
+    psError(__func__, "Do not know how to handle the protocol '%s'.", protocol);
     return 1;
 }
@@ -181,5 +179,4 @@
         fmt = "THLNM";
     }
-
     // Step through each character in the format string.  For each letter
     // in that string, set/unset the appropriate logging.
@@ -214,15 +211,12 @@
 
     if (!logMsg) {
-        psTrace("utils.logMsg", 1,
-                "You must at least log error messages (You chose \"%s\")",
-                fmt);
-    }
-}
-
-
-
-#if !defined(HOST_NAME_MAX)  // should be in limits.h
-#  define HOST_NAME_MAX 256
+        psTrace("utils.logMsg", 1, "You must at least log error messages (You chose \"%s\")", fmt);
+    }
+}
+
+#if !defined(HOST_NAME_MAX)                // should be in limits.h
+#    define HOST_NAME_MAX 256
 #endif
+
 /*****************************************************************************
     psVLogMsg(): This routine sends the message, which is a printf style
@@ -239,29 +233,25 @@
  NULL.
  *****************************************************************************/
-void psLogMsgV(const char *name,
-               int level,
-               const char *fmt,
-               va_list ap)
-{
-    static int first = 1;               // Flag for calling gethostname()
+void psLogMsgV(const char *name, int level, const char *fmt, va_list ap)
+{
+    static int first = 1;       // Flag for calling gethostname()
     static char hostname[HOST_NAME_MAX + 1];
+
     // Buffer for hostname.
-    char clevel=0;                      // letter-name for level
-    char head[MAX_LOG_LINE_LENGTH+2];   // the added two are for the ending | and \0
-    char *head_ptr = head;              // where we've got to in head
+    char clevel = 0;            // letter-name for level
+    char head[MAX_LOG_LINE_LENGTH + 2]; // the added two are for the ending | and \0
+    char *head_ptr = head;      // where we've got to in head
     int maxLength = MAX_LOG_LINE_LENGTH;
-    time_t clock = time(NULL);          // The current time.
+    time_t clock = time(NULL);  // The current time.
     struct tm *utc = gmtime(&clock);    // The current gm time.
 
     // if logDest has not been initialized, do so before using it
-    if (logDest==(FILE*)1) {
+    if (logDest == (FILE *) 1) {
         logDest = stderr;
     }
-
     // If logging is off, or if the level is too high, return immediately.
     if ((level > globalLogLevel) || (logDest == NULL)) {
         return;
     }
-
     // If I have not been here yet, determine my hostname and save it.
     if (first) {
@@ -297,6 +287,5 @@
 
     default:
-        psTrace("utils.logMsg", 2, "Invalid logMsg level: %d (%s)\n",
-                level, fmt);
+        psTrace("utils.logMsg", 2, "Invalid logMsg level: %d (%s)\n", level, fmt);
         level = (level < 0) ? 0 : 9;
         break;
@@ -307,5 +296,5 @@
         maxLength -= snprintf(head_ptr, maxLength, "%4d:%02d:%02d %02d:%02d:%02dZ",
                               utc->tm_year + 1900, utc->tm_mon + 1, utc->tm_mday,
-                              utc->tm_hour, utc->tm_min, utc->tm_sec)-1;
+                              utc->tm_hour, utc->tm_min, utc->tm_sec) - 1;
         head_ptr += strlen(head_ptr);
     }
@@ -336,8 +325,7 @@
     if (head_ptr > head) {
         *head_ptr++ = '|';
-    } else
-        if (!logMsg) { // no output desired
-            return;
-        }
+    } else if (!logMsg) {                  // no output desired
+        return;
+    }
     *head_ptr = '\0';
 
@@ -352,5 +340,4 @@
     }
 }
-
 
 /*****************************************************************************
@@ -369,8 +356,5 @@
  NULL
  *****************************************************************************/
-void psLogMsg(const char *name,
-              int level,
-              const char *fmt,
-              ...)
+void psLogMsg(const char *name, int level, const char *fmt, ...)
 {
     va_list ap;
Index: /trunk/psLib/src/sys/psLogMsg.h
===================================================================
--- /trunk/psLib/src/sys/psLogMsg.h	(revision 1406)
+++ /trunk/psLib/src/sys/psLogMsg.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psLogMsg.h
  *  @brief Procedures for logging messages.
@@ -11,12 +12,12 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
 #if !defined(PS_LOG_MSG_H)
-#define PS_LOG_MSG_H
-#include <stdarg.h>
+#    define PS_LOG_MSG_H
+#    include <stdarg.h>
 
 /** @addtogroup LogTrace
@@ -29,7 +30,6 @@
 /// In future versions, this procedure will take a character string as an
 /// argument which can specify more general log destinations.
-int psLogSetDestination(const char* dest   ///< Specifies where to send messages.
+int psLogSetDestination(const char *dest        // /< Specifies where to send messages.
                        );
-
 
 /// This procedure sets the message level for future log messages.  Subsequent
@@ -38,7 +38,6 @@
 /// Ie. higher values set by this procedure will cause more log messages to
 /// be displayed.
-int psLogSetLevel(int level          ///< Specifies the system log level
+int psLogSetLevel(int level     // /< Specifies the system log level
                  );
-
 
 /// This procedure sets the log format for future log messages.  The argument
@@ -47,7 +46,6 @@
 /// Deleting a letter from the string will cause the associated information
 /// to not be logged.
-void psLogSetFormat(const char *fmt ///< Specifies the system log format
+void psLogSetFormat(const char *fmt     // /< Specifies the system log format
                    );
-
 
 /// This procedure logs a message to the destination set by a prior
@@ -55,16 +53,15 @@
 /// specified by a prior call to psLogSetLevel().  The message is specified
 /// with a printf-stype string an arguments.
-void psLogMsg(const char *name,     ///< name of the log source
-              int myLevel,          ///< severity level of this log message
-              const char *fmt, ...  ///< printf-style format command
+void psLogMsg(const char *name, // /< name of the log source
+              int myLevel,      // /< severity level of this log message
+              const char *fmt, ...      // /< printf-style format command
              );
-
 
 /// This procedure is functionally equivalent to psLogMsg(), except that
 /// it takes a va_list as the message parameter, not a printf-style string.
-void psLogMsgV(const char *name, ///< name of the log source
-               int myLevel,      ///< severity level of this log message
-               const char *fmt,  ///< printf-style format command
-               va_list ap        ///< varargs argument list
+void psLogMsgV(const char *name,        // /< name of the log source
+               int myLevel,     // /< severity level of this log message
+               const char *fmt, // /< printf-style format command
+               va_list ap       // /< varargs argument list
               );
 
@@ -74,5 +71,6 @@
     PS_LOG_ERROR,
     PS_LOG_WARN,
-    PS_LOG_INFO };
+    PS_LOG_INFO
+};
 
 ///< Destinations for log messages
@@ -80,5 +78,6 @@
     PS_LOG_NONE,
     PS_LOG_TO_STDERR,
-    PS_LOG_TO_STDOUT };
+    PS_LOG_TO_STDOUT
+};
 
 /// @}
Index: /trunk/psLib/src/sys/psMemory.c
===================================================================
--- /trunk/psLib/src/sys/psMemory.c	(revision 1406)
+++ /trunk/psLib/src/sys/psMemory.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psMemory.c
 *
@@ -8,11 +9,11 @@
 *  @author Robert Lupton, Princeton University
 *
-*  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 22:34:05 $
+*  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
 */
 
-#define PS_ALLOW_MALLOC                 // we're allowed to call malloc()
+#define PS_ALLOW_MALLOC                    // we're allowed to call malloc()
 
 #include <stdlib.h>
@@ -26,9 +27,9 @@
 #include "psLogMsg.h"
 
-#define P_PS_MEMMAGIC (void *)0xdeadbeef // Magic number in psMemBlock header
-
-#define P_PS_LARGE_BLOCK_SIZE 65536    // size where under, we try to recycle
-
-static int checkMemBlock( const psMemBlock *m, const char* funcName );
+#define P_PS_MEMMAGIC (void *)0xdeadbeef   // Magic number in psMemBlock header
+
+#define P_PS_LARGE_BLOCK_SIZE 65536        // size where under, we try to recycle
+
+static int checkMemBlock(const psMemBlock * m, const char *funcName);
 static psMemBlock *lastMemBlockAllocated = NULL;
 static pthread_mutex_t memBlockListMutex = PTHREAD_MUTEX_INITIALIZER;
@@ -38,17 +39,17 @@
 
 static int recycleBins = 13;
-static int recycleBinSize[ 14 ] =
-    {
-        8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, P_PS_LARGE_BLOCK_SIZE
-    };
+static int recycleBinSize[14] = {
+                                    8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, P_PS_LARGE_BLOCK_SIZE
+                                };
+
 // N.B. recycleBinSize should be terminated by P_PS_LARGE_BLOCK_SIZE (simplifies search loops)
-static psMemBlock* recycleMemBlockList[ 13 ] =
-    {
-        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
-    };
+static psMemBlock *recycleMemBlockList[13] = {
+            NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+        };
 
 #ifdef PS_MEM_DEBUG
-static psMemBlock* deadBlockList;    // a place to put dead memBlocks in debug mode.
+static psMemBlock *deadBlockList;       // a place to put dead memBlocks in debug mode.
 #endif
+
 /**
  * Unique ID for allocated blocks
@@ -59,20 +60,22 @@
  *  Default memExhausted callback.
  */
-static void *memExhaustedCallbackDefault( size_t size )
-{
-    void * ptr = NULL;
-
-    pthread_mutex_lock( &recycleMemBlockListMutex );
+static void *memExhaustedCallbackDefault(size_t size)
+{
+    void *ptr = NULL;
+
+    pthread_mutex_lock(&recycleMemBlockListMutex);
     int level = recycleBins - 1;
-    while ( level >= 0 && ptr == NULL ) {
-        while ( recycleMemBlockList[ level ] != NULL && ptr == NULL ) {
-            psMemBlock * old = recycleMemBlockList[ level ];
-            recycleMemBlockList[ level ] = recycleMemBlockList[ level ] ->nextBlock;
-            free( old );
-            ptr = malloc( size );
+
+    while (level >= 0 && ptr == NULL) {
+        while (recycleMemBlockList[level] != NULL && ptr == NULL) {
+            psMemBlock *old = recycleMemBlockList[level];
+
+            recycleMemBlockList[level] = recycleMemBlockList[level]->nextBlock;
+            free(old);
+            ptr = malloc(size);
         }
         level--;
     }
-    pthread_mutex_unlock( &recycleMemBlockListMutex );
+    pthread_mutex_unlock(&recycleMemBlockListMutex);
 
     return ptr;
@@ -81,9 +84,9 @@
 static psMemExhaustedCallback memExhaustedCallback = memExhaustedCallbackDefault;
 
-psMemExhaustedCallback psMemExhaustedCallbackSet( psMemExhaustedCallback func )
+psMemExhaustedCallback psMemExhaustedCallbackSet(psMemExhaustedCallback func)
 {
     psMemExhaustedCallback old = memExhaustedCallback;
 
-    if ( func != NULL ) {
+    if (func != NULL) {
         memExhaustedCallback = func;
     } else {
@@ -94,24 +97,23 @@
 }
 
-static void memProblemCallbackDefault( const psMemBlock *ptr,
-                                       const char *file, int lineno )
-{
-    if ( ptr->refCounter < 1 ) {
-        psError( __func__,
-                 "Block %ld allocated at %s:%d freed more than once at %s:%d\n",
-                 ptr->id, ptr->file, ptr->lineno, file, lineno );
-    }
-
-    if ( lineno > 0 ) {
-        psAbort( __func__, "Detected a problem in the memory system at %s:%d", file, lineno );
+static void memProblemCallbackDefault(const psMemBlock * ptr, const char *file, int lineno)
+{
+    if (ptr->refCounter < 1) {
+        psError(__func__,
+                "Block %ld allocated at %s:%d freed more than once at %s:%d\n",
+                ptr->id, ptr->file, ptr->lineno, file, lineno);
+    }
+
+    if (lineno > 0) {
+        psAbort(__func__, "Detected a problem in the memory system at %s:%d", file, lineno);
     }
 }
 static psMemProblemCallback memProblemCallback = memProblemCallbackDefault;
 
-psMemProblemCallback psMemProblemCallbackSet( psMemProblemCallback func )
+psMemProblemCallback psMemProblemCallbackSet(psMemProblemCallback func)
 {
     psMemProblemCallback old = memProblemCallback;
 
-    if ( func != NULL ) {
+    if (func != NULL) {
         memProblemCallback = func;
     } else {
@@ -121,4 +123,5 @@
     return old;
 }
+
 /*
  * And now the I-want-to-be-informed callbacks
@@ -126,10 +129,11 @@
  * Call the callbacks when these IDs are allocated/freed
  */
-psMemoryId p_psMemAllocateID = 0;  // notify user this block is allocated
+psMemoryId p_psMemAllocateID = 0;       // notify user this block is allocated
 psMemoryId p_psMemFreeID = 0;   // notify user this block is freed
 
-psMemoryId psMemAllocateCallbackSetID( psMemoryId id )
+psMemoryId psMemAllocateCallbackSetID(psMemoryId id)
 {
     psMemoryId old = p_psMemAllocateID;
+
     p_psMemAllocateID = id;
 
@@ -137,7 +141,8 @@
 }
 
-psMemoryId psMemFreeCallbackSetID( psMemoryId id )
+psMemoryId psMemFreeCallbackSetID(psMemoryId id)
 {
     psMemoryId old = p_psMemFreeID;
+
     p_psMemFreeID = id;
 
@@ -151,14 +156,14 @@
  * isn't resignalled)
  */
-static psMemoryId memAllocateCallbackDefault( const psMemBlock *ptr )
-{
-    static psMemoryId incr = 0;  // "p_psMemAllocateID += incr"
+static psMemoryId memAllocateCallbackDefault(const psMemBlock * ptr)
+{
+    static psMemoryId incr = 0; // "p_psMemAllocateID += incr"
 
     return incr;
 }
 
-static psMemoryId memFreeCallbackDefault( const psMemBlock *ptr )
-{
-    static psMemoryId incr = 0;  // "p_psMemFreeID += incr"
+static psMemoryId memFreeCallbackDefault(const psMemBlock * ptr)
+{
+    static psMemoryId incr = 0; // "p_psMemFreeID += incr"
 
     return incr;
@@ -171,9 +176,9 @@
 static psMemFreeCallback memFreeCallback = memFreeCallbackDefault;
 
-psMemAllocateCallback psMemAllocateCallbackSet( psMemAllocateCallback func )
+psMemAllocateCallback psMemAllocateCallbackSet(psMemAllocateCallback func)
 {
     psMemFreeCallback old = memAllocateCallback;
 
-    if ( func != NULL ) {
+    if (func != NULL) {
         memAllocateCallback = func;
     } else {
@@ -184,9 +189,9 @@
 }
 
-psMemFreeCallback psMemFreeCallbackSet( psMemFreeCallback func )
+psMemFreeCallback psMemFreeCallbackSet(psMemFreeCallback func)
 {
     psMemFreeCallback old = memFreeCallback;
 
-    if ( func != NULL ) {
+    if (func != NULL) {
         memFreeCallback = func;
     } else {
@@ -200,10 +205,11 @@
  * Return memory ID counter for next block to be allocated
  */
-psMemoryId psMemGetId( void )
+psMemoryId psMemGetId(void)
 {
     psMemoryId id;
-    pthread_mutex_lock( &memIdMutex );
+
+    pthread_mutex_lock(&memIdMutex);
     id = memid + 1;
-    pthread_mutex_unlock( &memIdMutex );
+    pthread_mutex_unlock(&memIdMutex);
 
     return id;
@@ -216,29 +222,26 @@
  */
 
-static int checkMemBlock( const psMemBlock *m, const char* funcName )
+static int checkMemBlock(const psMemBlock * m, const char *funcName)
 {
     // n.b. since this is called by psMemCheckCorruption while the memblock list is mutex locked,
     // we shouldn't call such things as p_psAlloc/p_psFree here.
 
-    if ( m == NULL ) {
-        psError( funcName, "Memory Corruption: NULL memory block found." );
+    if (m == NULL) {
+        psError(funcName, "Memory Corruption: NULL memory block found.");
         return 1;
     }
 
-    if ( m->refCounter == 0 ) {
+    if (m->refCounter == 0) {
         // using an unreferenced block of memory, are you?
-        psError( __func__, "Memory Corruption: memory block %ld was freed but still used.",
-                 m->id );
+        psError(__func__, "Memory Corruption: memory block %ld was freed but still used.", m->id);
         return 1;
     }
 
-    if ( m->startblock != P_PS_MEMMAGIC || m->endblock != P_PS_MEMMAGIC ) {
-        psError( funcName, "Memory Corruption: memory block %ld is corrupted (buffer underflow)",
-                 m->id );
+    if (m->startblock != P_PS_MEMMAGIC || m->endblock != P_PS_MEMMAGIC) {
+        psError(funcName, "Memory Corruption: memory block %ld is corrupted (buffer underflow)", m->id);
         return 1;
     }
-    if ( *( void** ) ( ( int8_t* ) ( m + 1 ) + m->userMemorySize ) != P_PS_MEMMAGIC ) {
-        psError( funcName, "Memory Corruption: memory block %ld is corrupted (buffer overflow)",
-                 m->id );
+    if (*(void **)((int8_t *) (m + 1) + m->userMemorySize) != P_PS_MEMMAGIC) {
+        psError(funcName, "Memory Corruption: memory block %ld is corrupted (buffer overflow)", m->id);
         return 1;
     }
@@ -247,21 +250,21 @@
 }
 
-int psMemCheckCorruption( bool abort_on_error )
-{
-    int nbad = 0;                       // number of bad blocks
+int psMemCheckCorruption(bool abort_on_error)
+{
+    int nbad = 0;               // number of bad blocks
 
     // get exclusive access to the memBlock list to avoid it changing on us while we use it.
-    pthread_mutex_lock( &memBlockListMutex );
-
-    for ( psMemBlock * iter = lastMemBlockAllocated; iter != NULL; iter = iter->nextBlock ) {
-        if ( checkMemBlock( iter, __func__ ) ) {
+    pthread_mutex_lock(&memBlockListMutex);
+
+    for (psMemBlock * iter = lastMemBlockAllocated; iter != NULL; iter = iter->nextBlock) {
+        if (checkMemBlock(iter, __func__)) {
             nbad++;
 
-            memProblemCallback( iter, __func__, __LINE__ );
-
-            if ( abort_on_error ) {
+            memProblemCallback(iter, __func__, __LINE__);
+
+            if (abort_on_error) {
                 // release the lock on the memblock list
-                pthread_mutex_unlock( &memBlockListMutex );
-                psAbort( __func__, "Detected memory corruption" );
+                pthread_mutex_unlock(&memBlockListMutex);
+                psAbort(__func__, "Detected memory corruption");
                 return nbad;
             }
@@ -270,48 +273,48 @@
 
     // release the lock on the memblock list
-    pthread_mutex_unlock( &memBlockListMutex );
+    pthread_mutex_unlock(&memBlockListMutex);
     return nbad;
 }
 
-void *p_psAlloc( size_t size, const char *file, int lineno )
-{
-
-    psMemBlock * ptr = NULL;
+void *p_psAlloc(size_t size, const char *file, int lineno)
+{
+
+    psMemBlock *ptr = NULL;
 
     // memory is of the size I want to bother recycling?
-    if ( size < P_PS_LARGE_BLOCK_SIZE ) {
+    if (size < P_PS_LARGE_BLOCK_SIZE) {
         // find the bin we need.
         int level = 0;
-        while ( size > recycleBinSize[ level ] ) {
+
+        while (size > recycleBinSize[level]) {
             level++;
         }
         // Are we in one of the bins
-        if ( level < recycleBins ) {
-
-            size = recycleBinSize[ level ];  // round-up size to next sized bin.
-
-            pthread_mutex_lock( &recycleMemBlockListMutex );
-
-            if ( recycleMemBlockList[ level ] != NULL ) {
-                ptr = recycleMemBlockList[ level ];
-                recycleMemBlockList[ level ] = ptr->nextBlock;
-                if ( recycleMemBlockList[ level ] != NULL ) {
-                    recycleMemBlockList[ level ] ->previousBlock = NULL;
+        if (level < recycleBins) {
+
+            size = recycleBinSize[level];  // round-up size to next sized bin.
+
+            pthread_mutex_lock(&recycleMemBlockListMutex);
+
+            if (recycleMemBlockList[level] != NULL) {
+                ptr = recycleMemBlockList[level];
+                recycleMemBlockList[level] = ptr->nextBlock;
+                if (recycleMemBlockList[level] != NULL) {
+                    recycleMemBlockList[level]->previousBlock = NULL;
                 }
                 size = ptr->userMemorySize;
             }
 
-            pthread_mutex_unlock( &recycleMemBlockListMutex );
-        }
-    }
-
-    if ( ptr == NULL ) {
-        ptr = malloc( sizeof( psMemBlock ) + size + sizeof( void* ) );
-
-        if ( ptr == NULL ) {
-            ptr = memExhaustedCallback( size );
-            if ( ptr == NULL ) {
-                psAbort( __func__, "Failed to allocate %u bytes at %s:%d",
-                         size, file, lineno );
+            pthread_mutex_unlock(&recycleMemBlockListMutex);
+        }
+    }
+
+    if (ptr == NULL) {
+        ptr = malloc(sizeof(psMemBlock) + size + sizeof(void *));
+
+        if (ptr == NULL) {
+            ptr = memExhaustedCallback(size);
+            if (ptr == NULL) {
+                psAbort(__func__, "Failed to allocate %u bytes at %s:%d", size, file, lineno);
             }
         }
@@ -320,95 +323,91 @@
         ptr->endblock = P_PS_MEMMAGIC;
         ptr->userMemorySize = size;
-        pthread_mutex_init( &ptr->refCounterMutex, NULL );
-    }
-
+        pthread_mutex_init(&ptr->refCounterMutex, NULL);
+    }
     // increment the memory id safely.
-    pthread_mutex_lock( &memBlockListMutex );
-    *( psMemoryId* ) & ptr->id = ++memid;
-    pthread_mutex_unlock( &memBlockListMutex );
+    pthread_mutex_lock(&memBlockListMutex);
+    *(psMemoryId *) & ptr->id = ++memid;
+    pthread_mutex_unlock(&memBlockListMutex);
 
     ptr->file = file;
     ptr->freeFcn = NULL;
-    *( unsigned int* ) & ptr->lineno = lineno;
-    *( void** ) ( ( int8_t* ) ( ptr + 1 ) + size ) = P_PS_MEMMAGIC;
+    *(unsigned int *)&ptr->lineno = lineno;
+    *(void **)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;
     ptr->previousBlock = NULL;
 
-    ptr->refCounter = 1;                // one user so far
+    ptr->refCounter = 1;                   // one user so far
 
     // need exclusive access of the memory block list now...
-    pthread_mutex_lock( &memBlockListMutex );
+    pthread_mutex_lock(&memBlockListMutex);
 
     // insert the new block to the front of the memBlock linked-list
     ptr->nextBlock = lastMemBlockAllocated;
-    if ( ptr->nextBlock != NULL ) {
+    if (ptr->nextBlock != NULL) {
         ptr->nextBlock->previousBlock = ptr;
     }
     lastMemBlockAllocated = ptr;
 
-    pthread_mutex_unlock( &memBlockListMutex );
-
-    //  Did the user ask to be informed about this allocation?
-    if ( ptr->id == p_psMemAllocateID ) {
-        p_psMemAllocateID += memAllocateCallback( ptr );
-    }
-
+    pthread_mutex_unlock(&memBlockListMutex);
+
+    // Did the user ask to be informed about this allocation?
+    if (ptr->id == p_psMemAllocateID) {
+        p_psMemAllocateID += memAllocateCallback(ptr);
+    }
     // And return the user the memory that they allocated
-    return ptr + 1;   // user memory
-}
-
-void *p_psRealloc( void *vptr, size_t size, const char *file, int lineno )
-{
-    if ( vptr == NULL ) {
-        return p_psAlloc( size, file, lineno );
+    return ptr + 1;                        // user memory
+}
+
+void *p_psRealloc(void *vptr, size_t size, const char *file, int lineno)
+{
+    if (vptr == NULL) {
+        return p_psAlloc(size, file, lineno);
     } else {
-        psMemBlock *ptr = ( ( psMemBlock * ) vptr ) - 1;
+        psMemBlock *ptr = ((psMemBlock *) vptr) - 1;
         bool isBlockLast = false;
 
-        if ( checkMemBlock( ptr, __func__ ) != 0 ) {
-            memProblemCallback( ptr, file, lineno );
-            psAbort( file, "Realloc detected a memory corruption (id %ld @ %s:%d).",
-                     ptr->id, ptr->file, ptr->lineno );
-        }
-
-        pthread_mutex_lock( &memBlockListMutex );
-
-        isBlockLast = ( ptr == lastMemBlockAllocated );
-
-        ptr = ( psMemBlock* ) realloc( ptr, sizeof( psMemBlock ) + size + sizeof( void* ) );
-
-        if ( ptr == NULL ) {
-            psAbort( __func__, "Failed to reallocate %ld bytes at %s:%d",
-                     size, file, lineno );
+        if (checkMemBlock(ptr, __func__) != 0) {
+            memProblemCallback(ptr, file, lineno);
+            psAbort(file, "Realloc detected a memory corruption (id %ld @ %s:%d).",
+                    ptr->id, ptr->file, ptr->lineno);
+        }
+
+        pthread_mutex_lock(&memBlockListMutex);
+
+        isBlockLast = (ptr == lastMemBlockAllocated);
+
+        ptr = (psMemBlock *) realloc(ptr, sizeof(psMemBlock) + size + sizeof(void *));
+
+        if (ptr == NULL) {
+            psAbort(__func__, "Failed to reallocate %ld bytes at %s:%d", size, file, lineno);
         }
 
         ptr->userMemorySize = size;
-        *( void** ) ( ( int8_t* ) ( ptr + 1 ) + size ) = P_PS_MEMMAGIC;
-
-        if ( isBlockLast ) {
+        *(void **)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;
+
+        if (isBlockLast) {
             lastMemBlockAllocated = ptr;
         }
-
         // the block location may have changed, so fix the linked list addresses.
-        if ( ptr->nextBlock != NULL ) {
+        if (ptr->nextBlock != NULL) {
             ptr->nextBlock->previousBlock = ptr;
         }
-        if ( ptr->previousBlock != NULL ) {
+        if (ptr->previousBlock != NULL) {
             ptr->previousBlock->nextBlock = ptr;
         }
 
-        pthread_mutex_unlock( &memBlockListMutex );
-
-        //  Did the user ask to be informed about this allocation?
-        if ( ptr->id == p_psMemAllocateID ) {
-            p_psMemAllocateID += memAllocateCallback( ptr );
-        }
-
-        return ptr + 1;   // usr memory
-    }
-}
-
-void p_psFree( void *vptr, const char *file, int lineno )
-{
-    ( void ) p_psMemDecrRefCounter( vptr, file, lineno );   // this handles the free, if required.
+        pthread_mutex_unlock(&memBlockListMutex);
+
+        // Did the user ask to be informed about this allocation?
+        if (ptr->id == p_psMemAllocateID) {
+            p_psMemAllocateID += memAllocateCallback(ptr);
+        }
+
+        return ptr + 1;                    // usr memory
+    }
+}
+
+void p_psFree(void *vptr, const char *file, int lineno)
+{
+    (void)p_psMemDecrRefCounter(vptr, file, lineno);    // this handles the free, if required.
 }
 
@@ -416,39 +415,39 @@
  * Check for memory leaks.
  */
-int psMemCheckLeaks( psMemoryId id0, psMemBlock ***arr, FILE *fd )
+int psMemCheckLeaks(psMemoryId id0, psMemBlock *** arr, FILE * fd)
 {
     int nleak = 0;
     int j = 0;
-    psMemBlock* topBlock = lastMemBlockAllocated;
-
-    pthread_mutex_lock( &memBlockListMutex );
-
-    for ( psMemBlock * iter = topBlock; iter != NULL; iter = iter->nextBlock ) {
-        if ( ( psMemGetRefCounter( iter + 1 ) > 0 ) && ( iter->id >= id0 ) ) {
+    psMemBlock *topBlock = lastMemBlockAllocated;
+
+    pthread_mutex_lock(&memBlockListMutex);
+
+    for (psMemBlock * iter = topBlock; iter != NULL; iter = iter->nextBlock) {
+        if ((psMemGetRefCounter(iter + 1) > 0) && (iter->id >= id0)) {
             nleak++;
 
-            if ( fd != NULL ) {
-                if ( nleak == 1 ) {
-                    fprintf( fd, "   %20s:line ID\n", "file" );
+            if (fd != NULL) {
+                if (nleak == 1) {
+                    fprintf(fd, "   %20s:line ID\n", "file");
                 }
 
-                fprintf( fd, "   %20s:%-4d %ld\n", iter->file, iter->lineno, iter->id );
-            }
-        }
-    }
-
-    pthread_mutex_unlock( &memBlockListMutex );
-
-    if ( nleak == 0 || arr == NULL ) {
+                fprintf(fd, "   %20s:%-4d %ld\n", iter->file, iter->lineno, iter->id);
+            }
+        }
+    }
+
+    pthread_mutex_unlock(&memBlockListMutex);
+
+    if (nleak == 0 || arr == NULL) {
         return nleak;
     }
 
-    *arr = p_psAlloc( nleak * sizeof( psMemBlock ), __FILE__, __LINE__ );
-    pthread_mutex_lock( &memBlockListMutex );
-
-    for ( psMemBlock * iter = topBlock; iter != NULL; iter = iter->nextBlock ) {
-        if ( ( psMemGetRefCounter( iter + 1 ) > 0 ) && ( iter->id >= id0 ) ) {
-            ( *arr ) [ j++ ] = iter;
-            if ( j == nleak ) { // found them all
+    *arr = p_psAlloc(nleak * sizeof(psMemBlock), __FILE__, __LINE__);
+    pthread_mutex_lock(&memBlockListMutex);
+
+    for (psMemBlock * iter = topBlock; iter != NULL; iter = iter->nextBlock) {
+        if ((psMemGetRefCounter(iter + 1) > 0) && (iter->id >= id0)) {
+            (*arr)[j++] = iter;
+            if (j == nleak) {              // found them all
                 break;
             }
@@ -456,5 +455,5 @@
     }
 
-    pthread_mutex_unlock( &memBlockListMutex );
+    pthread_mutex_unlock(&memBlockListMutex);
 
     return nleak;
@@ -465,43 +464,44 @@
  */
 // return refCounter
-psReferenceCount psMemGetRefCounter( void *vptr )
-{
-    psMemBlock * ptr;
+psReferenceCount psMemGetRefCounter(void *vptr)
+{
+    psMemBlock *ptr;
     unsigned int refCount;
 
-    if ( vptr == NULL ) {
+    if (vptr == NULL) {
         return 0;
     }
 
-    ptr = ( ( psMemBlock * ) vptr ) - 1;
-
-    if ( checkMemBlock( ptr, __func__ ) != 0 ) {
-        memProblemCallback( ptr, __func__, __LINE__ );
-    }
-
-    pthread_mutex_lock( &ptr->refCounterMutex );
+    ptr = ((psMemBlock *) vptr) - 1;
+
+    if (checkMemBlock(ptr, __func__) != 0) {
+        memProblemCallback(ptr, __func__, __LINE__);
+    }
+
+    pthread_mutex_lock(&ptr->refCounterMutex);
     refCount = ptr->refCounter;
-    pthread_mutex_unlock( &ptr->refCounterMutex );
+    pthread_mutex_unlock(&ptr->refCounterMutex);
 
     return refCount;
 }
+
 // increment and return refCounter
-void* p_psMemIncrRefCounter( void *vptr, const char *file, int lineno )
-{
-    psMemBlock * ptr;
-
-    if ( vptr == NULL ) {
+void *p_psMemIncrRefCounter(void *vptr, const char *file, int lineno)
+{
+    psMemBlock *ptr;
+
+    if (vptr == NULL) {
         return vptr;
     }
 
-    ptr = ( ( psMemBlock * ) vptr ) - 1;
-
-    if ( checkMemBlock( ptr, __func__ ) ) {
-        memProblemCallback( ptr, file, lineno );
-    }
-
-    pthread_mutex_lock( &ptr->refCounterMutex );
+    ptr = ((psMemBlock *) vptr) - 1;
+
+    if (checkMemBlock(ptr, __func__)) {
+        memProblemCallback(ptr, file, lineno);
+    }
+
+    pthread_mutex_lock(&ptr->refCounterMutex);
     ptr->refCounter++;
-    pthread_mutex_unlock( &ptr->refCounterMutex );
+    pthread_mutex_unlock(&ptr->refCounterMutex);
 
     return vptr;
@@ -509,57 +509,57 @@
 
 // decrement and return refCounter
-void* p_psMemDecrRefCounter( void *vptr, const char *file, int lineno )
-{
-    if ( vptr == NULL ) {
+void *p_psMemDecrRefCounter(void *vptr, const char *file, int lineno)
+{
+    if (vptr == NULL) {
         return NULL;
     }
 
-    psMemBlock *ptr = ( ( psMemBlock * ) vptr ) - 1;
-
-    if ( checkMemBlock( ptr, __func__ ) != 0 ) {
-        memProblemCallback( ptr, file, lineno );
+    psMemBlock *ptr = ((psMemBlock *) vptr) - 1;
+
+    if (checkMemBlock(ptr, __func__) != 0) {
+        memProblemCallback(ptr, file, lineno);
         return NULL;
     }
 
-    pthread_mutex_lock( &ptr->refCounterMutex );
-
-    if ( ptr->refCounter > 1 ) {
-        /// XXX - Probably should have another mutex here.
-        ptr->refCounter--;          // multiple references, just decrement the count.
-        pthread_mutex_unlock( &ptr->refCounterMutex );
+    pthread_mutex_lock(&ptr->refCounterMutex);
+
+    if (ptr->refCounter > 1) {
+        // / XXX - Probably should have another mutex here.
+        ptr->refCounter--;                 // multiple references, just decrement the count.
+        pthread_mutex_unlock(&ptr->refCounterMutex);
 
     } else {
-        pthread_mutex_unlock( &ptr->refCounterMutex );
+        pthread_mutex_unlock(&ptr->refCounterMutex);
 
         // Did the user ask to be informed about this deallocation?
-        if ( ptr->id == p_psMemFreeID ) {
-            p_psMemFreeID += memFreeCallback( ptr );
-        }
-
-        if ( ptr->freeFcn != NULL ) {
-            ptr->freeFcn( vptr );
-        }
-
-        pthread_mutex_lock( &memBlockListMutex );
+        if (ptr->id == p_psMemFreeID) {
+            p_psMemFreeID += memFreeCallback(ptr);
+        }
+
+        if (ptr->freeFcn != NULL) {
+            ptr->freeFcn(vptr);
+        }
+
+        pthread_mutex_lock(&memBlockListMutex);
 
         // cut the memBlock out of the memBlock list
-        if ( ptr->nextBlock != NULL ) {
+        if (ptr->nextBlock != NULL) {
             ptr->nextBlock->previousBlock = ptr->previousBlock;
         }
-        if ( ptr->previousBlock != NULL ) {
+        if (ptr->previousBlock != NULL) {
             ptr->previousBlock->nextBlock = ptr->nextBlock;
         }
-        if ( lastMemBlockAllocated == ptr ) {
+        if (lastMemBlockAllocated == ptr) {
             lastMemBlockAllocated = ptr->nextBlock;
         }
 
-        pthread_mutex_unlock( &memBlockListMutex );
-
+        pthread_mutex_unlock(&memBlockListMutex);
 
         // do we need to recycle?
-        if ( ptr->userMemorySize < P_PS_LARGE_BLOCK_SIZE ) {
+        if (ptr->userMemorySize < P_PS_LARGE_BLOCK_SIZE) {
 
             int level = 1;
-            while ( ptr->userMemorySize >= recycleBinSize[ level ] ) {
+
+            while (ptr->userMemorySize >= recycleBinSize[level]) {
                 level++;
             }
@@ -569,19 +569,19 @@
             ptr->previousBlock = NULL;
 
-            pthread_mutex_lock( &recycleMemBlockListMutex );
-            ptr->nextBlock = recycleMemBlockList[ level ];
-            if ( recycleMemBlockList[ level ] != NULL ) {
-                recycleMemBlockList[ level ] ->previousBlock = ptr;
-            }
-            recycleMemBlockList[ level ] = ptr;
-            pthread_mutex_unlock( &recycleMemBlockListMutex );
+            pthread_mutex_lock(&recycleMemBlockListMutex);
+            ptr->nextBlock = recycleMemBlockList[level];
+            if (recycleMemBlockList[level] != NULL) {
+                recycleMemBlockList[level]->previousBlock = ptr;
+            }
+            recycleMemBlockList[level] = ptr;
+            pthread_mutex_unlock(&recycleMemBlockListMutex);
 
         } else {
             // memory is larger than I want to recycle.
             #ifdef PS_MEM_DEBUG
-            ( void ) p_psRealloc( vptr, 0, file, lineno );
+            (void)p_psRealloc(vptr, 0, file, lineno);
             ptr->previousBlock = NULL;
             ptr->nextBlock = deadBlockList;
-            if ( deadBlockList != NULL ) {
+            if (deadBlockList != NULL) {
                 deadBlockList->previous = ptr;
             }
@@ -589,11 +589,11 @@
             #else
 
-            pthread_mutex_destroy( &ptr->refCounterMutex );
-            free( ptr );
+            pthread_mutex_destroy(&ptr->refCounterMutex);
+            free(ptr);
             #endif
 
         }
 
-        vptr = NULL;    // since we freed it, make sure we return NULL.
+        vptr = NULL;                       // since we freed it, make sure we return NULL.
     }
 
@@ -601,14 +601,14 @@
 }
 
-void p_psMemSetDeallocator( void* vptr, psFreeFcn freeFcn )
-{
-    if ( vptr == NULL ) {
-        return ;
-    }
-
-    psMemBlock *ptr = ( ( psMemBlock * ) vptr ) - 1;
-
-    if ( checkMemBlock( ptr, __func__ ) != 0 ) {
-        memProblemCallback( ptr, __func__, __LINE__ );
+void p_psMemSetDeallocator(void *vptr, psFreeFcn freeFcn)
+{
+    if (vptr == NULL) {
+        return;
+    }
+
+    psMemBlock *ptr = ((psMemBlock *) vptr) - 1;
+
+    if (checkMemBlock(ptr, __func__) != 0) {
+        memProblemCallback(ptr, __func__, __LINE__);
     }
 
@@ -616,14 +616,14 @@
 
 }
-psFreeFcn p_psMemGetDeallocator( void* vptr )
-{
-    if ( vptr == NULL ) {
+psFreeFcn p_psMemGetDeallocator(void *vptr)
+{
+    if (vptr == NULL) {
         return NULL;
     }
 
-    psMemBlock *ptr = ( ( psMemBlock * ) vptr ) - 1;
-
-    if ( checkMemBlock( ptr, __func__ ) != 0 ) {
-        memProblemCallback( ptr, __func__, __LINE__ );
+    psMemBlock *ptr = ((psMemBlock *) vptr) - 1;
+
+    if (checkMemBlock(ptr, __func__) != 0) {
+        memProblemCallback(ptr, __func__, __LINE__);
     }
 
Index: /trunk/psLib/src/sys/psMemory.h
===================================================================
--- /trunk/psLib/src/sys/psMemory.h	(revision 1406)
+++ /trunk/psLib/src/sys/psMemory.h	(revision 1407)
@@ -1,4 +1,5 @@
 #if !defined(PS_MEMORY_H)
-#define PS_MEMORY_H
+#    define PS_MEMORY_H
+
 /** @file  psMemory.h
  *
@@ -14,13 +15,13 @@
  *  @ingroup MemoryManagement
  *
- *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
 
-#include <stdio.h>                      // needed for FILE
-#include <stdbool.h>
-#include <pthread.h>                    // we need a mutex to make this stuff thread safe.
+#    include <stdio.h>                     // needed for FILE
+#    include <stdbool.h>
+#    include <pthread.h>                   // we need a mutex to make this stuff thread safe.
 
 /** @addtogroup MemoryManagement
@@ -53,5 +54,5 @@
 
 /// typedef for deallocator.
-typedef void (*psFreeFcn)(void* ptr);
+typedef void (*psFreeFcn) (void *ptr);
 
 /** Book-keeping data for storage allocator.
@@ -62,15 +63,15 @@
 typedef struct psMemBlock
 {
-    const void* startblock;            ///< initialised to p_psMEMMAGIC
-    struct psMemBlock* previousBlock;  ///< previous block in allocation list
-    struct psMemBlock* nextBlock;      ///< next block allocation list
-    psFreeFcn freeFcn;                 ///< deallocator.  If NULL, use generic deallocation.
-    size_t  userMemorySize;            ///< the size of the user-portion of the memory block
-    const psMemoryId id;               ///< a unique ID for this allocation
-    const char* file;                  ///< set from __FILE__ in e.g. p_psAlloc
-    const int lineno;                  ///< set from __LINE__ in e.g. p_psAlloc
-    pthread_mutex_t   refCounterMutex; ///< mutex to ensure exclusive access to reference counter
-    psReferenceCount refCounter;       ///< how many times pointer is referenced
-    const void* endblock;              ///< initialised to p_psMEMMAGIC
+    const void *startblock;     // /< initialised to p_psMEMMAGIC
+    struct psMemBlock *previousBlock;   // /< previous block in allocation list
+    struct psMemBlock *nextBlock;       // /< next block allocation list
+    psFreeFcn freeFcn;          // /< deallocator.  If NULL, use generic deallocation.
+    size_t userMemorySize;      // /< the size of the user-portion of the memory block
+    const psMemoryId id;        // /< a unique ID for this allocation
+    const char *file;           // /< set from __FILE__ in e.g. p_psAlloc
+    const int lineno;           // /< set from __LINE__ in e.g. p_psAlloc
+    pthread_mutex_t refCounterMutex;    // /< mutex to ensure exclusive access to reference counter
+    psReferenceCount refCounter;        // /< how many times pointer is referenced
+    const void *endblock;       // /< initialised to p_psMEMMAGIC
 }
 psMemBlock;
@@ -81,7 +82,6 @@
  *  @ingroup memCallback
  */
-typedef psMemoryId (*psMemAllocateCallback)(
-    const psMemBlock *ptr           ///< the psMemBlock just allocated
-);
+typedef psMemoryId(*psMemAllocateCallback) (const psMemBlock * ptr      // /< the psMemBlock just allocated
+                                           );
 
 /** prototype of memory free callback used by memory functions
@@ -90,7 +90,6 @@
  *  @ingroup memCallback
  */
-typedef psMemoryId (*psMemFreeCallback)(
-    const psMemBlock *ptr           ///< the psMemBlock being freed
-);
+typedef psMemoryId(*psMemFreeCallback) (const psMemBlock * ptr  // /< the psMemBlock being freed
+                                       );
 
 /** prototype of a callback used in error conditions
@@ -101,9 +100,9 @@
  *  @ingroup memCallback
  */
-typedef void (*psMemProblemCallback)(
-    const psMemBlock *ptr,          ///< the pointer to the problematic memory block.
-    const char *file,               ///< the file in which the problem originated
-    int lineno                      ///< the line number in which the problem originated
-);
+typedef void (*psMemProblemCallback) (const psMemBlock * ptr,   // /< the pointer to the problematic memory
+                                      // block.
+                                      const char *file, // /< the file in which the problem originated
+                                      int lineno        // /< the line number in which the problem originated
+                                     );
 
 /** prototype of a callback function used when memory runs out
@@ -115,7 +114,6 @@
  *  @ingroup memCallback
  */
-typedef void *(*psMemExhaustedCallback)(
-    size_t size                     //< the size of buffer required
-);
+typedef void *(*psMemExhaustedCallback) (size_t size    // < the size of buffer required
+                                        );
 
 /** Memory allocation.  This operates much like malloc(), but is guaranteed to return a non-NULL value.
@@ -124,22 +122,19 @@
  *  @see psFree 
  */
-#ifdef DOXYGEN
-void* psAlloc(
-    size_t size                     ///< Size required
-);
-#else
-void* p_psAlloc(
-    size_t size,                    ///< Size required
-    const char *file,               ///< File of call
-    int lineno                      ///< Line number of call
-);
-
-void p_psMemSetDeallocator(void* ptr, psFreeFcn freeFcn);
-psFreeFcn p_psMemGetDeallocator(void* ptr);
+#    ifdef DOXYGEN
+void *psAlloc(size_t size       // /< Size required
+             );
+#    else
+    void *p_psAlloc(size_t size,    // /< Size required
+                    const char *file,       // /< File of call
+                    int lineno      // /< Line number of call
+                   );
+
+void p_psMemSetDeallocator(void *ptr, psFreeFcn freeFcn);
+psFreeFcn p_psMemGetDeallocator(void *ptr);
 
 /// Memory allocation. psAlloc sends file and line number to p_psAlloc.
-#define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__)
-#endif
-
+#        define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__)
+#    endif
 
 /** Memory re-allocation.  This operates much like realloc(), but is guaranteed to return a non-NULL value.
@@ -148,38 +143,37 @@
  *  @see psAlloc, psFree
  */
-#ifdef DOXYGEN
-void* psRealloc(void *ptr               ///< Pointer to re-allocate
-                size_t size,            ///< Size required
+#    ifdef DOXYGEN
+void *psRealloc(void *ptr       // /< Pointer to re-allocate
+                size_t size,    // /< Size required
                );
-#else
-void* p_psRealloc(void *ptr,            ///< Pointer to re-allocate
-                  size_t size,          ///< Size required
-                  const char *file,     ///< File of call
-                  int lineno            ///< Line number of call
+#    else
+    void *p_psRealloc(void *ptr,    // /< Pointer to re-allocate
+                      size_t size,  // /< Size required
+                      const char *file,     // /< File of call
+                      int lineno    // /< Line number of call
+                     );
+
+/// Memory re-allocation.  psRealloc sends file and line number to p_psRealloc.
+#        define psRealloc(ptr, size) p_psRealloc(ptr, size, __FILE__, __LINE__)
+
+#    endif
+
+/** Free memory.  This operates much like free().
+ *
+ *  @see psAlloc, psRealloc
+ */
+#    ifdef DOXYGEN
+void psFree(void *ptr,          // /< Pointer to free, if NULL, function returns immediately.
+           );
+#    else
+    void p_psFree(void *ptr,        // /< Pointer to free
+                  const char *file, // /< File of call
+                  int lineno        // /< Line number of call
                  );
 
-/// Memory re-allocation.  psRealloc sends file and line number to p_psRealloc.
-#define psRealloc(ptr, size) p_psRealloc(ptr, size, __FILE__, __LINE__)
-
-#endif
-
-
-/** Free memory.  This operates much like free().
- *
- *  @see psAlloc, psRealloc
- */
-#ifdef DOXYGEN
-void psFree(void *ptr,                  ///< Pointer to free, if NULL, function returns immediately.
-           );
-#else
-void p_psFree(void *ptr,                ///< Pointer to free
-              const char *file,         ///< File of call
-              int lineno                ///< Line number of call
-             );
-
 /// Free memory.  psFree sends file and line number to p_psFree.
-#define psFree(size) p_psFree(size, __FILE__, __LINE__)
-
-#endif
+#        define psFree(size) p_psFree(size, __FILE__, __LINE__)
+
+#    endif
 
 /** Check for memory leaks.  This scans for allocated memory buffers not freed with an ID not less than id0.
@@ -197,9 +191,8 @@
  *  @ingroup memTracing
  */
-int psMemCheckLeaks(
-    psMemoryId id0,              ///< don't list blocks with id < id0
-    psMemBlock ***arr,              ///< pointer to array of pointers to leaked blocks, or NULL
-    FILE *fd                        ///< print list of leaks to fd (or NULL)
-);
+int psMemCheckLeaks(psMemoryId id0,     // /< don't list blocks with id < id0
+                    psMemBlock *** arr, // /< pointer to array of pointers to leaked blocks, or NULL
+                    FILE * fd   // /< print list of leaks to fd (or NULL)
+                   );
 
 /** Check for memory corruption.  Scans all currently allocated memory buffers and checks for corruptions,
@@ -208,7 +201,6 @@
  *  @ingroup memTracing
  */
-int psMemCheckCorruption(
-    bool abort_on_error              ///< Abort on detecting corruption?
-);
+int psMemCheckCorruption(bool abort_on_error    // /< Abort on detecting corruption?
+                        );
 
 /** Return reference counter
@@ -216,7 +208,6 @@
  *  @ingroup memRefCount
  */
-psReferenceCount psMemGetRefCounter(
-    void *vptr                      ///< Pointer to get refCounter for
-);
+psReferenceCount psMemGetRefCounter(void *vptr  // /< Pointer to get refCounter for
+                                   );
 
 /** Increment reference counter and return the pointer
@@ -224,16 +215,15 @@
  *  @ingroup memRefCount
  */
-#ifdef DOXYGEN
-void* psMemIncrRefCounter(
-    void *vptr                         ///< Pointer to increment refCounter, and return
-);
-#else
-void* p_psMemIncrRefCounter(
-    void *vptr,                        ///< Pointer to increment refCounter, and return
-    const char *file,                  ///< File of call
-    int lineno                         ///< Line number of call
-);
-#define psMemIncrRefCounter(vptr) p_psMemIncrRefCounter(vptr, __FILE__, __LINE__)
-#endif
+#    ifdef DOXYGEN
+void *psMemIncrRefCounter(void *vptr    // /< Pointer to increment refCounter, and return
+                         );
+#    else
+    void *p_psMemIncrRefCounter(void *vptr, // /< Pointer to increment refCounter, and return
+                                const char *file,   // /< File of call
+                                int lineno  // /< Line number of call
+                               );
+
+#        define psMemIncrRefCounter(vptr) p_psMemIncrRefCounter(vptr, __FILE__, __LINE__)
+#    endif
 
 /** Decrement reference counter and return the pointer
@@ -241,23 +231,21 @@
  *  @ingroup memRefCount
  */
-#ifdef DOXYGEN
-void* psMemDecrRefCounter(
-    void *vptr                         ///< Pointer to decrement refCounter, and return
-);
-#else
-void* p_psMemDecrRefCounter(
-    void *vptr,                        ///< Pointer to decrement refCounter, and return
-    const char *file,                  ///< File of call
-    int lineno                         ///< Line number of call
-);
-#define psMemDecrRefCounter(vptr) p_psMemDecrRefCounter(vptr, __FILE__, __LINE__)
-#endif
+#    ifdef DOXYGEN
+void *psMemDecrRefCounter(void *vptr    // /< Pointer to decrement refCounter, and return
+                         );
+#    else
+    void *p_psMemDecrRefCounter(void *vptr, // /< Pointer to decrement refCounter, and return
+                                const char *file,   // /< File of call
+                                int lineno  // /< Line number of call
+                               );
+
+#        define psMemDecrRefCounter(vptr) p_psMemDecrRefCounter(vptr, __FILE__, __LINE__)
+#    endif
 
 /** Set callback for problems
  *  @ingroup memCallback
  */
-psMemProblemCallback psMemProblemCallbackSet(
-    psMemProblemCallback func       ///< Function to run
-);
+psMemProblemCallback psMemProblemCallbackSet(psMemProblemCallback func  // /< Function to run
+                                            );
 
 /** Set callback for out-of-memory
@@ -265,7 +253,6 @@
  *  @ingroup memCallback
  */
-psMemExhaustedCallback psMemExhaustedCallbackSet(
-    psMemExhaustedCallback func     ///< Function to run
-);
+psMemExhaustedCallback psMemExhaustedCallbackSet(psMemExhaustedCallback func    // /< Function to run
+                                                );
 
 /** Set call back for when a particular memory block is allocated
@@ -273,7 +260,6 @@
  *  @ingroup memCallback
  */
-psMemAllocateCallback psMemAllocateCallbackSet(
-    psMemAllocateCallback func          ///< Function to run
-);
+psMemAllocateCallback psMemAllocateCallbackSet(psMemAllocateCallback func       // /< Function to run
+                                              );
 
 /** Set call back for when a particular memory block is freed
@@ -281,7 +267,6 @@
  *  @ingroup memCallback
  */
-psMemFreeCallback psMemFreeCallbackSet(
-    psMemFreeCallback func              ///< Function to run
-);
+psMemFreeCallback psMemFreeCallbackSet(psMemFreeCallback func   // /< Function to run
+                                      );
 
 /** get next memory ID
@@ -295,7 +280,6 @@
  *  @ingroup memCallback
  */
-psMemoryId psMemAllocateCallbackSetID(
-    psMemoryId id                       ///< ID to set
-);
+psMemoryId psMemAllocateCallbackSetID(psMemoryId id     // /< ID to set
+                                     );
 
 /** set p_psMemFreeID to id
@@ -303,27 +287,27 @@
  *  @ingroup memCallback
  */
-psMemoryId psMemFreeCallbackSetID(
-    psMemoryId id                       ///< ID to set
-);
+psMemoryId psMemFreeCallbackSetID(psMemoryId id // /< ID to set
+                                 );
 
 //@} End of Memory Management Functions
 
-#ifndef DOXYGEN
+#    ifndef DOXYGEN
 
 /*
  * Ensure that any program using malloc/realloc/free will fail to compile
  */
-#ifndef PS_ALLOW_MALLOC
-#ifdef __GNUC__
-#pragma GCC poison malloc realloc calloc free
-#else
-#define malloc(S)       _Pragma("error Use of malloc is not allowed.  Use psAlloc instead.")
-#define realloc(P,S)    _Pragma("error Use of realloc is not allowed.  Use psRealloc instead.")
-#define calloc(S)       _Pragma("error Use of calloc is not allowed.  Use psAlloc instead.")
-#define free(P)         _Pragma("error Use of free is not allowed.  Use psFree instead.")
-#endif
-#endif
-
-#endif // doxygen skip
-
-#endif // end of header file
+#        ifndef PS_ALLOW_MALLOC
+#            ifdef __GNUC__
+#                pragma GCC poison malloc realloc calloc free
+#            else
+    #                define malloc(S)       _Pragma("error Use of malloc is not allowed.  Use psAlloc instead.")
+    #                define realloc(P,S)    _Pragma("error Use of realloc is not allowed.  Use psRealloc instead.")
+    #                define calloc(S)       _Pragma("error Use of calloc is not allowed.  Use psAlloc instead.")
+    #                define free(P)         _Pragma("error Use of free is not allowed.  Use psFree instead.")
+    #            endif
+    #        endif
+
+    #    endif
+    // doxygen skip
+
+    #endif // end of header file
Index: /trunk/psLib/src/sys/psString.c
===================================================================
--- /trunk/psLib/src/sys/psString.c	(revision 1406)
+++ /trunk/psLib/src/sys/psString.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psString.c
  *
@@ -8,6 +9,6 @@
  *  @author Eric Van Alst, MHPCC
  *   
- *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -15,5 +16,7 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 #include <stdlib.h>
@@ -24,5 +27,7 @@
 
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
@@ -30,5 +35,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -36,5 +43,7 @@
 
 /*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
+
 /*****************************************************************************/
 
@@ -42,5 +51,7 @@
 
 /*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
+
 /*****************************************************************************/
 
@@ -48,5 +59,7 @@
 
 /*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
+
 /*****************************************************************************/
 
@@ -54,10 +67,10 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
+
 /*****************************************************************************/
 
-char *psStringCopy(
-    const char*  str
-)
+char *psStringCopy(const char *str)
 {
     // Allocate memory using psAlloc function
@@ -67,16 +80,12 @@
 }
 
-char *psStringNCopy(
-    const char*  str,
-    int          nChar
-)
+char *psStringNCopy(const char *str, int nChar)
 {
     char *returnValue = NULL;
 
     // Check the number of characters to copy is non-negative
-    if ( nChar < 0 ) {
+    if (nChar < 0) {
         // Log error message and return NULL
-        psError(__FILE__,"psStringNCopy with negative count specified %d",
-                nChar);
+        psError(__FILE__, "psStringNCopy with negative count specified %d", nChar);
         return NULL;
     }
@@ -84,14 +93,11 @@
     // Copy input string to memory allocated up to nChar characters
     // Return the copy
-    returnValue = strncpy(psAlloc((size_t)nChar + 1), str, (size_t)nChar);
+    returnValue = strncpy(psAlloc((size_t) nChar + 1), str, (size_t) nChar);
 
     // Ensure the last byte is NULL character
-    if ( nChar > 0 ) {
-        returnValue[nChar-1] = '\0';
+    if (nChar > 0) {
+        returnValue[nChar - 1] = '\0';
     }
-
     // Return the string pointer
     return returnValue;
 }
-
-
Index: /trunk/psLib/src/sys/psString.h
===================================================================
--- /trunk/psLib/src/sys/psString.h	(revision 1406)
+++ /trunk/psLib/src/sys/psString.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psString.h
  *
@@ -10,6 +11,6 @@
  *  @author Eric Van Alst, MHPCC
  *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-10 01:58:06 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -17,15 +18,19 @@
 
 #ifndef PS_STRING_H
-#define PS_STRING_H
+#    define PS_STRING_H
 
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
 /** This macro will convert the arguement to a quoted string */
-#define PS_STRING(S)  #S
+#    define PS_STRING(S)  #S
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -33,8 +38,11 @@
 
 /*****************************************************************************/
+
 /* FUNCTION PROTOTYPES                                                       */
+
 /*****************************************************************************/
 
 // Doxygen group tags
+
 /** @addtogroup SysUtils
  *  @{
@@ -49,8 +57,8 @@
  *
  */
-char *psStringCopy(
-    const char *str      /**< Input string of characters to copy */
-);
 
+char *psStringCopy(const char *str
+                   /**< Input string of characters to copy */
+                  );
 
 /** Copies the input string up to the specified number of characters
@@ -67,12 +75,15 @@
  *
  */
+
 /*@null@*/
-char *psStringNCopy(
-    const char *str,    /**< Input string of characters to copy */
-    int        nChar    /**< Number of bytes to allocate for string copy */
-);
 
-/* @} */  // Doxygen - End of SystemGroup Functions
+char *psStringNCopy(const char *str,
+                    /**< Input string of characters to copy */
+
+                    int nChar
+                    /**< Number of bytes to allocate for string copy */
+                   );
+
+/* @} */// Doxygen - End of SystemGroup Functions
 
 #endif
-
Index: /trunk/psLib/src/sys/psTrace.c
===================================================================
--- /trunk/psLib/src/sys/psTrace.c	(revision 1406)
+++ /trunk/psLib/src/sys/psTrace.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file psTrace.c
  *  \brief basic run-time trace facilities
@@ -9,9 +10,10 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
+
 /*****************************************************************************
     NOTES:
@@ -34,27 +36,27 @@
 #ifndef PS_NO_TRACE
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include "psMemory.h"
-#include "psTrace.h"
-#include "psString.h"
-#include "psError.h"
-
-static p_psComponent *p_psCroot = NULL;       // The root of the trace component
-static FILE *p_psTraceFP = NULL;          // File destination for messages.
-
-static void componentFree(p_psComponent *comp);
-static p_psComponent *componentAlloc(const char *name,int level);
+#    include <stdlib.h>
+#    include <stdio.h>
+#    include <string.h>
+#    include <stdarg.h>
+#    include "psMemory.h"
+#    include "psTrace.h"
+#    include "psString.h"
+#    include "psError.h"
+
+static p_psComponent *p_psCroot = NULL; // The root of the trace component
+static FILE *p_psTraceFP = NULL;        // File destination for messages.
+
+static void componentFree(p_psComponent * comp);
+static p_psComponent *componentAlloc(const char *name, int level);
 
 /*****************************************************************************
 componentAlloc(): allocate memory for a new node, and initialize members.
  *****************************************************************************/
-static p_psComponent *componentAlloc(const char *name,
-                                     int level)
+static p_psComponent *componentAlloc(const char *name, int level)
 {
     p_psComponent *comp = psAlloc(sizeof(p_psComponent));
-    p_psMemSetDeallocator(comp,(psFreeFcn)componentFree);
+
+    p_psMemSetDeallocator(comp, (psFreeFcn) componentFree);
     comp->name = psStringCopy(name);
     comp->level = level;
@@ -64,10 +66,9 @@
 }
 
-
 /*****************************************************************************
 componentFree(): free the current node in the root tree, and all children
 nodes as well.
  *****************************************************************************/
-static void componentFree(p_psComponent *comp)
+static void componentFree(p_psComponent * comp)
 {
     if (comp == NULL) {
@@ -85,5 +86,4 @@
 }
 
-
 /*****************************************************************************
 initTrace(): simply initialize the component root tree.
@@ -96,9 +96,8 @@
 }
 
-
 /*****************************************************************************
 Set all trace levels to zero.
  *****************************************************************************/
-void p_psTraceReset(p_psComponent *currentNode)
+void p_psTraceReset(p_psComponent * currentNode)
 {
     int i = 0;
@@ -109,9 +108,8 @@
 
     currentNode->level = 0;
-    for (i=0;i<currentNode->n;i++) {
+    for (i = 0; i < currentNode->n; i++) {
         if (NULL == currentNode->subcomp[i]) {
             psError(__func__,
-                    "Sub-component %d of node %s in the trace tree is NULL.\n",
-                    i, currentNode->name);
+                    "Sub-component %d of node %s in the trace tree is NULL.\n", i, currentNode->name);
         } else {
             p_psTraceReset(currentNode->subcomp[i]);
@@ -129,5 +127,4 @@
 }
 
-
 /*****************************************************************************
 Free all nodes in the component tree.
@@ -137,5 +134,4 @@
     psFree(p_psCroot);
 }
-
 
 /*****************************************************************************
@@ -145,15 +141,14 @@
 to ANSI-C.
  *****************************************************************************/
-static void componentAdd(const char *addNodeName,
-                         int         level)
-{
-    int        i = 0;                         // Loop index variable.
-    char       name[strlen(addNodeName) + 1]; // buffer for writeable copy.
-    char      *pname=name;
-    char      *firstComponent = NULL;       // first component of name
+static void componentAdd(const char *addNodeName, int level)
+{
+    int i = 0;                  // Loop index variable.
+    char name[strlen(addNodeName) + 1]; // buffer for writeable copy.
+    char *pname = name;
+    char *firstComponent = NULL;        // first component of name
     p_psComponent *currentNode = p_psCroot;
-    int        nodeExists = 0;
-
-    // Is this the root node?  If so, simply set level and return.
+    int nodeExists = 0;
+
+    // Is this the root node? If so, simply set level and return.
     if (strcmp(".", addNodeName) == 0) {
         p_psCroot->level = level;
@@ -162,6 +157,5 @@
 
     if (addNodeName[0] != '.') {
-        printf("ERROR: failed to add %s to the root component tree.\n",
-               addNodeName);
+        printf("ERROR: failed to add %s to the root component tree.\n", addNodeName);
         exit(1);
     }
@@ -188,13 +182,11 @@
         if (nodeExists == 0) {
             currentNode->subcomp = psRealloc(currentNode->subcomp,
-                                             (currentNode->n + 1) * sizeof(p_psComponent*));
-            currentNode->n = (currentNode->n)+1;
-
-            currentNode->subcomp[(currentNode->n)-1] =
-                componentAlloc(firstComponent, level);
-        }
-    }
-}
-
+                                             (currentNode->n + 1) * sizeof(p_psComponent *));
+            currentNode->n = (currentNode->n) + 1;
+
+            currentNode->subcomp[(currentNode->n) - 1] = componentAlloc(firstComponent, level);
+        }
+    }
+}
 
 /*****************************************************************************
@@ -210,5 +202,5 @@
 *****************************************************************************/
 int psTraceSetLevel(const char *comp,   // component of interest
-                    int level)          // desired trace level
+                    int level)  // desired trace level
 {
     // If the root component tree does not exist, then initialize it.
@@ -216,5 +208,4 @@
         initTrace();
     }
-
     // Add the new component to the component tree.
     componentAdd(comp, level);
@@ -223,5 +214,4 @@
     return 0;
 }
-
 
 /*****************************************************************************
@@ -241,20 +231,20 @@
 static int doGetTraceLevel(const char *aname)
 {
-    char       name[strlen(aname) + 1]; // need a writeable copy: for strsep()
-    char      *pname=name;
-    char      *firstComponent = NULL;   // first component of name
+    char name[strlen(aname) + 1];       // need a writeable copy: for strsep()
+    char *pname = name;
+    char *firstComponent = NULL;        // first component of name
     p_psComponent *currentNode = p_psCroot;
-    int        i = 0;
+    int i = 0;
 
     if (NULL == currentNode) {
-        return(PS_UNKNOWN_TRACE_LEVEL);
+        return (PS_UNKNOWN_TRACE_LEVEL);
     }
 
     if (strcmp(".", aname) == 0) {
-        return(p_psCroot->level);
+        return (p_psCroot->level);
     }
 
     if (aname[0] != '.') {
-        return(PS_UNKNOWN_TRACE_LEVEL);
+        return (PS_UNKNOWN_TRACE_LEVEL);
     }
 
@@ -266,6 +256,5 @@
             if (NULL == currentNode->subcomp[i]) {
                 psError(__func__,
-                        "Sub-component %d of node %s in trace tree is NULL.\n",
-                        i, currentNode->name);
+                        "Sub-component %d of node %s in trace tree is NULL.\n", i, currentNode->name);
             }
 
@@ -273,12 +262,11 @@
                 currentNode = currentNode->subcomp[i];
                 if (pname == NULL) {
-                    return(currentNode->level);
+                    return (currentNode->level);
                 }
             }
         }
     }
-    return(PS_UNKNOWN_TRACE_LEVEL);
-}
-
+    return (PS_UNKNOWN_TRACE_LEVEL);
+}
 
 /*****************************************************************************
@@ -297,11 +285,9 @@
 {
     if (p_psCroot == NULL) {
-        return(PS_UNKNOWN_TRACE_LEVEL);
-    }
-
+        return (PS_UNKNOWN_TRACE_LEVEL);
+    }
     // Search the component root tree, determine the trace level.
-    return(doGetTraceLevel(name));
-}
-
+    return (doGetTraceLevel(name));
+}
 
 /*****************************************************************************
@@ -317,6 +303,5 @@
  null
  *****************************************************************************/
-static void doPrintTraceLevels(const p_psComponent *comp,
-                               int depth)
+static void doPrintTraceLevels(const p_psComponent * comp, int depth)
 {
     int i = 0;
@@ -327,17 +312,14 @@
     } else {
         if (comp->level == PS_UNKNOWN_TRACE_LEVEL) {
-            printf("%*s%-*s %s\n", depth, "", 20 - depth,
-                   comp->name, ".");
+            printf("%*s%-*s %s\n", depth, "", 20 - depth, comp->name, ".");
         } else {
-            printf("%*s%-*s %d\n", depth, "", 20 - depth,
-                   comp->name, comp->level);
+            printf("%*s%-*s %d\n", depth, "", 20 - depth, comp->name, comp->level);
         }
     }
 
     for (i = 0; i < comp->n; i++) {
-        doPrintTraceLevels(comp->subcomp[i], depth+1);
-    }
-}
-
+        doPrintTraceLevels(comp->subcomp[i], depth + 1);
+    }
+}
 
 /*****************************************************************************
@@ -359,5 +341,4 @@
     doPrintTraceLevels(p_psCroot, 0);
 }
-
 
 /*****************************************************************************
@@ -376,6 +357,6 @@
  *****************************************************************************/
 void p_psTrace(const char *comp,        // component being traced
-               int level,               // desired trace level
-               ...)                     // arguments
+               int level,       // desired trace level
+               ...)             // arguments
 {
     char *fmt = NULL;
@@ -384,8 +365,6 @@
 
     if (NULL == comp) {
-        psError(__func__,
-                "p_psTrace() called on a NULL trace level tree\n");
-    }
-
+        psError(__func__, "p_psTrace() called on a NULL trace level tree\n");
+    }
     // Only display this message if it's trace level is less than the level
     // of it's associatedcomponent.
@@ -413,9 +392,8 @@
         va_end(ap);
     }
-
-    // NOTE: should we free *fmt as well?  Read the man page.
-}
-
-void psTraceSetDestination(FILE *fp)
+    // NOTE: should we free *fmt as well? Read the man page.
+}
+
+void psTraceSetDestination(FILE * fp)
 {
     p_psTraceFP = fp;
Index: /trunk/psLib/src/sys/psTrace.h
===================================================================
--- /trunk/psLib/src/sys/psTrace.h	(revision 1406)
+++ /trunk/psLib/src/sys/psTrace.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file psTrace.h
  *  \brief basic run-time trace facilities
@@ -9,15 +10,14 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-05 19:38:52 $
+ *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
 #if !defined(PS_TRACE_H)
-#define PS_TRACE_H 1
+#    define PS_TRACE_H 1
 
-#define PS_UNKNOWN_TRACE_LEVEL -9999         // we don't know this name's level
-#define PS_DEFAULT_TRACE_LEVEL 0
-
+#    define PS_UNKNOWN_TRACE_LEVEL -9999   // we don't know this name's level
+#    define PS_DEFAULT_TRACE_LEVEL 0
 
 /** \addtogroup LogTrace
@@ -29,66 +29,65 @@
 //#define PS_NO_TRACE 1   ///< to turn off all tracing
 
-#if defined(PS_NO_TRACE)
-#define psTrace(facil, level, ...) (void)0 /* do nothing */
-#define p_psTrace(facil, level, ...)  (void)0 /* do nothing */
-#define psTraceSetLevel(facil,level) 0
-#define psTraceGetLevel(facil) 0
-#define psTraceReset() (void)0 /* do nothing */
-#define psTraceFree() (void)0 /* do nothing */
-#define psTracePrintLevels() (void)0 /* do nothing */
-#define psTraceSetDestination(fp) (void)0 /* do nothing */
-#else
+#    if defined(PS_NO_TRACE)
+    #        define psTrace(facil, level, ...) (void)0
+    /* do nothing */
+    #        define p_psTrace(facil, level, ...)  (void)0
+    /* do nothing */
+    #        define psTraceSetLevel(facil,level) 0
+    #        define psTraceGetLevel(facil) 0
+    #        define psTraceReset() (void)0     /* do nothing */
+    #        define psTraceFree() (void)0      /* do nothing */
+    #        define psTracePrintLevels() (void)0
+    /* do nothing */
+    #        define psTraceSetDestination(fp) (void)0
+    /* do nothing */
+    #    else
 
-/** Basic structure for the component tree.  A component is a string of the
-    form aaa.bbb.ccc, and may itself contain further subcomponents.  The
-    Component structure doesn't in fact contain it's full name, but only the
-    last part. */
-typedef struct p_psComponent
-{
-    const char *name;                     // last part of name of component
-    int level;                            // trace level for this component
-    int n;                                // number of subcomponents
-    struct p_psComponent **subcomp;           // next level of subcomponents
-}
+        /** Basic structure for the component tree.  A component is a string of the
+            form aaa.bbb.ccc, and may itself contain further subcomponents.  The
+            Component structure doesn't in fact contain it's full name, but only the
+            last part. */
+        typedef struct p_psComponent
+        {
+            const char *name;           // last part of name of component
+            int level;                  // trace level for this component
+            int n;                      // number of subcomponents
+            struct p_psComponent **subcomp;     // next level of subcomponents
+        }
 p_psComponent;
 
-#ifndef DOXYGEN
+#        ifndef DOXYGEN
 /// Send a trace message
-void p_psTrace(const char *facil,  ///< facilty of interest
-               int myLevel,  ///< desired trace level
-               ...)   ///< trace message arguments
+void p_psTrace(const char *facil,       // /< facilty of interest
+               int myLevel,     // /< desired trace level
+               ...)             // /< trace message arguments
 ;
-#endif
+#        endif
 
 /// Set trace level
-int psTraceSetLevel(const char *facil, ///< facilty of interest
-                    int level)  ///< desired trace level
+int psTraceSetLevel(const char *facil,     // /< facilty of interest
+                    int level)     // /< desired trace level
 ;
 
 /// Get the trace level
-int psTraceGetLevel(const char *facil) ///< facilty of interest
+int psTraceGetLevel(const char *facil)     // /< facilty of interest
 ;
 
 /// Set all trace levels to zero (do not free nodes in the component tree).
-void psTraceReset()
-;
+void psTraceReset();
 
 /// Free all nodes in the component tree.
-void psTraceFree()
-;
+void psTraceFree();
 
 /// print trace levels
-void psTracePrintLevels(void)
-;
+void psTracePrintLevels(void);
 
 /// Set the destination of future trace messages.
-void psTraceSetDestination(FILE *fp);
+void psTraceSetDestination(FILE * fp);
 
+/* \} */// End of SystemGroup Functions
 
-/* \} */ // End of SystemGroup Functions
-
-#define psTrace(facil, level, ...) p_psTrace(facil, level, __VA_ARGS__)
-#endif
+#        define psTrace(facil, level, ...) p_psTrace(facil, level, __VA_ARGS__)
+#    endif
 
 #endif
-
Index: /trunk/psLib/src/sys/psType.h
===================================================================
--- /trunk/psLib/src/sys/psType.h	(revision 1406)
+++ /trunk/psLib/src/sys/psType.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psType.h
 *
@@ -10,6 +11,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 23:37:39 $
+*  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -17,9 +18,9 @@
 
 #ifndef PS_TYPE_H
-#define PS_TYPE_H
+#    define PS_TYPE_H
 
-#include <complex.h>
-#include <stdint.h>
-#include <float.h>
+#    include <complex.h>
+#    include <stdint.h>
+#    include <float.h>
 
 /// @addtogroup DataContainer
@@ -27,5 +28,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -37,74 +40,75 @@
  */
 
-typedef uint8_t psU8;           ///< 8-bit unsigned int
-typedef uint16_t psU16;          ///< 16-bit unsigned int
-typedef uint32_t psU32;          ///< 32-bit unsigned int
-typedef uint64_t psU64;          ///< 64-bit unsigned int
-typedef int8_t psS8;           ///< 8-bit signed int
-typedef int16_t psS16;          ///< 16-bit signed int
-typedef int32_t psS32;          ///< 32-bit signed int
-typedef int64_t psS64;          ///< 64-bit signed int
-typedef float psF32;          ///< 32-bit floating point
-typedef double psF64;          ///< 64-bit floating point
-typedef complex float psC32;          ///< complex with 32-bit floating point Real and Imagary numbers
-typedef complex double psC64;          ///< complex with 64-bit floating point Real and Imagary numbers
-typedef void* psPTR;           ///< void pointer
-
+typedef uint8_t psU8;           // /< 8-bit unsigned int
+typedef uint16_t psU16;         // /< 16-bit unsigned int
+typedef uint32_t psU32;         // /< 32-bit unsigned int
+typedef uint64_t psU64;         // /< 64-bit unsigned int
+typedef int8_t psS8;            // /< 8-bit signed int
+typedef int16_t psS16;          // /< 16-bit signed int
+typedef int32_t psS32;          // /< 32-bit signed int
+typedef int64_t psS64;          // /< 64-bit signed int
+typedef float psF32;            // /< 32-bit floating point
+typedef double psF64;           // /< 64-bit floating point
+typedef complex float psC32;    // /< complex with 32-bit floating point Real and Imagary numbers
+typedef complex double psC64;   // /< complex with 64-bit floating point Real and Imagary numbers
+typedef void *psPTR;            // /< void pointer
 
 typedef enum {
-    PS_TYPE_S8 = 0x0101,   ///< Character.
-    PS_TYPE_S16 = 0x0102,   ///< Short integer.
-    PS_TYPE_S32 = 0x0104,   ///< Integer.
-    PS_TYPE_S64 = 0x0108,   ///< Long integer.
-    PS_TYPE_U8 = 0x0301,   ///< Unsigned character.
-    PS_TYPE_U16 = 0x0302,   ///< Unsigned short integer.
-    PS_TYPE_U32 = 0x0304,   ///< Unsigned integer.
-    PS_TYPE_U64 = 0x0308,   ///< Unsigned long integer.
-    PS_TYPE_F32 = 0x0404,   ///< Single-precision Floating point.
-    PS_TYPE_F64 = 0x0408,   ///< Double-precision floating point.
-    PS_TYPE_C32 = 0x0808,   ///< Complex numbers consisting of single-precision floating point.
-    PS_TYPE_C64 = 0x0810,   ///< Complex numbers consisting of double-precision floating point.
-    PS_TYPE_PTR = 0x0000   ///< Something else that's not supported for arithmetic.
+    PS_TYPE_S8 = 0x0101,        // /< Character.
+    PS_TYPE_S16 = 0x0102,                  // /< Short integer.
+    PS_TYPE_S32 = 0x0104,                  // /< Integer.
+    PS_TYPE_S64 = 0x0108,                  // /< Long integer.
+    PS_TYPE_U8 = 0x0301,                   // /< Unsigned character.
+    PS_TYPE_U16 = 0x0302,                  // /< Unsigned short integer.
+    PS_TYPE_U32 = 0x0304,                  // /< Unsigned integer.
+    PS_TYPE_U64 = 0x0308,                  // /< Unsigned long integer.
+    PS_TYPE_F32 = 0x0404,                  // /< Single-precision Floating point.
+    PS_TYPE_F64 = 0x0408,                  // /< Double-precision floating point.
+    PS_TYPE_C32 = 0x0808,                  // /< Complex numbers consisting of single-precision floating
+    // point.
+    PS_TYPE_C64 = 0x0810,                  // /< Complex numbers consisting of double-precision floating
+    // point.
+    PS_TYPE_PTR = 0x0000                   // /< Something else that's not supported for arithmetic.
 } psElemType;
 
-#define PS_TYPE_MASK PS_TYPE_U8         ///< the psElemType to use for mask image
-#define PS_TYPE_MASK_DATA U8            ///< the data member to use for mask image
-#define PS_TYPE_MASK_NAME "psU8"
-typedef psU8 psMaskType;                ///< the C datatype for a mask image
+#    define PS_TYPE_MASK PS_TYPE_U8        // /< the psElemType to use for mask image
+#    define PS_TYPE_MASK_DATA U8           // /< the data member to use for mask image
+#    define PS_TYPE_MASK_NAME "psU8"
+typedef psU8 psMaskType;        // /< the C datatype for a mask image
 
-#define PS_MIN_S8        INT8_MIN
-#define PS_MIN_S16       INT16_MIN
-#define PS_MIN_S32       INT32_MIN
-#define PS_MIN_S64       INT64_MIN
-#define PS_MIN_U8        0
-#define PS_MIN_U16       0
-#define PS_MIN_U32       0
-#define PS_MIN_U64       0
-#define PS_MIN_F32       -FLT_MAX
-#define PS_MIN_F64       -DBL_MAX
-#define PS_MIN_C32       -FLT_MAX
-#define PS_MIN_C64       -DBL_MAX
+#    define PS_MIN_S8        INT8_MIN
+#    define PS_MIN_S16       INT16_MIN
+#    define PS_MIN_S32       INT32_MIN
+#    define PS_MIN_S64       INT64_MIN
+#    define PS_MIN_U8        0
+#    define PS_MIN_U16       0
+#    define PS_MIN_U32       0
+#    define PS_MIN_U64       0
+#    define PS_MIN_F32       -FLT_MAX
+#    define PS_MIN_F64       -DBL_MAX
+#    define PS_MIN_C32       -FLT_MAX
+#    define PS_MIN_C64       -DBL_MAX
 
-#define PS_MAX_S8        INT8_MAX
-#define PS_MAX_S16       INT16_MAX
-#define PS_MAX_S32       INT32_MAX
-#define PS_MAX_S64       INT64_MAX
-#define PS_MAX_U8        UINT8_MAX
-#define PS_MAX_U16       UINT16_MAX
-#define PS_MAX_U32       UINT32_MAX
-#define PS_MAX_U64       UINT64_MAX
-#define PS_MAX_F32       FLT_MAX
-#define PS_MAX_F64       DBL_MAX
-#define PS_MAX_C32       FLT_MAX
-#define PS_MAX_C64       DBL_MAX
+#    define PS_MAX_S8        INT8_MAX
+#    define PS_MAX_S16       INT16_MAX
+#    define PS_MAX_S32       INT32_MAX
+#    define PS_MAX_S64       INT64_MAX
+#    define PS_MAX_U8        UINT8_MAX
+#    define PS_MAX_U16       UINT16_MAX
+#    define PS_MAX_U32       UINT32_MAX
+#    define PS_MAX_U64       UINT64_MAX
+#    define PS_MAX_F32       FLT_MAX
+#    define PS_MAX_F64       DBL_MAX
+#    define PS_MAX_C32       FLT_MAX
+#    define PS_MAX_C64       DBL_MAX
 
 /// Macro to get the bad pixel reason code (stored as part of mask value)
-#define PS_BADPIXEL_BITMASK 0x0f
-#define PS_GET_BADPIXEL(maskValue) (maskValue & PS_BADPIXEL_BITMASK)
+#    define PS_BADPIXEL_BITMASK 0x0f
+#    define PS_GET_BADPIXEL(maskValue) (maskValue & PS_BADPIXEL_BITMASK)
 
-#define PS_IS_BADPIXEL(maskValue) (PS_GET_BADPIXEL(maskValue) != 0)
+#    define PS_IS_BADPIXEL(maskValue) (PS_GET_BADPIXEL(maskValue) != 0)
 
 /// Macro to apply a bad pixel reason code to mask image
-#define PS_SET_BADPIXEL(maskValue, reasonCode) \
+#    define PS_SET_BADPIXEL(maskValue, reasonCode) \
 { \
     maskValue = (psMaskType)((reasonCode & PS_BADPIXEL_BITMASK) | (maskValue & ~PS_BADPIXEL_BITMASK)); \
@@ -112,13 +116,13 @@
 
 /// Macro to determine if the psElemType is an integer.
-#define PS_IS_PSELEMTYPE_INT(x) ((x & 0x100) == 0x100)
+#    define PS_IS_PSELEMTYPE_INT(x) ((x & 0x100) == 0x100)
 /// Macro to determine if the psElemType is unsigned.
-#define PS_IS_PSELEMTYPE_UNSIGNED(x) ((x & 0x200) == 0x200)
+#    define PS_IS_PSELEMTYPE_UNSIGNED(x) ((x & 0x200) == 0x200)
 /// Macro to determine if the psElemType is a real (non-complex) floating-point type.
-#define PS_IS_PSELEMTYPE_REAL(x) ((x & 0x400) == 0x400)
+#    define PS_IS_PSELEMTYPE_REAL(x) ((x & 0x400) == 0x400)
 /// Macro to determine if the psElemType is complex number type.
-#define PS_IS_PSELEMTYPE_COMPLEX(x) ((x & 0x800) == 0x800)
+#    define PS_IS_PSELEMTYPE_COMPLEX(x) ((x & 0x800) == 0x800)
 /// Macro to determine the storage size, in bytes, of the psElemType.
-#define PSELEMTYPE_SIZEOF(x) ( (x==PS_TYPE_PTR) ? sizeof(void*) :(x & 0xFF) )
+#    define PSELEMTYPE_SIZEOF(x) ( (x==PS_TYPE_PTR) ? sizeof(void*) :(x & 0xFF) )
 
 /** Dimensions of a data type.
@@ -128,9 +132,9 @@
  */
 typedef enum {
-    PS_DIMEN_SCALAR,     ///< Scalar.
-    PS_DIMEN_VECTOR,     ///< Vector.
-    PS_DIMEN_TRANSV,     ///< Transposed vector.
-    PS_DIMEN_IMAGE,      ///< Image.
-    PS_DIMEN_OTHER      ///< Something else that's not supported for arithmetic.
+    PS_DIMEN_SCALAR,            // /< Scalar.
+    PS_DIMEN_VECTOR,            // /< Vector.
+    PS_DIMEN_TRANSV,            // /< Transposed vector.
+    PS_DIMEN_IMAGE,             // /< Image.
+    PS_DIMEN_OTHER              // /< Something else that's not supported for arithmetic.
 } psDimen;
 
@@ -143,6 +147,6 @@
 typedef struct
 {
-    psElemType type;    ///< Primitive type.
-    psDimen dimen;      ///< Dimensionality.
+    psElemType type;            // /< Primitive type.
+    psDimen dimen;              // /< Dimensionality.
 }
 psType;
Index: /trunk/psLib/src/sysUtils/psAbort.c
===================================================================
--- /trunk/psLib/src/sysUtils/psAbort.c	(revision 1406)
+++ /trunk/psLib/src/sysUtils/psAbort.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psAbort.c
  *
@@ -9,6 +10,6 @@
  *  @author Eric Van Alst, MHPCC
  *   
- *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -16,5 +17,7 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 #include <stdarg.h>
@@ -24,5 +27,7 @@
 
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
@@ -30,5 +35,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -36,5 +43,7 @@
 
 /*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
+
 /*****************************************************************************/
 
@@ -42,5 +51,7 @@
 
 /*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
+
 /*****************************************************************************/
 
@@ -48,5 +59,7 @@
 
 /*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
+
 /*****************************************************************************/
 
@@ -54,10 +67,12 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
+
 /*****************************************************************************/
 
-void psAbort(const char *name, const char *fmt,... )
+void psAbort(const char *name, const char *fmt, ...)
 {
-    va_list    argPtr;     // variable list arguement pointer
+    va_list argPtr;             // variable list arguement pointer
 
     // Get the variable list parameters to pass to logging function
@@ -73,3 +88,2 @@
     abort();
 }
-
Index: /trunk/psLib/src/sysUtils/psAbort.h
===================================================================
--- /trunk/psLib/src/sysUtils/psAbort.h	(revision 1406)
+++ /trunk/psLib/src/sysUtils/psAbort.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psAbort.h
  *
@@ -11,6 +12,6 @@
  *  @author Eric Van Alst, MHPCC
  *
- *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-10 01:58:06 $
+ *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -18,8 +19,8 @@
 
 #ifndef PS_ABORT_H
-#define PS_ABORT_H
-
+#    define PS_ABORT_H
 
 // Doxygen grouping tags
+
 /** @addtogroup ErrorHandling
  *  @{
@@ -36,12 +37,10 @@
  *
  */
-void psAbort(
-    const char* name,                   ///< Source of abort such as file or function detected
-    const char* fmt,                    ///< A printf style formatting statement defining msg
-    ...
-);
+void psAbort(const char *name,  // /< Source of abort such as file or function detected
+             const char *fmt,   // /< A printf style formatting statement defining msg
+             ...
+            );
 
-/* @} */  // Doxygen - End of SystemGroup Functions
+/* @} */// Doxygen - End of SystemGroup Functions
 
 #endif
-
Index: /trunk/psLib/src/sysUtils/psError.c
===================================================================
--- /trunk/psLib/src/sysUtils/psError.c	(revision 1406)
+++ /trunk/psLib/src/sysUtils/psError.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psError.c
  *
@@ -10,6 +11,6 @@
  *  @author Eric Van Alst, MHPCC
  *   
- *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -17,5 +18,7 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 #include <stdarg.h>
@@ -24,5 +27,7 @@
 
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
@@ -30,5 +35,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -36,5 +43,7 @@
 
 /*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
+
 /*****************************************************************************/
 
@@ -42,5 +51,7 @@
 
 /*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
+
 /*****************************************************************************/
 
@@ -48,5 +59,7 @@
 
 /*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATIONS - LOCAL                                         */
+
 /*****************************************************************************/
 
@@ -54,12 +67,14 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATIONS - PUBLIC                                         */
+
 /*****************************************************************************/
 
-void psError(const char *name,const char *fmt, ...)
+void psError(const char *name, const char *fmt, ...)
 {
-    va_list    argPtr;        // variable list arguement pointer
+    va_list argPtr;             // variable list arguement pointer
 
-    // Get the variable list parameters  to pass to logging function
+    // Get the variable list parameters to pass to logging function
     va_start(argPtr, fmt);
 
@@ -70,3 +85,2 @@
     va_end(argPtr);
 }
-
Index: /trunk/psLib/src/sysUtils/psError.h
===================================================================
--- /trunk/psLib/src/sysUtils/psError.h	(revision 1406)
+++ /trunk/psLib/src/sysUtils/psError.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psError.h
  *
@@ -12,6 +13,6 @@
  *  @author Eric Van Alst, MHPCC
  *
- *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-10 01:58:06 $
+ *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -19,5 +20,5 @@
 
 #ifndef PS_ERROR_H
-#define PS_ERROR_H
+#    define PS_ERROR_H
 
 /** @addtogroup ErrorHandling
@@ -34,12 +35,10 @@
  *
  */
-void psError(
-    const char *name,                   ///< Source of error such as file or function detected
-    const char *fmt,                    ///< A printf style formatting statement defining msg
-    ...
-);
+void psError(const char *name,  // /< Source of error such as file or function detected
+             const char *fmt,   // /< A printf style formatting statement defining msg
+             ...
+            );
 
-/* @} */  // End of SysUtils Functions
+/* @} */// End of SysUtils Functions
 
 #endif
-
Index: /trunk/psLib/src/sysUtils/psHash.c
===================================================================
--- /trunk/psLib/src/sysUtils/psHash.c	(revision 1406)
+++ /trunk/psLib/src/sysUtils/psHash.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psHash.c
 *
@@ -10,6 +11,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 22:34:05 $
+*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -25,10 +26,9 @@
 #include "psAbort.h"
 
-static psHashBucket *hashBucketAlloc( const char *key, void *data, psHashBucket *next );
-static void hashBucketFree( psHashBucket *bucket );
-static void *doHashWork( psHash* table, const char* key, void* data, bool remove
-                           )
-    ;
-static void hashFree( psHash *table );
+static psHashBucket *hashBucketAlloc(const char *key, void *data, psHashBucket * next);
+static void hashBucketFree(psHashBucket * bucket);
+static void *doHashWork(psHash * table, const char *key, void *data, bool remove
+                           );
+static void hashFree(psHash * table);
 
 /******************************************************************************
@@ -40,27 +40,26 @@
     The linked list
  *****************************************************************************/
-psList *psHashKeyList( psHash *table )
-{
-    int i = 0;                          // Loop index variable
+psList *psHashKeyList(psHash * table)
+{
+    int i = 0;                  // Loop index variable
     psList *myLinkList = NULL;  // The output data structure
-    psHashBucket *ptr = NULL;           // Used to step thru linked list.
-
-    if ( table == NULL ) {
+    psHashBucket *ptr = NULL;   // Used to step thru linked list.
+
+    if (table == NULL) {
         return NULL;
     }
-
     // Create the linked list
-    myLinkList = psListAlloc( NULL );
+    myLinkList = psListAlloc(NULL);
 
     // Loop through every bucket in the hash table.  If that bucket is not
     // NULL, then add the bucket's key to the linked list.
-    for ( i = 0;i < table->nbucket;i++ ) {
-        if ( table->buckets[ i ] != NULL ) {
+    for (i = 0; i < table->nbucket; i++) {
+        if (table->buckets[i] != NULL) {
             // Since a bucket contains a linked list of keys/data, we must
             // step trough each key in that linked list:
 
-            ptr = table->buckets[ i ];
-            while ( ptr != NULL ) {
-                psListAdd( myLinkList, ptr->key, PS_LIST_HEAD );
+            ptr = table->buckets[i];
+            while (ptr != NULL) {
+                psListAdd(myLinkList, ptr->key, PS_LIST_HEAD);
                 ptr = ptr->next;
             }
@@ -69,8 +68,6 @@
 
     // Return the linked list
-    return ( myLinkList );
-}
-
-
+    return (myLinkList);
+}
 
 /******************************************************************************
@@ -84,24 +81,22 @@
     the new hash bucket.
  *****************************************************************************/
-static psHashBucket *hashBucketAlloc( const char *key,
-                                      void *data,
-                                      psHashBucket *next )
-{
-    if ( key == NULL ) {
-        psAbort( __func__, "psHashBucket() called with NULL key." );
-    }
-
+static psHashBucket *hashBucketAlloc(const char *key, void *data, psHashBucket * next)
+{
+    if (key == NULL) {
+        psAbort(__func__, "psHashBucket() called with NULL key.");
+    }
     // Allocate memory for the new hash bucket.
-    psHashBucket *bucket = psAlloc( sizeof( psHashBucket ) );
-    p_psMemSetDeallocator( bucket, ( psFreeFcn ) hashBucketFree );
+    psHashBucket *bucket = psAlloc(sizeof(psHashBucket));
+
+    p_psMemSetDeallocator(bucket, (psFreeFcn) hashBucketFree);
 
     // Initialize the bucket.
-    bucket->key = psStringCopy( key );
-
-    if ( data == NULL ) {
+    bucket->key = psStringCopy(key);
+
+    if (data == NULL) {
         // NOTE: Should we flag a warning message?
         bucket->data = NULL;
     } else {
-        bucket->data = psMemIncrRefCounter( data );
+        bucket->data = psMemIncrRefCounter(data);
     }
 
@@ -110,5 +105,4 @@
     return bucket;
 }
-
 
 /******************************************************************************
@@ -120,19 +114,17 @@
     NONE
  *****************************************************************************/
-static void hashBucketFree( psHashBucket *bucket )
-{
-    if ( bucket == NULL ) {
-        return ;
-    }
-
+static void hashBucketFree(psHashBucket * bucket)
+{
+    if (bucket == NULL) {
+        return;
+    }
     // A bucket is actually a linked list of buckets.  We recursively step
     // through that linked list, free each bucket.
-    psFree( bucket->next );
-
-    psFree( bucket->key );
-
-    psFree( bucket->data );
-}
-
+    psFree(bucket->next);
+
+    psFree(bucket->key);
+
+    psFree(bucket->data);
+}
 
 /******************************************************************************
@@ -144,21 +136,23 @@
     The new hash table.
  *****************************************************************************/
-psHash *psHashAlloc( int nbucket )   // initial number of buckets
-{
-    int i = 0;   // loop index variable
+psHash *psHashAlloc(int nbucket)        // initial number of buckets
+{
+    int i = 0;                  // loop index variable
+
     // Create the new hash table.
-    psHash *table = psAlloc( sizeof( psHash ) );
-    p_psMemSetDeallocator( table, ( psFreeFcn ) hashFree );
+    psHash *table = psAlloc(sizeof(psHash));
+
+    p_psMemSetDeallocator(table, (psFreeFcn) hashFree);
 
     // Allocate memory for the buckets.
-    table->buckets = psAlloc( nbucket * sizeof( psHashBucket * ) );
+    table->buckets = psAlloc(nbucket * sizeof(psHashBucket *));
     table->nbucket = nbucket;
 
-    psTrace( "utils.hash", 1, "Creating %d-element hash table\n", nbucket );
+    psTrace("utils.hash", 1, "Creating %d-element hash table\n", nbucket);
 
     // Initialize all buckets to NULL.
-    for ( i = 0; i < nbucket; i++ )
+    for (i = 0; i < nbucket; i++)
     {
-        table->buckets[ i ] = NULL;
+        table->buckets[i] = NULL;
     }
 
@@ -166,6 +160,4 @@
     return table;
 }
-
-
 
 /******************************************************************************
@@ -179,24 +171,23 @@
     NONE
  *****************************************************************************/
-static void hashFree( psHash *table )
-{
-    int i = 0;                          // Loop index variable.
-
-    if ( table == NULL ) {
-        return ;
-    }
-
+static void hashFree(psHash * table)
+{
+    int i = 0;                  // Loop index variable.
+
+    if (table == NULL) {
+        return;
+    }
     // Loop through each bucket in the hash table.  If that bucket is not
     // NULL, then free the bucket via a function call to hashBucketFree();
-    for ( i = 0; i < table->nbucket; i++ ) {
+    for (i = 0; i < table->nbucket; i++) {
 
         // A bucket is composed of a linked list of buckets.
-        if ( table->buckets[ i ] != NULL ) {
-            psFree( table->buckets[ i ] );
+        if (table->buckets[i] != NULL) {
+            psFree(table->buckets[i]);
         }
     }
 
     // Free the bucket structure, then the hash table.
-    psFree( table->buckets );
+    psFree(table->buckets);
 }
 
@@ -220,12 +211,14 @@
 there is little common code between those functions.
   *****************************************************************************/
-static void *doHashWork( psHash *table, const char *key, void *data, bool remove
+static void *doHashWork(psHash * table, const char *key, void *data, bool remove
                            )
 {
-    long int hash = 1;                  // This will contain an integer value
+    long int hash = 1;          // This will contain an integer value
+
     // "hashed" from the key.
-    char *tmpchar = NULL;               // Used in computing the hash function.
-    psHashBucket *ptr = NULL;           // Used to retrieve the hash bucket.
-    psHashBucket *optr = NULL;          // "original pointer": used to step
+    char *tmpchar = NULL;       // Used in computing the hash function.
+    psHashBucket *ptr = NULL;   // Used to retrieve the hash bucket.
+    psHashBucket *optr = NULL;  // "original pointer": used to step
+
     // thru the linked list for a bucket.
 
@@ -233,30 +226,28 @@
     // function, but I'm checking it anyway since future coders might change
     // the way this procedure is called.
-    if ( ( table == NULL ) || ( key == NULL ) ) {
-
-        psAbort( __func__, "psHashRemove() called with NULL key or table." );
-    }
-
+    if ((table == NULL) || (key == NULL)) {
+
+        psAbort(__func__, "psHashRemove() called with NULL key or table.");
+    }
     // NOTE: This is the originally supplied hash function.
-    //    for (int i = 0, len = strlen(key); i < len; i++) {
-    //        hash = (hash << 1) ^ key[i];
-    //    }
-    //    hash &= (table->nbucket - 1);
+    // for (int i = 0, len = strlen(key); i < len; i++) {
+    // hash = (hash << 1) ^ key[i];
+    // }
+    // hash &= (table->nbucket - 1);
 
     // This hash algorithm is from Sedgewick.  NOTE: must reread to ensure that
     // the size of the hash table is not required to be a prime number.
-    tmpchar = ( char * ) key;
-    for ( hash = 0; *tmpchar != '\0'; tmpchar++ ) {
-        hash = ( 64 * hash + *tmpchar ) % ( table->nbucket );
+    tmpchar = (char *)key;
+    for (hash = 0; *tmpchar != '\0'; tmpchar++) {
+        hash = (64 * hash + *tmpchar) % (table->nbucket);
     }
 
     // NOTE: This should not be necessary, but for now, I'm checking bounds
     // anyway.
-    if ( ( hash < 0 ) || ( hash >= table->nbucket ) ) {
-        psAbort( __func__, "Internal hash function out of range (%d)", hash );
-    }
-
+    if ((hash < 0) || (hash >= table->nbucket)) {
+        psAbort(__func__, "Internal hash function out of range (%d)", hash);
+    }
     // ptr will have the correct hash bucket.
-    ptr = table->buckets[ hash ];
+    ptr = table->buckets[hash];
 
     // We know the correct hash bucket, now we need to know what to do.
@@ -264,45 +255,46 @@
     // or a remove operation on the hash table.
 
-    if ( data == NULL ) {
-        if ( remove
-               ) {
-                // We search through the linked list for this bucket in
-                // the hash table and look for an entry for this key.
-
+    if (data == NULL) {
+        if (remove
+           ) {
+            // We search through the linked list for this bucket in
+            // the hash table and look for an entry for this key.
+
+            optr = ptr;
+            while (ptr != NULL) {
+                // Dtermine if this entry holds the correct key.
+                if (strcmp(key, ptr->key) == 0) {
+                    // The following lines of code are fairly standard ways
+                    // of removing an item from a single-linked list.
+
+                    void *data = ptr->data;
+
+                    optr->next = ptr->next;
+                    if (ptr == table->buckets[hash]) {
+                        table->buckets[hash] = ptr->next;
+                    }
+
+                    psFree(ptr);
+
+                    // By definition, the data associated with that key
+                    // must be returned, not freed.
+                    return data;
+                }
                 optr = ptr;
-                while ( ptr != NULL ) {
-                    // Dtermine if this entry holds the correct key.
-                    if ( strcmp( key, ptr->key ) == 0 ) {
-                        // The following lines of code are fairly standard ways
-                        // of removing an item from a single-linked list.
-
-                        void * data = ptr->data;
-                        optr->next = ptr->next;
-                        if ( ptr == table->buckets[ hash ] ) {
-                            table->buckets[ hash ] = ptr->next;
-                        }
-
-                        psFree( ptr );
-
-                        // By definition, the data associated with that key
-                        // must be returned, not freed.
-                        return data;
-                    }
-                    optr = ptr;
-                    ptr = ptr->next;
-                }
-                return NULL;   // not in hash
+                ptr = ptr->next;
             }
+            return NULL;                   // not in hash
+        }
         else {
             // If we get here, then a retrieve operation is requested.  So,
             // we step trough the linked list at this bucket, and return the
             // data once we find it, or return NULL if we don't.
-            while ( ptr != NULL ) {
-                if ( strcmp( key, ptr->key ) == 0 ) {
+            while (ptr != NULL) {
+                if (strcmp(key, ptr->key) == 0) {
                     return ptr->data;
                 }
                 ptr = ptr->next;
             }
-            return NULL;   // not in hash
+            return NULL;                   // not in hash
         }
     } else {
@@ -312,10 +304,9 @@
         // the hash table and look for a duplicate entry for this key.
 
-        while ( ptr != NULL ) {
-            if ( strcmp( key, ptr->key ) == 0 ) {
+        while (ptr != NULL) {
+            if (strcmp(key, ptr->key) == 0) {
                 // We have found this key in the hash table.
 
-                psTrace( "utils.hash.insert", 3, "Replacing data for %s\n",
-                         key );
+                psTrace("utils.hash.insert", 3, "Replacing data for %s\n", key);
 
                 // NOTE: I have changed this behavior from the originally
@@ -323,7 +314,7 @@
                 // the new data was not inserted into the hash table.
 
-                psFree( ptr->data );
-
-                ptr->data = psMemIncrRefCounter( data );
+                psFree(ptr->data);
+
+                ptr->data = psMemIncrRefCounter(data);
                 return data;
             }
@@ -333,7 +324,5 @@
         // table.  So, we insert this data at the head of that linked list.
 
-        table->buckets[ hash ] = hashBucketAlloc( key,
-                                 data,
-                                 table->buckets[ hash ] );
+        table->buckets[hash] = hashBucketAlloc(key, data, table->buckets[hash]);
         return data;
     }
@@ -351,17 +340,17 @@
     boolean value defining success or failure
  *****************************************************************************/
-bool psHashAdd( psHash *table, const char *key, void *data )
-{
-    if ( table == NULL ) {
-        psAbort( __func__, "psHashInsert() called with NULL hash table." );
-    }
-    if ( key == NULL ) {
-        psAbort( __func__, "psHashInsert() called with NULL key." );
-    }
-    if ( data == NULL ) {
-        psAbort( __func__, "psHashLookup() called with NULL data." );
-    }
-
-    return ( doHashWork( table, key, data, 0 ) != NULL );
+bool psHashAdd(psHash * table, const char *key, void *data)
+{
+    if (table == NULL) {
+        psAbort(__func__, "psHashInsert() called with NULL hash table.");
+    }
+    if (key == NULL) {
+        psAbort(__func__, "psHashInsert() called with NULL key.");
+    }
+    if (data == NULL) {
+        psAbort(__func__, "psHashLookup() called with NULL data.");
+    }
+
+    return (doHashWork(table, key, data, 0) != NULL);
 }
 
@@ -377,16 +366,15 @@
     The data associated with that key.
  *****************************************************************************/
-void *psHashLookup( psHash *table,     // table to lookup key in
-                    const char *key )   // key to lookup
-{
-    if ( table == NULL ) {
-        psAbort( __func__, "psHashLookup() called with NULL hash table." );
-    }
-    if ( key == NULL ) {
-        psAbort( __func__, "psHashLookup() called with NULL key." );
-    }
-
-
-    return doHashWork( table, key, NULL, 0 );
+void *psHashLookup(psHash * table,      // table to lookup key in
+                   const char *key)     // key to lookup
+{
+    if (table == NULL) {
+        psAbort(__func__, "psHashLookup() called with NULL hash table.");
+    }
+    if (key == NULL) {
+        psAbort(__func__, "psHashLookup() called with NULL key.");
+    }
+
+    return doHashWork(table, key, NULL, 0);
 }
 
@@ -401,19 +389,19 @@
     boolean value defining success or failure
  *****************************************************************************/
-bool psHashRemove( psHash *table, const char *key )
-{
-    void * data = NULL;
+bool psHashRemove(psHash * table, const char *key)
+{
+    void *data = NULL;
     bool retVal = false;
 
-    if ( table == NULL ) {
-        psAbort( __func__, "psHashRemove() called with NULL hash table." );
-    }
-    if ( key == NULL ) {
-        psAbort( __func__, "psHashRemove() called with NULL key." );
-    }
-
-    data = doHashWork( table, key, NULL, 1 );
-    if ( data != NULL ) {
-        psFree( data );
+    if (table == NULL) {
+        psAbort(__func__, "psHashRemove() called with NULL hash table.");
+    }
+    if (key == NULL) {
+        psAbort(__func__, "psHashRemove() called with NULL key.");
+    }
+
+    data = doHashWork(table, key, NULL, 1);
+    if (data != NULL) {
+        psFree(data);
         retVal = true;
     } else {
Index: /trunk/psLib/src/sysUtils/psHash.h
===================================================================
--- /trunk/psLib/src/sysUtils/psHash.h	(revision 1406)
+++ /trunk/psLib/src/sysUtils/psHash.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psHash.h
  *  @brief Contains support for basic hashing functions.
@@ -10,62 +11,63 @@
  *  @author George Gusciora, MHPCC
  *   
- *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
 #if !defined(PS_HASH_H)
-#define PS_HASH_H
+#    define PS_HASH_H
 
 /** \addtogroup HashTable
  *  \{
  */
-#include<stdbool.h>
+#    include<stdbool.h>
 
-#include "psList.h"
+#    include "psList.h"
 
 /** A bucket that holds an item of data. */
 typedef struct psHashBucket
 {
-    char *key;                          ///< key for this item of data
-    void *data;                         ///< the data itself
-    struct psHashBucket *next;          ///< list of other possible keys
+    char *key;                  // /< key for this item of data
+    void *data;                 // /< the data itself
+    struct psHashBucket *next;  // /< list of other possible keys
 }
 psHashBucket;
 
 //typedef struct HashTable psHash; ///< Opaque type for a hash table
+
 /** The hash-table itself. */
 typedef struct psHash
 {
-    int nbucket;                        ///< Number of buckets in hash table.
-    psHashBucket **buckets;             ///< The bucket data.
+    int nbucket;                // /< Number of buckets in hash table.
+    psHashBucket **buckets;     // /< The bucket data.
 }
 psHash;
 
 /// Allocate hash buckets in table.
-psHash *psHashAlloc(int nbucket       ///< The number of buckets to allocate.
+psHash *psHashAlloc(int nbucket // /< The number of buckets to allocate.
                    );
 
 /// Insert entry into table.
-bool psHashAdd(psHash *table,               ///< table to insert in
-               const char *key,             ///< key to use
-               void *data                   ///< data to insert
+bool psHashAdd(psHash * table,  // /< table to insert in
+               const char *key, // /< key to use
+               void *data       // /< data to insert
               );
 
 /// Lookup key in table.
-void *psHashLookup(psHash *table,      ///< table to lookup key in
-                   const char *key     ///< key to lookup
+void *psHashLookup(psHash * table,      // /< table to lookup key in
+                   const char *key      // /< key to lookup
                   );
 
 /// Remove key from table.
-bool psHashRemove(psHash *table,      ///< table to lookup key in
-                  const char *key     ///< key to lookup
+bool psHashRemove(psHash * table,       // /< table to lookup key in
+                  const char *key       // /< key to lookup
                  );
 
 /// List all keys in table.
-psList *psHashKeyList(psHash *table  ///< table to list keys from.
+psList *psHashKeyList(psHash * table    // /< table to list keys from.
                      );
 
-/* \} */ // End of DataGroup Functions
+/* \} */// End of DataGroup Functions
 
 #endif
Index: /trunk/psLib/src/sysUtils/psLogMsg.c
===================================================================
--- /trunk/psLib/src/sysUtils/psLogMsg.c	(revision 1406)
+++ /trunk/psLib/src/sysUtils/psLogMsg.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psLogMsg.c
  *  @brief Procedures for logging messages.
@@ -11,6 +12,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -44,11 +45,11 @@
 
 #define MAX_LOG_LINE_LENGTH 128
-static FILE* logDest = (FILE*)1;       // flag to initialize to stderr before using.
-static int globalLogLevel = PS_LOG_INFO; // log all messages at this or above
-static bool logTime = true;            // Flag to include time info
-static bool logHost = true;            // Flag to include host info
-static bool logLevel = true;           // Flag to include level info
-static bool logName = true;            // Flag to include name info
-static bool logMsg = true;             // Flag to include message info
+static FILE *logDest = (FILE *) 1;      // flag to initialize to stderr before using.
+static int globalLogLevel = PS_LOG_INFO;        // log all messages at this or above
+static bool logTime = true;     // Flag to include time info
+static bool logHost = true;     // Flag to include host info
+static bool logLevel = true;    // Flag to include level info
+static bool logName = true;     // Flag to include name info
+static bool logMsg = true;      // Flag to include message info
 
 /*****************************************************************************
@@ -67,9 +68,7 @@
 
     if ((level < MIN_LOG_LEVEL) || (level > MAX_LOG_LEVEL)) {
-        psLogMsg("logmsg", PS_LOG_WARN,
-                 "Attempt to set invalid logMsg level: %d", level);
+        psLogMsg("logmsg", PS_LOG_WARN, "Attempt to set invalid logMsg level: %d", level);
         level = (level < MIN_LOG_LEVEL) ? MIN_LOG_LEVEL : MAX_LOG_LEVEL;
     }
-
     // Set new global log level
     globalLogLevel = level;
@@ -78,5 +77,4 @@
     return oldLevel;
 }
-
 
 /*****************************************************************************
@@ -91,5 +89,5 @@
  An integer specifying the old log destination.
  *****************************************************************************/
-int psLogSetDestination(const char* dest)
+int psLogSetDestination(const char *dest)
 {
     char protocol[5];
@@ -97,9 +95,9 @@
 
     // if logDest has not been initialized, do so before using it
-    if (logDest==(FILE*)1) {
+    if (logDest == (FILE *) 1) {
         logDest = stderr;
     }
 
-    if (dest == NULL || strcmp(dest,"none")==0) {
+    if (dest == NULL || strcmp(dest, "none") == 0) {
         if (logDest != NULL && logDest != stderr && logDest != stdout) {
             fclose(logDest);
@@ -109,11 +107,11 @@
     }
 
-    if (sscanf(dest,"%4s:%256s",protocol,location) < 2) {
-        psError(__func__,"The specified destination, %s, is malformed.", dest);
+    if (sscanf(dest, "%4s:%256s", protocol, location) < 2) {
+        psError(__func__, "The specified destination, %s, is malformed.", dest);
         return 1;
     }
 
-    if (strcmp(protocol,"dest") == 0) {
-        if (strcmp(location,"stderr") == 0) {
+    if (strcmp(protocol, "dest") == 0) {
+        if (strcmp(location, "stderr") == 0) {
             if (logDest != NULL && logDest != stderr && logDest != stdout) {
                 fclose(logDest);
@@ -122,5 +120,5 @@
             return 0;
         }
-        if (strcmp(location,"stdout") == 0) {
+        if (strcmp(location, "stdout") == 0) {
             if (logDest != NULL && logDest != stderr && logDest != stdout) {
                 fclose(logDest);
@@ -129,21 +127,21 @@
             return 0;
         }
-        psError(__func__,"The location, %s, for protocol 'dest' is invalid.",location);
+        psError(__func__, "The location, %s, for protocol 'dest' is invalid.", location);
         return 1;
-    } else
-        if (strcmp(protocol,"file") == 0) {
-            FILE* file = fopen(location,"w");
-            if (file == NULL) {
-                psError(__func__,"Could not open file '%s' for output.",location);
-                return 1;
-            }
-            if (logDest != NULL && logDest != stderr && logDest != stdout) {
-                fclose(logDest);
-            }
-            logDest = file;
-            return 0;
-        }
-
-    psError(__func__,"Do not know how to handle the protocol '%s'.",protocol);
+    } else if (strcmp(protocol, "file") == 0) {
+        FILE *file = fopen(location, "w");
+
+        if (file == NULL) {
+            psError(__func__, "Could not open file '%s' for output.", location);
+            return 1;
+        }
+        if (logDest != NULL && logDest != stderr && logDest != stdout) {
+            fclose(logDest);
+        }
+        logDest = file;
+        return 0;
+    }
+
+    psError(__func__, "Do not know how to handle the protocol '%s'.", protocol);
     return 1;
 }
@@ -181,5 +179,4 @@
         fmt = "THLNM";
     }
-
     // Step through each character in the format string.  For each letter
     // in that string, set/unset the appropriate logging.
@@ -214,15 +211,12 @@
 
     if (!logMsg) {
-        psTrace("utils.logMsg", 1,
-                "You must at least log error messages (You chose \"%s\")",
-                fmt);
-    }
-}
-
-
-
-#if !defined(HOST_NAME_MAX)  // should be in limits.h
-#  define HOST_NAME_MAX 256
+        psTrace("utils.logMsg", 1, "You must at least log error messages (You chose \"%s\")", fmt);
+    }
+}
+
+#if !defined(HOST_NAME_MAX)                // should be in limits.h
+#    define HOST_NAME_MAX 256
 #endif
+
 /*****************************************************************************
     psVLogMsg(): This routine sends the message, which is a printf style
@@ -239,29 +233,25 @@
  NULL.
  *****************************************************************************/
-void psLogMsgV(const char *name,
-               int level,
-               const char *fmt,
-               va_list ap)
-{
-    static int first = 1;               // Flag for calling gethostname()
+void psLogMsgV(const char *name, int level, const char *fmt, va_list ap)
+{
+    static int first = 1;       // Flag for calling gethostname()
     static char hostname[HOST_NAME_MAX + 1];
+
     // Buffer for hostname.
-    char clevel=0;                      // letter-name for level
-    char head[MAX_LOG_LINE_LENGTH+2];   // the added two are for the ending | and \0
-    char *head_ptr = head;              // where we've got to in head
+    char clevel = 0;            // letter-name for level
+    char head[MAX_LOG_LINE_LENGTH + 2]; // the added two are for the ending | and \0
+    char *head_ptr = head;      // where we've got to in head
     int maxLength = MAX_LOG_LINE_LENGTH;
-    time_t clock = time(NULL);          // The current time.
+    time_t clock = time(NULL);  // The current time.
     struct tm *utc = gmtime(&clock);    // The current gm time.
 
     // if logDest has not been initialized, do so before using it
-    if (logDest==(FILE*)1) {
+    if (logDest == (FILE *) 1) {
         logDest = stderr;
     }
-
     // If logging is off, or if the level is too high, return immediately.
     if ((level > globalLogLevel) || (logDest == NULL)) {
         return;
     }
-
     // If I have not been here yet, determine my hostname and save it.
     if (first) {
@@ -297,6 +287,5 @@
 
     default:
-        psTrace("utils.logMsg", 2, "Invalid logMsg level: %d (%s)\n",
-                level, fmt);
+        psTrace("utils.logMsg", 2, "Invalid logMsg level: %d (%s)\n", level, fmt);
         level = (level < 0) ? 0 : 9;
         break;
@@ -307,5 +296,5 @@
         maxLength -= snprintf(head_ptr, maxLength, "%4d:%02d:%02d %02d:%02d:%02dZ",
                               utc->tm_year + 1900, utc->tm_mon + 1, utc->tm_mday,
-                              utc->tm_hour, utc->tm_min, utc->tm_sec)-1;
+                              utc->tm_hour, utc->tm_min, utc->tm_sec) - 1;
         head_ptr += strlen(head_ptr);
     }
@@ -336,8 +325,7 @@
     if (head_ptr > head) {
         *head_ptr++ = '|';
-    } else
-        if (!logMsg) { // no output desired
-            return;
-        }
+    } else if (!logMsg) {                  // no output desired
+        return;
+    }
     *head_ptr = '\0';
 
@@ -352,5 +340,4 @@
     }
 }
-
 
 /*****************************************************************************
@@ -369,8 +356,5 @@
  NULL
  *****************************************************************************/
-void psLogMsg(const char *name,
-              int level,
-              const char *fmt,
-              ...)
+void psLogMsg(const char *name, int level, const char *fmt, ...)
 {
     va_list ap;
Index: /trunk/psLib/src/sysUtils/psLogMsg.h
===================================================================
--- /trunk/psLib/src/sysUtils/psLogMsg.h	(revision 1406)
+++ /trunk/psLib/src/sysUtils/psLogMsg.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psLogMsg.h
  *  @brief Procedures for logging messages.
@@ -11,12 +12,12 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
 #if !defined(PS_LOG_MSG_H)
-#define PS_LOG_MSG_H
-#include <stdarg.h>
+#    define PS_LOG_MSG_H
+#    include <stdarg.h>
 
 /** @addtogroup LogTrace
@@ -29,7 +30,6 @@
 /// In future versions, this procedure will take a character string as an
 /// argument which can specify more general log destinations.
-int psLogSetDestination(const char* dest   ///< Specifies where to send messages.
+int psLogSetDestination(const char *dest        // /< Specifies where to send messages.
                        );
-
 
 /// This procedure sets the message level for future log messages.  Subsequent
@@ -38,7 +38,6 @@
 /// Ie. higher values set by this procedure will cause more log messages to
 /// be displayed.
-int psLogSetLevel(int level          ///< Specifies the system log level
+int psLogSetLevel(int level     // /< Specifies the system log level
                  );
-
 
 /// This procedure sets the log format for future log messages.  The argument
@@ -47,7 +46,6 @@
 /// Deleting a letter from the string will cause the associated information
 /// to not be logged.
-void psLogSetFormat(const char *fmt ///< Specifies the system log format
+void psLogSetFormat(const char *fmt     // /< Specifies the system log format
                    );
-
 
 /// This procedure logs a message to the destination set by a prior
@@ -55,16 +53,15 @@
 /// specified by a prior call to psLogSetLevel().  The message is specified
 /// with a printf-stype string an arguments.
-void psLogMsg(const char *name,     ///< name of the log source
-              int myLevel,          ///< severity level of this log message
-              const char *fmt, ...  ///< printf-style format command
+void psLogMsg(const char *name, // /< name of the log source
+              int myLevel,      // /< severity level of this log message
+              const char *fmt, ...      // /< printf-style format command
              );
-
 
 /// This procedure is functionally equivalent to psLogMsg(), except that
 /// it takes a va_list as the message parameter, not a printf-style string.
-void psLogMsgV(const char *name, ///< name of the log source
-               int myLevel,      ///< severity level of this log message
-               const char *fmt,  ///< printf-style format command
-               va_list ap        ///< varargs argument list
+void psLogMsgV(const char *name,        // /< name of the log source
+               int myLevel,     // /< severity level of this log message
+               const char *fmt, // /< printf-style format command
+               va_list ap       // /< varargs argument list
               );
 
@@ -74,5 +71,6 @@
     PS_LOG_ERROR,
     PS_LOG_WARN,
-    PS_LOG_INFO };
+    PS_LOG_INFO
+};
 
 ///< Destinations for log messages
@@ -80,5 +78,6 @@
     PS_LOG_NONE,
     PS_LOG_TO_STDERR,
-    PS_LOG_TO_STDOUT };
+    PS_LOG_TO_STDOUT
+};
 
 /// @}
Index: /trunk/psLib/src/sysUtils/psMemory.c
===================================================================
--- /trunk/psLib/src/sysUtils/psMemory.c	(revision 1406)
+++ /trunk/psLib/src/sysUtils/psMemory.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psMemory.c
 *
@@ -8,11 +9,11 @@
 *  @author Robert Lupton, Princeton University
 *
-*  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 22:34:05 $
+*  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
 */
 
-#define PS_ALLOW_MALLOC                 // we're allowed to call malloc()
+#define PS_ALLOW_MALLOC                    // we're allowed to call malloc()
 
 #include <stdlib.h>
@@ -26,9 +27,9 @@
 #include "psLogMsg.h"
 
-#define P_PS_MEMMAGIC (void *)0xdeadbeef // Magic number in psMemBlock header
-
-#define P_PS_LARGE_BLOCK_SIZE 65536    // size where under, we try to recycle
-
-static int checkMemBlock( const psMemBlock *m, const char* funcName );
+#define P_PS_MEMMAGIC (void *)0xdeadbeef   // Magic number in psMemBlock header
+
+#define P_PS_LARGE_BLOCK_SIZE 65536        // size where under, we try to recycle
+
+static int checkMemBlock(const psMemBlock * m, const char *funcName);
 static psMemBlock *lastMemBlockAllocated = NULL;
 static pthread_mutex_t memBlockListMutex = PTHREAD_MUTEX_INITIALIZER;
@@ -38,17 +39,17 @@
 
 static int recycleBins = 13;
-static int recycleBinSize[ 14 ] =
-    {
-        8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, P_PS_LARGE_BLOCK_SIZE
-    };
+static int recycleBinSize[14] = {
+                                    8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, P_PS_LARGE_BLOCK_SIZE
+                                };
+
 // N.B. recycleBinSize should be terminated by P_PS_LARGE_BLOCK_SIZE (simplifies search loops)
-static psMemBlock* recycleMemBlockList[ 13 ] =
-    {
-        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
-    };
+static psMemBlock *recycleMemBlockList[13] = {
+            NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+        };
 
 #ifdef PS_MEM_DEBUG
-static psMemBlock* deadBlockList;    // a place to put dead memBlocks in debug mode.
+static psMemBlock *deadBlockList;       // a place to put dead memBlocks in debug mode.
 #endif
+
 /**
  * Unique ID for allocated blocks
@@ -59,20 +60,22 @@
  *  Default memExhausted callback.
  */
-static void *memExhaustedCallbackDefault( size_t size )
-{
-    void * ptr = NULL;
-
-    pthread_mutex_lock( &recycleMemBlockListMutex );
+static void *memExhaustedCallbackDefault(size_t size)
+{
+    void *ptr = NULL;
+
+    pthread_mutex_lock(&recycleMemBlockListMutex);
     int level = recycleBins - 1;
-    while ( level >= 0 && ptr == NULL ) {
-        while ( recycleMemBlockList[ level ] != NULL && ptr == NULL ) {
-            psMemBlock * old = recycleMemBlockList[ level ];
-            recycleMemBlockList[ level ] = recycleMemBlockList[ level ] ->nextBlock;
-            free( old );
-            ptr = malloc( size );
+
+    while (level >= 0 && ptr == NULL) {
+        while (recycleMemBlockList[level] != NULL && ptr == NULL) {
+            psMemBlock *old = recycleMemBlockList[level];
+
+            recycleMemBlockList[level] = recycleMemBlockList[level]->nextBlock;
+            free(old);
+            ptr = malloc(size);
         }
         level--;
     }
-    pthread_mutex_unlock( &recycleMemBlockListMutex );
+    pthread_mutex_unlock(&recycleMemBlockListMutex);
 
     return ptr;
@@ -81,9 +84,9 @@
 static psMemExhaustedCallback memExhaustedCallback = memExhaustedCallbackDefault;
 
-psMemExhaustedCallback psMemExhaustedCallbackSet( psMemExhaustedCallback func )
+psMemExhaustedCallback psMemExhaustedCallbackSet(psMemExhaustedCallback func)
 {
     psMemExhaustedCallback old = memExhaustedCallback;
 
-    if ( func != NULL ) {
+    if (func != NULL) {
         memExhaustedCallback = func;
     } else {
@@ -94,24 +97,23 @@
 }
 
-static void memProblemCallbackDefault( const psMemBlock *ptr,
-                                       const char *file, int lineno )
-{
-    if ( ptr->refCounter < 1 ) {
-        psError( __func__,
-                 "Block %ld allocated at %s:%d freed more than once at %s:%d\n",
-                 ptr->id, ptr->file, ptr->lineno, file, lineno );
-    }
-
-    if ( lineno > 0 ) {
-        psAbort( __func__, "Detected a problem in the memory system at %s:%d", file, lineno );
+static void memProblemCallbackDefault(const psMemBlock * ptr, const char *file, int lineno)
+{
+    if (ptr->refCounter < 1) {
+        psError(__func__,
+                "Block %ld allocated at %s:%d freed more than once at %s:%d\n",
+                ptr->id, ptr->file, ptr->lineno, file, lineno);
+    }
+
+    if (lineno > 0) {
+        psAbort(__func__, "Detected a problem in the memory system at %s:%d", file, lineno);
     }
 }
 static psMemProblemCallback memProblemCallback = memProblemCallbackDefault;
 
-psMemProblemCallback psMemProblemCallbackSet( psMemProblemCallback func )
+psMemProblemCallback psMemProblemCallbackSet(psMemProblemCallback func)
 {
     psMemProblemCallback old = memProblemCallback;
 
-    if ( func != NULL ) {
+    if (func != NULL) {
         memProblemCallback = func;
     } else {
@@ -121,4 +123,5 @@
     return old;
 }
+
 /*
  * And now the I-want-to-be-informed callbacks
@@ -126,10 +129,11 @@
  * Call the callbacks when these IDs are allocated/freed
  */
-psMemoryId p_psMemAllocateID = 0;  // notify user this block is allocated
+psMemoryId p_psMemAllocateID = 0;       // notify user this block is allocated
 psMemoryId p_psMemFreeID = 0;   // notify user this block is freed
 
-psMemoryId psMemAllocateCallbackSetID( psMemoryId id )
+psMemoryId psMemAllocateCallbackSetID(psMemoryId id)
 {
     psMemoryId old = p_psMemAllocateID;
+
     p_psMemAllocateID = id;
 
@@ -137,7 +141,8 @@
 }
 
-psMemoryId psMemFreeCallbackSetID( psMemoryId id )
+psMemoryId psMemFreeCallbackSetID(psMemoryId id)
 {
     psMemoryId old = p_psMemFreeID;
+
     p_psMemFreeID = id;
 
@@ -151,14 +156,14 @@
  * isn't resignalled)
  */
-static psMemoryId memAllocateCallbackDefault( const psMemBlock *ptr )
-{
-    static psMemoryId incr = 0;  // "p_psMemAllocateID += incr"
+static psMemoryId memAllocateCallbackDefault(const psMemBlock * ptr)
+{
+    static psMemoryId incr = 0; // "p_psMemAllocateID += incr"
 
     return incr;
 }
 
-static psMemoryId memFreeCallbackDefault( const psMemBlock *ptr )
-{
-    static psMemoryId incr = 0;  // "p_psMemFreeID += incr"
+static psMemoryId memFreeCallbackDefault(const psMemBlock * ptr)
+{
+    static psMemoryId incr = 0; // "p_psMemFreeID += incr"
 
     return incr;
@@ -171,9 +176,9 @@
 static psMemFreeCallback memFreeCallback = memFreeCallbackDefault;
 
-psMemAllocateCallback psMemAllocateCallbackSet( psMemAllocateCallback func )
+psMemAllocateCallback psMemAllocateCallbackSet(psMemAllocateCallback func)
 {
     psMemFreeCallback old = memAllocateCallback;
 
-    if ( func != NULL ) {
+    if (func != NULL) {
         memAllocateCallback = func;
     } else {
@@ -184,9 +189,9 @@
 }
 
-psMemFreeCallback psMemFreeCallbackSet( psMemFreeCallback func )
+psMemFreeCallback psMemFreeCallbackSet(psMemFreeCallback func)
 {
     psMemFreeCallback old = memFreeCallback;
 
-    if ( func != NULL ) {
+    if (func != NULL) {
         memFreeCallback = func;
     } else {
@@ -200,10 +205,11 @@
  * Return memory ID counter for next block to be allocated
  */
-psMemoryId psMemGetId( void )
+psMemoryId psMemGetId(void)
 {
     psMemoryId id;
-    pthread_mutex_lock( &memIdMutex );
+
+    pthread_mutex_lock(&memIdMutex);
     id = memid + 1;
-    pthread_mutex_unlock( &memIdMutex );
+    pthread_mutex_unlock(&memIdMutex);
 
     return id;
@@ -216,29 +222,26 @@
  */
 
-static int checkMemBlock( const psMemBlock *m, const char* funcName )
+static int checkMemBlock(const psMemBlock * m, const char *funcName)
 {
     // n.b. since this is called by psMemCheckCorruption while the memblock list is mutex locked,
     // we shouldn't call such things as p_psAlloc/p_psFree here.
 
-    if ( m == NULL ) {
-        psError( funcName, "Memory Corruption: NULL memory block found." );
+    if (m == NULL) {
+        psError(funcName, "Memory Corruption: NULL memory block found.");
         return 1;
     }
 
-    if ( m->refCounter == 0 ) {
+    if (m->refCounter == 0) {
         // using an unreferenced block of memory, are you?
-        psError( __func__, "Memory Corruption: memory block %ld was freed but still used.",
-                 m->id );
+        psError(__func__, "Memory Corruption: memory block %ld was freed but still used.", m->id);
         return 1;
     }
 
-    if ( m->startblock != P_PS_MEMMAGIC || m->endblock != P_PS_MEMMAGIC ) {
-        psError( funcName, "Memory Corruption: memory block %ld is corrupted (buffer underflow)",
-                 m->id );
+    if (m->startblock != P_PS_MEMMAGIC || m->endblock != P_PS_MEMMAGIC) {
+        psError(funcName, "Memory Corruption: memory block %ld is corrupted (buffer underflow)", m->id);
         return 1;
     }
-    if ( *( void** ) ( ( int8_t* ) ( m + 1 ) + m->userMemorySize ) != P_PS_MEMMAGIC ) {
-        psError( funcName, "Memory Corruption: memory block %ld is corrupted (buffer overflow)",
-                 m->id );
+    if (*(void **)((int8_t *) (m + 1) + m->userMemorySize) != P_PS_MEMMAGIC) {
+        psError(funcName, "Memory Corruption: memory block %ld is corrupted (buffer overflow)", m->id);
         return 1;
     }
@@ -247,21 +250,21 @@
 }
 
-int psMemCheckCorruption( bool abort_on_error )
-{
-    int nbad = 0;                       // number of bad blocks
+int psMemCheckCorruption(bool abort_on_error)
+{
+    int nbad = 0;               // number of bad blocks
 
     // get exclusive access to the memBlock list to avoid it changing on us while we use it.
-    pthread_mutex_lock( &memBlockListMutex );
-
-    for ( psMemBlock * iter = lastMemBlockAllocated; iter != NULL; iter = iter->nextBlock ) {
-        if ( checkMemBlock( iter, __func__ ) ) {
+    pthread_mutex_lock(&memBlockListMutex);
+
+    for (psMemBlock * iter = lastMemBlockAllocated; iter != NULL; iter = iter->nextBlock) {
+        if (checkMemBlock(iter, __func__)) {
             nbad++;
 
-            memProblemCallback( iter, __func__, __LINE__ );
-
-            if ( abort_on_error ) {
+            memProblemCallback(iter, __func__, __LINE__);
+
+            if (abort_on_error) {
                 // release the lock on the memblock list
-                pthread_mutex_unlock( &memBlockListMutex );
-                psAbort( __func__, "Detected memory corruption" );
+                pthread_mutex_unlock(&memBlockListMutex);
+                psAbort(__func__, "Detected memory corruption");
                 return nbad;
             }
@@ -270,48 +273,48 @@
 
     // release the lock on the memblock list
-    pthread_mutex_unlock( &memBlockListMutex );
+    pthread_mutex_unlock(&memBlockListMutex);
     return nbad;
 }
 
-void *p_psAlloc( size_t size, const char *file, int lineno )
-{
-
-    psMemBlock * ptr = NULL;
+void *p_psAlloc(size_t size, const char *file, int lineno)
+{
+
+    psMemBlock *ptr = NULL;
 
     // memory is of the size I want to bother recycling?
-    if ( size < P_PS_LARGE_BLOCK_SIZE ) {
+    if (size < P_PS_LARGE_BLOCK_SIZE) {
         // find the bin we need.
         int level = 0;
-        while ( size > recycleBinSize[ level ] ) {
+
+        while (size > recycleBinSize[level]) {
             level++;
         }
         // Are we in one of the bins
-        if ( level < recycleBins ) {
-
-            size = recycleBinSize[ level ];  // round-up size to next sized bin.
-
-            pthread_mutex_lock( &recycleMemBlockListMutex );
-
-            if ( recycleMemBlockList[ level ] != NULL ) {
-                ptr = recycleMemBlockList[ level ];
-                recycleMemBlockList[ level ] = ptr->nextBlock;
-                if ( recycleMemBlockList[ level ] != NULL ) {
-                    recycleMemBlockList[ level ] ->previousBlock = NULL;
+        if (level < recycleBins) {
+
+            size = recycleBinSize[level];  // round-up size to next sized bin.
+
+            pthread_mutex_lock(&recycleMemBlockListMutex);
+
+            if (recycleMemBlockList[level] != NULL) {
+                ptr = recycleMemBlockList[level];
+                recycleMemBlockList[level] = ptr->nextBlock;
+                if (recycleMemBlockList[level] != NULL) {
+                    recycleMemBlockList[level]->previousBlock = NULL;
                 }
                 size = ptr->userMemorySize;
             }
 
-            pthread_mutex_unlock( &recycleMemBlockListMutex );
-        }
-    }
-
-    if ( ptr == NULL ) {
-        ptr = malloc( sizeof( psMemBlock ) + size + sizeof( void* ) );
-
-        if ( ptr == NULL ) {
-            ptr = memExhaustedCallback( size );
-            if ( ptr == NULL ) {
-                psAbort( __func__, "Failed to allocate %u bytes at %s:%d",
-                         size, file, lineno );
+            pthread_mutex_unlock(&recycleMemBlockListMutex);
+        }
+    }
+
+    if (ptr == NULL) {
+        ptr = malloc(sizeof(psMemBlock) + size + sizeof(void *));
+
+        if (ptr == NULL) {
+            ptr = memExhaustedCallback(size);
+            if (ptr == NULL) {
+                psAbort(__func__, "Failed to allocate %u bytes at %s:%d", size, file, lineno);
             }
         }
@@ -320,95 +323,91 @@
         ptr->endblock = P_PS_MEMMAGIC;
         ptr->userMemorySize = size;
-        pthread_mutex_init( &ptr->refCounterMutex, NULL );
-    }
-
+        pthread_mutex_init(&ptr->refCounterMutex, NULL);
+    }
     // increment the memory id safely.
-    pthread_mutex_lock( &memBlockListMutex );
-    *( psMemoryId* ) & ptr->id = ++memid;
-    pthread_mutex_unlock( &memBlockListMutex );
+    pthread_mutex_lock(&memBlockListMutex);
+    *(psMemoryId *) & ptr->id = ++memid;
+    pthread_mutex_unlock(&memBlockListMutex);
 
     ptr->file = file;
     ptr->freeFcn = NULL;
-    *( unsigned int* ) & ptr->lineno = lineno;
-    *( void** ) ( ( int8_t* ) ( ptr + 1 ) + size ) = P_PS_MEMMAGIC;
+    *(unsigned int *)&ptr->lineno = lineno;
+    *(void **)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;
     ptr->previousBlock = NULL;
 
-    ptr->refCounter = 1;                // one user so far
+    ptr->refCounter = 1;                   // one user so far
 
     // need exclusive access of the memory block list now...
-    pthread_mutex_lock( &memBlockListMutex );
+    pthread_mutex_lock(&memBlockListMutex);
 
     // insert the new block to the front of the memBlock linked-list
     ptr->nextBlock = lastMemBlockAllocated;
-    if ( ptr->nextBlock != NULL ) {
+    if (ptr->nextBlock != NULL) {
         ptr->nextBlock->previousBlock = ptr;
     }
     lastMemBlockAllocated = ptr;
 
-    pthread_mutex_unlock( &memBlockListMutex );
-
-    //  Did the user ask to be informed about this allocation?
-    if ( ptr->id == p_psMemAllocateID ) {
-        p_psMemAllocateID += memAllocateCallback( ptr );
-    }
-
+    pthread_mutex_unlock(&memBlockListMutex);
+
+    // Did the user ask to be informed about this allocation?
+    if (ptr->id == p_psMemAllocateID) {
+        p_psMemAllocateID += memAllocateCallback(ptr);
+    }
     // And return the user the memory that they allocated
-    return ptr + 1;   // user memory
-}
-
-void *p_psRealloc( void *vptr, size_t size, const char *file, int lineno )
-{
-    if ( vptr == NULL ) {
-        return p_psAlloc( size, file, lineno );
+    return ptr + 1;                        // user memory
+}
+
+void *p_psRealloc(void *vptr, size_t size, const char *file, int lineno)
+{
+    if (vptr == NULL) {
+        return p_psAlloc(size, file, lineno);
     } else {
-        psMemBlock *ptr = ( ( psMemBlock * ) vptr ) - 1;
+        psMemBlock *ptr = ((psMemBlock *) vptr) - 1;
         bool isBlockLast = false;
 
-        if ( checkMemBlock( ptr, __func__ ) != 0 ) {
-            memProblemCallback( ptr, file, lineno );
-            psAbort( file, "Realloc detected a memory corruption (id %ld @ %s:%d).",
-                     ptr->id, ptr->file, ptr->lineno );
-        }
-
-        pthread_mutex_lock( &memBlockListMutex );
-
-        isBlockLast = ( ptr == lastMemBlockAllocated );
-
-        ptr = ( psMemBlock* ) realloc( ptr, sizeof( psMemBlock ) + size + sizeof( void* ) );
-
-        if ( ptr == NULL ) {
-            psAbort( __func__, "Failed to reallocate %ld bytes at %s:%d",
-                     size, file, lineno );
+        if (checkMemBlock(ptr, __func__) != 0) {
+            memProblemCallback(ptr, file, lineno);
+            psAbort(file, "Realloc detected a memory corruption (id %ld @ %s:%d).",
+                    ptr->id, ptr->file, ptr->lineno);
+        }
+
+        pthread_mutex_lock(&memBlockListMutex);
+
+        isBlockLast = (ptr == lastMemBlockAllocated);
+
+        ptr = (psMemBlock *) realloc(ptr, sizeof(psMemBlock) + size + sizeof(void *));
+
+        if (ptr == NULL) {
+            psAbort(__func__, "Failed to reallocate %ld bytes at %s:%d", size, file, lineno);
         }
 
         ptr->userMemorySize = size;
-        *( void** ) ( ( int8_t* ) ( ptr + 1 ) + size ) = P_PS_MEMMAGIC;
-
-        if ( isBlockLast ) {
+        *(void **)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;
+
+        if (isBlockLast) {
             lastMemBlockAllocated = ptr;
         }
-
         // the block location may have changed, so fix the linked list addresses.
-        if ( ptr->nextBlock != NULL ) {
+        if (ptr->nextBlock != NULL) {
             ptr->nextBlock->previousBlock = ptr;
         }
-        if ( ptr->previousBlock != NULL ) {
+        if (ptr->previousBlock != NULL) {
             ptr->previousBlock->nextBlock = ptr;
         }
 
-        pthread_mutex_unlock( &memBlockListMutex );
-
-        //  Did the user ask to be informed about this allocation?
-        if ( ptr->id == p_psMemAllocateID ) {
-            p_psMemAllocateID += memAllocateCallback( ptr );
-        }
-
-        return ptr + 1;   // usr memory
-    }
-}
-
-void p_psFree( void *vptr, const char *file, int lineno )
-{
-    ( void ) p_psMemDecrRefCounter( vptr, file, lineno );   // this handles the free, if required.
+        pthread_mutex_unlock(&memBlockListMutex);
+
+        // Did the user ask to be informed about this allocation?
+        if (ptr->id == p_psMemAllocateID) {
+            p_psMemAllocateID += memAllocateCallback(ptr);
+        }
+
+        return ptr + 1;                    // usr memory
+    }
+}
+
+void p_psFree(void *vptr, const char *file, int lineno)
+{
+    (void)p_psMemDecrRefCounter(vptr, file, lineno);    // this handles the free, if required.
 }
 
@@ -416,39 +415,39 @@
  * Check for memory leaks.
  */
-int psMemCheckLeaks( psMemoryId id0, psMemBlock ***arr, FILE *fd )
+int psMemCheckLeaks(psMemoryId id0, psMemBlock *** arr, FILE * fd)
 {
     int nleak = 0;
     int j = 0;
-    psMemBlock* topBlock = lastMemBlockAllocated;
-
-    pthread_mutex_lock( &memBlockListMutex );
-
-    for ( psMemBlock * iter = topBlock; iter != NULL; iter = iter->nextBlock ) {
-        if ( ( psMemGetRefCounter( iter + 1 ) > 0 ) && ( iter->id >= id0 ) ) {
+    psMemBlock *topBlock = lastMemBlockAllocated;
+
+    pthread_mutex_lock(&memBlockListMutex);
+
+    for (psMemBlock * iter = topBlock; iter != NULL; iter = iter->nextBlock) {
+        if ((psMemGetRefCounter(iter + 1) > 0) && (iter->id >= id0)) {
             nleak++;
 
-            if ( fd != NULL ) {
-                if ( nleak == 1 ) {
-                    fprintf( fd, "   %20s:line ID\n", "file" );
+            if (fd != NULL) {
+                if (nleak == 1) {
+                    fprintf(fd, "   %20s:line ID\n", "file");
                 }
 
-                fprintf( fd, "   %20s:%-4d %ld\n", iter->file, iter->lineno, iter->id );
-            }
-        }
-    }
-
-    pthread_mutex_unlock( &memBlockListMutex );
-
-    if ( nleak == 0 || arr == NULL ) {
+                fprintf(fd, "   %20s:%-4d %ld\n", iter->file, iter->lineno, iter->id);
+            }
+        }
+    }
+
+    pthread_mutex_unlock(&memBlockListMutex);
+
+    if (nleak == 0 || arr == NULL) {
         return nleak;
     }
 
-    *arr = p_psAlloc( nleak * sizeof( psMemBlock ), __FILE__, __LINE__ );
-    pthread_mutex_lock( &memBlockListMutex );
-
-    for ( psMemBlock * iter = topBlock; iter != NULL; iter = iter->nextBlock ) {
-        if ( ( psMemGetRefCounter( iter + 1 ) > 0 ) && ( iter->id >= id0 ) ) {
-            ( *arr ) [ j++ ] = iter;
-            if ( j == nleak ) { // found them all
+    *arr = p_psAlloc(nleak * sizeof(psMemBlock), __FILE__, __LINE__);
+    pthread_mutex_lock(&memBlockListMutex);
+
+    for (psMemBlock * iter = topBlock; iter != NULL; iter = iter->nextBlock) {
+        if ((psMemGetRefCounter(iter + 1) > 0) && (iter->id >= id0)) {
+            (*arr)[j++] = iter;
+            if (j == nleak) {              // found them all
                 break;
             }
@@ -456,5 +455,5 @@
     }
 
-    pthread_mutex_unlock( &memBlockListMutex );
+    pthread_mutex_unlock(&memBlockListMutex);
 
     return nleak;
@@ -465,43 +464,44 @@
  */
 // return refCounter
-psReferenceCount psMemGetRefCounter( void *vptr )
-{
-    psMemBlock * ptr;
+psReferenceCount psMemGetRefCounter(void *vptr)
+{
+    psMemBlock *ptr;
     unsigned int refCount;
 
-    if ( vptr == NULL ) {
+    if (vptr == NULL) {
         return 0;
     }
 
-    ptr = ( ( psMemBlock * ) vptr ) - 1;
-
-    if ( checkMemBlock( ptr, __func__ ) != 0 ) {
-        memProblemCallback( ptr, __func__, __LINE__ );
-    }
-
-    pthread_mutex_lock( &ptr->refCounterMutex );
+    ptr = ((psMemBlock *) vptr) - 1;
+
+    if (checkMemBlock(ptr, __func__) != 0) {
+        memProblemCallback(ptr, __func__, __LINE__);
+    }
+
+    pthread_mutex_lock(&ptr->refCounterMutex);
     refCount = ptr->refCounter;
-    pthread_mutex_unlock( &ptr->refCounterMutex );
+    pthread_mutex_unlock(&ptr->refCounterMutex);
 
     return refCount;
 }
+
 // increment and return refCounter
-void* p_psMemIncrRefCounter( void *vptr, const char *file, int lineno )
-{
-    psMemBlock * ptr;
-
-    if ( vptr == NULL ) {
+void *p_psMemIncrRefCounter(void *vptr, const char *file, int lineno)
+{
+    psMemBlock *ptr;
+
+    if (vptr == NULL) {
         return vptr;
     }
 
-    ptr = ( ( psMemBlock * ) vptr ) - 1;
-
-    if ( checkMemBlock( ptr, __func__ ) ) {
-        memProblemCallback( ptr, file, lineno );
-    }
-
-    pthread_mutex_lock( &ptr->refCounterMutex );
+    ptr = ((psMemBlock *) vptr) - 1;
+
+    if (checkMemBlock(ptr, __func__)) {
+        memProblemCallback(ptr, file, lineno);
+    }
+
+    pthread_mutex_lock(&ptr->refCounterMutex);
     ptr->refCounter++;
-    pthread_mutex_unlock( &ptr->refCounterMutex );
+    pthread_mutex_unlock(&ptr->refCounterMutex);
 
     return vptr;
@@ -509,57 +509,57 @@
 
 // decrement and return refCounter
-void* p_psMemDecrRefCounter( void *vptr, const char *file, int lineno )
-{
-    if ( vptr == NULL ) {
+void *p_psMemDecrRefCounter(void *vptr, const char *file, int lineno)
+{
+    if (vptr == NULL) {
         return NULL;
     }
 
-    psMemBlock *ptr = ( ( psMemBlock * ) vptr ) - 1;
-
-    if ( checkMemBlock( ptr, __func__ ) != 0 ) {
-        memProblemCallback( ptr, file, lineno );
+    psMemBlock *ptr = ((psMemBlock *) vptr) - 1;
+
+    if (checkMemBlock(ptr, __func__) != 0) {
+        memProblemCallback(ptr, file, lineno);
         return NULL;
     }
 
-    pthread_mutex_lock( &ptr->refCounterMutex );
-
-    if ( ptr->refCounter > 1 ) {
-        /// XXX - Probably should have another mutex here.
-        ptr->refCounter--;          // multiple references, just decrement the count.
-        pthread_mutex_unlock( &ptr->refCounterMutex );
+    pthread_mutex_lock(&ptr->refCounterMutex);
+
+    if (ptr->refCounter > 1) {
+        // / XXX - Probably should have another mutex here.
+        ptr->refCounter--;                 // multiple references, just decrement the count.
+        pthread_mutex_unlock(&ptr->refCounterMutex);
 
     } else {
-        pthread_mutex_unlock( &ptr->refCounterMutex );
+        pthread_mutex_unlock(&ptr->refCounterMutex);
 
         // Did the user ask to be informed about this deallocation?
-        if ( ptr->id == p_psMemFreeID ) {
-            p_psMemFreeID += memFreeCallback( ptr );
-        }
-
-        if ( ptr->freeFcn != NULL ) {
-            ptr->freeFcn( vptr );
-        }
-
-        pthread_mutex_lock( &memBlockListMutex );
+        if (ptr->id == p_psMemFreeID) {
+            p_psMemFreeID += memFreeCallback(ptr);
+        }
+
+        if (ptr->freeFcn != NULL) {
+            ptr->freeFcn(vptr);
+        }
+
+        pthread_mutex_lock(&memBlockListMutex);
 
         // cut the memBlock out of the memBlock list
-        if ( ptr->nextBlock != NULL ) {
+        if (ptr->nextBlock != NULL) {
             ptr->nextBlock->previousBlock = ptr->previousBlock;
         }
-        if ( ptr->previousBlock != NULL ) {
+        if (ptr->previousBlock != NULL) {
             ptr->previousBlock->nextBlock = ptr->nextBlock;
         }
-        if ( lastMemBlockAllocated == ptr ) {
+        if (lastMemBlockAllocated == ptr) {
             lastMemBlockAllocated = ptr->nextBlock;
         }
 
-        pthread_mutex_unlock( &memBlockListMutex );
-
+        pthread_mutex_unlock(&memBlockListMutex);
 
         // do we need to recycle?
-        if ( ptr->userMemorySize < P_PS_LARGE_BLOCK_SIZE ) {
+        if (ptr->userMemorySize < P_PS_LARGE_BLOCK_SIZE) {
 
             int level = 1;
-            while ( ptr->userMemorySize >= recycleBinSize[ level ] ) {
+
+            while (ptr->userMemorySize >= recycleBinSize[level]) {
                 level++;
             }
@@ -569,19 +569,19 @@
             ptr->previousBlock = NULL;
 
-            pthread_mutex_lock( &recycleMemBlockListMutex );
-            ptr->nextBlock = recycleMemBlockList[ level ];
-            if ( recycleMemBlockList[ level ] != NULL ) {
-                recycleMemBlockList[ level ] ->previousBlock = ptr;
-            }
-            recycleMemBlockList[ level ] = ptr;
-            pthread_mutex_unlock( &recycleMemBlockListMutex );
+            pthread_mutex_lock(&recycleMemBlockListMutex);
+            ptr->nextBlock = recycleMemBlockList[level];
+            if (recycleMemBlockList[level] != NULL) {
+                recycleMemBlockList[level]->previousBlock = ptr;
+            }
+            recycleMemBlockList[level] = ptr;
+            pthread_mutex_unlock(&recycleMemBlockListMutex);
 
         } else {
             // memory is larger than I want to recycle.
             #ifdef PS_MEM_DEBUG
-            ( void ) p_psRealloc( vptr, 0, file, lineno );
+            (void)p_psRealloc(vptr, 0, file, lineno);
             ptr->previousBlock = NULL;
             ptr->nextBlock = deadBlockList;
-            if ( deadBlockList != NULL ) {
+            if (deadBlockList != NULL) {
                 deadBlockList->previous = ptr;
             }
@@ -589,11 +589,11 @@
             #else
 
-            pthread_mutex_destroy( &ptr->refCounterMutex );
-            free( ptr );
+            pthread_mutex_destroy(&ptr->refCounterMutex);
+            free(ptr);
             #endif
 
         }
 
-        vptr = NULL;    // since we freed it, make sure we return NULL.
+        vptr = NULL;                       // since we freed it, make sure we return NULL.
     }
 
@@ -601,14 +601,14 @@
 }
 
-void p_psMemSetDeallocator( void* vptr, psFreeFcn freeFcn )
-{
-    if ( vptr == NULL ) {
-        return ;
-    }
-
-    psMemBlock *ptr = ( ( psMemBlock * ) vptr ) - 1;
-
-    if ( checkMemBlock( ptr, __func__ ) != 0 ) {
-        memProblemCallback( ptr, __func__, __LINE__ );
+void p_psMemSetDeallocator(void *vptr, psFreeFcn freeFcn)
+{
+    if (vptr == NULL) {
+        return;
+    }
+
+    psMemBlock *ptr = ((psMemBlock *) vptr) - 1;
+
+    if (checkMemBlock(ptr, __func__) != 0) {
+        memProblemCallback(ptr, __func__, __LINE__);
     }
 
@@ -616,14 +616,14 @@
 
 }
-psFreeFcn p_psMemGetDeallocator( void* vptr )
-{
-    if ( vptr == NULL ) {
+psFreeFcn p_psMemGetDeallocator(void *vptr)
+{
+    if (vptr == NULL) {
         return NULL;
     }
 
-    psMemBlock *ptr = ( ( psMemBlock * ) vptr ) - 1;
-
-    if ( checkMemBlock( ptr, __func__ ) != 0 ) {
-        memProblemCallback( ptr, __func__, __LINE__ );
+    psMemBlock *ptr = ((psMemBlock *) vptr) - 1;
+
+    if (checkMemBlock(ptr, __func__) != 0) {
+        memProblemCallback(ptr, __func__, __LINE__);
     }
 
Index: /trunk/psLib/src/sysUtils/psMemory.h
===================================================================
--- /trunk/psLib/src/sysUtils/psMemory.h	(revision 1406)
+++ /trunk/psLib/src/sysUtils/psMemory.h	(revision 1407)
@@ -1,4 +1,5 @@
 #if !defined(PS_MEMORY_H)
-#define PS_MEMORY_H
+#    define PS_MEMORY_H
+
 /** @file  psMemory.h
  *
@@ -14,13 +15,13 @@
  *  @ingroup MemoryManagement
  *
- *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
 
-#include <stdio.h>                      // needed for FILE
-#include <stdbool.h>
-#include <pthread.h>                    // we need a mutex to make this stuff thread safe.
+#    include <stdio.h>                     // needed for FILE
+#    include <stdbool.h>
+#    include <pthread.h>                   // we need a mutex to make this stuff thread safe.
 
 /** @addtogroup MemoryManagement
@@ -53,5 +54,5 @@
 
 /// typedef for deallocator.
-typedef void (*psFreeFcn)(void* ptr);
+typedef void (*psFreeFcn) (void *ptr);
 
 /** Book-keeping data for storage allocator.
@@ -62,15 +63,15 @@
 typedef struct psMemBlock
 {
-    const void* startblock;            ///< initialised to p_psMEMMAGIC
-    struct psMemBlock* previousBlock;  ///< previous block in allocation list
-    struct psMemBlock* nextBlock;      ///< next block allocation list
-    psFreeFcn freeFcn;                 ///< deallocator.  If NULL, use generic deallocation.
-    size_t  userMemorySize;            ///< the size of the user-portion of the memory block
-    const psMemoryId id;               ///< a unique ID for this allocation
-    const char* file;                  ///< set from __FILE__ in e.g. p_psAlloc
-    const int lineno;                  ///< set from __LINE__ in e.g. p_psAlloc
-    pthread_mutex_t   refCounterMutex; ///< mutex to ensure exclusive access to reference counter
-    psReferenceCount refCounter;       ///< how many times pointer is referenced
-    const void* endblock;              ///< initialised to p_psMEMMAGIC
+    const void *startblock;     // /< initialised to p_psMEMMAGIC
+    struct psMemBlock *previousBlock;   // /< previous block in allocation list
+    struct psMemBlock *nextBlock;       // /< next block allocation list
+    psFreeFcn freeFcn;          // /< deallocator.  If NULL, use generic deallocation.
+    size_t userMemorySize;      // /< the size of the user-portion of the memory block
+    const psMemoryId id;        // /< a unique ID for this allocation
+    const char *file;           // /< set from __FILE__ in e.g. p_psAlloc
+    const int lineno;           // /< set from __LINE__ in e.g. p_psAlloc
+    pthread_mutex_t refCounterMutex;    // /< mutex to ensure exclusive access to reference counter
+    psReferenceCount refCounter;        // /< how many times pointer is referenced
+    const void *endblock;       // /< initialised to p_psMEMMAGIC
 }
 psMemBlock;
@@ -81,7 +82,6 @@
  *  @ingroup memCallback
  */
-typedef psMemoryId (*psMemAllocateCallback)(
-    const psMemBlock *ptr           ///< the psMemBlock just allocated
-);
+typedef psMemoryId(*psMemAllocateCallback) (const psMemBlock * ptr      // /< the psMemBlock just allocated
+                                           );
 
 /** prototype of memory free callback used by memory functions
@@ -90,7 +90,6 @@
  *  @ingroup memCallback
  */
-typedef psMemoryId (*psMemFreeCallback)(
-    const psMemBlock *ptr           ///< the psMemBlock being freed
-);
+typedef psMemoryId(*psMemFreeCallback) (const psMemBlock * ptr  // /< the psMemBlock being freed
+                                       );
 
 /** prototype of a callback used in error conditions
@@ -101,9 +100,9 @@
  *  @ingroup memCallback
  */
-typedef void (*psMemProblemCallback)(
-    const psMemBlock *ptr,          ///< the pointer to the problematic memory block.
-    const char *file,               ///< the file in which the problem originated
-    int lineno                      ///< the line number in which the problem originated
-);
+typedef void (*psMemProblemCallback) (const psMemBlock * ptr,   // /< the pointer to the problematic memory
+                                      // block.
+                                      const char *file, // /< the file in which the problem originated
+                                      int lineno        // /< the line number in which the problem originated
+                                     );
 
 /** prototype of a callback function used when memory runs out
@@ -115,7 +114,6 @@
  *  @ingroup memCallback
  */
-typedef void *(*psMemExhaustedCallback)(
-    size_t size                     //< the size of buffer required
-);
+typedef void *(*psMemExhaustedCallback) (size_t size    // < the size of buffer required
+                                        );
 
 /** Memory allocation.  This operates much like malloc(), but is guaranteed to return a non-NULL value.
@@ -124,22 +122,19 @@
  *  @see psFree 
  */
-#ifdef DOXYGEN
-void* psAlloc(
-    size_t size                     ///< Size required
-);
-#else
-void* p_psAlloc(
-    size_t size,                    ///< Size required
-    const char *file,               ///< File of call
-    int lineno                      ///< Line number of call
-);
-
-void p_psMemSetDeallocator(void* ptr, psFreeFcn freeFcn);
-psFreeFcn p_psMemGetDeallocator(void* ptr);
+#    ifdef DOXYGEN
+void *psAlloc(size_t size       // /< Size required
+             );
+#    else
+    void *p_psAlloc(size_t size,    // /< Size required
+                    const char *file,       // /< File of call
+                    int lineno      // /< Line number of call
+                   );
+
+void p_psMemSetDeallocator(void *ptr, psFreeFcn freeFcn);
+psFreeFcn p_psMemGetDeallocator(void *ptr);
 
 /// Memory allocation. psAlloc sends file and line number to p_psAlloc.
-#define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__)
-#endif
-
+#        define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__)
+#    endif
 
 /** Memory re-allocation.  This operates much like realloc(), but is guaranteed to return a non-NULL value.
@@ -148,38 +143,37 @@
  *  @see psAlloc, psFree
  */
-#ifdef DOXYGEN
-void* psRealloc(void *ptr               ///< Pointer to re-allocate
-                size_t size,            ///< Size required
+#    ifdef DOXYGEN
+void *psRealloc(void *ptr       // /< Pointer to re-allocate
+                size_t size,    // /< Size required
                );
-#else
-void* p_psRealloc(void *ptr,            ///< Pointer to re-allocate
-                  size_t size,          ///< Size required
-                  const char *file,     ///< File of call
-                  int lineno            ///< Line number of call
+#    else
+    void *p_psRealloc(void *ptr,    // /< Pointer to re-allocate
+                      size_t size,  // /< Size required
+                      const char *file,     // /< File of call
+                      int lineno    // /< Line number of call
+                     );
+
+/// Memory re-allocation.  psRealloc sends file and line number to p_psRealloc.
+#        define psRealloc(ptr, size) p_psRealloc(ptr, size, __FILE__, __LINE__)
+
+#    endif
+
+/** Free memory.  This operates much like free().
+ *
+ *  @see psAlloc, psRealloc
+ */
+#    ifdef DOXYGEN
+void psFree(void *ptr,          // /< Pointer to free, if NULL, function returns immediately.
+           );
+#    else
+    void p_psFree(void *ptr,        // /< Pointer to free
+                  const char *file, // /< File of call
+                  int lineno        // /< Line number of call
                  );
 
-/// Memory re-allocation.  psRealloc sends file and line number to p_psRealloc.
-#define psRealloc(ptr, size) p_psRealloc(ptr, size, __FILE__, __LINE__)
-
-#endif
-
-
-/** Free memory.  This operates much like free().
- *
- *  @see psAlloc, psRealloc
- */
-#ifdef DOXYGEN
-void psFree(void *ptr,                  ///< Pointer to free, if NULL, function returns immediately.
-           );
-#else
-void p_psFree(void *ptr,                ///< Pointer to free
-              const char *file,         ///< File of call
-              int lineno                ///< Line number of call
-             );
-
 /// Free memory.  psFree sends file and line number to p_psFree.
-#define psFree(size) p_psFree(size, __FILE__, __LINE__)
-
-#endif
+#        define psFree(size) p_psFree(size, __FILE__, __LINE__)
+
+#    endif
 
 /** Check for memory leaks.  This scans for allocated memory buffers not freed with an ID not less than id0.
@@ -197,9 +191,8 @@
  *  @ingroup memTracing
  */
-int psMemCheckLeaks(
-    psMemoryId id0,              ///< don't list blocks with id < id0
-    psMemBlock ***arr,              ///< pointer to array of pointers to leaked blocks, or NULL
-    FILE *fd                        ///< print list of leaks to fd (or NULL)
-);
+int psMemCheckLeaks(psMemoryId id0,     // /< don't list blocks with id < id0
+                    psMemBlock *** arr, // /< pointer to array of pointers to leaked blocks, or NULL
+                    FILE * fd   // /< print list of leaks to fd (or NULL)
+                   );
 
 /** Check for memory corruption.  Scans all currently allocated memory buffers and checks for corruptions,
@@ -208,7 +201,6 @@
  *  @ingroup memTracing
  */
-int psMemCheckCorruption(
-    bool abort_on_error              ///< Abort on detecting corruption?
-);
+int psMemCheckCorruption(bool abort_on_error    // /< Abort on detecting corruption?
+                        );
 
 /** Return reference counter
@@ -216,7 +208,6 @@
  *  @ingroup memRefCount
  */
-psReferenceCount psMemGetRefCounter(
-    void *vptr                      ///< Pointer to get refCounter for
-);
+psReferenceCount psMemGetRefCounter(void *vptr  // /< Pointer to get refCounter for
+                                   );
 
 /** Increment reference counter and return the pointer
@@ -224,16 +215,15 @@
  *  @ingroup memRefCount
  */
-#ifdef DOXYGEN
-void* psMemIncrRefCounter(
-    void *vptr                         ///< Pointer to increment refCounter, and return
-);
-#else
-void* p_psMemIncrRefCounter(
-    void *vptr,                        ///< Pointer to increment refCounter, and return
-    const char *file,                  ///< File of call
-    int lineno                         ///< Line number of call
-);
-#define psMemIncrRefCounter(vptr) p_psMemIncrRefCounter(vptr, __FILE__, __LINE__)
-#endif
+#    ifdef DOXYGEN
+void *psMemIncrRefCounter(void *vptr    // /< Pointer to increment refCounter, and return
+                         );
+#    else
+    void *p_psMemIncrRefCounter(void *vptr, // /< Pointer to increment refCounter, and return
+                                const char *file,   // /< File of call
+                                int lineno  // /< Line number of call
+                               );
+
+#        define psMemIncrRefCounter(vptr) p_psMemIncrRefCounter(vptr, __FILE__, __LINE__)
+#    endif
 
 /** Decrement reference counter and return the pointer
@@ -241,23 +231,21 @@
  *  @ingroup memRefCount
  */
-#ifdef DOXYGEN
-void* psMemDecrRefCounter(
-    void *vptr                         ///< Pointer to decrement refCounter, and return
-);
-#else
-void* p_psMemDecrRefCounter(
-    void *vptr,                        ///< Pointer to decrement refCounter, and return
-    const char *file,                  ///< File of call
-    int lineno                         ///< Line number of call
-);
-#define psMemDecrRefCounter(vptr) p_psMemDecrRefCounter(vptr, __FILE__, __LINE__)
-#endif
+#    ifdef DOXYGEN
+void *psMemDecrRefCounter(void *vptr    // /< Pointer to decrement refCounter, and return
+                         );
+#    else
+    void *p_psMemDecrRefCounter(void *vptr, // /< Pointer to decrement refCounter, and return
+                                const char *file,   // /< File of call
+                                int lineno  // /< Line number of call
+                               );
+
+#        define psMemDecrRefCounter(vptr) p_psMemDecrRefCounter(vptr, __FILE__, __LINE__)
+#    endif
 
 /** Set callback for problems
  *  @ingroup memCallback
  */
-psMemProblemCallback psMemProblemCallbackSet(
-    psMemProblemCallback func       ///< Function to run
-);
+psMemProblemCallback psMemProblemCallbackSet(psMemProblemCallback func  // /< Function to run
+                                            );
 
 /** Set callback for out-of-memory
@@ -265,7 +253,6 @@
  *  @ingroup memCallback
  */
-psMemExhaustedCallback psMemExhaustedCallbackSet(
-    psMemExhaustedCallback func     ///< Function to run
-);
+psMemExhaustedCallback psMemExhaustedCallbackSet(psMemExhaustedCallback func    // /< Function to run
+                                                );
 
 /** Set call back for when a particular memory block is allocated
@@ -273,7 +260,6 @@
  *  @ingroup memCallback
  */
-psMemAllocateCallback psMemAllocateCallbackSet(
-    psMemAllocateCallback func          ///< Function to run
-);
+psMemAllocateCallback psMemAllocateCallbackSet(psMemAllocateCallback func       // /< Function to run
+                                              );
 
 /** Set call back for when a particular memory block is freed
@@ -281,7 +267,6 @@
  *  @ingroup memCallback
  */
-psMemFreeCallback psMemFreeCallbackSet(
-    psMemFreeCallback func              ///< Function to run
-);
+psMemFreeCallback psMemFreeCallbackSet(psMemFreeCallback func   // /< Function to run
+                                      );
 
 /** get next memory ID
@@ -295,7 +280,6 @@
  *  @ingroup memCallback
  */
-psMemoryId psMemAllocateCallbackSetID(
-    psMemoryId id                       ///< ID to set
-);
+psMemoryId psMemAllocateCallbackSetID(psMemoryId id     // /< ID to set
+                                     );
 
 /** set p_psMemFreeID to id
@@ -303,27 +287,27 @@
  *  @ingroup memCallback
  */
-psMemoryId psMemFreeCallbackSetID(
-    psMemoryId id                       ///< ID to set
-);
+psMemoryId psMemFreeCallbackSetID(psMemoryId id // /< ID to set
+                                 );
 
 //@} End of Memory Management Functions
 
-#ifndef DOXYGEN
+#    ifndef DOXYGEN
 
 /*
  * Ensure that any program using malloc/realloc/free will fail to compile
  */
-#ifndef PS_ALLOW_MALLOC
-#ifdef __GNUC__
-#pragma GCC poison malloc realloc calloc free
-#else
-#define malloc(S)       _Pragma("error Use of malloc is not allowed.  Use psAlloc instead.")
-#define realloc(P,S)    _Pragma("error Use of realloc is not allowed.  Use psRealloc instead.")
-#define calloc(S)       _Pragma("error Use of calloc is not allowed.  Use psAlloc instead.")
-#define free(P)         _Pragma("error Use of free is not allowed.  Use psFree instead.")
-#endif
-#endif
-
-#endif // doxygen skip
-
-#endif // end of header file
+#        ifndef PS_ALLOW_MALLOC
+#            ifdef __GNUC__
+#                pragma GCC poison malloc realloc calloc free
+#            else
+    #                define malloc(S)       _Pragma("error Use of malloc is not allowed.  Use psAlloc instead.")
+    #                define realloc(P,S)    _Pragma("error Use of realloc is not allowed.  Use psRealloc instead.")
+    #                define calloc(S)       _Pragma("error Use of calloc is not allowed.  Use psAlloc instead.")
+    #                define free(P)         _Pragma("error Use of free is not allowed.  Use psFree instead.")
+    #            endif
+    #        endif
+
+    #    endif
+    // doxygen skip
+
+    #endif // end of header file
Index: /trunk/psLib/src/sysUtils/psString.c
===================================================================
--- /trunk/psLib/src/sysUtils/psString.c	(revision 1406)
+++ /trunk/psLib/src/sysUtils/psString.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psString.c
  *
@@ -8,6 +9,6 @@
  *  @author Eric Van Alst, MHPCC
  *   
- *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -15,5 +16,7 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 #include <stdlib.h>
@@ -24,5 +27,7 @@
 
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
@@ -30,5 +35,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -36,5 +43,7 @@
 
 /*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
+
 /*****************************************************************************/
 
@@ -42,5 +51,7 @@
 
 /*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
+
 /*****************************************************************************/
 
@@ -48,5 +59,7 @@
 
 /*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
+
 /*****************************************************************************/
 
@@ -54,10 +67,10 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
+
 /*****************************************************************************/
 
-char *psStringCopy(
-    const char*  str
-)
+char *psStringCopy(const char *str)
 {
     // Allocate memory using psAlloc function
@@ -67,16 +80,12 @@
 }
 
-char *psStringNCopy(
-    const char*  str,
-    int          nChar
-)
+char *psStringNCopy(const char *str, int nChar)
 {
     char *returnValue = NULL;
 
     // Check the number of characters to copy is non-negative
-    if ( nChar < 0 ) {
+    if (nChar < 0) {
         // Log error message and return NULL
-        psError(__FILE__,"psStringNCopy with negative count specified %d",
-                nChar);
+        psError(__FILE__, "psStringNCopy with negative count specified %d", nChar);
         return NULL;
     }
@@ -84,14 +93,11 @@
     // Copy input string to memory allocated up to nChar characters
     // Return the copy
-    returnValue = strncpy(psAlloc((size_t)nChar + 1), str, (size_t)nChar);
+    returnValue = strncpy(psAlloc((size_t) nChar + 1), str, (size_t) nChar);
 
     // Ensure the last byte is NULL character
-    if ( nChar > 0 ) {
-        returnValue[nChar-1] = '\0';
+    if (nChar > 0) {
+        returnValue[nChar - 1] = '\0';
     }
-
     // Return the string pointer
     return returnValue;
 }
-
-
Index: /trunk/psLib/src/sysUtils/psString.h
===================================================================
--- /trunk/psLib/src/sysUtils/psString.h	(revision 1406)
+++ /trunk/psLib/src/sysUtils/psString.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psString.h
  *
@@ -10,6 +11,6 @@
  *  @author Eric Van Alst, MHPCC
  *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-10 01:58:06 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -17,15 +18,19 @@
 
 #ifndef PS_STRING_H
-#define PS_STRING_H
+#    define PS_STRING_H
 
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
 /** This macro will convert the arguement to a quoted string */
-#define PS_STRING(S)  #S
+#    define PS_STRING(S)  #S
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -33,8 +38,11 @@
 
 /*****************************************************************************/
+
 /* FUNCTION PROTOTYPES                                                       */
+
 /*****************************************************************************/
 
 // Doxygen group tags
+
 /** @addtogroup SysUtils
  *  @{
@@ -49,8 +57,8 @@
  *
  */
-char *psStringCopy(
-    const char *str      /**< Input string of characters to copy */
-);
 
+char *psStringCopy(const char *str
+                   /**< Input string of characters to copy */
+                  );
 
 /** Copies the input string up to the specified number of characters
@@ -67,12 +75,15 @@
  *
  */
+
 /*@null@*/
-char *psStringNCopy(
-    const char *str,    /**< Input string of characters to copy */
-    int        nChar    /**< Number of bytes to allocate for string copy */
-);
 
-/* @} */  // Doxygen - End of SystemGroup Functions
+char *psStringNCopy(const char *str,
+                    /**< Input string of characters to copy */
+
+                    int nChar
+                    /**< Number of bytes to allocate for string copy */
+                   );
+
+/* @} */// Doxygen - End of SystemGroup Functions
 
 #endif
-
Index: /trunk/psLib/src/sysUtils/psTrace.c
===================================================================
--- /trunk/psLib/src/sysUtils/psTrace.c	(revision 1406)
+++ /trunk/psLib/src/sysUtils/psTrace.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file psTrace.c
  *  \brief basic run-time trace facilities
@@ -9,9 +10,10 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
+
 /*****************************************************************************
     NOTES:
@@ -34,27 +36,27 @@
 #ifndef PS_NO_TRACE
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include "psMemory.h"
-#include "psTrace.h"
-#include "psString.h"
-#include "psError.h"
-
-static p_psComponent *p_psCroot = NULL;       // The root of the trace component
-static FILE *p_psTraceFP = NULL;          // File destination for messages.
-
-static void componentFree(p_psComponent *comp);
-static p_psComponent *componentAlloc(const char *name,int level);
+#    include <stdlib.h>
+#    include <stdio.h>
+#    include <string.h>
+#    include <stdarg.h>
+#    include "psMemory.h"
+#    include "psTrace.h"
+#    include "psString.h"
+#    include "psError.h"
+
+static p_psComponent *p_psCroot = NULL; // The root of the trace component
+static FILE *p_psTraceFP = NULL;        // File destination for messages.
+
+static void componentFree(p_psComponent * comp);
+static p_psComponent *componentAlloc(const char *name, int level);
 
 /*****************************************************************************
 componentAlloc(): allocate memory for a new node, and initialize members.
  *****************************************************************************/
-static p_psComponent *componentAlloc(const char *name,
-                                     int level)
+static p_psComponent *componentAlloc(const char *name, int level)
 {
     p_psComponent *comp = psAlloc(sizeof(p_psComponent));
-    p_psMemSetDeallocator(comp,(psFreeFcn)componentFree);
+
+    p_psMemSetDeallocator(comp, (psFreeFcn) componentFree);
     comp->name = psStringCopy(name);
     comp->level = level;
@@ -64,10 +66,9 @@
 }
 
-
 /*****************************************************************************
 componentFree(): free the current node in the root tree, and all children
 nodes as well.
  *****************************************************************************/
-static void componentFree(p_psComponent *comp)
+static void componentFree(p_psComponent * comp)
 {
     if (comp == NULL) {
@@ -85,5 +86,4 @@
 }
 
-
 /*****************************************************************************
 initTrace(): simply initialize the component root tree.
@@ -96,9 +96,8 @@
 }
 
-
 /*****************************************************************************
 Set all trace levels to zero.
  *****************************************************************************/
-void p_psTraceReset(p_psComponent *currentNode)
+void p_psTraceReset(p_psComponent * currentNode)
 {
     int i = 0;
@@ -109,9 +108,8 @@
 
     currentNode->level = 0;
-    for (i=0;i<currentNode->n;i++) {
+    for (i = 0; i < currentNode->n; i++) {
         if (NULL == currentNode->subcomp[i]) {
             psError(__func__,
-                    "Sub-component %d of node %s in the trace tree is NULL.\n",
-                    i, currentNode->name);
+                    "Sub-component %d of node %s in the trace tree is NULL.\n", i, currentNode->name);
         } else {
             p_psTraceReset(currentNode->subcomp[i]);
@@ -129,5 +127,4 @@
 }
 
-
 /*****************************************************************************
 Free all nodes in the component tree.
@@ -137,5 +134,4 @@
     psFree(p_psCroot);
 }
-
 
 /*****************************************************************************
@@ -145,15 +141,14 @@
 to ANSI-C.
  *****************************************************************************/
-static void componentAdd(const char *addNodeName,
-                         int         level)
-{
-    int        i = 0;                         // Loop index variable.
-    char       name[strlen(addNodeName) + 1]; // buffer for writeable copy.
-    char      *pname=name;
-    char      *firstComponent = NULL;       // first component of name
+static void componentAdd(const char *addNodeName, int level)
+{
+    int i = 0;                  // Loop index variable.
+    char name[strlen(addNodeName) + 1]; // buffer for writeable copy.
+    char *pname = name;
+    char *firstComponent = NULL;        // first component of name
     p_psComponent *currentNode = p_psCroot;
-    int        nodeExists = 0;
-
-    // Is this the root node?  If so, simply set level and return.
+    int nodeExists = 0;
+
+    // Is this the root node? If so, simply set level and return.
     if (strcmp(".", addNodeName) == 0) {
         p_psCroot->level = level;
@@ -162,6 +157,5 @@
 
     if (addNodeName[0] != '.') {
-        printf("ERROR: failed to add %s to the root component tree.\n",
-               addNodeName);
+        printf("ERROR: failed to add %s to the root component tree.\n", addNodeName);
         exit(1);
     }
@@ -188,13 +182,11 @@
         if (nodeExists == 0) {
             currentNode->subcomp = psRealloc(currentNode->subcomp,
-                                             (currentNode->n + 1) * sizeof(p_psComponent*));
-            currentNode->n = (currentNode->n)+1;
-
-            currentNode->subcomp[(currentNode->n)-1] =
-                componentAlloc(firstComponent, level);
-        }
-    }
-}
-
+                                             (currentNode->n + 1) * sizeof(p_psComponent *));
+            currentNode->n = (currentNode->n) + 1;
+
+            currentNode->subcomp[(currentNode->n) - 1] = componentAlloc(firstComponent, level);
+        }
+    }
+}
 
 /*****************************************************************************
@@ -210,5 +202,5 @@
 *****************************************************************************/
 int psTraceSetLevel(const char *comp,   // component of interest
-                    int level)          // desired trace level
+                    int level)  // desired trace level
 {
     // If the root component tree does not exist, then initialize it.
@@ -216,5 +208,4 @@
         initTrace();
     }
-
     // Add the new component to the component tree.
     componentAdd(comp, level);
@@ -223,5 +214,4 @@
     return 0;
 }
-
 
 /*****************************************************************************
@@ -241,20 +231,20 @@
 static int doGetTraceLevel(const char *aname)
 {
-    char       name[strlen(aname) + 1]; // need a writeable copy: for strsep()
-    char      *pname=name;
-    char      *firstComponent = NULL;   // first component of name
+    char name[strlen(aname) + 1];       // need a writeable copy: for strsep()
+    char *pname = name;
+    char *firstComponent = NULL;        // first component of name
     p_psComponent *currentNode = p_psCroot;
-    int        i = 0;
+    int i = 0;
 
     if (NULL == currentNode) {
-        return(PS_UNKNOWN_TRACE_LEVEL);
+        return (PS_UNKNOWN_TRACE_LEVEL);
     }
 
     if (strcmp(".", aname) == 0) {
-        return(p_psCroot->level);
+        return (p_psCroot->level);
     }
 
     if (aname[0] != '.') {
-        return(PS_UNKNOWN_TRACE_LEVEL);
+        return (PS_UNKNOWN_TRACE_LEVEL);
     }
 
@@ -266,6 +256,5 @@
             if (NULL == currentNode->subcomp[i]) {
                 psError(__func__,
-                        "Sub-component %d of node %s in trace tree is NULL.\n",
-                        i, currentNode->name);
+                        "Sub-component %d of node %s in trace tree is NULL.\n", i, currentNode->name);
             }
 
@@ -273,12 +262,11 @@
                 currentNode = currentNode->subcomp[i];
                 if (pname == NULL) {
-                    return(currentNode->level);
+                    return (currentNode->level);
                 }
             }
         }
     }
-    return(PS_UNKNOWN_TRACE_LEVEL);
-}
-
+    return (PS_UNKNOWN_TRACE_LEVEL);
+}
 
 /*****************************************************************************
@@ -297,11 +285,9 @@
 {
     if (p_psCroot == NULL) {
-        return(PS_UNKNOWN_TRACE_LEVEL);
-    }
-
+        return (PS_UNKNOWN_TRACE_LEVEL);
+    }
     // Search the component root tree, determine the trace level.
-    return(doGetTraceLevel(name));
-}
-
+    return (doGetTraceLevel(name));
+}
 
 /*****************************************************************************
@@ -317,6 +303,5 @@
  null
  *****************************************************************************/
-static void doPrintTraceLevels(const p_psComponent *comp,
-                               int depth)
+static void doPrintTraceLevels(const p_psComponent * comp, int depth)
 {
     int i = 0;
@@ -327,17 +312,14 @@
     } else {
         if (comp->level == PS_UNKNOWN_TRACE_LEVEL) {
-            printf("%*s%-*s %s\n", depth, "", 20 - depth,
-                   comp->name, ".");
+            printf("%*s%-*s %s\n", depth, "", 20 - depth, comp->name, ".");
         } else {
-            printf("%*s%-*s %d\n", depth, "", 20 - depth,
-                   comp->name, comp->level);
+            printf("%*s%-*s %d\n", depth, "", 20 - depth, comp->name, comp->level);
         }
     }
 
     for (i = 0; i < comp->n; i++) {
-        doPrintTraceLevels(comp->subcomp[i], depth+1);
-    }
-}
-
+        doPrintTraceLevels(comp->subcomp[i], depth + 1);
+    }
+}
 
 /*****************************************************************************
@@ -359,5 +341,4 @@
     doPrintTraceLevels(p_psCroot, 0);
 }
-
 
 /*****************************************************************************
@@ -376,6 +357,6 @@
  *****************************************************************************/
 void p_psTrace(const char *comp,        // component being traced
-               int level,               // desired trace level
-               ...)                     // arguments
+               int level,       // desired trace level
+               ...)             // arguments
 {
     char *fmt = NULL;
@@ -384,8 +365,6 @@
 
     if (NULL == comp) {
-        psError(__func__,
-                "p_psTrace() called on a NULL trace level tree\n");
-    }
-
+        psError(__func__, "p_psTrace() called on a NULL trace level tree\n");
+    }
     // Only display this message if it's trace level is less than the level
     // of it's associatedcomponent.
@@ -413,9 +392,8 @@
         va_end(ap);
     }
-
-    // NOTE: should we free *fmt as well?  Read the man page.
-}
-
-void psTraceSetDestination(FILE *fp)
+    // NOTE: should we free *fmt as well? Read the man page.
+}
+
+void psTraceSetDestination(FILE * fp)
 {
     p_psTraceFP = fp;
Index: /trunk/psLib/src/sysUtils/psTrace.h
===================================================================
--- /trunk/psLib/src/sysUtils/psTrace.h	(revision 1406)
+++ /trunk/psLib/src/sysUtils/psTrace.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file psTrace.h
  *  \brief basic run-time trace facilities
@@ -9,15 +10,14 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-05 19:38:52 $
+ *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
 #if !defined(PS_TRACE_H)
-#define PS_TRACE_H 1
+#    define PS_TRACE_H 1
 
-#define PS_UNKNOWN_TRACE_LEVEL -9999         // we don't know this name's level
-#define PS_DEFAULT_TRACE_LEVEL 0
-
+#    define PS_UNKNOWN_TRACE_LEVEL -9999   // we don't know this name's level
+#    define PS_DEFAULT_TRACE_LEVEL 0
 
 /** \addtogroup LogTrace
@@ -29,66 +29,65 @@
 //#define PS_NO_TRACE 1   ///< to turn off all tracing
 
-#if defined(PS_NO_TRACE)
-#define psTrace(facil, level, ...) (void)0 /* do nothing */
-#define p_psTrace(facil, level, ...)  (void)0 /* do nothing */
-#define psTraceSetLevel(facil,level) 0
-#define psTraceGetLevel(facil) 0
-#define psTraceReset() (void)0 /* do nothing */
-#define psTraceFree() (void)0 /* do nothing */
-#define psTracePrintLevels() (void)0 /* do nothing */
-#define psTraceSetDestination(fp) (void)0 /* do nothing */
-#else
+#    if defined(PS_NO_TRACE)
+    #        define psTrace(facil, level, ...) (void)0
+    /* do nothing */
+    #        define p_psTrace(facil, level, ...)  (void)0
+    /* do nothing */
+    #        define psTraceSetLevel(facil,level) 0
+    #        define psTraceGetLevel(facil) 0
+    #        define psTraceReset() (void)0     /* do nothing */
+    #        define psTraceFree() (void)0      /* do nothing */
+    #        define psTracePrintLevels() (void)0
+    /* do nothing */
+    #        define psTraceSetDestination(fp) (void)0
+    /* do nothing */
+    #    else
 
-/** Basic structure for the component tree.  A component is a string of the
-    form aaa.bbb.ccc, and may itself contain further subcomponents.  The
-    Component structure doesn't in fact contain it's full name, but only the
-    last part. */
-typedef struct p_psComponent
-{
-    const char *name;                     // last part of name of component
-    int level;                            // trace level for this component
-    int n;                                // number of subcomponents
-    struct p_psComponent **subcomp;           // next level of subcomponents
-}
+        /** Basic structure for the component tree.  A component is a string of the
+            form aaa.bbb.ccc, and may itself contain further subcomponents.  The
+            Component structure doesn't in fact contain it's full name, but only the
+            last part. */
+        typedef struct p_psComponent
+        {
+            const char *name;           // last part of name of component
+            int level;                  // trace level for this component
+            int n;                      // number of subcomponents
+            struct p_psComponent **subcomp;     // next level of subcomponents
+        }
 p_psComponent;
 
-#ifndef DOXYGEN
+#        ifndef DOXYGEN
 /// Send a trace message
-void p_psTrace(const char *facil,  ///< facilty of interest
-               int myLevel,  ///< desired trace level
-               ...)   ///< trace message arguments
+void p_psTrace(const char *facil,       // /< facilty of interest
+               int myLevel,     // /< desired trace level
+               ...)             // /< trace message arguments
 ;
-#endif
+#        endif
 
 /// Set trace level
-int psTraceSetLevel(const char *facil, ///< facilty of interest
-                    int level)  ///< desired trace level
+int psTraceSetLevel(const char *facil,     // /< facilty of interest
+                    int level)     // /< desired trace level
 ;
 
 /// Get the trace level
-int psTraceGetLevel(const char *facil) ///< facilty of interest
+int psTraceGetLevel(const char *facil)     // /< facilty of interest
 ;
 
 /// Set all trace levels to zero (do not free nodes in the component tree).
-void psTraceReset()
-;
+void psTraceReset();
 
 /// Free all nodes in the component tree.
-void psTraceFree()
-;
+void psTraceFree();
 
 /// print trace levels
-void psTracePrintLevels(void)
-;
+void psTracePrintLevels(void);
 
 /// Set the destination of future trace messages.
-void psTraceSetDestination(FILE *fp);
+void psTraceSetDestination(FILE * fp);
 
+/* \} */// End of SystemGroup Functions
 
-/* \} */ // End of SystemGroup Functions
-
-#define psTrace(facil, level, ...) p_psTrace(facil, level, __VA_ARGS__)
-#endif
+#        define psTrace(facil, level, ...) p_psTrace(facil, level, __VA_ARGS__)
+#    endif
 
 #endif
-
Index: /trunk/psLib/src/sysUtils/psType.h
===================================================================
--- /trunk/psLib/src/sysUtils/psType.h	(revision 1406)
+++ /trunk/psLib/src/sysUtils/psType.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psType.h
 *
@@ -10,6 +11,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-04 23:37:39 $
+*  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -17,9 +18,9 @@
 
 #ifndef PS_TYPE_H
-#define PS_TYPE_H
+#    define PS_TYPE_H
 
-#include <complex.h>
-#include <stdint.h>
-#include <float.h>
+#    include <complex.h>
+#    include <stdint.h>
+#    include <float.h>
 
 /// @addtogroup DataContainer
@@ -27,5 +28,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -37,74 +40,75 @@
  */
 
-typedef uint8_t psU8;           ///< 8-bit unsigned int
-typedef uint16_t psU16;          ///< 16-bit unsigned int
-typedef uint32_t psU32;          ///< 32-bit unsigned int
-typedef uint64_t psU64;          ///< 64-bit unsigned int
-typedef int8_t psS8;           ///< 8-bit signed int
-typedef int16_t psS16;          ///< 16-bit signed int
-typedef int32_t psS32;          ///< 32-bit signed int
-typedef int64_t psS64;          ///< 64-bit signed int
-typedef float psF32;          ///< 32-bit floating point
-typedef double psF64;          ///< 64-bit floating point
-typedef complex float psC32;          ///< complex with 32-bit floating point Real and Imagary numbers
-typedef complex double psC64;          ///< complex with 64-bit floating point Real and Imagary numbers
-typedef void* psPTR;           ///< void pointer
-
+typedef uint8_t psU8;           // /< 8-bit unsigned int
+typedef uint16_t psU16;         // /< 16-bit unsigned int
+typedef uint32_t psU32;         // /< 32-bit unsigned int
+typedef uint64_t psU64;         // /< 64-bit unsigned int
+typedef int8_t psS8;            // /< 8-bit signed int
+typedef int16_t psS16;          // /< 16-bit signed int
+typedef int32_t psS32;          // /< 32-bit signed int
+typedef int64_t psS64;          // /< 64-bit signed int
+typedef float psF32;            // /< 32-bit floating point
+typedef double psF64;           // /< 64-bit floating point
+typedef complex float psC32;    // /< complex with 32-bit floating point Real and Imagary numbers
+typedef complex double psC64;   // /< complex with 64-bit floating point Real and Imagary numbers
+typedef void *psPTR;            // /< void pointer
 
 typedef enum {
-    PS_TYPE_S8 = 0x0101,   ///< Character.
-    PS_TYPE_S16 = 0x0102,   ///< Short integer.
-    PS_TYPE_S32 = 0x0104,   ///< Integer.
-    PS_TYPE_S64 = 0x0108,   ///< Long integer.
-    PS_TYPE_U8 = 0x0301,   ///< Unsigned character.
-    PS_TYPE_U16 = 0x0302,   ///< Unsigned short integer.
-    PS_TYPE_U32 = 0x0304,   ///< Unsigned integer.
-    PS_TYPE_U64 = 0x0308,   ///< Unsigned long integer.
-    PS_TYPE_F32 = 0x0404,   ///< Single-precision Floating point.
-    PS_TYPE_F64 = 0x0408,   ///< Double-precision floating point.
-    PS_TYPE_C32 = 0x0808,   ///< Complex numbers consisting of single-precision floating point.
-    PS_TYPE_C64 = 0x0810,   ///< Complex numbers consisting of double-precision floating point.
-    PS_TYPE_PTR = 0x0000   ///< Something else that's not supported for arithmetic.
+    PS_TYPE_S8 = 0x0101,        // /< Character.
+    PS_TYPE_S16 = 0x0102,                  // /< Short integer.
+    PS_TYPE_S32 = 0x0104,                  // /< Integer.
+    PS_TYPE_S64 = 0x0108,                  // /< Long integer.
+    PS_TYPE_U8 = 0x0301,                   // /< Unsigned character.
+    PS_TYPE_U16 = 0x0302,                  // /< Unsigned short integer.
+    PS_TYPE_U32 = 0x0304,                  // /< Unsigned integer.
+    PS_TYPE_U64 = 0x0308,                  // /< Unsigned long integer.
+    PS_TYPE_F32 = 0x0404,                  // /< Single-precision Floating point.
+    PS_TYPE_F64 = 0x0408,                  // /< Double-precision floating point.
+    PS_TYPE_C32 = 0x0808,                  // /< Complex numbers consisting of single-precision floating
+    // point.
+    PS_TYPE_C64 = 0x0810,                  // /< Complex numbers consisting of double-precision floating
+    // point.
+    PS_TYPE_PTR = 0x0000                   // /< Something else that's not supported for arithmetic.
 } psElemType;
 
-#define PS_TYPE_MASK PS_TYPE_U8         ///< the psElemType to use for mask image
-#define PS_TYPE_MASK_DATA U8            ///< the data member to use for mask image
-#define PS_TYPE_MASK_NAME "psU8"
-typedef psU8 psMaskType;                ///< the C datatype for a mask image
+#    define PS_TYPE_MASK PS_TYPE_U8        // /< the psElemType to use for mask image
+#    define PS_TYPE_MASK_DATA U8           // /< the data member to use for mask image
+#    define PS_TYPE_MASK_NAME "psU8"
+typedef psU8 psMaskType;        // /< the C datatype for a mask image
 
-#define PS_MIN_S8        INT8_MIN
-#define PS_MIN_S16       INT16_MIN
-#define PS_MIN_S32       INT32_MIN
-#define PS_MIN_S64       INT64_MIN
-#define PS_MIN_U8        0
-#define PS_MIN_U16       0
-#define PS_MIN_U32       0
-#define PS_MIN_U64       0
-#define PS_MIN_F32       -FLT_MAX
-#define PS_MIN_F64       -DBL_MAX
-#define PS_MIN_C32       -FLT_MAX
-#define PS_MIN_C64       -DBL_MAX
+#    define PS_MIN_S8        INT8_MIN
+#    define PS_MIN_S16       INT16_MIN
+#    define PS_MIN_S32       INT32_MIN
+#    define PS_MIN_S64       INT64_MIN
+#    define PS_MIN_U8        0
+#    define PS_MIN_U16       0
+#    define PS_MIN_U32       0
+#    define PS_MIN_U64       0
+#    define PS_MIN_F32       -FLT_MAX
+#    define PS_MIN_F64       -DBL_MAX
+#    define PS_MIN_C32       -FLT_MAX
+#    define PS_MIN_C64       -DBL_MAX
 
-#define PS_MAX_S8        INT8_MAX
-#define PS_MAX_S16       INT16_MAX
-#define PS_MAX_S32       INT32_MAX
-#define PS_MAX_S64       INT64_MAX
-#define PS_MAX_U8        UINT8_MAX
-#define PS_MAX_U16       UINT16_MAX
-#define PS_MAX_U32       UINT32_MAX
-#define PS_MAX_U64       UINT64_MAX
-#define PS_MAX_F32       FLT_MAX
-#define PS_MAX_F64       DBL_MAX
-#define PS_MAX_C32       FLT_MAX
-#define PS_MAX_C64       DBL_MAX
+#    define PS_MAX_S8        INT8_MAX
+#    define PS_MAX_S16       INT16_MAX
+#    define PS_MAX_S32       INT32_MAX
+#    define PS_MAX_S64       INT64_MAX
+#    define PS_MAX_U8        UINT8_MAX
+#    define PS_MAX_U16       UINT16_MAX
+#    define PS_MAX_U32       UINT32_MAX
+#    define PS_MAX_U64       UINT64_MAX
+#    define PS_MAX_F32       FLT_MAX
+#    define PS_MAX_F64       DBL_MAX
+#    define PS_MAX_C32       FLT_MAX
+#    define PS_MAX_C64       DBL_MAX
 
 /// Macro to get the bad pixel reason code (stored as part of mask value)
-#define PS_BADPIXEL_BITMASK 0x0f
-#define PS_GET_BADPIXEL(maskValue) (maskValue & PS_BADPIXEL_BITMASK)
+#    define PS_BADPIXEL_BITMASK 0x0f
+#    define PS_GET_BADPIXEL(maskValue) (maskValue & PS_BADPIXEL_BITMASK)
 
-#define PS_IS_BADPIXEL(maskValue) (PS_GET_BADPIXEL(maskValue) != 0)
+#    define PS_IS_BADPIXEL(maskValue) (PS_GET_BADPIXEL(maskValue) != 0)
 
 /// Macro to apply a bad pixel reason code to mask image
-#define PS_SET_BADPIXEL(maskValue, reasonCode) \
+#    define PS_SET_BADPIXEL(maskValue, reasonCode) \
 { \
     maskValue = (psMaskType)((reasonCode & PS_BADPIXEL_BITMASK) | (maskValue & ~PS_BADPIXEL_BITMASK)); \
@@ -112,13 +116,13 @@
 
 /// Macro to determine if the psElemType is an integer.
-#define PS_IS_PSELEMTYPE_INT(x) ((x & 0x100) == 0x100)
+#    define PS_IS_PSELEMTYPE_INT(x) ((x & 0x100) == 0x100)
 /// Macro to determine if the psElemType is unsigned.
-#define PS_IS_PSELEMTYPE_UNSIGNED(x) ((x & 0x200) == 0x200)
+#    define PS_IS_PSELEMTYPE_UNSIGNED(x) ((x & 0x200) == 0x200)
 /// Macro to determine if the psElemType is a real (non-complex) floating-point type.
-#define PS_IS_PSELEMTYPE_REAL(x) ((x & 0x400) == 0x400)
+#    define PS_IS_PSELEMTYPE_REAL(x) ((x & 0x400) == 0x400)
 /// Macro to determine if the psElemType is complex number type.
-#define PS_IS_PSELEMTYPE_COMPLEX(x) ((x & 0x800) == 0x800)
+#    define PS_IS_PSELEMTYPE_COMPLEX(x) ((x & 0x800) == 0x800)
 /// Macro to determine the storage size, in bytes, of the psElemType.
-#define PSELEMTYPE_SIZEOF(x) ( (x==PS_TYPE_PTR) ? sizeof(void*) :(x & 0xFF) )
+#    define PSELEMTYPE_SIZEOF(x) ( (x==PS_TYPE_PTR) ? sizeof(void*) :(x & 0xFF) )
 
 /** Dimensions of a data type.
@@ -128,9 +132,9 @@
  */
 typedef enum {
-    PS_DIMEN_SCALAR,     ///< Scalar.
-    PS_DIMEN_VECTOR,     ///< Vector.
-    PS_DIMEN_TRANSV,     ///< Transposed vector.
-    PS_DIMEN_IMAGE,      ///< Image.
-    PS_DIMEN_OTHER      ///< Something else that's not supported for arithmetic.
+    PS_DIMEN_SCALAR,            // /< Scalar.
+    PS_DIMEN_VECTOR,            // /< Vector.
+    PS_DIMEN_TRANSV,            // /< Transposed vector.
+    PS_DIMEN_IMAGE,             // /< Image.
+    PS_DIMEN_OTHER              // /< Something else that's not supported for arithmetic.
 } psDimen;
 
@@ -143,6 +147,6 @@
 typedef struct
 {
-    psElemType type;    ///< Primitive type.
-    psDimen dimen;      ///< Dimensionality.
+    psElemType type;            // /< Primitive type.
+    psDimen dimen;              // /< Dimensionality.
 }
 psType;
Index: /trunk/psLib/src/types/psArray.c
===================================================================
--- /trunk/psLib/src/types/psArray.c	(revision 1406)
+++ /trunk/psLib/src/types/psArray.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psArray.c
  *
@@ -8,6 +9,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -15,7 +16,9 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
-#include<stdlib.h>            // for qsort, etc.
+#include<stdlib.h>                         // for qsort, etc.
 
 #include "psMemory.h"
@@ -24,26 +27,28 @@
 #include "psLogMsg.h"
 
+/*****************************************************************************/
+
+/*  FUNCTION IMPLEMENTATION - LOCAL                                          */
 
 /*****************************************************************************/
-/*  FUNCTION IMPLEMENTATION - LOCAL                                          */
-/*****************************************************************************/
-static void arrayFree(psArray *restrict psArr);
+static void arrayFree(psArray * restrict psArr);
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
+
 /*****************************************************************************/
-psArray* psArrayAlloc(unsigned int nalloc)
+psArray *psArrayAlloc(unsigned int nalloc)
 {
     psArray *psArr = NULL;
 
     // Invalid nalloc
-    if(nalloc < 1) {
+    if (nalloc < 1) {
         psError(__func__, "Invalid value for nalloc. nalloc: %d\n", nalloc);
         return NULL;
     }
-
     // Create vector struct
-    psArr = (psArray *)psAlloc(sizeof(psArray));
-    p_psMemSetDeallocator(psArr,(psFreeFcn)arrayFree);
+    psArr = (psArray *) psAlloc(sizeof(psArray));
+    p_psMemSetDeallocator(psArr, (psFreeFcn) arrayFree);
 
     psArr->nalloc = nalloc;
@@ -51,38 +56,36 @@
 
     // Create vector data array
-    psArr->data = psAlloc(nalloc*sizeof(psPTR));
+    psArr->data = psAlloc(nalloc * sizeof(psPTR));
 
     return psArr;
 }
 
-psArray *psArrayRealloc(unsigned int nalloc, psArray *restrict in)
+psArray *psArrayRealloc(unsigned int nalloc, psArray * restrict in)
 {
     // Invalid nalloc
-    if(nalloc < 1) {
+    if (nalloc < 1) {
         psError(__func__, "Invalid value for realloc (%d)\n", nalloc);
         return NULL;
     }
 
-    if(in == NULL) {
+    if (in == NULL) {
         psError(__func__, "Null input vector\n");
         return NULL;
-    } else
-        if(in->nalloc != nalloc) {                    // No need to realloc to same size
-            if(nalloc < in->n) {
-                for (int i = nalloc; i < in->n; i++) {   // For reduction in vector size
-                    psFree(in->data[i]);
-                }
-                in->n = nalloc;
+    } else if (in->nalloc != nalloc) {     // No need to realloc to same size
+        if (nalloc < in->n) {
+            for (int i = nalloc; i < in->n; i++) {      // For reduction in vector size
+                psFree(in->data[i]);
             }
-
-            // Realloc after decrementation to avoid accessing freed array elements
-            in->data = psRealloc(in->data,nalloc*sizeof(psPTR));
-            in->nalloc = nalloc;
+            in->n = nalloc;
         }
+        // Realloc after decrementation to avoid accessing freed array elements
+        in->data = psRealloc(in->data, nalloc * sizeof(psPTR));
+        in->nalloc = nalloc;
+    }
 
     return in;
 }
 
-static void arrayFree(psArray *restrict psArr)
+static void arrayFree(psArray * restrict psArr)
 {
     if (psArr == NULL) {
@@ -95,12 +98,12 @@
 }
 
-void psArrayElementFree(psArray *restrict psArr)
+void psArrayElementFree(psArray * restrict psArr)
 {
 
-    if(psArr == NULL) {
+    if (psArr == NULL) {
         return;
     }
 
-    for(int i = 0; i < psArr->n; i++) {
+    for (int i = 0; i < psArr->n; i++) {
         psFree(psArr->data[i]);
         psArr->data[i] = NULL;
@@ -108,5 +111,5 @@
 }
 
-psArray* psArraySort(psArray* in, psComparePtrFcn compare)
+psArray *psArraySort(psArray * in, psComparePtrFcn compare)
 {
     if (in == NULL) {
@@ -114,7 +117,5 @@
     }
 
-    qsort(in->data, in->n, sizeof(psPTR),
-          (int(*)(const void *, const void *))compare);
-
+    qsort(in->data, in->n, sizeof(psPTR), (int (*)(const void *, const void *))compare);
 
     return in;
Index: /trunk/psLib/src/types/psArray.h
===================================================================
--- /trunk/psLib/src/types/psArray.h	(revision 1406)
+++ /trunk/psLib/src/types/psArray.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psArray.h
  *
@@ -11,6 +12,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-15 22:18:02 $
+ *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -18,8 +19,8 @@
 
 #ifndef PS_ARRAY_H
-#define PS_ARRAY_H
+#    define PS_ARRAY_H
 
-#include "psType.h"
-#include "psCompare.h"
+#    include "psType.h"
+#    include "psCompare.h"
 
 /// @addtogroup Array
@@ -33,12 +34,14 @@
 typedef struct
 {
-    unsigned int nalloc;                ///< Total number of elements available.
-    unsigned int n;                     ///< Number of elements in use.
-    psPTR* data;                        ///< An Array of pointer elements
+    unsigned int nalloc;        // /< Total number of elements available.
+    unsigned int n;             // /< Number of elements in use.
+    psPTR *data;                // /< An Array of pointer elements
 }
 psArray;
 
 /*****************************************************************************/
+
 /* FUNCTION PROTOTYPES                                                       */
+
 /*****************************************************************************/
 
@@ -51,7 +54,6 @@
  *
  */
-psArray *psArrayAlloc(
-    unsigned int nalloc                 ///< Total number of elements to make available.
-);
+psArray *psArrayAlloc(unsigned int nalloc       // /< Total number of elements to make available.
+                     );
 
 /** Reallocate an array.
@@ -63,8 +65,7 @@
  *
  */
-psArray *psArrayRealloc(
-    unsigned int nalloc,                ///< Total number of elements to make available.
-    psArray *restrict psArr            ///< array to reallocate.
-);
+psArray *psArrayRealloc(unsigned int nalloc,    // /< Total number of elements to make available.
+                        psArray * restrict psArr        // /< array to reallocate.
+                       );
 
 /** Deallocate/Dereference elements of an array.
@@ -75,7 +76,6 @@
  *
  */
-void psArrayElementFree(
-    psArray *restrict psArr    ///< Void pointer array to destroy.
-);
+void psArrayElementFree(psArray * restrict psArr        // /< Void pointer array to destroy.
+                       );
 
 /** Sort the array according to an external compare function.
@@ -86,5 +86,5 @@
  *  @return psArray*       The sorted array.
  */
-psArray* psArraySort(psArray* in, psComparePtrFcn compare);
+psArray *psArraySort(psArray * in, psComparePtrFcn compare);
 
 /// @}
Index: /trunk/psLib/src/types/psBitSet.c
===================================================================
--- /trunk/psLib/src/types/psBitSet.c	(revision 1406)
+++ /trunk/psLib/src/types/psBitSet.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psBitSet.c
  *
@@ -10,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -17,5 +18,7 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 #include <string.h>
@@ -31,32 +34,41 @@
 
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
-/******************************************************************************/
-
-// None
-
-/******************************************************************************/
+
+/******************************************************************************/
+
+// None
+
+/******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
-/******************************************************************************/
-
-// None
-
-/*****************************************************************************/
+
+/******************************************************************************/
+
+// None
+
+/*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
-/*****************************************************************************/
-
-// None
-
-/*****************************************************************************/
+
+/*****************************************************************************/
+
+// None
+
+/*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
-/*****************************************************************************/
-
-// None
-
-/*****************************************************************************/
+
+/*****************************************************************************/
+
+// None
+
+/*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
-/*****************************************************************************/
-static void psBitSetFree(psBitSet *restrict inBitSet);
-
+
+/*****************************************************************************/
+static void psBitSetFree(psBitSet * restrict inBitSet);
 
 /** Private function to create a mask.
@@ -70,7 +82,8 @@
 {
     char mask = (char)0x01;
+
     // Ignore splint warning about negative bit shifts
-    /*@i@*/
-    mask = mask << (bit%8);
+    /* @i@ */
+    mask = mask << (bit % 8);
 
     return mask;
@@ -78,29 +91,31 @@
 
 /*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
-/*****************************************************************************/
-psBitSet* psBitSetAlloc(int n)
+
+/*****************************************************************************/
+psBitSet *psBitSetAlloc(int n)
 {
     int numBytes = 0;
     psBitSet *newObj = NULL;
 
-    if(n <= 0) {
+    if (n <= 0) {
         psError(__func__, " : Line %d - Allocation size must be > 0: size = %d", __LINE__, n);
         return 0;
     }
 
-    numBytes = ceil(n/8.0);
+    numBytes = ceil(n / 8.0);
     newObj = psAlloc(sizeof(psBitSet));
-    if(newObj == NULL) {
-        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
-    }
-    p_psMemSetDeallocator(newObj,(psFreeFcn)psBitSetFree);
+    if (newObj == NULL) {
+        psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
+    }
+    p_psMemSetDeallocator(newObj, (psFreeFcn) psBitSetFree);
     newObj->n = numBytes;
 
     // Ignore splint warning about releasing pointer members, since they've not been allocated yet
-    /*@i@*/
-    newObj->bits = psAlloc(sizeof(char)*numBytes);
-    if(newObj->bits == NULL) {
-        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
+    /* @i@ */
+    newObj->bits = psAlloc(sizeof(char) * numBytes);
+    if (newObj->bits == NULL) {
+        psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
     }
 
@@ -110,7 +125,7 @@
 }
 
-static void psBitSetFree(psBitSet *restrict inBitSet)
-{
-    if(inBitSet == NULL) {
+static void psBitSetFree(psBitSet * restrict inBitSet)
+{
+    if (inBitSet == NULL) {
         psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__);
         return;
@@ -119,23 +134,20 @@
 }
 
-psBitSet* psBitSetSet(psBitSet *inBitSet, int bit)
-{
-    char* byte = NULL;
-
-    if(inBitSet == NULL) {
+psBitSet *psBitSetSet(psBitSet * inBitSet, int bit)
+{
+    char *byte = NULL;
+
+    if (inBitSet == NULL) {
         psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__);
         return inBitSet;
-    } else
-        if(bit < 0) {
-            psError(__func__, " : Line %d - Bit position too small: %d", __LINE__, bit);
-            return inBitSet;
-        } else
-            if(bit > inBitSet->n*8-1) {
-                psError(__func__, " : Line %d - Bit position too large: %d", __LINE__, bit);
-                return inBitSet;
-            }
-
+    } else if (bit < 0) {
+        psError(__func__, " : Line %d - Bit position too small: %d", __LINE__, bit);
+        return inBitSet;
+    } else if (bit > inBitSet->n * 8 - 1) {
+        psError(__func__, " : Line %d - Bit position too large: %d", __LINE__, bit);
+        return inBitSet;
+    }
     // Variable byte is the byte in the array that contains the bit to be set
-    byte = inBitSet->bits+bit/8;
+    byte = inBitSet->bits + bit / 8;
     *byte |= mask(bit);
 
@@ -143,24 +155,21 @@
 }
 
-bool psBitSetTest(const psBitSet *inBitSet, int bit)
-{
-    char* byte = NULL;
-
-    if(inBitSet == NULL) {
-        psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__);
-        return 0;
-    } else
-        if(bit < 0) {
-            psError(__func__, " : Line %d - Bit position too small: %d", __LINE__, bit);
-            return 0;
-        } else
-            if(bit > inBitSet->n*8-1) {
-                psError(__func__, " : Line %d - Bit position too large: %d", __LINE__, bit);
-                return 0;
-            }
-
+bool psBitSetTest(const psBitSet * inBitSet, int bit)
+{
+    char *byte = NULL;
+
+    if (inBitSet == NULL) {
+        psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__);
+        return 0;
+    } else if (bit < 0) {
+        psError(__func__, " : Line %d - Bit position too small: %d", __LINE__, bit);
+        return 0;
+    } else if (bit > inBitSet->n * 8 - 1) {
+        psError(__func__, " : Line %d - Bit position too large: %d", __LINE__, bit);
+        return 0;
+    }
     // Variable byte is the byte in the array that contains the bit to be tested
-    byte = inBitSet->bits+bit/8;
-    if((int)(*byte&mask(bit)) == 0) {
+    byte = inBitSet->bits + bit / 8;
+    if ((int)(*byte & mask(bit)) == 0) {
         return 0;
     }
@@ -169,6 +178,6 @@
 }
 
-psBitSet* psBitSetOp(psBitSet *outBitSet, const psBitSet *restrict inBitSet1, char *operator,
-                     const psBitSet *restrict inBitSet2)
+psBitSet *psBitSetOp(psBitSet * outBitSet, const psBitSet * restrict inBitSet1, char *operator,
+                     const psBitSet * restrict inBitSet2)
 {
     int i = 0;
@@ -179,24 +188,24 @@
     char *inBits2 = NULL;
 
-    if(inBitSet1 == NULL) {
+    if (inBitSet1 == NULL) {
         psError(__func__, " : Line %d - Null psBitSet for inBitSet1 argument", __LINE__);
         return outBitSet;
     }
 
-    if(operator == NULL) {
+    if (operator == NULL) {
         psError(__func__, " : Line %d - Null input operator\n", __LINE__);
         return outBitSet;
     }
 
-    if(inBitSet2 == NULL) {
+    if (inBitSet2 == NULL) {
         psError(__func__, " : Line %d - Null psBitSet for inBitSet2 argument", __LINE__);
         return outBitSet;
     }
 
-    if(outBitSet == NULL) {
-        outBitSet = psBitSetAlloc(inBitSet1->n*8);
-    }
-
-    if(inBitSet1->n != inBitSet2->n || outBitSet->n != inBitSet1->n) {
+    if (outBitSet == NULL) {
+        outBitSet = psBitSetAlloc(inBitSet1->n * 8);
+    }
+
+    if (inBitSet1->n != inBitSet2->n || outBitSet->n != inBitSet1->n) {
         psError(__func__, " : Line %d - psBitSet sizes not the same", __LINE__);
         return outBitSet;
@@ -209,17 +218,17 @@
 
     tempChar = toupper(operator[0]);
-    switch(tempChar) {
+    switch (tempChar) {
     case 'A':
-        for(i=0; i<n; i++) {
+        for (i = 0; i < n; i++) {
             outBits[i] = inBits1[i] & inBits2[i];
         }
         break;
     case 'O':
-        for(i=0; i<n; i++) {
+        for (i = 0; i < n; i++) {
             outBits[i] = inBits1[i] | inBits2[i];
         }
         break;
     case 'X':
-        for(i=0; i<n; i++) {
+        for (i = 0; i < n; i++) {
             outBits[i] = inBits1[i] ^ inBits2[i];
         }
@@ -232,5 +241,5 @@
 }
 
-psBitSet* psBitSetNot(psBitSet *outBitSet, const psBitSet *restrict inBitSet)
+psBitSet *psBitSetNot(psBitSet * outBitSet, const psBitSet * restrict inBitSet)
 {
     int i = 0;
@@ -239,5 +248,5 @@
     char *inBits = NULL;
 
-    if(inBitSet == NULL) {
+    if (inBitSet == NULL) {
         psError(__func__, " : Line %d - Null psBitSet for inBitSet argument", __LINE__);
         return outBitSet;
@@ -245,14 +254,14 @@
 
     n = inBitSet->n;
-    if(n == 0) {
+    if (n == 0) {
         psError(__func__, " : Line %d - No elements in inBitSet", __LINE__);
         return outBitSet;
     }
 
-    if(outBitSet == NULL) {
-        outBitSet = psBitSetAlloc(n*8);
-    }
-
-    if(inBitSet->n != outBitSet->n) {
+    if (outBitSet == NULL) {
+        outBitSet = psBitSetAlloc(n * 8);
+    }
+
+    if (inBitSet->n != outBitSet->n) {
         psError(__func__, " : Line %d - psBitSet sizes not the same", __LINE__);
         return outBitSet;
@@ -262,5 +271,5 @@
     inBits = inBitSet->bits;
 
-    for(i=0; i<n; i++) {
+    for (i = 0; i < n; i++) {
         outBits[i] = ~inBits[i];
     }
@@ -269,15 +278,16 @@
 }
 
-char *psBitSetToString(const psBitSet *restrict inBitSet)
+char *psBitSetToString(const psBitSet * restrict inBitSet)
 {
     int i = 0;
-    int numBits = inBitSet->n*8;
-    char* outString = psAlloc((size_t)numBits+1);
-    if(outString == NULL) {
-        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
-    }
-
-    for(i=0; i<numBits; i++) {
-        outString[numBits-i-1] = (psBitSetTest(inBitSet, i) == 1)?'1':'0';
+    int numBits = inBitSet->n * 8;
+    char *outString = psAlloc((size_t) numBits + 1);
+
+    if (outString == NULL) {
+        psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
+    }
+
+    for (i = 0; i < numBits; i++) {
+        outString[numBits - i - 1] = (psBitSetTest(inBitSet, i) == 1) ? '1' : '0';
     }
 
Index: /trunk/psLib/src/types/psBitSet.h
===================================================================
--- /trunk/psLib/src/types/psBitSet.h	(revision 1406)
+++ /trunk/psLib/src/types/psBitSet.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psBitSet.h
  *
@@ -12,6 +13,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-01 21:48:11 $
+ *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -19,5 +20,5 @@
 
 #ifndef PSBITSET_H
-#define PSBITSET_H
+#    define PSBITSET_H
 
 /// @addtogroup BitSet
@@ -25,5 +26,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -35,5 +38,7 @@
 typedef struct
 {
+
     int n;      /**< Number of bytes in the array */
+
     char *bits; /**< Aray of bytes holding bits */
 }
@@ -41,5 +46,7 @@
 
 /*****************************************************************************/
+
 /* FUNCTION PROTOTYPES                                                       */
+
 /*****************************************************************************/
 
@@ -51,8 +58,10 @@
  *  @return  psBitSet*: Pointer to struct containing array of bits and size of array.
  */
+
 /*@null@*/
-psBitSet* psBitSetAlloc(
-    int n   /**< Number of bits in psBitSet array */
-);
+
+psBitSet *psBitSetAlloc(int n
+                        /**< Number of bits in psBitSet array */
+                       );
 
 /** Set a bit.
@@ -64,7 +73,10 @@
  *  @return  psBitSet*: Pointer to struct containing psBitSet.
  */
-psBitSet* psBitSetSet(
-    /*@returned@*/psBitSet *restrict inMask,  /**< Pointer to psBitSet to be set. */
-    int bit                     /**< Bit to be set. */
+psBitSet *psBitSetSet(
+
+    /* @returned@ */ psBitSet * restrict inMask,
+    /**< Pointer to psBitSet to be set. */
+
+    int bit/**< Bit to be set. */
 );
 
@@ -78,8 +90,10 @@
  *  @return  int: Value of bit, either one or zero.
  */
-bool psBitSetTest(
-    const psBitSet *restrict inMask,    /**< Pointer psBitSet to be tested. */
-    int bit                             /**< Bit to be tested. */
-);
+
+bool psBitSetTest(const psBitSet * restrict inMask,
+                  /**< Pointer psBitSet to be tested. */
+
+                  int bit               /**< Bit to be tested. */
+                 );
 
 /** Perform a binary operation on two psBitSets
@@ -90,9 +104,16 @@
  *  @return  psBitSet*: Pointer to struct containing result of binary operation.
  */
-psBitSet* psBitSetOp(
-    /*@returned@*/psBitSet *restrict outMask,   /**< Resulting psBitSet from binary operation */
-    const psBitSet *restrict inMask1,           /**< First psBitSet on which to operate */
-    char *operator,                             /**< Bit operation */
-    const psBitSet *restrict inMask2            /**< First psBitSet on which to operate */
+psBitSet *psBitSetOp(
+
+    /* @returned@ */ psBitSet * restrict outMask,
+    /**< Resulting psBitSet from binary operation */
+
+    const psBitSet * restrict inMask1,
+    /**< First psBitSet on which to operate */
+
+    char *operator,         /**< Bit operation */
+
+    const psBitSet * restrict inMask2
+    /**< First psBitSet on which to operate */
 );
 
@@ -103,8 +124,11 @@
  *  @return  psBitSet*: Pointer to struct containing result of operation.
  */
-psBitSet* psBitSetNot(
-    psBitSet *outBitSet,                /**< Resulting psBitSet from operation */
-    const psBitSet *restrict inBitSet   /**< Input psBitSet */
-);
+
+psBitSet *psBitSetNot(psBitSet * outBitSet,
+                      /**< Resulting psBitSet from operation */
+
+                      const psBitSet * restrict inBitSet
+                      /**< Input psBitSet */
+                     );
 
 /** Convert the psBitSet to a string of ones and zeros.
@@ -115,7 +139,8 @@
  *  @return  char*: Pointer to character array containing string data.
  */
-char *psBitSetToString(
-    const psBitSet *restrict inMask /**< psBitSet to convert */
-);
+
+char *psBitSetToString(const psBitSet * restrict inMask
+                       /**< psBitSet to convert */
+                      );
 
 /// @}
Index: /trunk/psLib/src/types/psList.c
===================================================================
--- /trunk/psLib/src/types/psList.c	(revision 1406)
+++ /trunk/psLib/src/types/psList.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file psList.c
  *  @brief Support for doubly linked lists
@@ -6,6 +7,6 @@
  *  @author Robert Daniel DeSonia, MHPCC
  *
- *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -15,5 +16,5 @@
 #include <stdbool.h>
 #include <stdio.h>
-#include <pthread.h>                   // we need a mutex to make this stuff thread safe.
+#include <pthread.h>                       // we need a mutex to make this stuff thread safe.
 
 #include "psError.h"
@@ -24,18 +25,18 @@
 #include "psLogMsg.h"
 
-#define ITER_INIT_HEAD ((void *)1) // next iteration should return head
-#define ITER_INIT_TAIL ((void *)2) // next iteration should return tail
+#define ITER_INIT_HEAD ((void *)1)         // next iteration should return head
+#define ITER_INIT_TAIL ((void *)2)         // next iteration should return tail
 
 // private functions.
-static psListElem* listGetIterator(psList* list);
-static int listGetIteratorIndex(psList* list);
-static void listSetIterator(psList *list, int where, bool lockList);
-static void listFree(psList *list);
-
+static psListElem *listGetIterator(psList * list);
+static int listGetIteratorIndex(psList * list);
+static void listSetIterator(psList * list, int where, bool lockList);
+static void listFree(psList * list);
 
 psList *psListAlloc(void *data)
 {
     psList *list = psAlloc(sizeof(psList));
-    p_psMemSetDeallocator(list,(psFreeFcn)listFree);
+
+    p_psMemSetDeallocator(list, (psFreeFcn) listFree);
 
     list->size = 0;
@@ -44,5 +45,5 @@
     list->iterIndex = PS_LIST_HEAD;
 
-    pthread_mutex_init(&(list->lock),NULL)
+    pthread_mutex_init(&(list->lock), NULL)
     ;
 
@@ -54,5 +55,5 @@
 }
 
-static void listFree(psList *list)
+static void listFree(psList * list)
 {
     if (list == NULL) {
@@ -63,5 +64,5 @@
     ;
 
-    for(psListElem *ptr = list->head; ptr != NULL; ) {
+    for (psListElem * ptr = list->head; ptr != NULL;) {
         psListElem *next = ptr->next;
 
@@ -80,8 +81,8 @@
 }
 
-bool psListAdd(psList *list, void *data, int where)
-{
-    psListElem* position;
-    psListElem* elem;
+bool psListAdd(psList * list, void *data, int where)
+{
+    psListElem *position;
+    psListElem *elem;
     int cursorIndex = 0;
 
@@ -95,8 +96,6 @@
 
     if (where <= PS_LIST_UNKNOWN) {
-        /// XXX What is the better way to communicate this failure to the caller?
-        psLogMsg(__func__,PS_LOG_WARN,
-                 "The given insert location (%i) for psListAdd is invalid.",
-                 where);
+        // / XXX What is the better way to communicate this failure to the caller?
+        psLogMsg(__func__, PS_LOG_WARN, "The given insert location (%i) for psListAdd is invalid.", where);
         return false;
     }
@@ -108,7 +107,6 @@
 
     if (where > 0 && where > list->size) {
-        psLogMsg(__func__,PS_LOG_WARN,
-                 "Invalid index %d (only %d elements in psList); assuming tail.",
-                 where, list->size);
+        psLogMsg(__func__, PS_LOG_WARN,
+                 "Invalid index %d (only %d elements in psList); assuming tail.", where, list->size);
         where = PS_LIST_TAIL;
     }
@@ -138,8 +136,7 @@
 
         if (position == NULL) {
-            psError(__func__,"%s failed to move cursor to specified location (%d)",__func__,where);
-            position = list->head; // since we no list->size != 0, this must be non-NULL
-        }
-
+            psError(__func__, "%s failed to move cursor to specified location (%d)", __func__, where);
+            position = list->head;         // since we no list->size != 0, this must be non-NULL
+        }
         // insert our new element in front of the given position
         elem->prev = position->prev;
@@ -147,5 +144,5 @@
         position->prev = elem;
 
-        if (elem->prev == NULL) { // must be front of list
+        if (elem->prev == NULL) {          // must be front of list
             list->head = elem;
         } else {
@@ -167,17 +164,17 @@
 
 /*****************************************************************************/
+
 /*
  * Remove an element from a list
  */
-bool psListRemove(psList *list, void *data,  int which)
-{
-    psListElem *elem = NULL;  // element to remove
+bool psListRemove(psList * list, void *data, int which)
+{
+    psListElem *elem = NULL;    // element to remove
     int cursorIndex = 0;
 
     if (list == NULL) {
-        psError(__func__,"list parameter found to be NULL in %s",__func__);
+        psError(__func__, "list parameter found to be NULL in %s", __func__);
         return false;
     }
-
     // get exclusive access to list so that other threads will not get in the way.
     pthread_mutex_lock(&list->lock)
@@ -187,6 +184,7 @@
         // search list for the data item.
 
-        int i = 0;   // index
-        for (psListElem *ptr = list->head; ptr != NULL; ptr = ptr->next) {
+        int i = 0;              // index
+
+        for (psListElem * ptr = list->head; ptr != NULL; ptr = ptr->next) {
             if (ptr->data == data) {
                 which = i;
@@ -201,12 +199,11 @@
         }
     }
-
     // position the list's cursor to the desired location
-    listSetIterator(list,which,false);
+    listSetIterator(list, which, false);
     elem = listGetIterator(list);
     cursorIndex = listGetIteratorIndex(list);
 
     if (elem == NULL) {
-        psError(__func__, "Couldn't position to given index (%d) to remove element from list.",which);
+        psError(__func__, "Couldn't position to given index (%d) to remove element from list.", which);
         return false;
     }
@@ -214,5 +211,5 @@
     list->size--;
 
-    if (elem->prev == NULL) { // head of list?
+    if (elem->prev == NULL) {              // head of list?
         list->head = elem->next;
     } else {
@@ -220,5 +217,5 @@
     }
 
-    if (elem->next == NULL) { // tail of list?
+    if (elem->next == NULL) {              // tail of list?
         list->tail = elem->prev;
 
@@ -246,16 +243,16 @@
 }
 
-void psListSetIterator(psList *list, int where)
-{
-    listSetIterator(list,where,true);
-}
-
-void listSetIterator(psList* list, int where, bool lockList)
-{
-    psListElem* cursor;
+void psListSetIterator(psList * list, int where)
+{
+    listSetIterator(list, where, true);
+}
+
+void listSetIterator(psList * list, int where, bool lockList)
+{
+    psListElem *cursor;
     int position;
 
     if (list == NULL) {
-        psError(__func__,"Unexpected null pointer for psList parameter (%s:%d).",__FILE__,__LINE__);
+        psError(__func__, "Unexpected null pointer for psList parameter (%s:%d).", __FILE__, __LINE__);
         return;
     }
@@ -291,5 +288,5 @@
         if (cursor != NULL) {
             list->iter = cursor->prev;
-            list->iterIndex = position-1;
+            list->iterIndex = position - 1;
         }
         break;
@@ -301,5 +298,5 @@
         if (cursor != NULL) {
             list->iter = cursor->next;
-            list->iterIndex = position+1;
+            list->iterIndex = position + 1;
         }
         break;
@@ -309,9 +306,9 @@
 
     default:
-        if (where <= PS_LIST_HEAD) { // bascially same as PS_LIST_UNKNOWN above
-            psError(__func__,"Can't move to an unknown position.  Not moving the iterator position.");
+        if (where <= PS_LIST_HEAD) {   // bascially same as PS_LIST_UNKNOWN above
+            psError(__func__, "Can't move to an unknown position.  Not moving the iterator position.");
         } else {
             cursor = listGetIterator(list);
-            if (cursor == NULL) { // reset the iterator if it is invalid
+            if (cursor == NULL) {      // reset the iterator if it is invalid
                 list->iter = ITER_INIT_HEAD;
                 list->iterIndex = 0;
@@ -321,12 +318,14 @@
 
             if (where < position) {
-                int diff = position-where;
-                for (int count=0;count < diff; count++) {
-                    listSetIterator(list,PS_LIST_PREVIOUS,false);
+                int diff = position - where;
+
+                for (int count = 0; count < diff; count++) {
+                    listSetIterator(list, PS_LIST_PREVIOUS, false);
                 }
             } else {
-                int diff = where-position;
-                for (int count=0;count < diff; count++) {
-                    listSetIterator(list,PS_LIST_NEXT,false);
+                int diff = where - position;
+
+                for (int count = 0; count < diff; count++) {
+                    listSetIterator(list, PS_LIST_NEXT, false);
                 }
             }
@@ -341,5 +340,5 @@
 }
 
-psListElem* listGetIterator(psList* list)
+psListElem *listGetIterator(psList * list)
 {
     if (list == NULL) {
@@ -349,29 +348,27 @@
     if (list->iter == ITER_INIT_HEAD) {
         return list->head;
-    } else
-        if (list->iter == ITER_INIT_TAIL) {
-            return list->tail;
-        } else {
-            return list->iter;
-        }
-}
-
-int listGetIteratorIndex(psList* list)
+    } else if (list->iter == ITER_INIT_TAIL) {
+        return list->tail;
+    } else {
+        return list->iter;
+    }
+}
+
+int listGetIteratorIndex(psList * list)
 {
     if (list->iter == ITER_INIT_HEAD) {
         return 0;
-    } else
-        if (list->iter == ITER_INIT_TAIL) {
-            return list->size-1;
-        } else {
-            return list->iterIndex;
-        }
-}
-
-void* psListGet(psList* list,int which)
-{
-    psListElem* element;
-
-    psListSetIterator(list,which);
+    } else if (list->iter == ITER_INIT_TAIL) {
+        return list->size - 1;
+    } else {
+        return list->iterIndex;
+    }
+}
+
+void *psListGet(psList * list, int which)
+{
+    psListElem *element;
+
+    psListSetIterator(list, which);
     element = listGetIterator(list);
 
@@ -382,18 +379,19 @@
     }
 }
+
 /*
  * and now return the previous/next element of the list
  */
-void *psListGetNext(psList *list)
+void *psListGetNext(psList * list)
 {
     return psListGet(list, PS_LIST_NEXT);
 }
 
-void *psListGetPrevious(psList *list)
+void *psListGetPrevious(psList * list)
 {
     return psListGet(list, PS_LIST_PREVIOUS);
 }
 
-void *psListGetCurrent(psList *list)
+void *psListGetCurrent(psList * list)
 {
     return psListGet(list, PS_LIST_CURRENT);
@@ -403,9 +401,9 @@
  * Convert a psList to/from a psVoidPtrArray
  */
-psArray* psListToArray(psList* restrict list)
-{
-    psListElem* ptr;
+psArray *psListToArray(psList * restrict list)
+{
+    psListElem *ptr;
     unsigned int n;
-    psArray* restrict arr;
+    psArray *restrict arr;
 
     if (list == NULL) {
@@ -431,8 +429,8 @@
 }
 
-psList* psArrayToList(psArray* arr)
+psList *psArrayToList(psArray * arr)
 {
     unsigned int n;
-    psList* list; // list of elements
+    psList *list;               // list of elements
 
     if (arr == NULL) {
@@ -443,5 +441,5 @@
     n = arr->n;
     for (int i = 0; i < n; i++) {
-        psListAdd(list,arr->data[i],PS_LIST_TAIL);
+        psListAdd(list, arr->data[i], PS_LIST_TAIL);
     }
 
@@ -449,17 +447,16 @@
 }
 
-
-psList* psListSort(psList* list, psComparePtrFcn compare)
-{
-    psArray* arr;
+psList *psListSort(psList * list, psComparePtrFcn compare)
+{
+    psArray *arr;
+
     if (list == NULL) {
         return NULL;
     }
-
     // convert to indexable vector for use by qsort.
     arr = psListToArray(list);
     psFree(list);
 
-    arr = psArraySort(arr,compare);
+    arr = psArraySort(arr, compare);
 
     // convert back to linked list
Index: /trunk/psLib/src/types/psList.h
===================================================================
--- /trunk/psLib/src/types/psList.h	(revision 1406)
+++ /trunk/psLib/src/types/psList.h	(revision 1407)
@@ -1,4 +1,4 @@
 #if !defined(PS_LIST_H)
-#define PS_LIST_H
+#    define PS_LIST_H
 
 /** @file psList.h
@@ -10,15 +10,15 @@
  *  @ingroup LinkedList
  *
- *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-07-15 22:18:02 $
+ *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
 
-#include <pthread.h>                   // we need a mutex to make this stuff thread safe.
-#include <stdbool.h>                   // we use the bool type.
+#    include <pthread.h>                   // we need a mutex to make this stuff thread safe.
+#    include <stdbool.h>                   // we use the bool type.
 
-#include "psCompare.h"
-#include "psArray.h"
+#    include "psCompare.h"
+#    include "psArray.h"
 
 /** @addtogroup LinkedList
@@ -33,10 +33,10 @@
  */
 enum {
-    PS_LIST_HEAD = 0,                  ///< at head
-    PS_LIST_TAIL = -1,                 ///< at tail
-    PS_LIST_PREVIOUS = -2,             ///< previous element
-    PS_LIST_CURRENT = -3,              ///< current element
-    PS_LIST_NEXT = -4,                 ///< next element
-    PS_LIST_UNKNOWN = -5               ///< unknown position (should be last in enum list)
+    PS_LIST_HEAD = 0,           // /< at head
+    PS_LIST_TAIL = -1,                     // /< at tail
+    PS_LIST_PREVIOUS = -2,                 // /< previous element
+    PS_LIST_CURRENT = -3,                  // /< current element
+    PS_LIST_NEXT = -4,                     // /< next element
+    PS_LIST_UNKNOWN = -5                   // /< unknown position (should be last in enum list)
 };
 
@@ -44,7 +44,7 @@
 typedef struct psListElem
 {
-    struct psListElem *prev;            ///< previous link in list
-    struct psListElem *next;            ///< next link in list
-    void *data;                         ///< real data item
+    struct psListElem *prev;    // /< previous link in list
+    struct psListElem *next;    // /< next link in list
+    void *data;                 // /< real data item
 }
 psListElem;
@@ -57,10 +57,10 @@
 typedef struct
 {
-    unsigned int size;                  ///< number of elements on list
-    psListElem* head;                   ///< first element on list (may be NULL)
-    psListElem* tail;                   ///< last element on list (may be NULL)
-    psListElem* iter;                   ///< iteration cursor
-    unsigned int iterIndex;             ///< the numeric position of the iteration cursor in the list
-    pthread_mutex_t lock;               ///< mutex to lock a node during changes
+    unsigned int size;          // /< number of elements on list
+    psListElem *head;           // /< first element on list (may be NULL)
+    psListElem *tail;           // /< last element on list (may be NULL)
+    psListElem *iter;           // /< iteration cursor
+    unsigned int iterIndex;     // /< the numeric position of the iteration cursor in the list
+    pthread_mutex_t lock;       // /< mutex to lock a node during changes
 }
 psList;
@@ -70,8 +70,7 @@
  *  @return psList*     A new psList object.
  */
-psList* psListAlloc(
-    void *data
-    ///< initial data item; may be NULL if no an empty psList is desired
-)
+psList *psListAlloc(void *data
+                    // /< initial data item; may be NULL if no an empty psList is desired
+                   )
 ;
 
@@ -81,9 +80,8 @@
  *                      NULL, the return value will also be NULL.
  */
-bool psListAdd(
-    psList* restrict list,              ///< list to add to (if NULL, nothing is done)
-    void* data,                         ///< data item to add.  If NULL, list is not modified.
-    int where                           ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location.
-);
+bool psListAdd(psList * restrict list,  // /< list to add to (if NULL, nothing is done)
+               void *data,      // /< data item to add.  If NULL, list is not modified.
+               int where        // /< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location.
+              );
 
 /** Remove an item from a list.  If which parameter is PS_LIST_UNKNOWN,
@@ -91,12 +89,11 @@
  *  @return bool        TRUE if element is successfully removed, otherwise FALSE.
  */
-bool psListRemove(
-    psList* restrict list,
-    ///< list to remove element from
-    void *data,
-    ///< if which is PS_LIST_UNKNOWN, data item to find and remove, otherwise this is ignored.
-    int which
-    ///< index of item, or PS_LIST_UNKNOWN, PS_LIST_NEXT, PS_LIST_PREV, or numbered location.
-);
+bool psListRemove(psList * restrict list,
+                  // /< list to remove element from
+                  void *data,
+                  // /< if which is PS_LIST_UNKNOWN, data item to find and remove, otherwise this is ignored.
+                  int which
+                  // /< index of item, or PS_LIST_UNKNOWN, PS_LIST_NEXT, PS_LIST_PREV, or numbered location.
+                 );
 
 /** Retrieve an item from a list.
@@ -107,8 +104,7 @@
  *                      NULL is returned.
  */
-void* psListGet(
-    psList* restrict list,             ///< list to retrieve element from
-    int which                          ///< index number, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN
-);
+void *psListGet(psList * restrict list, // /< list to retrieve element from
+                int which       // /< index number, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN
+               );
 
 /** Set the iterator of the list to a given position.  If where is invalid the
@@ -116,8 +112,7 @@
  *
  */
-void psListSetIterator(
-    psList* restrict list,             ///< list to retrieve element from
-    int where                           ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL
-);
+void psListSetIterator(psList * restrict list,  // /< list to retrieve element from
+                       int where        // /< index number, PS_LIST_HEAD, or PS_LIST_TAIL
+                      );
 
 /** Get next element relative to the iterator.  This also moves the iterator to
@@ -128,7 +123,6 @@
  *                      parameter was NULL.
  */
-void* psListGetNext(
-    psList* restrict list              ///< list to retrieve element from
-);
+void *psListGetNext(psList * restrict list      // /< list to retrieve element from
+                   );
 
 /** Get current element according to the psList's iterator cursor.  This does
@@ -139,7 +133,6 @@
  *                      iterator is not valid or list parameter was NULL.
  */
-void* psListGetCurrent(
-    psList* restrict list              ///< list to retrieve element from
-);
+void *psListGetCurrent(psList * restrict list   // /< list to retrieve element from
+                      );
 
 /** Get previous element relative to list's iterator. This also moves the
@@ -150,7 +143,6 @@
  *                      parameter was NULL.
  */
-void* psListGetPrevious(
-    psList* restrict list              ///< list to retrieve element from
-);
+void *psListGetPrevious(psList * restrict list  // /< list to retrieve element from
+                       );
 
 /** Convert a linked list to an array
@@ -159,7 +151,6 @@
  *                      or NULL if the given dlist parameter is NULL.
  */
-psArray* psListToArray(
-    psList *dlist                      ///< List to convert
-);
+psArray *psListToArray(psList * dlist   // /< List to convert
+                      );
 
 /** Convert array to a doubly-linked list
@@ -168,12 +159,10 @@
  *                      or NULL is the given arr parameter is NULL.
  */
-psList* psArrayToList(
-    psArray* arr                      ///< vector to convert
-);
+psList *psArrayToList(psArray * arr     // /< vector to convert
+                     );
 
-psList* psListSort(psList* list, psComparePtrFcn compare);
+psList *psListSort(psList * list, psComparePtrFcn compare);
 
 /// @} End of DataGroup Functions
 
 #endif
-
Index: /trunk/psLib/src/types/psMetadata.c
===================================================================
--- /trunk/psLib/src/types/psMetadata.c	(revision 1406)
+++ /trunk/psLib/src/types/psMetadata.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psMetadata.c
 *
@@ -11,6 +12,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-06 22:34:05 $
+*  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -18,5 +19,7 @@
 
 /******************************************************************************/
+
 /*  INCLUDE FILES                                                             */
+
 /******************************************************************************/
 #include<stdio.h>
@@ -34,7 +37,8 @@
 #include "psString.h"
 
-
 /******************************************************************************/
+
 /*  DEFINE STATEMENTS                                                         */
+
 /******************************************************************************/
 
@@ -56,5 +60,7 @@
 
 /******************************************************************************/
+
 /*  TYPE DEFINITIONS                                                          */
+
 /******************************************************************************/
 
@@ -62,5 +68,7 @@
 
 /*****************************************************************************/
+
 /*  GLOBAL VARIABLES                                                         */
+
 /*****************************************************************************/
 
@@ -68,5 +76,7 @@
 
 /*****************************************************************************/
+
 /*  FILE STATIC VARIABLES                                                    */
+
 /*****************************************************************************/
 
@@ -74,7 +84,9 @@
 
 /*****************************************************************************/
+
 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
-/*****************************************************************************/
-static void metadataItemFree( psMetadataItem *metadataItem )
+
+/*****************************************************************************/
+static void metadataItemFree(psMetadataItem * metadataItem)
 {
     psMetadataType type;
@@ -82,36 +94,35 @@
     type = metadataItem->type;
 
-    if(metadataItem == NULL) {
-        return ;
-    }
-
-    psFree( metadataItem->name );
-    psFree( metadataItem->comment );
-    psFree( metadataItem->items );
-
-    if(type == PS_META_STR ||
+    if (metadataItem == NULL) {
+        return;
+    }
+
+    psFree(metadataItem->name);
+    psFree(metadataItem->comment);
+    psFree(metadataItem->items);
+
+    if (type == PS_META_STR ||
             type == PS_META_IMG ||
-            type == PS_META_JPEG ||
-            type == PS_META_PNG ||
-            type == PS_META_ASTROM ||
-            type == PS_META_UNKNOWN) {
-        psFree( metadataItem->data.V );
-    }
-}
-
-static void metadataFree( psMetadata *metadata )
-{
-    if(metadata == NULL) {
-        return ;
-    }
-    psFree( metadata->list );
-    psFree( metadata->table );
-}
-
-/*****************************************************************************/
+            type == PS_META_JPEG || type == PS_META_PNG || type == PS_META_ASTROM || type == PS_META_UNKNOWN) {
+        psFree(metadataItem->data.V);
+    }
+}
+
+static void metadataFree(psMetadata * metadata)
+{
+    if (metadata == NULL) {
+        return;
+    }
+    psFree(metadata->list);
+    psFree(metadata->table);
+}
+
+/*****************************************************************************/
+
 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
-/*****************************************************************************/
-
-psMetadataItem *psMetadataItemAlloc( const char *name, psMetadataType type, const char *comment, ... )
+
+/*****************************************************************************/
+
+psMetadataItem *psMetadataItemAlloc(const char *name, psMetadataType type, const char *comment, ...)
 {
     va_list argPtr;
@@ -119,44 +130,43 @@
 
     // Get the variable list parameters to pass to allocation function
-    va_start( argPtr, comment );
+    va_start(argPtr, comment);
 
     // Call metadata item allocation
-    metadataItem = psMetadataItemAllocV( name, type, comment, argPtr );
+    metadataItem = psMetadataItemAllocV(name, type, comment, argPtr);
 
     // Clean up stack after variable arguement has been used
-    va_end( argPtr );
+    va_end(argPtr);
 
     return metadataItem;
 }
 
-psMetadataItem *psMetadataItemAllocV( const char *name, psMetadataType type, const char *comment, va_list argPtr )
-{
-    psMetadataItem * metadataItem = NULL;
-
-    if(name == NULL) {
-        psError( __func__, "Null value for name not allowed" );
-        return NULL;
-    }
-
+psMetadataItem *psMetadataItemAllocV(const char *name, psMetadataType type, const char *comment,
+                                     va_list argPtr)
+{
+    psMetadataItem *metadataItem = NULL;
+
+    if (name == NULL) {
+        psError(__func__, "Null value for name not allowed");
+        return NULL;
+    }
     // Allocate metadata item
-    metadataItem = ( psMetadataItem * ) psAlloc( sizeof( psMetadataItem ) );
-    if(metadataItem == NULL) {
-        psAbort( __func__, "Failed to allocate memory" );
-    }
-
+    metadataItem = (psMetadataItem *) psAlloc(sizeof(psMetadataItem));
+    if (metadataItem == NULL) {
+        psAbort(__func__, "Failed to allocate memory");
+    }
     // Set deallocator
-    p_psMemSetDeallocator( metadataItem, ( psFreeFcn ) metadataItemFree );
+    p_psMemSetDeallocator(metadataItem, (psFreeFcn) metadataItemFree);
 
     // Allocate and set metadata item comment
-    metadataItem->comment = ( char * ) psAlloc( sizeof( char ) * MAX_STRING_LENGTH );
-    if(comment == NULL) {
+    metadataItem->comment = (char *)psAlloc(sizeof(char) * MAX_STRING_LENGTH);
+    if (comment == NULL) {
         // Per SDRS, null isn't allowed, must use "" instead
-        strncpy( metadataItem->comment, "", MAX_STRING_LENGTH );
+        strncpy(metadataItem->comment, "", MAX_STRING_LENGTH);
     } else {
-        strncpy( metadataItem->comment, comment, MAX_STRING_LENGTH );
+        strncpy(metadataItem->comment, comment, MAX_STRING_LENGTH);
     }
 
     // Set metadata item unique id
-    *( int* ) ( &metadataItem->id ) = ++metadataId;
+    *(int *)(&metadataItem->id) = ++metadataId;
 
     // Set metadata item type
@@ -164,19 +174,21 @@
 
     // Set metadata item value
-    switch(type) {
+    switch (type) {
     case PS_META_BOOL:
-        metadataItem->data.B = ( bool ) va_arg( argPtr, int );
+        metadataItem->data.B = (bool) va_arg(argPtr, int);
+
         break;
     case PS_META_S32:
-        metadataItem->data.S32 = va_arg( argPtr, psS32 );
+        metadataItem->data.S32 = va_arg(argPtr, psS32);
         break;
     case PS_META_F32:
-        metadataItem->data.F32 = ( psF32 ) va_arg( argPtr, psF64 );
+        metadataItem->data.F32 = (psF32) va_arg(argPtr, psF64);
         break;
     case PS_META_F64:
-        metadataItem->data.F64 = va_arg( argPtr, psF64 );
+        metadataItem->data.F64 = va_arg(argPtr, psF64);
         break;
     case PS_META_STR:
-        metadataItem->data.V = psStringNCopy( va_arg( argPtr, char* ), MAX_STRING_LENGTH );
+        metadataItem->data.V = psStringNCopy(va_arg(argPtr, char *), MAX_STRING_LENGTH);
+
         break;
     case PS_META_IMG:
@@ -186,41 +198,40 @@
     case PS_META_UNKNOWN:
     default:
-        psError( __func__, "Invalid psMetadataType: %d", type );
+        psError(__func__, "Invalid psMetadataType: %d", type);
     }
 
     // Allocate and set metadata item name
-    metadataItem->name = ( char * ) psAlloc( sizeof( char ) * MAX_STRING_LENGTH );
-    vsprintf( metadataItem->name, name, argPtr );
+    metadataItem->name = (char *)psAlloc(sizeof(char) * MAX_STRING_LENGTH);
+    vsprintf(metadataItem->name, name, argPtr);
 
     // Allocate metadata items with same name.
-    metadataItem->items = psListAlloc( NULL );
+    metadataItem->items = psListAlloc(NULL);
 
     return metadataItem;
 }
 
-psMetadata *psMetadataAlloc( void )
-{
-    psList * list = NULL;
+psMetadata *psMetadataAlloc(void)
+{
+    psList *list = NULL;
     psHash *table = NULL;
     psMetadata *metadata = NULL;
 
     // Allocate metadata
-    metadata = ( psMetadata * ) psAlloc( sizeof( psMetadata ) );
-    if(metadata == NULL) {
-        psAbort( __func__, "Failed to allocate metadata" );
-    }
-
+    metadata = (psMetadata *) psAlloc(sizeof(psMetadata));
+    if (metadata == NULL) {
+        psAbort(__func__, "Failed to allocate metadata");
+    }
     // Set deallocator
-    p_psMemSetDeallocator( metadata, ( psFreeFcn ) metadataFree );
+    p_psMemSetDeallocator(metadata, (psFreeFcn) metadataFree);
 
     // Allocate metadata's internal containers
-    list = ( psList * ) psListAlloc( NULL );
-    if(list == NULL) {
-        psAbort( __func__, "Failed to allocate list" );
-    }
-
-    table = ( psHash * ) psHashAlloc( 10 );
-    if(table == NULL) {
-        psAbort( __func__, "Failed to allocate table" );
+    list = (psList *) psListAlloc(NULL);
+    if (list == NULL) {
+        psAbort(__func__, "Failed to allocate list");
+    }
+
+    table = (psHash *) psHashAlloc(10);
+    if (table == NULL) {
+        psAbort(__func__, "Failed to allocate table");
     }
 
@@ -231,7 +242,7 @@
 }
 
-bool psMetadataAddItem( psMetadata *restrict md, int where, psMetadataItem *restrict metadataItem )
-{
-    char * key = NULL;
+bool psMetadataAddItem(psMetadata * restrict md, int where, psMetadataItem * restrict metadataItem)
+{
+    char *key = NULL;
     psHash *mdTable = NULL;
     psList *mdList = NULL;
@@ -239,11 +250,11 @@
     psMetadataType type = PS_META_ITEM_SET;
 
-    if(md == NULL) {
-        psError( __func__, "Null metadata collection not allowed" );
-        return false;
-    }
-
-    if(metadataItem == NULL) {
-        psError( __func__, "Null metadata item not allowed" );
+    if (md == NULL) {
+        psError(__func__, "Null metadata collection not allowed");
+        return false;
+    }
+
+    if (metadataItem == NULL) {
+        psError(__func__, "Null metadata item not allowed");
         return false;
     }
@@ -252,54 +263,51 @@
 
     mdTable = md->table;
-    if(mdTable == NULL) {
-        psError( __func__, "Null metadata table not allowed" );
-        return false;
-    }
-
-    mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
+    if (mdTable == NULL) {
+        psError(__func__, "Null metadata table not allowed");
+        return false;
+    }
+
+    mdList = md->list;
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
         return false;
     }
 
     key = metadataItem->name;
-    if(key == NULL) {
-        psError( __func__, "Null key item not allowed" );
-        return false;
-    }
-
+    if (key == NULL) {
+        psError(__func__, "Null key item not allowed");
+        return false;
+    }
     // Check if key is already in table
-    value = ( psMetadataItem* ) psHashLookup( mdTable, key );
-    if(value != NULL && type != PS_META_ITEM_SET) {
+    value = (psMetadataItem *) psHashLookup(mdTable, key);
+    if (value != NULL && type != PS_META_ITEM_SET) {
 
         // The key was found and the new metadata item is a leaf node (its type isn't PS_META_ITEM_SET), so
         // add the new metadata item to hash as a child of the existing metadata item folder node.
-        if(!psListAdd( value->items, metadataItem, where )) {
-            psError( __func__, "Couldn't add metadata item to items list. Name: %s",
-                     metadataItem->name );
+        if (!psListAdd(value->items, metadataItem, where)) {
+            psError(__func__, "Couldn't add metadata item to items list. Name: %s", metadataItem->name);
             return false;
         }
-    } else
-        if(value != NULL) {
-
-            // The key was found and the new metadata item is a folder node. Don't add new metadata item, since
-            // it will wipe out existing node.
-            psError( __func__, "Metadata already exists in metadata collection. Item not added. Name: %s",
-                     metadataItem->name );
+    } else if (value != NULL) {
+
+        // The key was found and the new metadata item is a folder node. Don't add new metadata item, since
+        // it will wipe out existing node.
+        psError(__func__, "Metadata already exists in metadata collection. Item not added. Name: %s",
+                metadataItem->name);
+        return false;
+    } else {
+
+        // Duplicate key not found. Add new metadata item to metadata collection's hash
+        if (!psHashAdd(mdTable, key, metadataItem)) {
+            psError(__func__, "Couldn't add metadata item to metadata collection table. Name: %s",
+                    metadataItem->name);
             return false;
-        } else {
-
-            // Duplicate key not found. Add new metadata item to metadata collection's hash
-            if(!psHashAdd( mdTable, key, metadataItem )) {
-                psError( __func__, "Couldn't add metadata item to metadata collection table. Name: %s",
-                         metadataItem->name );
-                return false;
-            }
-        }
+        }
+    }
 
     // Add all items to metadata collection's list, even if they have the same metadata item names
-    if(!psListAdd( md->list, metadataItem, where )) {
-        psError( __func__, "Couldn't add metadata item to metadata collection list. Name: %s",
-                 metadataItem->name );
+    if (!psListAdd(md->list, metadataItem, where)) {
+        psError(__func__, "Couldn't add metadata item to metadata collection list. Name: %s",
+                metadataItem->name);
         return false;
     }
@@ -308,28 +316,28 @@
 }
 
-bool psMetadataAdd( psMetadata *restrict md, int where, const char *name, psMetadataType type,
-                    const char *comment, ... )
+bool psMetadataAdd(psMetadata * restrict md, int where, const char *name, psMetadataType type,
+                   const char *comment, ...)
 {
     va_list argPtr;
     psMetadataItem *metadataItem = NULL;
 
-    va_start( argPtr, comment );
-    metadataItem = psMetadataItemAllocV( name, type, comment, argPtr );
-    va_end( argPtr );
-
-    if(!psMetadataAddItem( md, where, metadataItem )) {
-        psError( __func__, "Couldn't add metadata item to metadata collection list. Name: %s",
-                 metadataItem->name );
-        psFree( metadataItem );
-        return false;
-    }
-
-    // Decrement reference count, since the metadata item is now in metadata collection and no longer needed here
-    psMemDecrRefCounter( metadataItem );
+    va_start(argPtr, comment);
+    metadataItem = psMetadataItemAllocV(name, type, comment, argPtr);
+    va_end(argPtr);
+
+    if (!psMetadataAddItem(md, where, metadataItem)) {
+        psError(__func__, "Couldn't add metadata item to metadata collection list. Name: %s",
+                metadataItem->name);
+        psFree(metadataItem);
+        return false;
+    }
+    // Decrement reference count, since the metadata item is now in metadata collection and no longer needed
+    // here
+    psMemDecrRefCounter(metadataItem);
 
     return true;
 }
 
-bool psMetadataRemove( psMetadata *restrict md, int where, const char *restrict key )
+bool psMetadataRemove(psMetadata * restrict md, int where, const char *restrict key)
 {
     int numChildren = 0;
@@ -340,49 +348,46 @@
 
     mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
         return false;
     }
 
     mdTable = md->table;
-    if(mdTable == NULL) {
-        psError( __func__, "Null metadata table not allowed" );
-        return false;
-    }
-
+    if (mdTable == NULL) {
+        psError(__func__, "Null metadata table not allowed");
+        return false;
+    }
     // Select removal by key or index
-    if(key != NULL) {
+    if (key != NULL) {
 
         // Remove by key name
-        entry = ( psMetadataItem* ) psHashLookup( mdTable, key );
-        if(entry == NULL) {
-            psError( __func__, "Couldn't find metadata item remove. Name: %s", key );
+        entry = (psMetadataItem *) psHashLookup(mdTable, key);
+        if (entry == NULL) {
+            psError(__func__, "Couldn't find metadata item remove. Name: %s", key);
             return false;
         }
 
         numChildren = entry->items->size;
-        if(entry->type == PS_META_ITEM_SET && numChildren > 0) {
+        if (entry->type == PS_META_ITEM_SET && numChildren > 0) {
 
             // Table entry has children. Entry and children must be removed from metadata collection's list
-            psListSetIterator( mdList, PS_LIST_HEAD );
-            entryChild = psListGetCurrent( mdList );
-            while(entryChild != NULL) {
-                if(!psListRemove( entry->items, entryChild, PS_LIST_UNKNOWN )) {
-                    psError( __func__, "Couldn't remove metadata item from list. Name: %s", key );
+            psListSetIterator(mdList, PS_LIST_HEAD);
+            entryChild = psListGetCurrent(mdList);
+            while (entryChild != NULL) {
+                if (!psListRemove(entry->items, entryChild, PS_LIST_UNKNOWN)) {
+                    psError(__func__, "Couldn't remove metadata item from list. Name: %s", key);
                     return false;
                 }
-                entryChild = psListGetNext( entry->items );
+                entryChild = psListGetNext(entry->items);
             }
         }
-
         // Remove entry from metadata collection's list
-        if(!psListRemove( mdList, entry, PS_LIST_UNKNOWN )) {
-            psError( __func__, "Couldn't remove metadata item from list. Name: %s", key );
+        if (!psListRemove(mdList, entry, PS_LIST_UNKNOWN)) {
+            psError(__func__, "Couldn't remove metadata item from list. Name: %s", key);
             return false;
         }
-
         // Remove entry from metadata collection's table
-        if(!psHashRemove( mdTable, key )) {
-            psError( __func__, "Couldn't remove metadata item from table. Name: %s", key );
+        if (!psHashRemove(mdTable, key)) {
+            psError(__func__, "Couldn't remove metadata item from table. Name: %s", key);
             return false;
         }
@@ -390,18 +395,17 @@
 
         // Remove by index
-        entry = psListGet( mdList, where );
-        if(entry == NULL) {
-            psError( __func__, "Couldn't find metadata item from list. Index: %d", where );
+        entry = psListGet(mdList, where);
+        if (entry == NULL) {
+            psError(__func__, "Couldn't find metadata item from list. Index: %d", where);
             return false;
         }
 
         key = entry->name;
-        if(key == NULL) {
-            psError( __func__, "Null key name not allowed. Index: %d", where );
+        if (key == NULL) {
+            psError(__func__, "Null key name not allowed. Index: %d", where);
             return false;
         }
-
         // Use recursive remove, now that key is known
-        psMetadataRemove( md, PS_LIST_UNKNOWN, key );
+        psMetadataRemove(md, PS_LIST_UNKNOWN, key);
     }
 
@@ -409,23 +413,23 @@
 }
 
-psMetadataItem *psMetadataLookup( psMetadata *restrict md, const char *restrict key )
-{
-    psHash * mdTable = NULL;
+psMetadataItem *psMetadataLookup(psMetadata * restrict md, const char *restrict key)
+{
+    psHash *mdTable = NULL;
     psMetadataItem *entry = NULL;
 
     mdTable = md->table;
-    if(mdTable == NULL) {
-        psError( __func__, "Null metadata table not allowed" );
-        return NULL;
-    }
-
-    if(key == NULL) {
-        psError( __func__, "Null key name not allowed" );
-        return NULL;
-    }
-
-    entry = ( psMetadataItem* ) psHashLookup( mdTable, key );
-    if(entry == NULL) {
-        psError( __func__, "Could not find metadata item with given key. Key: %s", key );
+    if (mdTable == NULL) {
+        psError(__func__, "Null metadata table not allowed");
+        return NULL;
+    }
+
+    if (key == NULL) {
+        psError(__func__, "Null key name not allowed");
+        return NULL;
+    }
+
+    entry = (psMetadataItem *) psHashLookup(mdTable, key);
+    if (entry == NULL) {
+        psError(__func__, "Could not find metadata item with given key. Key: %s", key);
         return NULL;
     }
@@ -434,18 +438,18 @@
 }
 
-psMetadataItem *psMetadataGet( psMetadata *restrict md, int where )
-{
-    psList * mdList = NULL;
+psMetadataItem *psMetadataGet(psMetadata * restrict md, int where)
+{
+    psList *mdList = NULL;
     psMetadataItem *entry = NULL;
 
     mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
-        return NULL;
-    }
-
-    entry = ( psMetadataItem* ) psListGet( mdList, where );
-    if(entry == NULL) {
-        psError( __func__, "Couldn't find metadata item with given index. Index: %d", where );
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
+        return NULL;
+    }
+
+    entry = (psMetadataItem *) psListGet(mdList, where);
+    if (entry == NULL) {
+        psError(__func__, "Couldn't find metadata item with given index. Index: %d", where);
         return NULL;
     }
@@ -454,50 +458,50 @@
 }
 
-bool psMetadataSetIterator( psMetadata *restrict md, int where )
-{
-    psList * mdList = NULL;
-
-    mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
-        return false;
-    }
-
-    psListSetIterator( mdList, where );
+bool psMetadataSetIterator(psMetadata * restrict md, int where)
+{
+    psList *mdList = NULL;
+
+    mdList = md->list;
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
+        return false;
+    }
+
+    psListSetIterator(mdList, where);
 
     return true;
 }
 
-psMetadataItem *psMetadataGetNext( psMetadata *restrict md, const char *restrict match, int which )
-{
-    psList * mdList = NULL;
+psMetadataItem *psMetadataGetNext(psMetadata * restrict md, const char *restrict match, int which)
+{
+    psList *mdList = NULL;
     psMetadataItem *entry = NULL;
 
     mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
-        return NULL;
-    }
-
-    mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
-        return NULL;
-    }
-
-    psListSetIterator( mdList, which );
-    entry = psListGetCurrent( mdList );
-    while(entry != NULL) {
-        if(!strncmp( match, entry->name, strlen( match ) )) {
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
+        return NULL;
+    }
+
+    mdList = md->list;
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
+        return NULL;
+    }
+
+    psListSetIterator(mdList, which);
+    entry = psListGetCurrent(mdList);
+    while (entry != NULL) {
+        if (!strncmp(match, entry->name, strlen(match))) {
 
             // Match found
             return entry;
         }
-        entry = psListGetNext( mdList );
+        entry = psListGetNext(mdList);
     }
 
     // Match not found
-    if(entry == NULL) {
-        psError( __func__, "Couldn't find metadata item with given match. Match: %s", match );
+    if (entry == NULL) {
+        psError(__func__, "Couldn't find metadata item with given match. Match: %s", match);
     }
 
@@ -505,35 +509,35 @@
 }
 
-psMetadataItem *psMetadataGetPrevious( psMetadata *restrict md, const char *restrict match, int which )
-{
-    psList * mdList = NULL;
+psMetadataItem *psMetadataGetPrevious(psMetadata * restrict md, const char *restrict match, int which)
+{
+    psList *mdList = NULL;
     psMetadataItem *entry = NULL;
 
     mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
-        return NULL;
-    }
-
-    mdList = md->list;
-    if(mdList == NULL) {
-        psError( __func__, "Null metadata list not allowed" );
-        return NULL;
-    }
-
-    psListSetIterator( mdList, which );
-    entry = psListGetCurrent( mdList );
-    while(entry != NULL) {
-        if(!strncmp( match, entry->name, strlen( match ) )) {
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
+        return NULL;
+    }
+
+    mdList = md->list;
+    if (mdList == NULL) {
+        psError(__func__, "Null metadata list not allowed");
+        return NULL;
+    }
+
+    psListSetIterator(mdList, which);
+    entry = psListGetCurrent(mdList);
+    while (entry != NULL) {
+        if (!strncmp(match, entry->name, strlen(match))) {
 
             // Match found
             return entry;
         }
-        entry = psListGetPrevious( mdList );
+        entry = psListGetPrevious(mdList);
     }
 
     // Match not found
-    if(entry == NULL) {
-        psError( __func__, "Couldn't find metadata item with given match. Match: %s", match );
+    if (entry == NULL) {
+        psError(__func__, "Couldn't find metadata item with given match. Match: %s", match);
     }
 
@@ -541,40 +545,40 @@
 }
 
-void psMetadataItemPrint( FILE *fd, const char *format, const psMetadataItem *restrict metadataItem )
+void psMetadataItemPrint(FILE * fd, const char *format, const psMetadataItem * restrict metadataItem)
 {
     psMetadataType type;
 
-    if(fd == NULL) {
-        psError( __func__, "Null file descriptor not allowed" );
-        return ;
-    }
-
-    if(format == NULL) {
-        psError( __func__, "Null format not allowed" );
-        return ;
-    }
-
-    if(metadataItem == NULL) {
-        psError( __func__, "Null metadata not allowed" );
-        return ;
+    if (fd == NULL) {
+        psError(__func__, "Null file descriptor not allowed");
+        return;
+    }
+
+    if (format == NULL) {
+        psError(__func__, "Null format not allowed");
+        return;
+    }
+
+    if (metadataItem == NULL) {
+        psError(__func__, "Null metadata not allowed");
+        return;
     }
 
     type = metadataItem->type;
 
-    switch(type) {
+    switch (type) {
     case PS_META_BOOL:
-        fprintf( fd, format, metadataItem->data.B );
+        fprintf(fd, format, metadataItem->data.B);
         break;
     case PS_META_S32:
-        fprintf( fd, format, metadataItem->data.S32 );
+        fprintf(fd, format, metadataItem->data.S32);
         break;
     case PS_META_F32:
-        fprintf( fd, format, metadataItem->data.F32 );
+        fprintf(fd, format, metadataItem->data.F32);
         break;
     case PS_META_F64:
-        fprintf( fd, format, metadataItem->data.F64 );
+        fprintf(fd, format, metadataItem->data.F64);
         break;
     case PS_META_STR:
-        fprintf( fd, format, metadataItem->data.V );
+        fprintf(fd, format, metadataItem->data.V);
         break;
     case PS_META_ITEM_SET:
@@ -585,17 +589,17 @@
     case PS_META_UNKNOWN:
     default:
-        psError( __func__, " Invalid psMetadataType to print: %d", type );
-    }
-}
-
-psMetadata *psMetadataFReadHeader( psMetadata *output, char *extName, int extNum, fitsfile *fd )
+        psError(__func__, " Invalid psMetadataType to print: %d", type);
+    }
+}
+
+psMetadata *psMetadataFReadHeader(psMetadata * output, char *extName, int extNum, fitsfile * fd)
 {
     bool tempBool;
     bool success;
     char keyType;
-    char keyName[ FITS_LINE_SIZE ];
-    char keyValue[ FITS_LINE_SIZE ];
-    char keyComment[ FITS_LINE_SIZE ];
-    char fitsErr[ MAX_STRING_LENGTH ];
+    char keyName[FITS_LINE_SIZE];
+    char keyValue[FITS_LINE_SIZE];
+    char keyComment[FITS_LINE_SIZE];
+    char fitsErr[MAX_STRING_LENGTH];
     int i;
     int hduType = 0;
@@ -605,30 +609,27 @@
     psMetadataType metadataItemType;
 
-    if(fd == NULL) {
-        psError( __func__, "Null FITS file descriptor not allowed" );
-        return NULL;
-    }
-
-    if(extName == NULL && extNum == 0) {
-        psError( __func__, "Null extName and extNum = 0 not allowed" );
-        return NULL;
-    } else
-        if(extName && extNum) {
-            psError( __func__, "Both extName and extNum arguments should not have non zero values." );
-            return NULL;
-        }
-
+    if (fd == NULL) {
+        psError(__func__, "Null FITS file descriptor not allowed");
+        return NULL;
+    }
+
+    if (extName == NULL && extNum == 0) {
+        psError(__func__, "Null extName and extNum = 0 not allowed");
+        return NULL;
+    } else if (extName && extNum) {
+        psError(__func__, "Both extName and extNum arguments should not have non zero values.");
+        return NULL;
+    }
     // Allocate metadata if user didn't
-    if(output == NULL) {
+    if (output == NULL) {
         output = psMetadataAlloc();
     }
-
     // Move to user designated HDU number or HDU name in FITS file. HDU numbers starts at one.
-    if(extName != NULL) {
-        if(fits_movnam_hdu( fd, ANY_HDU, extName, 0, &status ) != 0) {
+    if (extName != NULL) {
+        if (fits_movnam_hdu(fd, ANY_HDU, extName, 0, &status) != 0) {
             FITS_ERROR("FITS error while locating header %s: %s", extName);
         }
     } else {
-        if(fits_movabs_hdu( fd, extNum, &hduType, &status ) != 0) {
+        if (fits_movabs_hdu(fd, extNum, &hduType, &status) != 0) {
             FITS_ERROR("FITS error while locating header %d: %s", extNum);
         }
@@ -636,19 +637,19 @@
 
     // Get number of key names
-    if(fits_get_hdrpos( fd, &numKeys, &keyNum, &status ) != 0) {
+    if (fits_get_hdrpos(fd, &numKeys, &keyNum, &status) != 0) {
         FITS_ERROR("FITS error while reading key %d: %s", keyNum);
     }
-
     // Get each key name. Keywords start at one.
-    for(i = 1; i <= numKeys; i++) {
-        if(fits_read_keyn( fd, i, keyName, keyValue, keyComment, &status ) != 0) {
+    for (i = 1; i <= numKeys; i++) {
+        if (fits_read_keyn(fd, i, keyName, keyValue, keyComment, &status) != 0) {
             FITS_ERROR("FITS error while reading key %d: %s", keyNum);
         }
-        if(fits_get_keytype( keyValue, &keyType, &status ) != 0) {
-            fits_get_errstatus( status, fitsErr );
-            if(status != VALUE_UNDEFINED) {
+        if (fits_get_keytype(keyValue, &keyType, &status) != 0) {
+            fits_get_errstatus(status, fitsErr);
+            if (status != VALUE_UNDEFINED) {
                 FITS_ERROR("FITS error while determining key %d type: %s", keyNum);
             } else {
-                // Some keywords are still valid even though they don't have a type, like COMMENTS and HISTORY
+                // Some keywords are still valid even though they don't have a type, like COMMENTS and
+                // HISTORY
                 keyType = 'C';
                 status = 0;
@@ -656,31 +657,37 @@
         }
 
-        switch(keyType) {
+        switch (keyType) {
         case 'I':
             metadataItemType = PS_META_S32;
-            success = psMetadataAdd( output, PS_LIST_TAIL, keyName, metadataItemType, keyComment, atoi( keyValue ) );
+            success =
+                psMetadataAdd(output, PS_LIST_TAIL, keyName, metadataItemType, keyComment,
+                              atoi(keyValue));
             break;
         case 'F':
             metadataItemType = PS_META_F64;
-            success = psMetadataAdd( output, PS_LIST_TAIL, keyName, metadataItemType, keyComment, atof( keyValue ) );
+            success =
+                psMetadataAdd(output, PS_LIST_TAIL, keyName, metadataItemType, keyComment,
+                              atof(keyValue));
             break;
         case 'C':
             metadataItemType = PS_META_STR;
-            success = psMetadataAdd( output, PS_LIST_TAIL, keyName, metadataItemType, keyComment, keyValue );
+            success =
+                psMetadataAdd(output, PS_LIST_TAIL, keyName, metadataItemType, keyComment, keyValue);
             break;
         case 'L':
             metadataItemType = PS_META_BOOL;
-            tempBool = ( keyValue[ 0 ] == 'T' ) ? 1 : 0;
-            success = psMetadataAdd( output, PS_LIST_TAIL, keyName, metadataItemType, keyComment, tempBool );
+            tempBool = (keyValue[0] == 'T') ? 1 : 0;
+            success =
+                psMetadataAdd(output, PS_LIST_TAIL, keyName, metadataItemType, keyComment, tempBool);
             break;
         case 'U':
         case 'X':
         default:
-            psError( __func__, "Invalid psMetadataType: %c", keyType );
+            psError(__func__, "Invalid psMetadataType: %c", keyType);
             return output;
         }
 
-        if(!success) {
-            psError( __func__, "Failed to add metadata item. Name: %s", keyName );
+        if (!success) {
+            psError(__func__, "Failed to add metadata item. Name: %s", keyName);
             return output;
         }
Index: /trunk/psLib/src/types/psMetadata.h
===================================================================
--- /trunk/psLib/src/types/psMetadata.h	(revision 1406)
+++ /trunk/psLib/src/types/psMetadata.h	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file  psMetadata.h
 *
@@ -10,18 +11,18 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-05 20:55:22 $
+*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-08-07 00:06:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
 */
 #ifndef PS_METADATA_H
-#define PS_METADATA_H
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <fitsio.h>
-
-#include "psHash.h"
-#include "psList.h"
+#    define PS_METADATA_H
+
+#    include <stdarg.h>
+#    include <stdio.h>
+#    include <fitsio.h>
+
+#    include "psHash.h"
+#    include "psList.h"
 
 /// @addtogroup Metadata
@@ -33,16 +34,16 @@
  */
 typedef enum {
-    PS_META_ITEM_SET = 0,                   ///< Null. Metadata is in psMetadataItem.items
-    PS_META_BOOL,                           ///< Boolean data.
-    PS_META_S32,                            ///< Signed 32-bit integer data.
-    PS_META_F32,                            ///< Single-precision float data.
-    PS_META_F64,                            ///< Double-precision float data.
-    PS_META_STR,                            ///< String data (Stored in as void *).
-    PS_META_IMG,                            ///< Image data (Stored in as void *).
-    PS_META_JPEG,                           ///< JPEG data (Stored in as void .
-    PS_META_PNG,                            ///< PNG data (Stored in as void *).
-    PS_META_ASTROM,                         ///< Astrometric coefficients (Stored in as void *).
-    PS_META_UNKNOWN,                        ///< Other data (Stored in as void *).
-    PS_META_NTYPE                         ///< Number of types. Must be last.
+    PS_META_ITEM_SET = 0,       // /< Null. Metadata is in psMetadataItem.items
+    PS_META_BOOL,                          // /< Boolean data.
+    PS_META_S32,                           // /< Signed 32-bit integer data.
+    PS_META_F32,                           // /< Single-precision float data.
+    PS_META_F64,                           // /< Double-precision float data.
+    PS_META_STR,                           // /< String data (Stored in as void *).
+    PS_META_IMG,                           // /< Image data (Stored in as void *).
+    PS_META_JPEG,                          // /< JPEG data (Stored in as void .
+    PS_META_PNG,                           // /< PNG data (Stored in as void *).
+    PS_META_ASTROM,                        // /< Astrometric coefficients (Stored in as void *).
+    PS_META_UNKNOWN,                       // /< Other data (Stored in as void *).
+    PS_META_NTYPE                          // /< Number of types. Must be last.
 } psMetadataType;
 
@@ -54,17 +55,16 @@
 typedef struct psMetadataItem
 {
-    const int id;                       ///< Unique ID for metadata item.
-    char *restrict name;                ///< Name of metadata item.
-    psMetadataType type;                ///< Type of metadata item.
-    union
-    {
+    const int id;               // /< Unique ID for metadata item.
+    char *restrict name;        // /< Name of metadata item.
+    psMetadataType type;        // /< Type of metadata item.
+    union {
         bool B;
-        psS32 S32;                  ///< Signed 32-bit integer data.
-        psF32 F32;                  ///< Single-precision float data.
-        psF64 F64;                  ///< Double-precision float data.
-        psPTR V;                    ///< Pointer to other type of data.
-    }data;                          ///< Union for data types.
-    char *comment;                      ///< Optional comment ("", not NULL).
-    psList *restrict items;             ///< List of psMetadataItems with same name.
+        psS32 S32;              // /< Signed 32-bit integer data.
+        psF32 F32;              // /< Single-precision float data.
+        psF64 F64;              // /< Double-precision float data.
+        psPTR V;                // /< Pointer to other type of data.
+    } data;                     // /< Union for data types.
+    char *comment;              // /< Optional comment ("", not NULL).
+    psList *restrict items;     // /< List of psMetadataItems with same name.
 }
 psMetadataItem;
@@ -78,12 +78,13 @@
 typedef struct psMetadata
 {
-    psList* restrict list;
-    psHash* restrict table;
+    psList *restrict list;
+    psHash *restrict table;
 }
 psMetadata;
 
-
 /*****************************************************************************/
+
 /* FUNCTION PROTOTYPES                                                       */
+
 /*****************************************************************************/
 
@@ -101,10 +102,9 @@
  * @return psMetadataItem*: Pointer metadata item.
  */
-psMetadataItem *psMetadataItemAlloc(
-    const char *name,                       ///< Name of metadata item.
-    psMetadataType type,                    ///< Type of metadata item.
-    const char *comment,                    ///< Comment for metadata item.
-    ...                                 ///< Arguments for name formatting and metadata item data.
-);
+psMetadataItem *psMetadataItemAlloc(const char *name,   // /< Name of metadata item.
+                                    psMetadataType type,        // /< Type of metadata item.
+                                    const char *comment,        // /< Comment for metadata item.
+                                    ... // /< Arguments for name formatting and metadata item data.
+                                   );
 
 /** Create a metadata item with va_list.
@@ -121,10 +121,10 @@
  * @return psMetadataItem*: Pointer metadata item.
  */
-psMetadataItem *psMetadataItemAllocV(
-    const char *name,                       ///< Name of metadata item.
-    psMetadataType type,                    ///< Type of metadata item.
-    const char *comment,                    ///< Comment for metadata item.
-    va_list list                        ///< Arguments for name formatting and metadata item data.
-);
+psMetadataItem *psMetadataItemAllocV(const char *name,  // /< Name of metadata item.
+                                     psMetadataType type,       // /< Type of metadata item.
+                                     const char *comment,       // /< Comment for metadata item.
+                                     va_list list       // /< Arguments for name formatting and metadata item
+                                     // data.
+                                    );
 
 /** Create a metadata collection.
@@ -134,7 +134,6 @@
  * @return psMetadata*: Pointer metadata.
  */
-psMetadata *psMetadataAlloc(
-    void                                ///< Void.
-);
+psMetadata *psMetadataAlloc(void        // /< Void.
+                           );
 
 /** Add existing metadata item to metadata collection.
@@ -144,9 +143,8 @@
  * @return bool: True for success, false for failure.
  */
-bool psMetadataAddItem(
-    psMetadata *restrict md,                ///< Metadata collection to insert metadat item.
-    int where,                              ///< Location to be added.
-    psMetadataItem *restrict item       ///< Metadata item to be added.
-);
+bool psMetadataAddItem(psMetadata * restrict md,        // /< Metadata collection to insert metadat item.
+                       int where,       // /< Location to be added.
+                       psMetadataItem * restrict item   // /< Metadata item to be added.
+                      );
 
 /** Create and add a metadata item to metadata collection.
@@ -156,12 +154,11 @@
  * @return bool: True for success, false for failure.
  */
-bool psMetadataAdd(
-    psMetadata *restrict md,                ///< Metadata collection to insert metadat item.
-    int where,                              ///< Location to be added.
-    const char *name,                       ///< Name of metadata item.
-    psMetadataType type,                    ///< Type of metadata item.
-    const char *comment,                    ///< Comment for metadata item.
-    ...                                 ///< Arguments for name formatting and metadata item data.
-);
+bool psMetadataAdd(psMetadata * restrict md,    // /< Metadata collection to insert metadat item.
+                   int where,   // /< Location to be added.
+                   const char *name,    // /< Name of metadata item.
+                   psMetadataType type, // /< Type of metadata item.
+                   const char *comment, // /< Comment for metadata item.
+                   ...          // /< Arguments for name formatting and metadata item data.
+                  );
 
 /** Remove an item from metadata collection.
@@ -174,9 +171,8 @@
  * @return bool: True for success, false for failure.
  */
-bool psMetadataRemove(
-    psMetadata *restrict md,                ///< Metadata collection to insert metadat item.
-    int where,                              ///< Location to be removed.
-    const char *restrict key            ///< Name of metadata key.
-);
+bool psMetadataRemove(psMetadata * restrict md, // /< Metadata collection to insert metadat item.
+                      int where,        // /< Location to be removed.
+                      const char *restrict key  // /< Name of metadata key.
+                     );
 
 /** Find an item in the metadata collection based on key name.
@@ -187,8 +183,8 @@
  * @return psMetadataItem*: Pointer metadata item.
  */
-psMetadataItem *psMetadataLookup(
-    psMetadata *restrict md,                ///< Metadata collection to insert metadat item.
-    const char *restrict key            ///< Name of metadata key.
-);
+psMetadataItem *psMetadataLookup(psMetadata * restrict md,      // /< Metadata collection to insert metadat
+                                 // item.
+                                 const char *restrict key       // /< Name of metadata key.
+                                );
 
 /** Find an item in the metadata collection based on list index.
@@ -198,8 +194,7 @@
  * @return psMetadataItem*: Pointer metadata item.
  */
-psMetadataItem *psMetadataGet(
-    psMetadata *restrict md,                ///< Metadata collection to insert metadat item.
-    int where                           ///< Location to be retrieved.
-);
+psMetadataItem *psMetadataGet(psMetadata * restrict md, // /< Metadata collection to insert metadat item.
+                              int where // /< Location to be retrieved.
+                             );
 
 /** Set or reset metadata iterator.
@@ -209,8 +204,7 @@
  * @return void: void.
  */
-bool psMetadataSetIterator(
-    psMetadata *restrict md,                ///< Metadata collection to iterate.
-    int where                           ///< Location of iterator.
-);
+bool psMetadataSetIterator(psMetadata * restrict md,    // /< Metadata collection to iterate.
+                           int where    // /< Location of iterator.
+                          );
 
 /** Get next metadata item.
@@ -220,9 +214,8 @@
  * @return psMetadataItem*: Pointer metadata item.
  */
-psMetadataItem *psMetadataGetNext(
-    psMetadata *restrict md,                ///< Metadata collection to iterate.
-    const char *restrict match,             ///< Beginning of key name.
-    int which                           ///< Iterator to be used.
-);
+psMetadataItem *psMetadataGetNext(psMetadata * restrict md,     // /< Metadata collection to iterate.
+                                  const char *restrict match,   // /< Beginning of key name.
+                                  int which     // /< Iterator to be used.
+                                 );
 
 /** Get previous metadata item.
@@ -232,9 +225,8 @@
  * @return psMetadataItem*: Pointer metadata item.
  */
-psMetadataItem *psMetadataGetPrevious(
-    psMetadata *restrict md,                ///< Metadata collection to iterate.
-    const char *restrict match,             ///< Beginning of key name.
-    int which                           ///< Iterator to be used.
-);
+psMetadataItem *psMetadataGetPrevious(psMetadata * restrict md, // /< Metadata collection to iterate.
+                                      const char *restrict match,       // /< Beginning of key name.
+                                      int which // /< Iterator to be used.
+                                     );
 
 /** Print metadata item to file.
@@ -248,9 +240,8 @@
  * @return psMetadataItem*: Pointer metadata item.
  */
-void psMetadataItemPrint(
-    FILE *fd,                                       ///< Pointer to file to write metadata item.
-    const char *format,                             ///< Format to print metadata item.
-    const psMetadataItem *restrict metadataItem     ///< Metadata item to print.
-);
+void psMetadataItemPrint(FILE * fd,     // /< Pointer to file to write metadata item.
+                         const char *format,    // /< Format to print metadata item.
+                         const psMetadataItem * restrict metadataItem   // /< Metadata item to print.
+                        );
 
 /** Read metadata header.
@@ -261,10 +252,9 @@
  * @return psMetadata*: Pointer metadata.
  */
-psMetadata *psMetadataReadHeader(
-    psMetadata *output,                     ///< Resulting metadata from read.
-    char *extname,                          ///< File name extension string.
-    int extnum,                             ///< File name extension number. Starts at 1.
-    char *filename                          ///< Name of file to read.
-);
+psMetadata *psMetadataReadHeader(psMetadata * output,   // /< Resulting metadata from read.
+                                 char *extname, // /< File name extension string.
+                                 int extnum,    // /< File name extension number. Starts at 1.
+                                 char *filename // /< Name of file to read.
+                                );
 
 /** Read metadata header.
@@ -274,10 +264,10 @@
  * @return psMetadata*: Pointer metadata.
  */
-psMetadata *psMetadataFReadHeader(
-    psMetadata *output,                     ///< Resulting metadata from read.
-    char *extName,                          ///< File name extension string.
-    int extNum,                             ///< File name extension number.
-    fitsfile *fd                            ///< Pointer to file to read.
-);
+psMetadata *psMetadataFReadHeader(psMetadata * output,  // /< Resulting metadata from read.
+                                  char *extName,        // /< File name extension string.
+                                  int extNum,   // /< File name extension number.
+                                  fitsfile * fd // /< Pointer to file to read.
+                                 );
+
 /// @}
 
