Index: trunk/psLib/src/types/psArguments.c
===================================================================
--- trunk/psLib/src/types/psArguments.c	(revision 12288)
+++ trunk/psLib/src/types/psArguments.c	(revision 12289)
@@ -7,6 +7,6 @@
  *  @author David Robbins, MHPCC
  *
- *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-02-07 23:52:54 $
+ *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-03-07 02:50:15 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -41,4 +41,5 @@
     PS_ASSERT_PTR_NON_NULL(argv, 2);
     PS_ASSERT_PTR_NON_NULL(argc, 2);
+    PS_ASSERT_INT_POSITIVE(*argc, 2);
     int argnum = 0;   // Argument number
 
@@ -96,8 +97,8 @@
                   const char *arg)
 {
+    PS_ASSERT_INT_POSITIVE(argc, 0);
     PS_ASSERT_PTR_NON_NULL(argv, 0);
-    PS_ASSERT_PTR_NON_NULL(arg, 0);
-    if (strlen(arg) == 0)
-        return 0;
+    PS_ASSERT_STRING_NON_EMPTY(arg, 0);
+
     for (int i = 1; i < argc; i++) {
         if (!strcmp(argv[i], arg))
@@ -113,15 +114,14 @@
                       char **argv)
 {
+    PS_ASSERT_INT_POSITIVE(argnum, false);
+    PS_ASSERT_PTR_NON_NULL(argc, false);
+    PS_ASSERT_INT_LESS_THAN(argnum, *argc, false);
     PS_ASSERT_PTR_NON_NULL(argv, false);
-    PS_ASSERT_PTR_NON_NULL(argc, false);
-    if (argnum > 0) {
-        (*argc)--;
-        for (int i = argnum; i < *argc; i++) {
-            argv[i] = argv[i+1];
-        }
-        argv[*argc] = NULL;
-    } else {
-        return false;
-    }
+
+    (*argc)--;
+    for (int i = argnum; i < *argc; i++) {
+        argv[i] = argv[i+1];
+    }
+    argv[*argc] = NULL;
 
     return true;
@@ -174,9 +174,9 @@
                      char **argv)
 {
-    PS_ASSERT_PTR_NON_NULL(arguments, false);
+    PS_ASSERT_METADATA_NON_NULL(arguments, false);
+    PS_ASSERT_PTR_NON_NULL(argc, false);
+    PS_ASSERT_INT_POSITIVE(*argc, false);
     PS_ASSERT_PTR_NON_NULL(argv, false);
-    PS_ASSERT_PTR_NON_NULL(argc, false);
-    if (*argc < 1)
-        return false;
+
     // We need to do a bit of mucking around in order to preserve the arguments metadata until the last
     // minute --- if there is a bad argument, we need to return the old "arguments", since they contain
Index: trunk/psLib/src/types/psArray.c
===================================================================
--- trunk/psLib/src/types/psArray.c	(revision 12288)
+++ trunk/psLib/src/types/psArray.c	(revision 12289)
@@ -9,6 +9,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.60 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-03-02 02:34:45 $
+ *  @version $Revision: 1.61 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-03-07 02:50:15 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -33,5 +33,5 @@
 #include "psAssert.h"
 
-
+#define DEFAULT_ARRAY_ADD 10            // Default number to add to an array when not specified
 
 /*****************************************************************************
@@ -112,4 +112,5 @@
                           long nalloc)
 {
+    PS_ASSERT_ARRAY_NON_NULL(in, NULL);
     if (nalloc < 0) {
         psError(PS_ERR_BAD_PARAMETER_VALUE, true,
@@ -117,11 +118,8 @@
         return in;
     }
-    if (in == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL,true,
-                _("psArrayRealloc must be given a non-NULL psArray to resize."));
-        return NULL;
-    } else if (in->nalloc != nalloc) {     // No need to realloc to same size
+
+    if (in->nalloc != nalloc) {     // No need to realloc to same size
         if (nalloc < in->n) {
-            for (psS32 i = nalloc; i < in->n; i++) {      // For reduction in vector size
+            for (long i = nalloc; i < in->n; i++) {      // For reduction in vector size
                 psFree(in->data[i]);
             }
@@ -145,5 +143,5 @@
 {
     if (array == NULL) {
-        int d = (delta > 0) ? delta : 10; // as spec'ed in SDRS.
+        long d = (delta > 0) ? delta : DEFAULT_ARRAY_ADD;
         array = psArrayAlloc(d);
         array->n = 0;
@@ -154,5 +152,5 @@
     if (n >= array->nalloc) {
         // array needs to be expanded to make room for more elements
-        int d = (delta > 0) ? delta : 10; // as spec'ed in SDRS.
+        long d = (delta > 0) ? delta : DEFAULT_ARRAY_ADD;
         array = psArrayRealloc(array, n+d);
     }
@@ -168,18 +166,14 @@
                        const psPtr data)
 {
+    PS_ASSERT_ARRAY_NON_NULL(array, false);
+    PS_ASSERT_PTR_NON_NULL(data, false);
+
     bool success = false;
-
-    if (array == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                _("Specified psArray can not be NULL."));
-        return false;
-    }
-
-    psS32 n = array->n;
-    psPtr* psArrData = array->data;
-    for (psS32 i = n-1; i >= 0; i--) {
-        if (psArrData[i] == data) {
-            memmove(&array->data[i],&array->data[i+1],(n-i-1)*sizeof(psPtr));
-            psFree(data); // free the removed item (see Bug #449)
+    long n = array->n;
+    psPtr *arrayData = array->data;
+    for (long i = n-1; i >= 0; i--) {
+        if (arrayData[i] == data) {
+            memmove(&arrayData[i],&arrayData[i+1],(n-i-1)*sizeof(psPtr));
+            psFree(data); // Free the removed item
             n--;
             success = true;
@@ -194,9 +188,8 @@
                         long index)
 {
-    PS_ASSERT_PTR_NON_NULL(array, false);
-
+    PS_ASSERT_ARRAY_NON_NULL(array, false);
     if (index < 0 || index >= array->n) {
         psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                _("index > then the number of elements in the array."));
+                _("Specified index outside the range of elements in the array."));
         return false;
     }
@@ -228,10 +221,6 @@
                      psComparePtrFunc func)
 {
-    if (array == NULL) {
-        return NULL;
-    }
-
+    PS_ASSERT_ARRAY_NON_NULL(array, NULL);
     qsort(array->data, array->n, sizeof(psPtr), (int (*)(const void* , const void*))func);
-
     return array;
 }
@@ -242,10 +231,5 @@
                 psPtr data)                        ///< the value to set it to
 {
-    if (array == NULL)
-    {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                _("Specified psArray can not be NULL."));
-        return false;
-    }
+    PS_ASSERT_ARRAY_NON_NULL(array, false);
 
     if (position > array->n)
@@ -257,14 +241,13 @@
     }
 
-    if (position < 0)
+    if (position < 0) {
         position += array->n;
-    if (position < 0)
-    {
+    }
+    if (position < 0) {
         psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid position.  Negative number too large\n");
         return false;
     }
 
-    if (position == array->n)
-    {
+    if (position == array->n) {
         if (position >= array->nalloc) {
             psError(PS_ERR_BAD_PARAMETER_NULL, true,
@@ -285,9 +268,5 @@
                  long position )
 {
-    if (array == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                _("Specified psArray can not be NULL."));
-        return NULL;
-    }
+    PS_ASSERT_ARRAY_NON_NULL(array, NULL);
 
     if (position >= array->n) {
@@ -308,9 +287,5 @@
 long psArrayLength(const psArray *array)
 {
-    if ( !psMemCheckArray((psArray*)array) ) {
-        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
-                "Error:  Specified array is not a valid psArray \n");
-        return -1;
-    }
+    PS_ASSERT_ARRAY_NON_NULL(array, -1);
     return (array->n);
 }
Index: trunk/psLib/src/types/psHash.c
===================================================================
--- trunk/psLib/src/types/psHash.c	(revision 12288)
+++ trunk/psLib/src/types/psHash.c	(revision 12289)
@@ -12,6 +12,6 @@
 *  @author GLG, MHPCC
 *
-*  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2007-02-08 21:44:00 $
+*  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2007-03-07 02:50:15 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -38,6 +38,5 @@
 static psHashBucket* hashBucketAlloc(const char *key, psPtr data, psHashBucket* next);
 static void hashBucketFree(psHashBucket* bucket);
-static psPtr doHashWork(psHash* table, const char *key, psPtr data, bool remove
-                           );
+static psPtr doHashWork(psHash* table, const char *key, psPtr data, bool remove);
 static void hashFree(psHash* table);
 
@@ -52,6 +51,6 @@
 psList* psHashKeyList(const psHash* hash)
 {
-    PS_ASSERT_PTR_NON_NULL(hash, NULL);
-    psS32 i = 0;                  // Loop index variable
+    PS_ASSERT_HASH_NON_NULL(hash, NULL);
+
     psList* myLinkList = NULL;  // The output data structure
     psHashBucket* ptr = NULL;   // Used to step thru linked list.
@@ -62,5 +61,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->n; i++) {
+    for (long i = 0; i < hash->n; i++) {
         if (hash->buckets[i] != NULL) {
             // Since a bucket contains a linked list of keys/data, we must
@@ -93,4 +92,6 @@
                                      psHashBucket* next)
 {
+    assert(key && strlen(key) > 0);
+
     // Allocate memory for the new hash bucket.
     psHashBucket* bucket = psAlloc(sizeof(psHashBucket));
@@ -142,11 +143,9 @@
                       long nalloc)        // initial number of buckets
 {
-    if (nalloc < 0)
-    {
+    if (nalloc < 0) {
         psError(PS_ERR_BAD_PARAMETER_VALUE, true,
                 "Can't allocate a psHash of negative size.");
         return NULL;
     }
-    psS32 i = 0;                  // loop index variable
 
     // Create the new hash table.
@@ -162,6 +161,5 @@
 
     // Initialize all buckets to NULL.
-    for (i = 0; i < nalloc; i++)
-    {
+    for (long i = 0; i < nalloc; i++) {
         table->buckets[i] = NULL;
     }
@@ -183,5 +181,5 @@
 table.  It loops through each bucket, and calls hashBucketFree() on that
 bucket.
- 
+
 Inputs:
     table: a hash table
@@ -191,10 +189,7 @@
 static void hashFree(psHash* table)
 {
-    psS32 i = 0;                  // Loop index variable.
-
     // 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->n; i++) {
-
+    for (long i = 0; i < table->n; i++) {
         // A bucket is composed of a linked list of buckets.
         while (table->buckets[i] != NULL) {
@@ -223,5 +218,5 @@
 Return:
     NONE
- 
+
 NOTE: consider removing this private function and simply putting the code
 into the psHashInsert(), psHashLookup(), and psHashRemove().  Why?  Because
@@ -234,46 +229,20 @@
                            )
 {
-    psS64 hash = 1;          // This will contain an integer value
-
-    // "hashed" from the key.
-    char *tmpchar = NULL;       // Used in computing the hash function.
-    psHashBucket* ptr = NULL;   // Used to retrieve the hash bucket.
-    psHashBucket* optr = NULL;  // "original pointer": used to step
-
-    // thru the linked list for a bucket.
-
-    // The following condition should never be true, since this is a private
-    // function, but I'm checking it anyway since future coders might change
-    // the way this procedure is called.
-    /*    if ((table == NULL) || (key == NULL)) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-        _("Input key can not be NULL."));
-        return NULL;
-    }
-    */
-    // NOTE: This is the originally supplied hash function.
-    // for (psS32 i = 0, len = strlen(key); i < len; i++) {
-    // hash = (hash << 1) ^ key[i];
-    // }
-    // hash &= (table->n - 1);
+    assert(table);
+    assert(table->n > 0);
+    assert(key && strlen(key) > 0);
 
     // This hash algorithm is from Sedgewick.  NOTE: must reread to ensure that
     // the size of the hash table is not required to be a prime number.
-    if (table->n <= 0)
-        return NULL;
-    tmpchar = (char *)key;
+    char *tmpchar = (char *)key;        // Used in computing the hash function.
+    long hash;                          // The hash value
     for (hash = 0; *tmpchar != '\0'; tmpchar++) {
         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->n)) {
-        psError(PS_ERR_UNKNOWN, true,
-        "Internal hash function out of range (%" PRId64 ")", hash);
-    }
-    */
+    assert(hash >= 0 && hash < table->n);
+
     // ptr will have the correct hash bucket.
-    ptr = table->buckets[hash];
+    psHashBucket *ptr = table->buckets[hash];   // Used to retrieve the hash bucket.
+    psHashBucket* optr = NULL;          // "original pointer": used to step thru the linked list for a bucket.
 
     // We know the correct hash bucket, now we need to know what to do.
@@ -281,7 +250,6 @@
     // or a remove operation on the hash table.
 
-    if (data == NULL) {
-        if (remove
-           ) {
+    if (data) {
+        if (remove) {
             // We search through the linked list for this bucket in
             // the hash table and look for an entry for this key.
@@ -368,6 +336,6 @@
                psPtr data)
 {
-    PS_ASSERT_PTR_NON_NULL(hash, false);
-    PS_ASSERT_PTR_NON_NULL(key, false);
+    PS_ASSERT_HASH_NON_NULL(hash, false);
+    PS_ASSERT_STRING_NON_EMPTY(key, false);
     PS_ASSERT_PTR_NON_NULL(data, false);
 
@@ -379,5 +347,5 @@
 looks up the specified key in the hash table and returns the data associated
 with that key.
- 
+
 Inputs:
     table: a hash table
@@ -389,6 +357,6 @@
                    const char *key)     // key to lookup
 {
-    PS_ASSERT_PTR_NON_NULL(hash, NULL);
-    PS_ASSERT_PTR_NON_NULL(key, NULL);
+    PS_ASSERT_HASH_NON_NULL(hash, NULL);
+    PS_ASSERT_STRING_NON_EMPTY(key, NULL);
 
     return doHashWork((psPtr)hash, key, NULL, false);
@@ -407,6 +375,6 @@
                   const char *key)
 {
-    PS_ASSERT_PTR_NON_NULL(hash, false);
-    PS_ASSERT_PTR_NON_NULL(key, false);
+    PS_ASSERT_HASH_NON_NULL(hash, false);
+    PS_ASSERT_STRING_NON_EMPTY(key, false);
 
     psPtr data = NULL;
@@ -425,12 +393,11 @@
 psArray* psHashToArray(const psHash* hash)
 {
-    PS_ASSERT_PTR_NON_NULL(hash, NULL);
-
-    // first, let's just count the number of data elements to know what size
-    // psArray we need to allocate.
+    PS_ASSERT_HASH_NON_NULL(hash, NULL);
+
+    // first, let's just count the number of data elements to know what size psArray we need to allocate.
     int nElements = 0;
     int nbucket = hash->n;
-    //XXX:  If we do psArrayAlloc(0) here and use psArrayAdd(result, 1, tmpBucket->data)
-    //we can eliminate the 2nd for loop below.
+    // XXX:  If we do psArrayAlloc(0) here and use psArrayAdd(result, 1, tmpBucket->data)
+    // we can eliminate the 2nd for loop below.
     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 12288)
+++ trunk/psLib/src/types/psHash.h	(revision 12289)
@@ -11,6 +11,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-02-08 21:44:00 $
+ *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-03-07 02:50:15 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -45,5 +45,4 @@
 }
 psHash;
-
 
 /** Checks the type of a particular pointer.
@@ -114,4 +113,12 @@
 
 
+#define PS_ASSERT_HASH_NON_NULL(NAME, RVAL) \
+if (!(NAME) || !(NAME)->buckets || (NAME)->n <= 0) { \
+    psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
+            "Error: Hash %s or one of its components is NULL.", \
+            #NAME); \
+    return RVAL; \
+}
+
 /// @} End of DataContainer Functions
 #endif // #ifndef PS_HASH_H
Index: trunk/psLib/src/types/psList.c
===================================================================
--- trunk/psLib/src/types/psList.c	(revision 12288)
+++ trunk/psLib/src/types/psList.c	(revision 12289)
@@ -7,6 +7,6 @@
  *  @author Joshua Hoblitt, University of Hawaii
  *
- *  @version $Revision: 1.61 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-02-08 04:35:35 $
+ *  @version $Revision: 1.62 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-03-07 02:50:15 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -84,5 +84,6 @@
 static bool listIteratorRemove(psListIterator* iterator)
 {
-    if (iterator == NULL || iterator->cursor == NULL) {
+    assert(iterator);
+    if (iterator->cursor == NULL) {
         return false;
     }
@@ -159,11 +160,7 @@
                                     bool mutable)
 {
-    if (list == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                _("Specified list is NULL."));
-        return false;
-    }
+    PS_ASSERT_LIST_NON_NULL(list, NULL);
+
     psListIterator* iter = p_psAlloc(file, lineno, func, sizeof(psListIterator));
-
     psMemSetDeallocator(iter, (psFreeFunc) listIteratorFree);
 
@@ -180,5 +177,5 @@
     psMemDecrRefCounter(iter);
 
-    if (! psListIteratorSet(iter,location)) {
+    if (!psListIteratorSet(iter,location)) {
         psFree(iter);
         return NULL;
@@ -191,7 +188,5 @@
                        long location)
 {
-    if (iterator == NULL || iterator->list == NULL) {
-        return false;
-    }
+    PS_ASSERT_LIST_ITERATOR_NON_NULL(iterator, false);
 
     psList* list = iterator->list;
@@ -260,16 +255,6 @@
                psPtr data)
 {
-
-    if (list == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                _("Specified psList reference is NULL."));
-        return false;
-    }
-
-    if (data == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                _("Specified data item is NULL."));
-        return false;
-    }
+    PS_ASSERT_LIST_NON_NULL(list, false);
+    PS_ASSERT_PTR_NON_NULL(data, false);
 
     if (location > 0 && location >= (int)list->n) {
@@ -297,15 +282,6 @@
                     void* data)
 {
-    if (data == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                _("Specified data item is NULL."));
-        return false;
-    }
-
-    if (iterator == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                _("Specified iterator is NULL."));
-        return false;
-    }
+    PS_ASSERT_LIST_ITERATOR_NON_NULL(iterator, false);
+    PS_ASSERT_PTR_NON_NULL(data, false);
 
     // Check if the list pointed by the iterator can be changed
@@ -318,10 +294,4 @@
     psListElem* cursor = iterator->cursor;
     psList* list = iterator->list;
-
-    if (cursor == NULL && list->head != NULL) {
-        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
-                _("Specified iterator is not valid."));
-        return false;
-    }
 
     psListElem* elem = psAlloc(sizeof(psListElem));
@@ -348,10 +318,4 @@
     list->n++;
 
-    //XXX: The following is unreachable.  cursor can't == list->tail unless cursor->next == NULL.
-    // in which case list->tail will be set to elem.  (list->tail = elem;)
-    /*    if (cursor == list->tail) {
-            list->tail = elem;
-        }
-    */
     psArray* iterators = list->iterators;
     int index = iterator->index;
@@ -369,15 +333,6 @@
                      void* data)
 {
-    if (data == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                _("Specified data item is NULL."));
-        return false;
-    }
-
-    if (iterator == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                _("Specified iterator is NULL."));
-        return false;
-    }
+    PS_ASSERT_LIST_ITERATOR_NON_NULL(iterator, false);
+    PS_ASSERT_PTR_NON_NULL(data, false);
 
     // Check if the list pointed by the iterator can be changed
@@ -390,11 +345,4 @@
     psListElem* cursor = iterator->cursor;
     psList* list = iterator->list;
-
-    if (cursor == NULL && list->head != NULL) {
-        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
-                _("Specified iterator is not valid."));
-        return false;
-    }
-
     psListElem* elem = psAlloc(sizeof(psListElem));
 
@@ -420,10 +368,4 @@
     list->n++;
 
-    //XXX: The following is unreachable.  cursor can't == list->head unless cursor->prev == NULL.
-    // in which case list->head will be set to elem.  (list->tail = elem;)
-    /*   if (cursor == list->head) {
-            list->head = elem;
-        }
-    */
     psArray* iterators = list->iterators;
     int index = iterator->index;
@@ -441,9 +383,5 @@
                   long location)
 {
-    if (list == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                _("Specified psList reference is NULL."));
-        return false;
-    }
+    PS_ASSERT_LIST_NON_NULL(list, false);
 
     // move ourselves to the given position
