Index: /trunk/psLib/src/imageops/psImagePixelExtract.c
===================================================================
--- /trunk/psLib/src/imageops/psImagePixelExtract.c	(revision 5529)
+++ /trunk/psLib/src/imageops/psImagePixelExtract.c	(revision 5530)
@@ -8,6 +8,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-11-14 22:18:33 $
+ *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-11-16 23:06:14 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -22,5 +22,4 @@
 
 #include "psErrorText.h"
-
 
 #define FUNC_MACRO_VECTOR_STORE_ROW(TYPE) \
@@ -407,9 +406,12 @@
         imgVec = psAlloc(sizeof(psVector));
         imgVec->type = input->type;
-        imgVec->n = *(int*)&imgVec->nalloc = numCols;
+
+        P_PSVECTOR_SET_NALLOC(imgVec,numCols);
+        imgVec->n = numCols;
         if (mask != NULL) {
             maskVec = psAlloc(sizeof(psVector));
             maskVec->type = mask->type;
-            maskVec->n = *(int*)&maskVec->nalloc = numCols;
+            P_PSVECTOR_SET_NALLOC(maskVec,numCols);
+            maskVec->n = numCols;
         }
         // recycle output to make a proper sized/type output structure
Index: /trunk/psLib/src/imageops/psImageStats.c
===================================================================
--- /trunk/psLib/src/imageops/psImageStats.c	(revision 5529)
+++ /trunk/psLib/src/imageops/psImageStats.c	(revision 5530)
@@ -9,6 +9,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.83 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-10-12 21:02:20 $
+ *  @version $Revision: 1.84 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-11-16 23:06:14 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -64,5 +64,5 @@
         junkData = (psVector *) psAlloc(sizeof(psVector));
         junkData->type = in->type;
-        *(int*)&junkData->nalloc = in->numRows * in->numCols;
+        P_PSVECTOR_SET_NALLOC(junkData,in->numRows * in->numCols);
         junkData->n = junkData->nalloc;
         junkData->data.U8 = in->data.V[0];      // since psImage data is contiguous...
@@ -88,5 +88,5 @@
             junkMask = psAlloc(sizeof(psVector));
             junkMask->type = mask->type;
-            *(int*)&junkMask->nalloc = mask->numRows * mask->numCols;
+            P_PSVECTOR_SET_NALLOC(junkMask,mask->numRows * mask->numCols);
             junkMask->n = junkMask->nalloc;
             junkMask->data.U8 = mask->data.V[0];
@@ -137,5 +137,5 @@
         junkData = (psVector *) psAlloc(sizeof(psVector));
         junkData->type = in->type;
-        *(int*)&junkData->nalloc = in->numRows * in->numCols;
+        P_PSVECTOR_SET_NALLOC(junkData,in->numRows * in->numCols);
         junkData->n = junkData->nalloc;
         junkData->data.U8 = in->data.V[0];      // since psImage data is contiguous...
@@ -161,5 +161,5 @@
             junkMask = psAlloc(sizeof(psVector));
             junkMask->type = mask->type;
-            *(int*)&junkMask->nalloc = mask->numRows * mask->numCols;
+            P_PSVECTOR_SET_NALLOC(junkMask,mask->numRows * mask->numCols);
             junkMask->n = junkMask->nalloc;
             junkMask->data.U8 = mask->data.V[0];
Index: /trunk/psLib/src/math/psMinimize.c
===================================================================
--- /trunk/psLib/src/math/psMinimize.c	(revision 5529)
+++ /trunk/psLib/src/math/psMinimize.c	(revision 5530)
@@ -10,6 +10,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.144 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-10-28 19:15:04 $
+ *  @version $Revision: 1.145 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-11-16 23:06:19 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -17,5 +17,5 @@
  *  XXX: must follow coding name standards on local functions.
  *  XXX: put local functions in front.
- * 
+ *
  */
 /*****************************************************************************/
