Index: /trunk/psLib/src/db/psDB.c
===================================================================
--- /trunk/psLib/src/db/psDB.c	(revision 4555)
+++ /trunk/psLib/src/db/psDB.c	(revision 4556)
@@ -12,6 +12,6 @@
  *  @author Joshua Hoblitt
  *
- *  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-07-12 19:12:00 $
+ *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-07-15 02:33:52 $
  *
  *  Copyright 2005 Joshua Hoblitt, University of Hawaii
@@ -1409,5 +1409,5 @@
         // invert the PSToSQL table
         psToSQLTable = psDBGetPTypeToSQLTable();
-        lookupTable = psHashAlloc(psToSQLTable->nbucket);
+        lookupTable = psHashAlloc(psToSQLTable->n);
 
         list = psHashKeyList(psToSQLTable);
Index: /trunk/psLib/src/fits/psFits.c
===================================================================
--- /trunk/psLib/src/fits/psFits.c	(revision 4555)
+++ /trunk/psLib/src/fits/psFits.c	(revision 4556)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-07-12 19:12:01 $
+ *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-07-15 02:33:54 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -1474,5 +1474,5 @@
 
     // find all the columns needed
-    psArray* columns = psArrayAlloc(((psMetadata*)table->data[0])->list->size);
+    psArray* columns = psArrayAlloc(((psMetadata*)table->data[0])->list->n);
     columns->n=0;
 
Index: /trunk/psLib/src/sys/psError.c
===================================================================
--- /trunk/psLib/src/sys/psError.c	(revision 4555)
+++ /trunk/psLib/src/sys/psError.c	(revision 4556)
@@ -10,6 +10,6 @@
  *  @author Eric Van Alst, MHPCC
  *
- *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-25 02:02:05 $
+ *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-07-15 02:33:54 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -152,5 +152,5 @@
 }
 