@@ -459,15 +397,6 @@
                       psPtr data)
 {
-    if (list == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                _("Specified psList reference is NULL."));
-        return false;
-    }
-
-    if (data == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                _("Specified data item is NULL."));
-        return false;
-    }
+    PS_ASSERT_LIST_NON_NULL(list, false);
+    PS_ASSERT_PTR_NON_NULL(data, false);
 
     psListElem* elem = list->head;
@@ -493,15 +422,5 @@
                 long location)
 {
-    if (list == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                _("Specified psList reference is NULL."));
-        return NULL;
-    }
-
-    if (list->head == NULL) { // list empty?
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                _("Specified psList reference is empty."));
-        return NULL;
-    }
+    PS_ASSERT_LIST_NON_NULL(list, NULL);
 
     psListIterator* iterator = list->iterators->data[0];
@@ -522,7 +441,6 @@
 psPtr psListGetAndIncrement(psListIterator* iterator)
 {
-    if (iterator == NULL ) {
-        return NULL;
-    }
+    PS_ASSERT_LIST_ITERATOR_NON_NULL(iterator, NULL);
+
     if (( iterator->cursor == NULL) && (iterator->offEnd)) {
         return NULL;
@@ -547,7 +465,6 @@
 psPtr psListGetAndDecrement(psListIterator* iterator)
 {
-    if (iterator == NULL ) {
-        return NULL;
-    }
+    PS_ASSERT_LIST_ITERATOR_NON_NULL(iterator, NULL);
+
     if ((iterator->cursor == NULL) && (!iterator->offEnd))  {
         return NULL;
@@ -573,5 +490,5 @@
 psArray* psListToArray(const psList* list)
 {
-    PS_ASSERT_PTR_NON_NULL(list, NULL);
+    PS_ASSERT_LIST_NON_NULL(list, NULL);
 
     long n = list->n;
@@ -579,5 +496,5 @@
 
     psListElem *ptr = list->head;
-    for (psS32 i = 0; i < n; i++) {
+    for (long i = 0; i < n; i++) {
         arr->data[i] = psMemIncrRefCounter(ptr->data);
         ptr = ptr->next;
@@ -589,17 +506,10 @@
 psList* psArrayToList(const psArray* array)
 {
-    psU32 n;
-    psList* list;               // list of elements
-
-    if (array == NULL) {
-        return NULL;
-    }
-
-    list = psListAlloc(NULL);
-    n = array->n;
-    for (psS32 i = 0; i < n; i++) {
+    PS_ASSERT_ARRAY_NON_NULL(array, NULL);
+
+    psList *list = psListAlloc(NULL);   // list of elements
+    for (long i = 0; i < array->n; i++) {
         psListAdd(list, PS_LIST_TAIL, array->data[i]);
     }
-
     return list;
 }
@@ -608,17 +518,10 @@
                    psComparePtrFunc func)
 {
-    psArray* arr;
-
-    if (list == NULL) {
-        return NULL;
-    }
-    if (func == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                _("Specified psComparePtrFunc is NULL."));
-        return list;
-    }
+    PS_ASSERT_LIST_NON_NULL(list, NULL);
+    PS_ASSERT_PTR_NON_NULL(func, NULL);
+
     // convert to indexable vector for use by qsort.
-    arr = psListToArray(list);
-    psArray* iterators = psMemIncrRefCounter(list->iterators);
+    psArray *arr = psListToArray(list);
+    psArray *iterators = psMemIncrRefCounter(list->iterators);
     psFree(list);
 
@@ -641,11 +544,7 @@
 long psListLength(const psList *list)
 {
-    if ( !psMemCheckList((psList*)list) ) {
-        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
-                "Error:  Specified list is not a valid psList \n");
-        return -1;
-    }
-    return (list->n);
-}
-
-
+    PS_ASSERT_LIST_NON_NULL(list, -1);
+    return list->n;
+}
+
+
Index: trunk/psLib/src/types/psList.h
===================================================================
--- trunk/psLib/src/types/psList.h	(revision 12288)
+++ trunk/psLib/src/types/psList.h	(revision 12289)
@@ -5,6 +5,6 @@
  *  @author Robert Daniel DeSonia, MHPCC
  *
- *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-02-08 04:35:35 $
+ *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-03-07 02:50:15 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -34,11 +34,9 @@
 
 /** Doubly-linked list element */
-typedef struct psListElem
-{
+typedef struct psListElem {
     struct psListElem* prev;           ///< previous link in list
     struct psListElem* next;           ///< next link in list
     psPtr data;                        ///< real data item
-}
-psListElem;
+} psListElem;
 
 
@@ -48,6 +46,5 @@
  *  @see psListAlloc
  */
-typedef struct
-{
+typedef struct {
     long n;                            ///< number of elements on list
     psListElem* head;                  ///< first element on list (may be NULL)
@@ -58,6 +55,5 @@
     ///< others are user-level iterators created by psListIteratorAlloc.
     void *lock;                        ///< Optional lock for thread safety
-}
-psList;
+} psList;
 
 
@@ -279,4 +275,22 @@
 
 
+#define PS_ASSERT_LIST_NON_NULL(NAME, RVAL) \
+if (!(NAME) || !(NAME)->iterators || (NAME)->n <= 0) { \
+    psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
+            "Error: List %s or one of its components is NULL.", \
+            #NAME); \
+    return RVAL; \
+}
+
+#define PS_ASSERT_LIST_ITERATOR_NON_NULL(NAME, RVAL) \
+if (!(NAME) || !(NAME)->list || !(NAME)->list->iterators || (NAME)->list->n <= 0 || \
+    (!(NAME)->cursor && (NAME)->list->head) || (NAME)->index <= 0) { \
+    psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
+            "Error: List iterator %s or one of its components is NULL.", \
+            #NAME); \
+    return RVAL; \
+}
+
+
 /// @} End of DataContainer Functions
 #endif // #ifndef PS_LIST_H
Index: trunk/psLib/src/types/psLookupTable.h
===================================================================
--- trunk/psLib/src/types/psLookupTable.h	(revision 12288)
+++ trunk/psLib/src/types/psLookupTable.h	(revision 12289)
@@ -6,6 +6,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2007-02-08 21:57:02 $
+*  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2007-03-07 02:50:15 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -22,5 +22,5 @@
 #include "psArray.h"
 #include "psLogMsg.h"
-
+#include "psString.h"
 
 /** Lookup table structure
@@ -29,8 +29,7 @@
  *
  */
-typedef struct
-{
-    const char *filename;              ///< Name of file with table
-    const char *format;                ///< scanf-like format string for file
+typedef struct {
+    psString filename;                  ///< Name of file with table
+    psString format;                    ///< scanf-like format string for file
     long indexCol;                     ///< Column of the index vector (starting at zero)
     psVector *index;                   ///< Vector of independent index values
@@ -38,7 +37,14 @@
     const double validFrom;            ///< Lower bound for rable read
     const double validTo;              ///< Upper bound for table read
+} psLookupTable;
+
+#define PS_ASSERT_LOOKUPTABLE_NON_NULL(NAME, RVAL) \
+if (!(NAME) || !(NAME)->filename || strlen((NAME)->filename) == 0 || \
+    !(NAME)->format || strlen((NAME)->format) == 0 || (NAME)->index < 0) { \
+    psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
+            "Error: Lookup table %s or one of its components is NULL.", \
+            #NAME); \
+    return RVAL; \
 }
-psLookupTable;
-
 
 /** Lookup table lookup status and error conditions
@@ -135,5 +141,5 @@
     const char *func,                   ///< Function name of caller
     psLookupTable *table,               ///< Lookup table into which to import
-    const psArray *vectors,             ///< Array of vectors
+    psArray *vectors,                   ///< Array of vectors
     long indexCol                       ///< Index of the index vector in the array of vectors
 );
Index: trunk/psLib/src/types/psMetadata.c
===================================================================
--- trunk/psLib/src/types/psMetadata.c	(revision 12288)
+++ trunk/psLib/src/types/psMetadata.c	(revision 12289)
@@ -12,6 +12,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.153 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-03-06 21:58:47 $
+ *  @version $Revision: 1.154 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-03-07 02:50:15 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -1159,12 +1159,5 @@
 {
     PS_ASSERT_METADATA_NON_NULL(md, NULL);
-
-    psList *list = psListAlloc(NULL);   // List with the keys
-    psMetadataIterator *iter = psMetadataIteratorAlloc(md, PS_LIST_HEAD, false);
-    psMetadataItem *item;               // Item from iteration
-    while ((item = psMetadataGetAndIncrement(iter))) {
-        psListAdd(list, PS_LIST_TAIL, item->name);
-    }
-    return list;
+    return psHashKeyList(md->hash);
 }
 
Index: trunk/psLib/src/types/psMetadataConfig.c
===================================================================
--- trunk/psLib/src/types/psMetadataConfig.c	(revision 12288)
+++ trunk/psLib/src/types/psMetadataConfig.c	(revision 12289)
@@ -10,6 +10,6 @@
 *  @author Eric Van Alst, MHPCC
 *
-*  @version $Revision: 1.128 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2007-02-06 21:36:09 $
+*  @version $Revision: 1.129 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2007-03-07 02:50:15 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -449,6 +449,6 @@
 
     PS_ASSERT_PTR_NON_NULL(fd, false);
-    PS_ASSERT_PTR_NON_NULL(format, false);
-    PS_ASSERT_PTR_NON_NULL(item, false);
+    PS_ASSERT_STRING_NON_EMPTY(format, false);
+    PS_ASSERT_METADATA_ITEM_NON_NULL(item, false);
 
     type = item->type;
@@ -1152,6 +1152,6 @@
                          psMetadataFlags flags)
 {
-    PS_ASSERT_PTR_NON_NULL(keyName, false);
-    PS_ASSERT_PTR_NON_NULL(levelArray, false);
+    PS_ASSERT_STRING_NON_EMPTY(keyName, false);
+    PS_ASSERT_ARRAY_NON_NULL(levelArray, false);
     PS_ASSERT_PTR_NON_NULL(linePtr, false);
 
@@ -1182,6 +1182,6 @@
                       psMetadataFlags flags)
 {
-    PS_ASSERT_PTR_NON_NULL(keyName, false);
-    PS_ASSERT_PTR_NON_NULL(levelArray, false);
+    PS_ASSERT_STRING_NON_EMPTY(keyName, false);
+    PS_ASSERT_ARRAY_NON_NULL(levelArray, false);
     PS_ASSERT_PTR_NON_NULL(linePtr, false);
 
@@ -1247,6 +1247,6 @@
                              psMetadataFlags flags)
 {
-    PS_ASSERT_PTR_NON_NULL(keyName, false);
-    PS_ASSERT_PTR_NON_NULL(levelArray, false);
+    PS_ASSERT_STRING_NON_EMPTY(keyName, false);
+    PS_ASSERT_ARRAY_NON_NULL(levelArray, false);
     PS_ASSERT_PTR_NON_NULL(linePtr, false);
 
@@ -1274,5 +1274,5 @@
 {
     // Check for NULL file name
-    PS_ASSERT_PTR_NON_NULL(filename, NULL);
+    PS_ASSERT_STRING_NON_EMPTY(filename, NULL);
 
     // Attempt to open specified file
@@ -1357,5 +1357,5 @@
     bool allocedMD = false;
 
-    PS_ASSERT_PTR_NON_NULL(str, NULL);
+    PS_ASSERT_STRING_NON_EMPTY(str, NULL);
 
     // Initialise nFail, if provided
@@ -1430,5 +1430,5 @@
 psString psMetadataConfigFormat(psMetadata *md)
 {
-    PS_ASSERT_PTR_NON_NULL(md, NULL);
+    PS_ASSERT_METADATA_NON_NULL(md, NULL);
 
     psString format = NULL;
@@ -1465,5 +1465,5 @@
 static psString formatMetadataItem(psMetadataItem *item)
 {
-    PS_ASSERT_PTR_NON_NULL(item, NULL);
+    PS_ASSERT_METADATA_ITEM_NON_NULL(item, NULL);
 
     psString content = NULL;
@@ -1698,5 +1698,5 @@
 static psArray *p_psMetadataKeyArray(psMetadata *md)
 {
-    PS_ASSERT_PTR_NON_NULL(md, NULL);
+    PS_ASSERT_METADATA_NON_NULL(md, NULL);
 
     psArray *keys = psArrayAllocEmpty(psListLength(md->list));
@@ -1732,6 +1732,6 @@
                            const char *filename)
 {
-    PS_ASSERT_PTR_NON_NULL(md, NULL);
-    PS_ASSERT_PTR_NON_NULL(filename, NULL);
+    PS_ASSERT_METADATA_NON_NULL(md, NULL);
+    PS_ASSERT_STRING_NON_EMPTY(filename, NULL);
     FILE *file;
     if ( !(file = fopen(filename, "w")) ) {
@@ -1760,5 +1760,5 @@
                            psMetadata *md)
 {
-    PS_ASSERT_PTR_NON_NULL(md, false);
+    PS_ASSERT_METADATA_NON_NULL(md, false);
     PS_ASSERT_PTR_NON_NULL(stream, false);
     if (fprintf(stream, "\n") <= 0) {
Index: trunk/psLib/src/types/psMetadataItemParse.c
===================================================================
--- trunk/psLib/src/types/psMetadataItemParse.c	(revision 12288)
+++ trunk/psLib/src/types/psMetadataItemParse.c	(revision 12289)
@@ -41,5 +41,5 @@
                               )
 {
-    PS_ASSERT_PTR_NON_NULL(item, false);
+    PS_ASSERT_METADATA_ITEM_NON_NULL(item, false);
 
     switch (item->type) {
@@ -71,5 +71,5 @@
                             )
 {
-    PS_ASSERT_PTR_NON_NULL(item, NAN);
+    PS_ASSERT_METADATA_ITEM_NON_NULL(item, NAN);
 
     switch (item->type) {
@@ -94,5 +94,5 @@
                             )
 {
-    PS_ASSERT_PTR_NON_NULL(item, NAN);
+    PS_ASSERT_METADATA_ITEM_NON_NULL(item, NAN);
 
     switch (item->type) {
@@ -117,5 +117,5 @@
                           )
 {
-    PS_ASSERT_PTR_NON_NULL(item, 0);
+    PS_ASSERT_METADATA_ITEM_NON_NULL(item, 0);
 
     switch (item->type) {
@@ -140,5 +140,5 @@
                             )
 {
-    PS_ASSERT_PTR_NON_NULL(item, 0);
+    PS_ASSERT_METADATA_ITEM_NON_NULL(item, 0);
 
     switch (item->type) {
@@ -163,5 +163,5 @@
                             )
 {
-    PS_ASSERT_PTR_NON_NULL(item, 0);
+    PS_ASSERT_METADATA_ITEM_NON_NULL(item, 0);
 
     switch (item->type) {
@@ -186,5 +186,5 @@
                           )
 {
-    PS_ASSERT_PTR_NON_NULL(item, 0);
+    PS_ASSERT_METADATA_ITEM_NON_NULL(item, 0);
 
     switch (item->type) {
@@ -209,5 +209,5 @@
                             )
 {
-    PS_ASSERT_PTR_NON_NULL(item, 0);
+    PS_ASSERT_METADATA_ITEM_NON_NULL(item, 0);
 
     switch (item->type) {
@@ -232,5 +232,5 @@
                             )
 {
-    PS_ASSERT_PTR_NON_NULL(item, 0);
+    PS_ASSERT_METADATA_ITEM_NON_NULL(item, 0);
 
     switch (item->type) {
@@ -261,5 +261,5 @@
                                   )
 {
-    PS_ASSERT_PTR_NON_NULL(item, NULL);
+    PS_ASSERT_METADATA_ITEM_NON_NULL(item, NULL);
 
     switch (item->type) {
Index: trunk/psLib/src/types/psPixels.c
===================================================================
--- trunk/psLib/src/types/psPixels.c	(revision 12288)
+++ trunk/psLib/src/types/psPixels.c	(revision 12289)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-02-08 21:29:50 $
+ *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-03-07 02:50:15 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -25,4 +25,5 @@
 #include "psError.h"
 
+#define PIXELS_DEFAULT_ADD 10           // Default number to add, if not specified
 
 typedef int(*qsortCompareFcn)(const void *, const void *);
@@ -30,4 +31,5 @@
 static void pixelsFree(psPixels* pixels)
 {
+    assert(pixels);
     psFree(pixels->data);
 }
@@ -118,5 +120,5 @@
 {
     if (growth < 1) {
-        growth = 10;
+        growth = PIXELS_DEFAULT_ADD;
     }
 
@@ -141,12 +143,7 @@
                          const psPixels* pixels)
 {
-    if (pixels == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL,true,_("Input psPixels can not be NULL."));
-        psFree(out);
-        return NULL;
-    }
+    PS_ASSERT_PIXELS_NON_NULL(pixels, NULL);
 
     out = p_psPixelsRealloc(file, lineno, func, out, pixels->n);
-
     memcpy(out->data,pixels->data, pixels->n*sizeof(psPixelCoord));
     out->n = pixels->n;
@@ -160,18 +157,5 @@
                         psMaskType maskVal)
 {
-    // check that the input pixel vector is valid
-    if (pixels == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                _("Input psPixels can not be NULL."));
-        psFree(out);
-        return NULL;
-    }
-    psPixelCoord* data = pixels->data;
-    if (data == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_SIZE, true,
-                _("Input psPixels contains no data."));
-        psFree(out);
-        return NULL;
-    }
+    PS_ASSERT_PIXELS_NON_NULL(pixels, NULL);
 
     float x0 = region.x0;
@@ -224,6 +208,6 @@
     psMaskType** outData = out->data.PS_TYPE_MASK_DATA;
     for (int p = 0; p < length; p++) {
-        float x = data[p].x;
-        float y = data[p].y;
+        float x = pixels->data[p].x;
+        float y = pixels->data[p].y;
         // pixel in region?
         if (x >= x0 && x <= x1 && y >= y0 && y <= y1) {
@@ -239,19 +223,7 @@
                            psMaskType maskVal)
 {
-    if (mask == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                _("Specified mask can not be NULL."));
-        psFree(out);
-        return NULL;
-    }
-    if (mask->type.type != PS_TYPE_MASK) {
-        char* typeStr;
-        PS_TYPE_NAME(typeStr,mask->type.type);
-        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
-                _("Specified mask's type, %s, is invalid.  Should be PS_TYPE_MASK."),
-                typeStr);
-        psFree(out);
-        return NULL;
-    }
+    PS_ASSERT_IMAGE_NON_NULL(mask, NULL);
+    PS_ASSERT_IMAGE_TYPE(mask, PS_TYPE_MASK, NULL);
+
     int numRows = mask->numRows;
     int numCols = mask->numCols;
@@ -302,10 +274,5 @@
                               const psPixels *pixels)
 {
-    if (pixels == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                _("Input psPixels can not be NULL."));
-        psFree(out);
-        return NULL;
-    }
+    PS_ASSERT_PIXELS_NON_NULL(pixels, NULL);
 
     long pixelsN = pixels->n;
@@ -343,8 +310,10 @@
 }
 
-bool p_psPixelsPrint (FILE *fd,
-                      psPixels* pixels,
-                      const char *name)
-{
+bool p_psPixelsPrint(FILE *fd,
+                     psPixels* pixels,
+                     const char *name)
+{
+    PS_ASSERT_PIXELS_NON_NULL(pixels, false);
+
     if (fd == NULL) {
         fd = stdout;
@@ -361,9 +330,4 @@
     }
 
-    if (pixels == NULL) {
-        fprintf(fd,"NULL\n\n");
-        return true;
-    }
-
     long n = pixels->n;
     psPixelCoord* data = pixels->data;
@@ -385,27 +349,12 @@
                  psPixelCoord value)
 {
-    if (pixels == NULL) {
-        psError(PS_ERR_BAD_PARAMETER_NULL, true, _("Input psPixels can not be NULL."));
+    PS_ASSERT_PIXELS_NON_NULL(pixels, false);
+
+    if (position < 0) {
+        position += pixels->n;
+    }
+    if (position < 0 || position > pixels->n) {
+        psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid position: %ld\n", position);
         return false;
-    }
-    if (position > pixels->n) {
-        psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid position.  Number too large\n");
-        return false;
-    }
-    if(position < 0) {
-        position += pixels->n;
-    }
-    if(position < 0) {
-        psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid position.  Negative number too large\n");
-        return false;
-    }
-    if (position == pixels->n) {
-        if (position >= pixels->nalloc) {
-            psError(PS_ERR_BAD_PARAMETER_NULL, true,
-                    "Specified position, %ld, is greater than n+1 of the pixels, %ld.",
-                    position, pixels->nalloc);
-            return false;
-        }
-        pixels->n++;
     }
     pixels->data[position].x = value.x;
@@ -421,21 +370,21 @@
     if (pixels == NULL) {
         psError(PS_ERR_BAD_PARAMETER_NULL, true, _("Input psPixels can not be NULL."));
-        out.x = NAN; //XXX: should be NAN when changed to float
-        out.y = NAN; //XXX: should be NAN when changed to float
+        out.x = NAN;
+        out.y = NAN;
         return out;
+    }
+    if (position < 0) {
+        position += pixels->n;
     }
     if (position >= pixels->n) {
         psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid position.  Number too large\n");
-        out.x = NAN; //XXX: should be NAN when changed to float
-        out.y = NAN; //XXX: should be NAN when changed to float
+        out.x = NAN;
+        out.y = NAN;
         return out;
-    }
-    if (position < 0) {
-        position += pixels->n;
     }
     if (position < 0) {
         psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid position.  Negative number too large\n");
-        out.x = NAN; //XXX: should be NAN when changed to float
-        out.y = NAN; //XXX: should be NAN when changed to float
+        out.x = NAN;
+        out.y = NAN;
         return out;
     }
@@ -447,10 +396,6 @@
 long psPixelsLength(const psPixels *pixels)
 {
-    if ( !psMemCheckPixels((psPixels*)pixels) ) {
-        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
-                "Error:  Specified pixels is not a valid psPixels \n");
-        return -1;
-    }
-    return (pixels->n);
-}
-
+    PS_ASSERT_PIXELS_NON_NULL(pixels, -1);
+    return pixels->n;
+}
+
Index: trunk/psLib/src/types/psPixels.h
===================================================================
--- trunk/psLib/src/types/psPixels.h	(revision 12288)
+++ trunk/psLib/src/types/psPixels.h	(revision 12289)
@@ -6,6 +6,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-02-08 21:29:50 $
+ *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-03-07 02:50:15 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -49,4 +49,12 @@
 psPixels;
 
+#define PS_ASSERT_PIXELS_NON_NULL(NAME, RVAL) \
+if (!(NAME) || !(NAME)->data || (NAME)->n < 0 || (NAME)->nalloc < 0) { \
+    psError(PS_ERR_BAD_PARAMETER_VALUE, true, \
+            "Error: Pixels %s or one of its components is NULL.", \
+            #NAME); \
+    return RVAL; \
+}
+
 #define P_PSPIXELS_SET_NALLOC(pix,n) *(long*)&pix->nalloc = n
 