@@ -596,6 +596,6 @@
     psMinimization *min = psAlloc(sizeof(psMinimization));
     psMemSetDeallocator(min, (psFreeFunc)minimizationFree);
-    *(int*)&min->maxIter = maxIter;
-    *(float*)&min->tol = tol;
+    P_PSMINIMIZATION_SET_MAXITER(min,maxIter);
+    P_PSMINIMIZATION_SET_TOL(min,tol);
     min->value = 0.0;
     min->iter = 0;
@@ -1164,5 +1164,5 @@
         for (i=0;i<numDims;i++) {
             if (myParamMask->data.U8[i] == 0) {
-                *(int*)&dummyMin.maxIter = PS_MINIMIZE_POWELL_LINEMIN_MAX_ITERATIONS;
+                P_PSMINIMIZATION_SET_MAXITER((&dummyMin),PS_MINIMIZE_POWELL_LINEMIN_MAX_ITERATIONS);
                 *(float*)&dummyMin.tol = PS_MINIMIZE_POWELL_LINEMIN_ERROR_TOLERANCE;
                 mul = p_psLineMin(&dummyMin,
Index: /trunk/psLib/src/math/psMinimize.h
===================================================================
--- /trunk/psLib/src/math/psMinimize.h	(revision 5529)
+++ /trunk/psLib/src/math/psMinimize.h	(revision 5530)
@@ -8,6 +8,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.59 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-29 02:16:19 $
+ *  @version $Revision: 1.60 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-11-16 23:06:19 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -52,12 +52,16 @@
 psMinimization;
 
-/** Allocates a psMinimization structure.
- *
- *  @return psMinimization* :   a new psMinimization struct
-*/
-psMinimization *psMinimizationAlloc(
-    int maxIter,                       ///< Number of minimization iterations to perform.
-    float tol                          ///< Requested error tolerance
-);
+#define P_PSMINIMIZATION_SET_MAXITER(m,val) *(int*)&m->maxIter = val
+        #define P_PSMINIMIZATION_SET_TOL(m,val) *(float*)&m->tol = val
+
+
+                /** Allocates a psMinimization structure.
+                 *
+                 *  @return psMinimization* :   a new psMinimization struct
+                */
+                psMinimization *psMinimizationAlloc(
+                    int maxIter,                       ///< Number of minimization iterations to perform.
+                    float tol                          ///< Requested error tolerance
+                );
 
 /** Checks the type of a particular pointer.
Index: /trunk/psLib/src/math/psStats.c
===================================================================
--- /trunk/psLib/src/math/psStats.c	(revision 5529)
+++ /trunk/psLib/src/math/psStats.c	(revision 5530)
@@ -17,6 +17,6 @@
 *
 *
-*  @version $Revision: 1.150 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-11-15 20:10:32 $
+*  @version $Revision: 1.151 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-11-16 23:06:19 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -2334,6 +2334,7 @@
     newHist = (psHistogram* ) psAlloc(sizeof(psHistogram));
     psMemSetDeallocator(newHist, (psFreeFunc) histogramFree);
-    newHist->bounds = psVectorAlloc(n + 1, PS_TYPE_F32);
-    *(int *)&newHist->bounds->n = newHist->bounds->nalloc;
+    psVector* newBounds = psVectorAlloc(n + 1, PS_TYPE_F32);
+    newHist->bounds = newBounds;
+    newBounds->n = newHist->bounds->nalloc;
 
     // Calculate the bounds for each bin.
@@ -2343,5 +2344,5 @@
     binSize += FLT_EPSILON;
     for (i = 0; i < n + 1; i++) {
-        newHist->bounds->data.F32[i] = lower + (binSize * (psF32)i);
+        newBounds->data.F32[i] = lower + (binSize * (psF32)i);
     }
 
@@ -2383,8 +2384,9 @@
     newHist = (psHistogram* ) psAlloc(sizeof(psHistogram));
     psMemSetDeallocator(newHist, (psFreeFunc) histogramFree);
-    newHist->bounds = psVectorAlloc(bounds->n, PS_TYPE_F32);
-    *(int *)&newHist->bounds->n = newHist->bounds->nalloc;
+    psVector* newBounds = psVectorAlloc(bounds->n, PS_TYPE_F32);
+    newHist->bounds = newBounds;
+    newBounds->n = newHist->bounds->nalloc;
     for (i = 0; i < bounds->n; i++) {
-        newHist->bounds->data.F32[i] = bounds->data.F32[i];
+        newBounds->data.F32[i] = bounds->data.F32[i];
     }
 
Index: /trunk/psLib/src/mathtypes/psImage.h
===================================================================
--- /trunk/psLib/src/mathtypes/psImage.h	(revision 5529)
+++ /trunk/psLib/src/mathtypes/psImage.h	(revision 5530)
@@ -11,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.72 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-26 22:35:53 $
+ *  @version $Revision: 1.73 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-11-16 23:06:21 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -80,17 +80,21 @@
 psImage;
 
-/** Basic image region structure.
- *
- * Struct for specifying a rectangular area in an image.
- *
- */
-typedef struct
-{
-    float x0;                         ///< the first column of the region.
-    float x1;                         ///< the last column of the region.
-    float y0;                         ///< the first row of the region.
-    float y1;                         ///< the last row of the region.
-}
-psRegion;
+#define P_PSIMAGE_SET_NUMCOLS(img,nc) *(int*)&img->numCols = nc
+        #define P_PSIMAGE_SET_NUMROWS(img,nr) *(int*)&img->numCols = nr
+                #define P_PSIMAGE_SET_TYPE(img,t) *(psMathType*)&img->type = t
+
+                        /** Basic image region structure.
+                         *
+                         * Struct for specifying a rectangular area in an image.
+                         *
+                         */
+                        typedef struct
+                        {
+                            float x0;                         ///< the first column of the region.
+                            float x1;                         ///< the last column of the region.
+                            float y0;                         ///< the first row of the region.
+                            float y1;                         ///< the last row of the region.
+                        }
+                        psRegion;
 
 /** Create an image of the specified size and type.
Index: /trunk/psLib/src/mathtypes/psVector.c
===================================================================
--- /trunk/psLib/src/mathtypes/psVector.c	(revision 5529)
+++ /trunk/psLib/src/mathtypes/psVector.c	(revision 5530)
@@ -9,6 +9,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.60 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-10-04 01:31:40 $
+*  @version $Revision: 1.61 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-11-16 23:06:21 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -87,5 +87,5 @@
     psVec->type.dimen = PS_DIMEN_VECTOR;
     psVec->type.type = type;
-    *(long*)&psVec->nalloc = nalloc;
+    P_PSVECTOR_SET_NALLOC(psVec,nalloc);
     psVec->n = nalloc;
 
@@ -114,5 +114,5 @@
         // Realloc after decrementation to avoid accessing freed array elements
         vector->data.U8 = psRealloc(vector->data.U8, nalloc * elementSize);
-        *(long*)&vector->nalloc = nalloc;
+        P_PSVECTOR_SET_NALLOC(vector,nalloc);
     }
 
@@ -143,5 +143,5 @@
     if (byteSize > vector->nalloc*PSELEMTYPE_SIZEOF(vector->type.type)) {
         vector->data.U8 = psRealloc(vector->data.U8, byteSize);
-        *(long*)&vector->nalloc = nalloc;
+        P_PSVECTOR_SET_NALLOC(vector,nalloc);
     }
 
Index: /trunk/psLib/src/mathtypes/psVector.h
===================================================================
--- /trunk/psLib/src/mathtypes/psVector.h	(revision 5529)
+++ /trunk/psLib/src/mathtypes/psVector.h	(revision 5530)
@@ -11,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-26 22:35:53 $
+ *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-11-16 23:06:21 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -55,20 +55,22 @@
 psVector;
 
-/*****************************************************************************/
-
-/* FUNCTION PROTOTYPES                                                       */
-
-/*****************************************************************************/
-
-/** Checks the type of a particular pointer.
- *
- *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
- *
- *  @return bool:       True if the pointer matches a psVector structure, false otherwise.
- */
-bool psMemCheckVector(
-    psPtr ptr                          ///< the pointer whose type to check
-)
-;
+#define P_PSVECTOR_SET_NALLOC(vec,n) *(long*)&(vec->nalloc) = n
+
+        /*****************************************************************************/
+
+        /* FUNCTION PROTOTYPES                                                       */
+
+        /*****************************************************************************/
+
+        /** Checks the type of a particular pointer.
+         *
+         *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
+         *
+         *  @return bool:       True if the pointer matches a psVector structure, false otherwise.
+         */
+        bool psMemCheckVector(
+            psPtr ptr                          ///< the pointer whose type to check
+        )
+        ;
 
 /** Allocate a vector.
Index: /trunk/psLib/src/types/psArray.c
===================================================================
--- /trunk/psLib/src/types/psArray.c	(revision 5529)
+++ /trunk/psLib/src/types/psArray.c	(revision 5530)
@@ -9,6 +9,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-10-01 02:22:15 $
+ *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-11-16 23:06:35 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -63,5 +63,5 @@
     psMemSetDeallocator(psArr, (psFreeFunc) arrayFree);
 
-    *(long*)&psArr->nalloc = nalloc;
+    P_PSARRAY_SET_NALLOC(psArr,nalloc);
     psArr->n = nalloc;
 
@@ -87,5 +87,5 @@
         // Realloc after decrementation to avoid accessing freed array elements
         in->data = psRealloc(in->data, nalloc * sizeof(psPtr));
-        *(long*)&in->nalloc = nalloc;
+        P_PSARRAY_SET_NALLOC(in,nalloc);
     }
 
Index: /trunk/psLib/src/types/psArray.h
===================================================================
--- /trunk/psLib/src/types/psArray.h	(revision 5529)
+++ /trunk/psLib/src/types/psArray.h	(revision 5530)
@@ -11,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-10-29 00:05:53 $
+ *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-11-16 23:06:35 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -40,20 +40,22 @@
 psArray;
 
-/*****************************************************************************/
+#define P_PSARRAY_SET_NALLOC(vec,n) *(long*)&vec->nalloc = n
 
-/* FUNCTION PROTOTYPES                                                       */
+        /*****************************************************************************/
 
-/*****************************************************************************/
+        /* FUNCTION PROTOTYPES                                                       */
 
-/** Checks the type of a particular pointer.
- *
- *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
- *
- *  @return bool:       True if the pointer matches a psArray structure, false otherwise.
- */
-bool psMemCheckArray(
-    psPtr ptr                          ///< the pointer whose type to check
-)
-;
+        /*****************************************************************************/
+
+        /** Checks the type of a particular pointer.
+         *
+         *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
+         *
+         *  @return bool:       True if the pointer matches a psArray structure, false otherwise.
+         */
+        bool psMemCheckArray(
+            psPtr ptr                          ///< the pointer whose type to check
+        )
+        ;
 
 
Index: /trunk/psLib/src/types/psPixels.c
===================================================================
--- /trunk/psLib/src/types/psPixels.c	(revision 5529)
+++ /trunk/psLib/src/types/psPixels.c	(revision 5530)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-10-01 00:14:17 $
+ *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-11-16 23:06:35 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -66,5 +66,5 @@
     }
     out->n = nalloc;
-    *(long*)&out->nalloc = nalloc;
+    P_PSPIXELS_SET_NALLOC(out,nalloc);
 
     psMemSetDeallocator(out, (psFreeFunc)pixelsFree);
@@ -94,5 +94,5 @@
     }
 
-    *(long*)&pixels->nalloc = nalloc;
+    P_PSPIXELS_SET_NALLOC(pixels,nalloc);
 
     if (pixels->n > pixels->nalloc) {
Index: /trunk/psLib/src/types/psPixels.h
===================================================================
--- /trunk/psLib/src/types/psPixels.h	(revision 5529)
+++ /trunk/psLib/src/types/psPixels.h	(revision 5530)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-10-01 00:14:17 $
+ *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-11-16 23:06:35 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -48,13 +48,14 @@
 psPixels;
 
+#define P_PSPIXELS_SET_NALLOC(pix,n) *(long*)&pix->nalloc = n
 
-/** Allocates a new psPixels structure
- *
- *  @return psPixels*   new psPixels
- */
-psPixels* psPixelsAlloc(
-    long nalloc                       ///< the size of the coordinate vectors
-)
-;
+        /** Allocates a new psPixels structure
+         *
+         *  @return psPixels*   new psPixels
+         */
+        psPixels* psPixelsAlloc(
+            long nalloc                       ///< the size of the coordinate vectors
+        )
+        ;
 
 /** Checks the type of a particular pointer.
Index: /trunk/psLib/test/types/tst_psMetadata_04.c
===================================================================
--- /trunk/psLib/test/types/tst_psMetadata_04.c	(revision 5529)
+++ /trunk/psLib/test/types/tst_psMetadata_04.c	(revision 5530)
@@ -1,34 +1,33 @@
-
 /** @file  tst_psMetadata_04.c
-*
-*  @brief Test driver for psMetadata functions
-*
-*  This test driver contains the following tests for psMetadata:
-*     Test A - Allocate metadata and items
-*     Test B - Lookup metadata item by name
-*     Test C - Attempt to use null metadata
-*     Test D - Attempt to use null key
-*     Test E - Attempt to lookup non-existant metadata item
-*     Test F - Lookup metadata item by index
-*     Test G - Lookup metadata item and return psS32 value
-*     Test H - Lookup metadata item and return psF64 value
-*     Test I - Lookup metadata item and return psVector pointer
-*     Test J - Lookup metadata item and return psMetadata pointer
-*     Test K - Lookup metadata item and return psString value
-*     Test L - Attempt to use null metadata
-*     Test M - Attempt to get non-existant metadata item
-*     Test N - Attempt to look up with an invalid metadata object
-*     Test O - Attempt get item  with an invalid metadata object
-*     Test P - Attempt get value of non-existant metadata item
-*     Test Q - Free psMetadata
-*
-*  @author  Ross Harman, MHPCC
-*
-*  @version $Revision: 1.9 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2005-11-16 02:40:13 $
-*
-*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
-*
-*/
+ *
+ *  @brief Test driver for psMetadata functions
+ *
+ *  This test driver contains the following tests for psMetadata:
+ *     Test A - Allocate metadata and items
+ *     Test B - Lookup metadata item by name
+ *     Test C - Attempt to use null metadata
+ *     Test D - Attempt to use null key
+ *     Test E - Attempt to lookup non-existant metadata item
+ *     Test F - Lookup metadata item by index
+ *     Test G - Lookup metadata item and return psS32 value
+ *     Test H - Lookup metadata item and return psF64 value
+ *     Test I - Lookup metadata item and return psVector pointer
+ *     Test J - Lookup metadata item and return psMetadata pointer
+ *     Test K - Lookup metadata item and return psString value
+ *     Test L - Attempt to use null metadata
+ *     Test M - Attempt to get non-existant metadata item
+ *     Test N - Attempt to look up with an invalid metadata object
+ *     Test O - Attempt get item  with an invalid metadata object
+ *     Test P - Attempt get value of non-existant metadata item
+ *     Test Q - Free psMetadata
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.10 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2005-11-16 23:07:10 $
+ *
+ *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
 
 #include <string.h>