-psS32 psErrorGetStackSize()
+unsigned int psErrorGetStackSize()
 {
     return errorStackSize;
Index: /trunk/psLib/src/sys/psError.h
===================================================================
--- /trunk/psLib/src/sys/psError.h	(revision 4555)
+++ /trunk/psLib/src/sys/psError.h	(revision 4556)
@@ -12,6 +12,6 @@
  *  @author Eric Van Alst, MHPCC
  *
- *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-22 02:05:41 $
+ *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-07-15 02:33:54 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -74,5 +74,5 @@
  *  @return psS32   The number of items on the error stack
  */
-psS32 psErrorGetStackSize();
+unsigned int psErrorGetStackSize();
 
 /** Prints error stack to specified open file descriptor
@@ -138,9 +138,9 @@
 
 /** Reports an error message to the logging facility
- *  
+ *
  *  This function will invoke the psLogMsg function with a level of
  *  PS_LOG_ERROR and pass the parameters name and fmt to generate a proper
  *  log message.  This function is used to check a specific code location.
- *  
+ *
  *  This function modifies the error stack.
  *
@@ -158,9 +158,9 @@
 
 /** Logs a warning message.
- *  
+ *
  *  This procedure logs a message to the destination set by a prior call to
- *  psLogSetDestination().  This is equivalent to calling psLogMsg with a level of 
+ *  psLogSetDestination().  This is equivalent to calling psLogMsg with a level of
  *  PS_LOG_WARN.  This function is used to check a specific code location.
- *  
+ *
 */
 void p_psWarning(
Index: /trunk/psLib/src/sys/psErrorCodes.c
===================================================================
--- /trunk/psLib/src/sys/psErrorCodes.c	(revision 4555)
+++ /trunk/psLib/src/sys/psErrorCodes.c	(revision 4556)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-07-13 10:49:30 $
+ *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-07-15 02:33:54 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/sys/psLogMsg.h
===================================================================
--- /trunk/psLib/src/sys/psLogMsg.h	(revision 4555)
+++ /trunk/psLib/src/sys/psLogMsg.h	(revision 4556)
@@ -11,6 +11,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-23 03:50:29 $
+ *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-07-15 02:33:54 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -67,6 +67,6 @@
 void psLogMsg(
     const char *name,                  ///< name of the log source
-    int level,                       ///< severity level of this log message
-    const char *format,                   ///< printf-style format command
+    int level,                         ///< severity level of this log message
+    const char *format,                ///< printf-style format command
     ...
 );
Index: /trunk/psLib/src/sys/psMemory.c
===================================================================
--- /trunk/psLib/src/sys/psMemory.c	(revision 4555)
+++ /trunk/psLib/src/sys/psMemory.c	(revision 4556)
@@ -8,6 +8,6 @@
 *  @author Robert Lupton, Princeton University
 *
-*  @version $Revision: 1.58 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-07-12 19:12:01 $
+*  @version $Revision: 1.59 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-07-15 02:33:54 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -84,11 +84,11 @@
 /*
  * Default callback for both allocate and free. Note that the
- * value of p_psMemAllocateID/p_psMemFreeID is incremented
+ * value of p_psMemAllocID/p_psMemFreeID is incremented
  * by the return value (so returning 0 means that the callback
  * isn't resignalled)
  */
-static psMemId memAllocateCallbackDefault(const psMemBlock* ptr)
-{
-    static psMemId incr = 0; // "p_psMemAllocateID += incr"
+static psMemId memAllocCallbackDefault(const psMemBlock* ptr)
+{
+    static psMemId incr = 0; // "p_psMemAllocID += incr"
 
     return incr;
@@ -102,5 +102,5 @@
 }
 
-static void memProblemCallbackDefault(const psMemBlock* ptr, const char *file, psS32 lineno)
+static void memProblemCallbackDefault( psMemBlock* ptr, const char *file, unsigned int lineno)
 {
     if (ptr->refCounter < 1) {
@@ -158,5 +158,5 @@
  * The default callbacks
  */
-static psMemAllocateCallback memAllocateCallback = memAllocateCallbackDefault;
+static psMemAllocCallback memAllocCallback = memAllocCallbackDefault;
 static psMemFreeCallback memFreeCallback = memFreeCallbackDefault;
 static psMemProblemCallback memProblemCallback = memProblemCallbackDefault;
@@ -194,12 +194,12 @@
  * Call the callbacks when these IDs are allocated/freed
  */
-psMemId p_psMemAllocateID = 0;       // notify user this block is allocated
+psMemId p_psMemAllocID = 0;       // notify user this block is allocated
 psMemId p_psMemFreeID = 0;   // notify user this block is freed
 
-psMemId psMemAllocateCallbackSetID(psMemId id)
-{
-    psMemId old = p_psMemAllocateID;
-
-    p_psMemAllocateID = id;
+psMemId psMemAllocCallbackSetID(psMemId id)
+{
+    psMemId old = p_psMemAllocID;
+
+    p_psMemAllocID = id;
 
     return old;
@@ -215,12 +215,12 @@
 }
 
-psMemAllocateCallback psMemAllocateCallbackSet(psMemAllocateCallback func)
-{
-    psMemFreeCallback old = memAllocateCallback;
+psMemAllocCallback psMemAllocCallbackSet(psMemAllocCallback func)
+{
+    psMemFreeCallback old = memAllocCallback;
 
     if (func != NULL) {
-        memAllocateCallback = func;
+        memAllocCallback = func;
     } else {
-        memAllocateCallback = memAllocateCallbackDefault;
+        memAllocCallback = memAllocCallbackDefault;
     }
 
@@ -286,5 +286,5 @@
 }
 
-psPtr p_psAlloc(size_t size, const char *file, psS32 lineno)
+psPtr p_psAlloc(size_t size, const char *file, unsigned int lineno)
 {
 
@@ -363,6 +363,6 @@
 
     // Did the user ask to be informed about this allocation?
-    if (ptr->id == p_psMemAllocateID) {
-        p_psMemAllocateID += memAllocateCallback(ptr);
+    if (ptr->id == p_psMemAllocID) {
+        p_psMemAllocID += memAllocCallback(ptr);
     }
     // And return the user the memory that they allocated
@@ -370,5 +370,5 @@
 }
 
-psPtr p_psRealloc(psPtr vptr, size_t size, const char *file, psS32 lineno)
+psPtr p_psRealloc(psPtr vptr, size_t size, const char *file, unsigned int lineno)
 {
     size = (size < recycleBinSize[0]) ? recycleBinSize[0] : size; // set the minimum size to allocate
@@ -416,6 +416,6 @@
 
         // Did the user ask to be informed about this allocation?
-        if (ptr->id == p_psMemAllocateID) {
-            p_psMemAllocateID += memAllocateCallback(ptr);
+        if (ptr->id == p_psMemAllocID) {
+            p_psMemAllocID += memAllocCallback(ptr);
         }
 
@@ -424,5 +424,5 @@
 }
 
-void p_psFree(psPtr vptr, const char *file, psS32 lineno)
+void p_psFree(psPtr vptr, const char *file, unsigned int lineno)
 {
     if (vptr == NULL) {
Index: /trunk/psLib/src/sys/psMemory.h
===================================================================
--- /trunk/psLib/src/sys/psMemory.h	(revision 4555)
+++ /trunk/psLib/src/sys/psMemory.h	(revision 4556)
@@ -12,6 +12,6 @@
  *  @ingroup MemoryManagement
  *
- *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-27 20:38:12 $
+ *  @version $Revision: 1.45 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-07-15 02:33:54 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -49,11 +49,11 @@
 
 /// typedef for memory identification numbers.  Guaranteed to be some variety of integer.
-typedef psU64 psMemId;
+typedef unsigned long psMemId;
 
 /// typedef for a memory block's reference count. Guaranteed to be some variety of integer.
-typedef psU64 psReferenceCount;
+typedef unsigned long psReferenceCount;
 
 /// typedef for deallocator.
-typedef void (*psFreeFunc) (psPtr ptr);
+typedef void (*psFreeFunc) (void* ptr);
 
 /** Book-keeping data for storage allocator.
@@ -64,5 +64,5 @@
 typedef struct psMemBlock
 {
-    const psPtr startblock;            ///< 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
@@ -71,9 +71,9 @@
     const psMemId id;                  ///< a unique ID for this allocation
     const char *file;                  ///< set from __FILE__ in e.g. p_psAlloc
-    const psS32 lineno;                ///< set from __LINE__ in e.g. p_psAlloc
+    const unsigned 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
-    psBool persistent;                 ///< marks if this non-user persistent data like error stack, etc.
-    const psPtr endblock;              ///< initialised to p_psMEMMAGIC
+    bool persistent;                   ///< marks if this non-user persistent data like error stack, etc.
+    const void* endblock;              ///< initialised to p_psMEMMAGIC
 }
 psMemBlock;
@@ -81,8 +81,8 @@
 /** prototype of a basic callback used by memory functions
  *
- *  @see psMemAllocateCallbackSet
- *  @ingroup memCallback
- */
-typedef psMemId(*psMemAllocateCallback) (
+ *  @see psMemAllocCallbackSet
+ *  @ingroup memCallback
+ */
+typedef psMemId(*psMemAllocCallback) (
     const psMemBlock* ptr              ///< the psMemBlock just allocated
 );
@@ -105,7 +105,7 @@
  */
 typedef void (*psMemProblemCallback) (
-    const psMemBlock* ptr,             ///< the pointer to the problematic memory block.
-    const char *file,                  ///< the file in which the problem originated
-    psS32 lineno                         ///< the line number in which the problem originated
+    psMemBlock* ptr,                   ///< the pointer to the problematic memory block.
+    const char *filename,                    ///< the file in which the problem originated
+    unsigned int lineno                ///< the line number in which the problem originated
 );
 
@@ -118,5 +118,5 @@
  *  @ingroup memCallback
  */
-typedef psPtr (*psMemExhaustedCallback) (
+typedef void* (*psMemExhaustedCallback) (
     size_t size                        ///< the size of buffer required
 );
@@ -128,11 +128,15 @@
  */
 #ifdef DOXYGEN
-psPtr psAlloc(size_t size       ///< Size required
-             );
+
+psPtr psAlloc(
+    size_t size                        ///< Size required
+);
+
 #else // #ifdef DOXYGEN
-psPtr p_psAlloc(size_t size,    ///< Size required
-                const char *file,       ///< File of call
-                psS32 lineno      ///< Line number of call
-               );
+psPtr p_psAlloc(
+    size_t size,                       ///< Size required
+    const char *filename,              ///< File of call
+    unsigned int lineno                ///< Line number of call
+);
 
 /// Memory allocation. psAlloc sends file and line number to p_psAlloc.
@@ -203,14 +207,16 @@
  */
 #ifdef DOXYGEN
+
 psPtr psRealloc(
-    psPtr ptr,                          ///< Pointer to re-allocate
-    size_t size                         ///< Size required
+    psPtr ptr,                         ///< Pointer to re-allocate
+    size_t size                        ///< Size required
 );
 #else // #ifdef DOXYGEN
+
 psPtr p_psRealloc(
     psPtr ptr,                         ///< Pointer to re-allocate
     size_t size,                       ///< Size required
-    const char *file,                  ///< File of call
-    psS32 lineno                       ///< Line number of call
+    const char *filename,              ///< File of call
+    unsigned int lineno                ///< Line number of call
 );
 
@@ -234,5 +240,5 @@
     psPtr ptr,                         ///< Pointer to free
     const char *file,                  ///< File of call
-    psS32 lineno                       ///< Line number of call
+    unsigned int lineno                ///< Line number of call
 );
 
@@ -259,5 +265,5 @@
  */
 psS32 psMemCheckLeaks(
-    psMemId id0,                    ///< don't list blocks with id < id0
+    psMemId 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)
@@ -288,5 +294,5 @@
 #ifdef DOXYGEN
 psPtr psMemIncrRefCounter(
-    const psPtr ptr                         ///< Pointer to increment refCounter, and return
+    const psPtr ptr                    ///< Pointer to increment refCounter, and return
 );
 #else
@@ -294,5 +300,5 @@
     psPtr vptr,                        ///< Pointer to increment refCounter, and return
     const char *file,                  ///< File of call
-    psS32 lineno                         ///< Line number of call
+    psS32 lineno                       ///< Line number of call
 );
 
@@ -318,5 +324,5 @@
     psPtr vptr,                        ///< Pointer to decrement refCounter, and return
     const char *file,                  ///< File of call
-    psS32 lineno                         ///< Line number of call
+    psS32 lineno                       ///< Line number of call
 );
 
@@ -362,15 +368,15 @@
 /** Set call back for when a particular memory block is allocated
  *
- *  A private variable, p_psMemAllocateID, can be used to trace the allocation
- *  and freeing of specific memory blocks. If p_psMemAllocateID is set and a
- *  memory block with that ID is allocated, psMemAllocateCallback is called
+ *  A private variable, p_psMemAllocID, can be used to trace the allocation
+ *  and freeing of specific memory blocks. If p_psMemAllocID is set and a
+ *  memory block with that ID is allocated, psMemAllocCallback is called
  *  just before memory is returned to the calling function.
  *
  *  @ingroup memCallback
  *
- *  @return psMemAllocateCallback      old psMemAllocateCallback function
- */
-psMemAllocateCallback psMemAllocateCallbackSet(
-    psMemAllocateCallback func       ///< Function to run at memory allocation of specific mem block
+ *  @return psMemAllocCallback      old psMemAllocCallback function
+ */
+psMemAllocCallback psMemAllocCallbackSet(
+    psMemAllocCallback func            ///< Function to run at memory allocation of specific mem block
 );
 
@@ -398,9 +404,9 @@
 psMemId psMemGetId(void);
 
-/** set p_psMemAllocateID to specific id
- *
- *  A private variable, p_psMemAllocateID, can be used to trace the allocation
- *  and freeing of specific memory blocks. If p_psMemAllocateID is set and a
- *  memory block with that ID is allocated, psMemAllocateCallback is called
+/** set p_psMemAllocID to specific id
+ *
+ *  A private variable, p_psMemAllocID, can be used to trace the allocation
+ *  and freeing of specific memory blocks. If p_psMemAllocID is set and a
+ *  memory block with that ID is allocated, psMemAllocCallback is called
  *  just before memory is returned to the calling function.
  *
@@ -409,8 +415,8 @@
  *  @return psMemId
  *
- *  @see psMemAllocateCallbackSet
- */
-psMemId psMemAllocateCallbackSetID(
-    psMemId id                      ///< ID to set
+ *  @see psMemAllocCallbackSet
+ */
+psMemId psMemAllocCallbackSetID(
+    psMemId id                         ///< ID to set
 );
 
@@ -429,5 +435,5 @@
  */
 psMemId psMemFreeCallbackSetID(
-    psMemId id                      ///< ID to set
+    psMemId id                         ///< ID to set
 );
 
Index: /trunk/psLib/src/types/psArray.c
===================================================================
--- /trunk/psLib/src/types/psArray.c	(revision 4555)
+++ /trunk/psLib/src/types/psArray.c	(revision 4556)
@@ -9,6 +9,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-07-12 19:12:01 $
+ *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-07-15 02:33:54 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -49,5 +49,5 @@
   FUNCTION IMPLEMENTATION - PUBLIC
  *****************************************************************************/
-psArray* psArrayAlloc(unsigned long nalloc)
+psArray* psArrayAlloc(long nalloc)
 {
     psArray* psArr = NULL;
@@ -66,5 +66,5 @@
 }
 
-psArray* psArrayRealloc(psArray* in, unsigned long nalloc)
+psArray* psArrayRealloc(psArray* in, long nalloc)
 {
     if (in == NULL) {
@@ -160,5 +160,5 @@
 /// Set an element in the array.
 bool psArraySet(psArray* array,                      ///< input array to set element in
-                unsigned long position,            ///< the element position to set
+                long position,                      ///< the element position to set
                 psPtr data)                        ///< the value to set it to
 {
@@ -185,5 +185,5 @@
 
 /// Get an element in the array.
-psPtr psArrayGet(const psArray* array, unsigned long position )
+psPtr psArrayGet(const psArray* array,  long position )
 {
     if (array == NULL) {
Index: /trunk/psLib/src/types/psArray.h
===================================================================
--- /trunk/psLib/src/types/psArray.h	(revision 4555)
+++ /trunk/psLib/src/types/psArray.h	(revision 4556)
@@ -12,6 +12,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-23 03:50:29 $
+ *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-07-15 02:33:54 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -34,7 +34,8 @@
 typedef struct
 {
-    psU32 nalloc;                      ///< Total number of elements available.
-    psU32 n;                           ///< Number of elements in use.
+    long nalloc;                       ///< Total number of elements available.
+    long n;                            ///< Number of elements in use.
     psPtr* data;                       ///< An Array of pointer elements
+    void *lock;                        ///< Optional lock for thread safety
 }
 psArray;
@@ -55,6 +56,7 @@
  */
 psArray* psArrayAlloc(
-    unsigned long nalloc               ///< Total number of elements to make available.
-);
+    long nalloc                        ///< Total number of elements to make available.
+)
+;
 
 /** Reallocate an array.
@@ -68,5 +70,5 @@
 psArray* psArrayRealloc(
     psArray* array,                    ///< array to reallocate.
-    unsigned long nalloc               ///< Total number of elements to make available.
+    long nalloc                        ///< Total number of elements to make available.
 );
 
@@ -133,5 +135,5 @@
 bool psArraySet(
     psArray* array,                    ///< input array to set element in
-    unsigned long position,            ///< the element position to set
+    long position,                     ///< the element position to set
     psPtr data                         ///< the value to set it to
 );
@@ -143,5 +145,5 @@
 psPtr psArrayGet(
     const psArray* array,              ///< input array to get element from
-    unsigned long position             ///< the element position to get
+    long position                      ///< the element position to get
 );
 
Index: /trunk/psLib/src/types/psBitSet.c
===================================================================
--- /trunk/psLib/src/types/psBitSet.c	(revision 4555)
+++ /trunk/psLib/src/types/psBitSet.c	(revision 4556)
@@ -11,6 +11,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-07-12 19:12:01 $
+ *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-07-15 02:33:54 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/types/psBitSet.h
===================================================================
--- /trunk/psLib/src/types/psBitSet.h	(revision 4555)
+++ /trunk/psLib/src/types/psBitSet.h	(revision 4556)
@@ -12,6 +12,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-22 02:05:41 $
+ *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-07-15 02:33:54 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -37,6 +37,7 @@
 typedef struct
 {
-    psS32 n;                             ///< Number of bytes in the array
-    char *bits;                        ///< Aray of bytes holding bits
+    long n;                            ///< Number of bytes in the array
+    psU8 *bits;                        ///< Aray of bytes holding bits
+    void *lock;                        ///< Optional lock for thread safety
 }
 psBitSet;
@@ -57,5 +58,6 @@
 psBitSet* psBitSetAlloc(
     long nalloc                            ///< Number of bits in psBitSet array
-);
+)
+;
 
 /** Set a bit.
@@ -70,5 +72,5 @@
     /* @returned@ */
     psBitSet* bitSet,                  ///< Pointer to psBitSet to be set.
-    long bit                          ///< Bit to be set.
+    long bit                           ///< Bit to be set.
 );
 
Index: /trunk/psLib/src/types/psHash.c
===================================================================
--- /trunk/psLib/src/types/psHash.c	(revision 4555)
+++ /trunk/psLib/src/types/psHash.c	(revision 4556)
@@ -12,6 +12,6 @@
 *  @author GLG, MHPCC
 *
-*  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-07-12 19:12:01 $
+*  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-07-15 02:33:54 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -57,5 +57,5 @@
     // 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 < hash->nbucket; i++) {
+    for (i = 0; i < hash->n; i++) {
         if (hash->buckets[i] != NULL) {
             // Since a bucket contains a linked list of keys/data, we must
@@ -128,8 +128,8 @@
 
 /******************************************************************************
-psHashAlloc(nbucket): this procedure creates a new hash table with the
+psHashAlloc(n): this procedure creates a new hash table with the
 specified number of buckets.
 Inputs:
-    nbucket: initial number of buckets
+    n: initial number of buckets
 Return:
     The new hash table.
@@ -146,5 +146,5 @@
     // Allocate memory for the buckets.
     table->buckets = psAlloc(nalloc * sizeof(psHashBucket* ));
-    table->nbucket = nalloc;
+    table->n = nalloc;
 
     psTrace("utils.hash", 1, "Creating %d-element hash table\n", nalloc);
@@ -179,5 +179,5 @@
     // 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->n; i++) {
 
         // A bucket is composed of a linked list of buckets.
@@ -238,5 +238,5 @@
     // hash = (hash << 1) ^ key[i];
     // }
-    // hash &= (table->nbucket - 1);
+    // hash &= (table->n - 1);
 
     // This hash algorithm is from Sedgewick.  NOTE: must reread to ensure that
@@ -244,10 +244,10 @@
     tmpchar = (char *)key;
     for (hash = 0; *tmpchar != '\0'; tmpchar++) {
-        hash = (64 * hash + *tmpchar) % (table->nbucket);
+        hash = (64 * hash + *tmpchar) % (table->n);
     }
 
     // NOTE: This should not be necessary, but for now, I'm checking bounds
     // anyway.
-    if ((hash < 0) || (hash >= table->nbucket)) {
+    if ((hash < 0) || (hash >= table->n)) {
         psError(PS_ERR_UNKNOWN, true,
                 "Internal hash function out of range (%d)", hash);
@@ -409,5 +409,5 @@
     // psArray we need to allocate.
     int nElements = 0;
-    int nbucket = hash->nbucket;
+    int nbucket = hash->n;
     for (int i = 0; i < nbucket; i++) {
         psHashBucket* tmpBucket = hash->buckets[i];
Index: /trunk/psLib/src/types/psHash.h
===================================================================
--- /trunk/psLib/src/types/psHash.h	(revision 4555)
+++ /trunk/psLib/src/types/psHash.h	(revision 4556)
@@ -11,6 +11,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-22 23:48:39 $
+ *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-07-15 02:33:54 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -40,6 +40,7 @@
 typedef struct psHash
 {
-    psS32 nbucket;                     ///< Number of buckets in hash table.
+    long n;                            ///< Number of buckets in hash table.
     psHashBucket* *buckets;            ///< The bucket data.
+    void *lock;                        ///< Optional lock for thread safety.
 }
 psHash;
@@ -48,5 +49,6 @@
 psHash* psHashAlloc(
     long nalloc                        ///< The number of buckets to allocate.
-);
+)
+;
 
 /// Insert entry into table.
Index: /trunk/psLib/src/types/psList.c
===================================================================
--- /trunk/psLib/src/types/psList.c	(revision 4555)
+++ /trunk/psLib/src/types/psList.c	(revision 4556)
@@ -6,6 +6,6 @@
  *  @author Robert Daniel DeSonia, MHPCC
  *
- *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-07-12 19:12:01 $
+ *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-07-15 02:33:54 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -113,5 +113,5 @@
     }
 
-    list->size--;
+    list->n--;
 
     pthread_mutex_unlock(&list->lock)
@@ -131,5 +131,5 @@
     psMemSetDeallocator(list, (psFreeFunc) listFree);
 
-    list->size = 0;
+    list->n = 0;
     list->head = list->tail = NULL;
     list->iterators = psArrayAlloc(16);
@@ -182,5 +182,5 @@
 
 bool psListIteratorSet(psListIterator* iterator,
-                       int location)
+                       long location)
 {
     if (iterator == NULL) {
@@ -192,5 +192,5 @@
     if (location == PS_LIST_TAIL) {
         iterator->cursor = list->tail;
-        iterator->index = list->size - 1;
+        iterator->index = list->n - 1;
         iterator->offEnd = false;
         return true;
@@ -205,8 +205,8 @@
 
     if (location < 0) {
-        location = list->size + location;
-    }
-
-    if (location < 0 || location >= (int)list->size) {
+        location = list->n + location;
+    }
+
+    if (location < 0 || location >= (int)list->n) {
         psError(PS_ERR_BAD_PARAMETER_VALUE, true,
                 PS_ERRORTEXT_psList_LOCATION_INVALID,
@@ -218,7 +218,7 @@
     int index = iterator->index;
     if (cursor == NULL) {      // set the cursor to the head if it is NULL
-        if (location > list->size/2) { // closer to tail or head?
+        if (location > list->n/2) { // closer to tail or head?
             cursor = list->tail;
-            index = list->size - 1;
+            index = list->n - 1;
         } else {
             cursor = list->head;
@@ -262,5 +262,5 @@
     }
 
-    if (location > 0 && location >= (int)list->size) {
+    if (location > 0 && location >= (int)list->n) {
         psLogMsg(__func__,PS_LOG_WARN,
                  "Specified location, %d, is beyond the end of the list.  "
@@ -337,5 +337,5 @@
     elem->data = psMemIncrRefCounter(data);
 
-    list->size++;
+    list->n++;
 
     if (cursor == list->tail) {
@@ -412,5 +412,5 @@
     elem->data = psMemIncrRefCounter(data);
 
-    list->size++;
+    list->n++;
 
     if (cursor == list->head) {
@@ -548,5 +548,5 @@
     if ( (iterator->cursor == NULL) && (iterator->offEnd) ) {
         iterator->cursor = iterator->list->tail;
-        iterator->index = iterator->list->size-1;
+        iterator->index = iterator->list->n-1;
         iterator->offEnd = false;
         return NULL;
@@ -574,14 +574,14 @@
     }
 
-    if (list->size > 0) {
-        arr = psArrayAlloc(list->size);
+    if (list->n > 0) {
+        arr = psArrayAlloc(list->n);
     } else {
         arr = psArrayAlloc(1);
     }
 
-    arr->n = list->size;
+    arr->n = list->n;
 
     ptr = list->head;
-    n = list->size;
+    n = list->n;
     for (psS32 i = 0; i < n; i++) {
         arr->data[i] = psMemIncrRefCounter(ptr->data);
Index: /trunk/psLib/src/types/psList.h
===================================================================
--- /trunk/psLib/src/types/psList.h	(revision 4555)
+++ /trunk/psLib/src/types/psList.h	(revision 4556)
@@ -7,6 +7,6 @@
  *  @ingroup LinkedList
  *
- *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-23 03:50:29 $
+ *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-07-15 02:33:54 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -52,5 +52,5 @@
 typedef struct
 {
-    psU32 size;                        ///< number of elements on list
+    long n;                            ///< number of elements on list
     psListElem* head;                  ///< first element on list (may be NULL)
     psListElem* tail;                  ///< last element on list (may be NULL)
@@ -61,4 +61,5 @@
 
     pthread_mutex_t lock;              ///< mutex to lock a node during changes
+//    void *lock;                        ///< Optional lock for thread safety
 }
 psList;
@@ -110,6 +111,6 @@
  */
 bool psListIteratorSet(
-    psListIterator* iterator,            ///< list iterator
-    int location                         ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL
+    psListIterator* iterator,          ///< list iterator
+    long location                      ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL
 );
 
@@ -120,5 +121,5 @@
 bool psListAdd(
     psList* list,                      ///< list to add item to
-    long location,                    ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location.
+    long location,                     ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location.
     psPtr data                         ///< data item to add.  If NULL, list is not modified.
 );
Index: /trunk/psLib/src/types/psLookupTable.c
===================================================================
--- /trunk/psLib/src/types/psLookupTable.c	(revision 4555)
+++ /trunk/psLib/src/types/psLookupTable.c	(revision 4556)
@@ -7,6 +7,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-07-12 19:12:01 $
+*  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-07-15 02:33:54 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
@@ -275,6 +275,6 @@
 
     // Valid ranges. Automatically set by table read if both zero.
-    outTable->validFrom = 0;
-    outTable->validTo = 0;
+    *(double *)&outTable->validFrom = 0;
+    *(double *)&outTable->validTo = 0;
     outTable->indexCol = indexCol;
 
@@ -291,46 +291,46 @@
 switch (TABLE->index->type.type) {                                              \
 case PS_TYPE_U8:                                                                \
-    TABLE->validFrom = (psF64)TABLE->index->data.U8[0];                         \
-    TABLE->validTo   = (psF64)TABLE->index->data.U8[TABLE->index->n-1];         \
+    *(double *)&TABLE->validFrom = (psF64)TABLE->index->data.U8[0];                         \
+    *(double *)&TABLE->validTo   = (psF64)TABLE->index->data.U8[TABLE->index->n-1];         \
     break;                                                                      \
 case PS_TYPE_S8:                                                                \
-    TABLE->validFrom = (psF64)TABLE->index->data.S8[0];                         \
-    TABLE->validTo   = (psF64)TABLE->index->data.S8[TABLE->index->n-1];         \
+    *(double *)&TABLE->validFrom = (psF64)TABLE->index->data.S8[0];                         \
+    *(double *)&TABLE->validTo   = (psF64)TABLE->index->data.S8[TABLE->index->n-1];         \
     break;                                                                      \
 case PS_TYPE_U16:                                                               \
-    TABLE->validFrom = (psF64)TABLE->index->data.U16[0];                        \
-    TABLE->validTo   = (psF64)TABLE->index->data.U16[TABLE->index->n-1];        \
+    *(double *)&TABLE->validFrom = (psF64)TABLE->index->data.U16[0];                        \
+    *(double *)&TABLE->validTo   = (psF64)TABLE->index->data.U16[TABLE->index->n-1];        \
     break;                                                                      \
 case PS_TYPE_S16:                                                               \
-    TABLE->validFrom = (psF64)TABLE->index->data.S16[0];                        \
-    TABLE->validTo   = (psF64)TABLE->index->data.S16[TABLE->index->n-1];        \
+    *(double *)&TABLE->validFrom = (psF64)TABLE->index->data.S16[0];                        \
+    *(double *)&TABLE->validTo   = (psF64)TABLE->index->data.S16[TABLE->index->n-1];        \
     break;                                                                      \
 case PS_TYPE_U32:                                                               \
-    TABLE->validFrom = (psF64)TABLE->index->data.U32[0];                        \
-    TABLE->validTo   = (psF64)TABLE->index->data.U32[TABLE->index->n-1];        \
+    *(double *)&TABLE->validFrom = (psF64)TABLE->index->data.U32[0];                        \
+    *(double *)&TABLE->validTo   = (psF64)TABLE->index->data.U32[TABLE->index->n-1];        \
     break;                                                                      \
 case PS_TYPE_S32:                                                               \
-    TABLE->validFrom = (psF64)TABLE->index->data.S32[0];                        \
-    TABLE->validTo   = (psF64)TABLE->index->data.S32[TABLE->index->n-1];        \
+    *(double *)&TABLE->validFrom = (psF64)TABLE->index->data.S32[0];                        \
+    *(double *)&TABLE->validTo   = (psF64)TABLE->index->data.S32[TABLE->index->n-1];        \
     break;                                                                      \
 case PS_TYPE_U64:                                                               \
-    TABLE->validFrom = (psF64)TABLE->index->data.U64[0];                        \
-    TABLE->validTo   = (psF64)TABLE->index->data.U64[TABLE->index->n-1];        \
+    *(double *)&TABLE->validFrom = (psF64)TABLE->index->data.U64[0];                        \
+    *(double *)&TABLE->validTo   = (psF64)TABLE->index->data.U64[TABLE->index->n-1];        \
     break;                                                                      \
 case PS_TYPE_S64:                                                               \
-    TABLE->validFrom = (psF64)TABLE->index->data.S64[0];                        \
-    TABLE->validTo   = (psF64)TABLE->index->data.S64[TABLE->index->n-1];        \
+    *(double *)&TABLE->validFrom = (psF64)TABLE->index->data.S64[0];                        \
+    *(double *)&TABLE->validTo   = (psF64)TABLE->index->data.S64[TABLE->index->n-1];        \
     break;                                                                      \
 case PS_TYPE_F32:                                                               \
-    TABLE->validFrom = (psF64)TABLE->index->data.F32[0];                        \
-    TABLE->validTo   = (psF64)TABLE->index->data.F32[TABLE->index->n-1];        \
+    *(double *)&TABLE->validFrom = (psF64)TABLE->index->data.F32[0];                        \
+    *(double *)&TABLE->validTo   = (psF64)TABLE->index->data.F32[TABLE->index->n-1];        \
     break;                                                                      \
 case PS_TYPE_F64:                                                               \
-    TABLE->validFrom = (psF64)TABLE->index->data.F64[0];                        \
-    TABLE->validTo   = (psF64)TABLE->index->data.F64[TABLE->index->n-1];        \
+    *(double *)&TABLE->validFrom = (psF64)TABLE->index->data.F64[0];                        \
+    *(double *)&TABLE->validTo   = (psF64)TABLE->index->data.F64[TABLE->index->n-1];        \
     break;                                                                      \
 default:                                                                        \
-    TABLE->validFrom = (psF64)0;                                                \
-    TABLE->validTo   = (psF64)0;                                                \
+    *(double *)&TABLE->validFrom = (psF64)0;                                                \
+    *(double *)&TABLE->validTo   = (psF64)0;                                                \
     break;                                                                      \
 }
@@ -641,5 +641,5 @@
 long psLookupTableRead(psLookupTable* table)
 {
-    psS32           numRows  = 0;
+    long            numRows  = 0;
     psArray*        vectors  = NULL;
     psLookupTable*  outTable = NULL;
@@ -745,10 +745,10 @@
 }
 
-psF64 psLookupTableInterpolate(const psLookupTable *table, psF64 index, psS32 column)
+double psLookupTableInterpolate(const psLookupTable *table, double index, long column)
 {
     psU64 hiIdx = 0;
     psU64 loIdx = 0;
-    psU64 numRows = 0;
-    psU64 numCols = 0;
+    long  numRows = 0;
+    long numCols = 0;
     psF64 out = 0.0;
     psF64 denom = 0.0;
@@ -818,7 +818,7 @@
 }
 
-psVector* psLookupTableInterpolateAll(psLookupTable *table, psF64 index)
-{
-    psU64 numCols = 0;
+psVector* psLookupTableInterpolateAll(const psLookupTable *table, double index)
+{
+    long numCols = 0;
     psVector *outVector = NULL;
 
Index: /trunk/psLib/src/types/psLookupTable.h
===================================================================
--- /trunk/psLib/src/types/psLookupTable.h	(revision 4555)
+++ /trunk/psLib/src/types/psLookupTable.h	(revision 4556)
@@ -7,6 +7,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-06-23 03:19:29 $
+*  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-07-15 02:33:54 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -33,6 +33,6 @@
     psVector *index;                   ///< Vector of independent index values
     psArray *values;                   ///< Array of dependent table values corresponding to index values
-    psF64 validFrom;                   ///< Lower bound for rable read
-    psF64 validTo;                     ///< Upper bound for table read
+    const double validFrom;            ///< Lower bound for rable read
+    const double validTo;              ///< Upper bound for table read
 }
 psLookupTable;
@@ -100,5 +100,5 @@
  *  Reads a lookup table and fills corresponding psLookupTable struct.
  *
- *  @return psS32     Number of valid lines read
+ *  @return long:     Number of valid lines read
  */
 long psLookupTableRead(
@@ -111,10 +111,10 @@
  *  conditions.
  *
- *  @return psLookupTable*     New psLookupTable struct
+ *  @return double     Interpolation value at index
  */
-psF64 psLookupTableInterpolate(
-    const psLookupTable *table,     ///< Table with data
-    psF64 index,                    ///< Value to be interpolated
-    psS32 column                    ///< Column in table to be interpolated
+double psLookupTableInterpolate(
+    const psLookupTable *table,        ///< Table with data
+    double index,                      ///< Value to be interpolated
+    long column                        ///< Column in table to be interpolated
 );
 
@@ -124,9 +124,9 @@
  *  conditions.
  *
- *  @return psLookupTable*     New psLookupTable struct
+ *  @return psVector*     Interpolation values calculated at index
  */
 psVector* psLookupTableInterpolateAll(
-    psLookupTable *table,           ///< Table with data
-    psF64 index                     ///< Value to be interpolated
+    const psLookupTable *table,        ///< Table with data
+    double index                       ///< Value to be interpolated
 );
 
Index: /trunk/psLib/src/types/psMetadata.c
===================================================================
--- /trunk/psLib/src/types/psMetadata.c	(revision 4555)
+++ /trunk/psLib/src/types/psMetadata.c	(revision 4556)
@@ -12,6 +12,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.70 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-07-12 19:12:01 $
+*  @version $Revision: 1.71 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-07-15 02:33:54 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -122,6 +122,6 @@
     psFree(iter->iter);
 
-    if (iter->preg != NULL) {
-        regfree(iter->preg);
+    if (iter->regex != NULL) {
+        regfree(iter->regex);
     }
 }
@@ -268,5 +268,5 @@
 }
 
-bool psMetadataAddItem(psMetadata *md, const psMetadataItem *item, psS32 location, psS32 flags)
+bool psMetadataAddItem(psMetadata *md, const psMetadataItem *item, long location, psS32 flags)
 {
     char * key = NULL;
@@ -360,5 +360,5 @@
 }
 
-bool psMetadataAdd(psMetadata *md, int location, const char *name,
+bool psMetadataAdd(psMetadata *md, long location, const char *name,
                    int format, const char *comment, ...)
 {
@@ -372,5 +372,5 @@
 }
 
-bool psMetadataAddV(psMetadata *md, int location, const char *name,
+bool psMetadataAddV(psMetadata *md, long location, const char *name,
                     int format, const char *comment, va_list list)
 {
@@ -391,5 +391,5 @@
 
 #define METADATA_ADD_TYPE(NAME,TYPE,METATYPE) \
-psBool psMetadataAdd##NAME(psMetadata* md, psS32 where, const char* name, \
+psBool psMetadataAdd##NAME(psMetadata* md, long where, const char* name, \
                            const char* comment, TYPE value) { \
     return psMetadataAdd(md,where,name, METATYPE,comment,value); \
@@ -409,5 +409,5 @@
 METADATA_ADD_TYPE(Array,psArray*,PS_META_ARRAY)
 
-psBool psMetadataRemove(psMetadata *md, psS32 where, const char *key)
+psBool psMetadataRemove(psMetadata *md, long where, const char *key)
 {
     PS_ASSERT_PTR_NON_NULL(md,NULL);
@@ -580,5 +580,5 @@
 psMetadataLookupNumTYPE(Bool)
 
-psMetadataItem* psMetadataGet(const psMetadata *md, int location)
+psMetadataItem* psMetadataGet(const psMetadata *md, long location)
 {
     psMetadataItem* entry = NULL;
@@ -597,5 +597,5 @@
 
 psMetadataIterator* psMetadataIteratorAlloc(psMetadata* md,
-        int location,
+        long location,
         const char* regex)
 {
@@ -604,5 +604,5 @@
 
     psMetadataIterator* newIter = psAlloc(sizeof(psMetadataIterator));
-    newIter->preg = NULL;
+    newIter->regex = NULL;
     newIter->iter = NULL;
 
@@ -614,9 +614,9 @@
         return newIter;
     } else {
-        int regRtn = regcomp(newIter->preg,regex,0);
+        int regRtn = regcomp(newIter->regex,regex,0);
         if (regRtn != 0) {
             char errMsg[256];
-            regerror(regRtn, newIter->preg, errMsg, 256);
-            regfree(newIter->preg);
+            regerror(regRtn, newIter->regex, errMsg, 256);
+            regfree(newIter->regex);
             psError(PS_ERR_BAD_PARAMETER_VALUE, true,
                     PS_ERRORTEXT_psMetadata_REGEX_INVALID,
@@ -633,5 +633,5 @@
 
 bool psMetadataIteratorSet(psMetadataIterator* iterator,
-                           int location)
+                           long location)
 {
     int match;
@@ -643,8 +643,8 @@
     PS_ASSERT_PTR_NON_NULL(iterator->iter,NULL);
 
-    regex_t* preg = iterator->preg;
+    regex_t* regex = iterator->regex;
 
     // handle trivial case where no regex subsetting is required.
-    if (preg == NULL) {
+    if (regex == NULL) {
         return psListIteratorSet(iter,location);
     }
@@ -655,5 +655,5 @@
         psListIteratorSet(iter,PS_LIST_TAIL);
         while ( (cursor=(psMetadataItem*)iter->cursor) != NULL) {
-            if (regexec(preg, cursor->name, 0, NULL, 0) == 0) {
+            if (regexec(regex, cursor->name, 0, NULL, 0) == 0) {
                 // this key is a match
                 match--;
@@ -671,5 +671,5 @@
     psListIteratorSet(iter,PS_LIST_HEAD);
     while ( (cursor=(psMetadataItem*)iter->cursor) != NULL) {
-        if (regexec(preg, cursor->name, 0, NULL, 0) == 0) {
+        if (regexec(regex, cursor->name, 0, NULL, 0) == 0) {
             // this key is a match
             match++;
@@ -692,8 +692,8 @@
     PS_ASSERT_PTR_NON_NULL(iterator->iter,NULL);
 
-    regex_t* preg = iterator->preg;
+    regex_t* regex = iterator->regex;
 
     // handle trivial case where no regex subsetting is required.
-    if (preg == NULL) {
+    if (regex == NULL) {
         return (psMetadataItem*)psListGetAndIncrement(iter);
     }
@@ -703,5 +703,5 @@
     while (psListGetAndIncrement(iter) != NULL) {
         if (iter->cursor != NULL &&
-                regexec(preg, ((psMetadataItem*)iter->cursor)->name, 0, NULL, 0) == 0) {
+                regexec(regex, ((psMetadataItem*)iter->cursor)->name, 0, NULL, 0) == 0) {
             // this key is a match
             break;
@@ -720,8 +720,8 @@
     PS_ASSERT_PTR_NON_NULL(iterator->iter,NULL);
 
-    regex_t* preg = iterator->preg;
+    regex_t* regex = iterator->regex;
 
     // handle trivial case where no regex subsetting is required.
-    if (preg == NULL) {
+    if (regex == NULL) {
         return (psMetadataItem*)psListGetAndDecrement(iter);
     }
@@ -731,5 +731,5 @@
     while (psListGetAndDecrement(iter) != NULL) {
         if (iter->cursor != NULL &&
-                regexec(preg, ((psMetadataItem*)iter->cursor)->name, 0, NULL, 0) == 0) {
+                regexec(regex, ((psMetadataItem*)iter->cursor)->name, 0, NULL, 0) == 0) {
             // this key is a match
             break;
Index: /trunk/psLib/src/types/psMetadata.h
===================================================================
--- /trunk/psLib/src/types/psMetadata.h	(revision 4555)
+++ /trunk/psLib/src/types/psMetadata.h	(revision 4556)
@@ -11,6 +11,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-06-27 20:38:12 $
+*  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-07-15 02:33:54 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -55,5 +55,4 @@
     PS_META_ARRAY                      ///< Array data (Stored as item.data.V).
 } psMetadataType;
-
 #define PS_META_IS_PRIMITIVE(TYPE) \
 (TYPE == PS_META_S32 || \
@@ -77,5 +76,6 @@
     PS_META_DEFAULT = 0,               ///< default behaviour (duplicate entry is an error)
     PS_META_REPLACE = 0x1000000,       ///< allow entry to be replaced
-    PS_META_DUPLICATE_OK = 0x2000000   ///< allow duplicate entries
+    PS_META_DUPLICATE_OK = 0x2000000,  ///< allow duplicate entries
+    PS_META_NULL = 0x4000000           ///< psMetadataItem.data is a NULL value
 } psMetadataFlags;
 
@@ -94,4 +94,5 @@
     psList*  list;                     ///< Metadata in linked-list
     psHash*  table;                    ///< Metadata in a hash table
+    void *lock;                        ///< Optional lock for thread safety
 }
 psMetadata;
@@ -104,5 +105,5 @@
 {
     psListIterator* iter;              ///< iterator for the psMetadata's psList
-    regex_t* preg;                     ///< the subsetting regular expression
+    regex_t* regex;                    ///< the subsetting regular expression
 }
 psMetadataIterator;
@@ -116,5 +117,5 @@
 {
     const psS32 id;                    ///< Unique ID for metadata item.
-    char *name;                        ///< Name of metadata item.
+    psString name;                     ///< Name of metadata item.
     psMetadataType type;               ///< Type of metadata item.
     union {
@@ -127,5 +128,5 @@
         psPtr V;                       ///< Pointer to other type of data.
     } data;                            ///< Union for data types.
-    char *comment;                     ///< Optional comment ("", not NULL).
+    psString comment;                  ///< Optional comment ("", not NULL).
 }
 psMetadataItem;
@@ -151,5 +152,6 @@
     const char *comment,               ///< Comment for metadata item.
     ...                                ///< Arguments for name formatting and metadata item data.
-);
+)
+;
 
 /** Create a metadata item with specified string data.
@@ -261,5 +263,5 @@
     psMetadata*  md,                   ///< Metadata collection to insert metadat item.
     const psMetadataItem* item,        ///< Metadata item to be added.
-    psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
+    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     psS32 flags                        ///< Options flag mask, see psMetadataFlags enum
 );
@@ -273,5 +275,5 @@
 bool psMetadataAdd(
     psMetadata* md,                    ///< Metadata collection to insert metadata item.
-    int location,                      ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
+    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     const char *name,                  ///< Name of metadata item.
     int format,                        ///< Type of metadata item (psMetadataType) and options (psMetadataFlags)
@@ -289,5 +291,5 @@
 bool psMetadataAddV(
     psMetadata* md,                    ///< Metadata collection to insert metadata item.
-    int location,                      ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
+    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     const char *name,                  ///< Name of metadata item.
     int format,                        ///< Type of metadata item (psMetadataType) and options (psMetadataFlags)
@@ -298,10 +300,10 @@
 
 /** Add a psS32 value to metadata collection.
- *  
- *  @return bool:  True for success, False for failure. 
+ *
+ *  @return bool:  True for success, False for failure.
  */
 bool psMetadataAddS32(
     psMetadata* md,                    ///< Metadata collection to insert metadata item
-    psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
+    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     const char* name,                  ///< Name of metadata item
     const char* comment,               ///< Comment for metadata item
@@ -310,10 +312,10 @@
 
 /** Add a psF32 value to metadata collection.
- *  
+ *
  *  @return bool:  True for success, False for failure.
 */
 bool psMetadataAddF32(
     psMetadata* md,                    ///< Metadata collection to insert metadata item
-    psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
+    long location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     const char* name,                  ///< Name of metadata item
     const char* comment,               ///< Comment for metadata item
@@ -322,10 +324,10 @@
 
 /** Add a psF64 value to metadata collection.
- *  
+ *
  *  @return bool:  True for success, False for failure.
 */
 bool psMetadataAddF64(
     psMetadata* md,                    ///< Metadata collection to insert metadata item
-    psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
+    long location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     const char* name,                  ///< Name of metadata item
     const char* comment,               ///< Comment for metadata item
@@ -334,10 +336,10 @@
 
 /** Add a psList to metadata collection.
- *       
+ *
  *  @return psBool:  True for success, False for failure.
  */
 psBool psMetadataAddList(
     psMetadata* md,                    ///< Metadata collection to insert metadata item
-    psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
+    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     const char* name,                  ///< Name of metadata item
     const char* comment,               ///< Comment for metadata item
@@ -346,10 +348,10 @@
 
 /** Add a string to metadata collection.
- *  
+ *
  *  @return bool:  True for success, False for failure.
  */
 bool psMetadataAddStr(
     psMetadata* md,                    ///< Metadata collection to insert metadata item
-    psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
+    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     const char* name,                  ///< Name of metadata item
     const char* comment,               ///< Comment for metadata item
@@ -358,10 +360,10 @@
 
 /** Add a vector to metadata collection.
- *  
+ *
  *  @return psBool:  True for success, False for failure.
  */
 psBool psMetadataAddVector(
     psMetadata* md,                    ///< Metadata collection to insert metadata item
-    psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
+    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     const char* name,                  ///< Name of metadata item
     const char* comment,               ///< Comment for metadata item
@@ -370,10 +372,10 @@
 
 /** Add a array to metadata collection.
- *  
+ *
  *  @return psBool:  True for success, False for failure.
  */
 psBool psMetadataAddArray(
     psMetadata* md,                    ///< Metadata collection to insert metadata item
-    psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
+    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     const char* name,                  ///< Name of metadata item
     const char* comment,               ///< Comment for metadata item
@@ -382,10 +384,10 @@
 
 /** Add an Image to metadata collection.
- *  
+ *
  *  @return psBool:  True for success, False for failure.
  */
 psBool psMetadataAddImage(
     psMetadata* md,                    ///< Metadata collection to insert metadata item
-    psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
+    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     const char* name,                  ///< Name of metadata item
     const char* comment,               ///< Comment for metadata item
@@ -394,10 +396,10 @@
 
 /** Add a Hash to metadata collection.
- *  
+ *
  *  @return psBool:  True for success, False for failure.
  */
 psBool psMetadataAddHash(
     psMetadata* md,                    ///< Metadata collection to insert metadata item
-    psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
+    long location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     const char* name,                  ///< Name of metadata item
     const char* comment,               ///< Comment for metadata item
@@ -406,10 +408,10 @@
 
 /** Add a LookupTable to metadata collection.
- *  
+ *
  *  @return psBool:  True for success, False for failure.
  */
 psBool psMetadataAddLookupTable(
     psMetadata* md,                    ///< Metadata collection to insert metadata item
-    psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
+    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     const char* name,                  ///< Name of metadata item
     const char* comment,               ///< Comment for metadata item
@@ -418,10 +420,10 @@
 
 /** Add an Unknown (psPtr) to metadata collection.
- *  
+ *
  *  @return psBool:  True for success, False for failure.
  */
 psBool psMetadataAddUnknown(
     psMetadata* md,                    ///< Metadata collection to insert metadata item
-    psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
+    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     const char* name,                  ///< Name of metadata item
     const char* comment,               ///< Comment for metadata item
@@ -430,10 +432,10 @@
 
 /** Add Metadata to metadata collection.
- *  
+ *
  *  @return psBool:  True for success, False for failure.
  */
 psBool psMetadataAddMetadata(
     psMetadata* md,                    ///< Metadata collection to insert metadata item
-    psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
+    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     const char* name,                  ///< Name of metadata item
     const char* comment,               ///< Comment for metadata item
@@ -453,5 +455,5 @@
 bool psMetadataRemove(
     psMetadata*  md,                   ///< Metadata collection to remove metadata item.
-    int location,                      ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
+    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     const char * key                   ///< Name of metadata key.
 );
@@ -549,5 +551,5 @@
 psMetadataItem* psMetadataGet(
     const psMetadata* md,              ///< Metadata collection to retrieve metadata item.
-    int location                       ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
+    long location                      ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
 );
 
@@ -562,5 +564,5 @@
 psMetadataIterator* psMetadataIteratorAlloc(
     psMetadata* md,                    ///< the psMetadata to iterate with
-    int location,                      ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
+    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     const char* regex
     ///< A regular expression for subsetting the psMetadata.  If NULL, no
@@ -575,5 +577,5 @@
 bool psMetadataIteratorSet(
     psMetadataIterator* iterator,      ///< psMetadata iterator
-    int location                       ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL
+    long location                      ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL
 );
 
Index: /trunk/psLib/src/types/psMetadataConfig.c
===================================================================
--- /trunk/psLib/src/types/psMetadataConfig.c	(revision 4555)
+++ /trunk/psLib/src/types/psMetadataConfig.c	(revision 4556)
@@ -1,3 +1,3 @@
-/** @file  psMetadataConfig.c
+/** @file  psMetadataIO.c
 *
 *  @brief Contains metadata input/output functions.
@@ -10,10 +10,11 @@
 *  @author Eric Van Alst, MHPCC
 *
-*  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-07-12 19:12:01 $
+*  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-07-15 02:33:54 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
 */
 
+#include <libxml/parser.h>
 #include <fitsio.h>
 #include <string.h>
@@ -33,4 +34,8 @@
 #include "psConstants.h"
 #include "psErrorText.h"
+
+/******************************************************************************/
+/*  DEFINE STATEMENTS                                                         */
+/******************************************************************************/
 
 /** Check for FITS errors */
@@ -54,19 +59,35 @@
 #define MAX_STRING_LENGTH 256
 
+
+/******************************************************************************/
+/*  TYPE DEFINITIONS                                                          */
+/******************************************************************************/
+
+// None
+
+/*****************************************************************************/
+/*  GLOBAL VARIABLES                                                         */
+/*****************************************************************************/
+
+// None
+
+/*****************************************************************************/
+/*  FILE STATIC VARIABLES                                                    */
+/*****************************************************************************/
+
+// None
+
+/*****************************************************************************/
+/*  FUNCTION IMPLEMENTATION - LOCAL                                          */
+/*****************************************************************************/
+
 static psMetadata* getMetadataType(char *linePtr);
-
 static psMetadata* setMetadataItem(psMetadata* template, char* linePtr)
 ;
-
 static void parseLevelInfoFree(p_psParseLevelInfo* info);
-
 static psBool parseLine(psS32* level,   psArray* levelArray,
-                        char*  linePtr, psS32 lineCount, char* fileName,
-                        psBool overwrite);
-
-static psBool parseMetadataItem(char* keyName, psS32* level,
-                                psArray* levelArray, char* linePtr,
-                                psS32 lineCount, char* fileName,
-                                psMetadataFlags flags);
+                        char*  linePtr, psS32 lineCount,     char* fileName, psBool overwrite);
+static psBool parseMetadataItem(char* keyName, psS32* level,     psArray* levelArray,
+                                char* linePtr, psS32  lineCount, char*    fileName,    psMetadataFlags flags);
 
 static void parseLevelInfoFree(p_psParseLevelInfo* info)
@@ -594,5 +615,5 @@
 
     // Determine the number of items in template
-    items = template->list->size;
+    items = template->list->n;
     if(items > 0 ) {
 
Index: /trunk/psLib/src/types/psMetadataConfig.h
===================================================================
--- /trunk/psLib/src/types/psMetadataConfig.h	(revision 4555)
+++ /trunk/psLib/src/types/psMetadataConfig.h	(revision 4556)
@@ -10,6 +10,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-07-12 19:12:01 $
+ *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-07-15 02:33:54 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -17,6 +17,4 @@
 #ifndef PS_METADATACONFIG_H
 #define PS_METADATACONFIG_H
-
-#include "psMetadata.h"
 
 /// @addtogroup Metadata
Index: /trunk/psLib/src/types/psPixels.c
===================================================================
--- /trunk/psLib/src/types/psPixels.c	(revision 4555)
+++ /trunk/psLib/src/types/psPixels.c	(revision 4556)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-07-12 19:12:01 $
+ *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-07-15 02:33:54 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -55,5 +55,5 @@
 }
 
-psPixels* psPixelsAlloc(psU32 nalloc)
+psPixels* psPixelsAlloc(long nalloc)
 {
     psPixels* out = psAlloc(sizeof(psPixels));
@@ -72,5 +72,5 @@
 }
 
-psPixels* psPixelsRealloc(psPixels* pixels, psU32 nalloc)
+psPixels* psPixelsRealloc(psPixels* pixels, long nalloc)
 {
     if (pixels == NULL) {
@@ -94,5 +94,5 @@
 }
 
-psPixels* p_psPixelsAppend(psPixels* pixels, int growth, psS32 x, psS32 y)
+psPixels* p_psPixelsAppend(psPixels* pixels, long growth, int x, int y)
 {
     if (growth < 1) {
Index: /trunk/psLib/src/types/psPixels.h
===================================================================
--- /trunk/psLib/src/types/psPixels.h	(revision 4555)
+++ /trunk/psLib/src/types/psPixels.h	(revision 4556)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-06-27 20:38:12 $
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-07-15 02:33:54 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -24,6 +24,6 @@
 typedef struct
 {
-    psS32 x;                           ///< x coordinate
-    psS32 y;                           ///< y coordinate
+    int x;                             ///< x coordinate
+    int y;                             ///< y coordinate
 }
 psPixelCoord;
@@ -41,7 +41,8 @@
 typedef struct
 {
-    int n;                             ///< Number in usa
-    int nalloc;                        ///< Number allocated
+    long n;                            ///< Number in usa
+    long nalloc;                       ///< Number allocated
     psPixelCoord* data;                ///< The pixel coordinates
+    void *lock;                        ///< Option lock for thread safety
 }
 psPixels;
@@ -53,6 +54,7 @@
  */
 psPixels* psPixelsAlloc(
-    psU32 nalloc                       ///< the size of the coordinate vectors
-);
+    long nalloc                       ///< the size of the coordinate vectors
+)
+;
 
 /** resizes a psPixels structure
@@ -62,5 +64,5 @@
 psPixels* psPixelsRealloc(
     psPixels* pixels,                  ///< psPixels to resize, or NULL to create new psPixels
-    psU32 nalloc                       ///< the size of the coordinate vectors
+    long nalloc                       ///< the size of the coordinate vectors
 );
 
@@ -71,7 +73,7 @@
 psPixels* p_psPixelsAppend(
     psPixels* pixels,                  ///< psPixels to append new coordinate to.  NULL creates a new one.
-    int growth,                        ///< number of elements to grow the psPixels list, if necessary.  if growth < 1, 10 is used.
-    psS32 x,                           ///< x coordinate to append
-    psS32 y                            ///< y coordinate to append
+    long growth,                        ///< number of elements to grow the psPixels list, if necessary.  if growth < 1, 10 is used.
+    int x,                             ///< x coordinate to append
+    int y                              ///< y coordinate to append
 );
 
@@ -138,5 +140,5 @@
 
 /** Prints a psPixels to specified destination.
- *  
+ *
  *  @return bool:    True if successful.
 */
