Index: /trunk/psLib/src/math/psRegion.c
===================================================================
--- /trunk/psLib/src/math/psRegion.c	(revision 7900)
+++ /trunk/psLib/src/math/psRegion.c	(revision 7901)
@@ -6,4 +6,9 @@
 #include "psRegion.h"
 
+static void regionFree(psRegion *region)
+{
+    // There are non dynamic allocated items
+}
+
 psRegion *psRegionAlloc(float x0,
                         float x1,
@@ -12,4 +17,5 @@
 {
     psRegion *region = psAlloc(sizeof(psRegion)); // New region, to be returned
+    psMemSetDeallocator(region, (psFreeFunc)regionFree);
     // No complex structures, so no special deallocator
     *region = psRegionSet(x0, x1, y0, y1);
@@ -101,2 +107,11 @@
 }
 
+bool psMemCheckRegion(psPtr ptr)
+{
+    if (!is_psType(ptr)) {
+        return false;
+    }
+    return ( psMemGetDeallocator(ptr) == (psFreeFunc)regionFree );
+}
+
+
Index: /trunk/psLib/src/math/psRegion.h
===================================================================
--- /trunk/psLib/src/math/psRegion.h	(revision 7900)
+++ /trunk/psLib/src/math/psRegion.h	(revision 7901)
@@ -27,4 +27,14 @@
                         float y1        ///< the last row of the region + 1.
                        );
+
+/** Checks the type of a particular pointer.
+ *
+ *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
+ *
+ *  @return bool:       True if the pointer matches a psRegion structure, false otherwise.
+ */
+bool psMemCheckRegion(
+    psPtr ptr                          ///< the pointer whose type to check
+);
 
 /** Create a psRegion with the specified attributes.
@@ -70,7 +80,11 @@
 );
 
-// Test if any element of the region is NaN
-bool psRegionIsNaN(psRegion region// Region to check
-                  );
+/** Test if any element of the region is NaN
+ *
+ * @return bool:        True if an element is NaN, otherwise false.
+ */
+bool psRegionIsNaN(
+    psRegion region                    ///< Region to check
+);
 
 #endif
Index: /trunk/psLib/src/sys/psLine.c
===================================================================
--- /trunk/psLib/src/sys/psLine.c	(revision 7900)
+++ /trunk/psLib/src/sys/psLine.c	(revision 7901)
@@ -39,5 +39,7 @@
 }
 
-bool psLineAdd(psLine *line, const char *format, ...)
+bool psLineAdd(psLine *line,
+               const char *format,
+               ...)
 {
     if (!line) {
@@ -58,2 +60,11 @@
     return true;
 }
+
+bool psMemCheckLine(psPtr ptr)
+{
+    if (!is_psType(ptr)) {
+        return false;
+    }
+    return ( psMemGetDeallocator(ptr) == (psFreeFunc)lineFree );
+}
+
Index: /trunk/psLib/src/sys/psLine.h
===================================================================
--- /trunk/psLib/src/sys/psLine.h	(revision 7900)
+++ /trunk/psLib/src/sys/psLine.h	(revision 7901)
@@ -1,9 +1,26 @@
 /** @file  psLine.h
  *
- * the psLine functions allow manipulation of fixed-length lines
+ *
+ *  @brief Contains the declarations of line utility functions
+ *
+ *  @ingroup SysUtils
+ *
+ *  The psLine functions allow manipulation of fixed-length lines.
+ *
+ *  @author Paul Price, IFA
+ *  @author David Robbins, MHPCC
+ *
+ *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-07-14 02:26:25 $
+ *
+ *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
  */
 
 #ifndef PS_LINE_H
 #define PS_LINE_H
+
+/** @addtogroup SysUtils
+ *  @{
+ */
 
 /** Structure to carry a dynamic string */
@@ -16,10 +33,20 @@
 psLine;
 
-/** Allocates a line object of length Nline
+/** Allocates a line object of length Nline.
  *
  *  @return psLine*:        the newly allocated line object.
 */
 psLine *psLineAlloc(
-    long Nline                         ///<
+    long Nline                         ///< length of line object to allocate
+);
+
+/** Checks the type of a particular pointer.
+ *
+ *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
+ *
+ *  @return bool:       True if the pointer matches a psLine structure, false otherwise.
+ */
+bool psMemCheckLine(
+    psPtr ptr                          ///< the pointer whose type to check
 );
 
@@ -32,5 +59,5 @@
 */
 bool psLineInit(
-    psLine *line                       ///<
+    psLine *line                       ///< line to (re-)initialize
 );
 
Index: /trunk/psLib/src/sys/psMemory.c
===================================================================
--- /trunk/psLib/src/sys/psMemory.c	(revision 7900)
+++ /trunk/psLib/src/sys/psMemory.c	(revision 7901)
@@ -8,6 +8,6 @@
 *  @author Robert Lupton, Princeton University
 *
-*  @version $Revision: 1.73 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-06-21 21:40:12 $
+*  @version $Revision: 1.74 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-07-14 02:26:25 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -24,25 +24,13 @@
 #include "psAbort.h"
 #include "psLogMsg.h"
-
 #include "psBitSet.h"
-//#include "psArray.h"
-//#include "psImage.h"
-//#include "psList.h"
-//#include "psLookupTable.h"
-//#include "psHash.h"
-
-//#include "psMetadata.h"
 #include "psFits.h"
 #include "psPixels.h"
-//#include "psScalar.h"
-//#include "psVector.h"
-//#include "psTime.h"
-//#include "psCoord.h"
 #include "psSphereOps.h"
-//#include "psStats.h"
 #include "psMinimizeLMM.h"
 #include "psImageConvolve.h"
 #include "psTime.h"
-
+#include "psLine.h"
+#include "psRegion.h"
 #include "psErrorText.h"
 
@@ -837,7 +825,24 @@
 }
 
+bool is_psType(psPtr ptr)
+{
+    if (ptr == NULL) {
+        return false;
+    }
+    psMemBlock* m = ((psMemBlock* ) ptr) - 1;
+    if (m->startblock != P_PS_MEMMAGIC || m->endblock != P_PS_MEMMAGIC) {
+        return false; //Probably not a psAllocated-Type
+    } else {
+        return true;
+    }
+}
+
 bool psMemCheckType(psDataType type,
                     psPtr ptr)
 {
+    if (!is_psType(ptr)) {
+        return false;
+    }
+
     switch(type) {
     case PS_DATA_ARRAY:
@@ -905,4 +910,12 @@
             break;
         }
+    case PS_DATA_LINE:
+        if ( psMemCheckLine(ptr) )
+            return true;
+        else {
+            psError(PS_ERR_BAD_PARAMETER_VALUE, false,
+                    "Incorrect pointer.  Datatypes do not match.\n");
+            break;
+        }
     case PS_DATA_LIST:
         if ( psMemCheckList(ptr) )
@@ -1017,4 +1030,12 @@
             break;
         }
+    case PS_DATA_REGION:
+        if ( psMemCheckRegion(ptr) )
+            return true;
+        else {
+            psError(PS_ERR_BAD_PARAMETER_VALUE, false,
+                    "Incorrect pointer.  Datatypes do not match.\n");
+            break;
+        }
     case PS_DATA_SCALAR:
         if ( psMemCheckScalar(ptr) )
@@ -1051,4 +1072,12 @@
     case PS_DATA_STATS:
         if ( psMemCheckStats(ptr) )
+            return true;
+        else {
+            psError(PS_ERR_BAD_PARAMETER_VALUE, false,
+                    "Incorrect pointer.  Datatypes do not match.\n");
+            break;
+        }
+    case PS_DATA_STRING:
+        if ( psMemCheckString(ptr) )
             return true;
         else {
Index: /trunk/psLib/src/sys/psMemory.h
===================================================================
--- /trunk/psLib/src/sys/psMemory.h	(revision 7900)
+++ /trunk/psLib/src/sys/psMemory.h	(revision 7901)
@@ -12,6 +12,6 @@
  *  @ingroup MemoryManagement
  *
- *  @version $Revision: 1.56 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-06-21 21:40:12 $
+ *  @version $Revision: 1.57 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-07-14 02:26:25 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -172,4 +172,8 @@
 );
 
+bool is_psType(
+    psPtr ptr
+);
+
 /** Checks the deallocator to see if the pointer matches the desired datatype.
  *
Index: /trunk/psLib/src/sys/psString.c
===================================================================
--- /trunk/psLib/src/sys/psString.c	(revision 7900)
+++ /trunk/psLib/src/sys/psString.c	(revision 7901)
@@ -13,6 +13,6 @@
  *  @author David Robbins, MHPCC
  *
- *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-07-12 21:17:51 $
+ *  @version $Revision: 1.37 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-07-14 02:26:25 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -30,4 +30,27 @@
 #include "psErrorText.h"
 
+static void stringFree(psString string)
+{
+    // There is non dynamic allocated item
+}
+
+psString psStringAlloc(long nChar)
+{
+    if (nChar < 1) {
+        return NULL;
+    }
+    psString string = psAlloc(nChar + 1);
+    psMemSetDeallocator(string, (psFreeFunc)stringFree);
+    return string;
+}
+
+bool psMemCheckString(psPtr ptr)
+{
+    if (!is_psType(ptr)) {
+        return false;
+    }
+    return ( psMemGetDeallocator(ptr) == (psFreeFunc)stringFree );
+}
+
 psString psStringCopy(const char *string)
 {
@@ -231,4 +254,8 @@
         return input;
     }
+    if (!psMemCheckString(input)) {
+        return input;
+    }
+
 
     // replace == NULL is valid: it just means that we strip out the key
Index: /trunk/psLib/src/sys/psString.h
===================================================================
--- /trunk/psLib/src/sys/psString.h	(revision 7900)
+++ /trunk/psLib/src/sys/psString.h	(revision 7901)
@@ -14,6 +14,6 @@
  *  @author David Robbins, MHPCC
  *
- *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-07-10 20:15:43 $
+ *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-07-14 02:26:25 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -39,4 +39,22 @@
  *  @{
  */
+
+/** Allocates a new psString.
+ *
+ *  @return psString:       Newly allocated string of length n.
+ */
+psString psStringAlloc(
+    long nChar                         ///< Size of psString to allocate.
+);
+
+/** Checks the type of a particular pointer.
+ *
+ *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
+ *
+ *  @return bool:       True if the pointer matches a psString structure, false otherwise.
+ */
+bool psMemCheckString(
+    psPtr ptr                          ///< the pointer whose type to check
+);
 
 /** Copies the input string
@@ -145,5 +163,4 @@
 );
 
-
 /** @} */// Doxygen - End of SystemGroup Functions
 
Index: /trunk/psLib/src/sys/psType.h
===================================================================
--- /trunk/psLib/src/sys/psType.h	(revision 7900)
+++ /trunk/psLib/src/sys/psType.h	(revision 7901)
@@ -10,6 +10,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-06-10 02:28:17 $
+*  @version $Revision: 1.51 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-07-14 02:26:25 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -118,4 +118,5 @@
     PS_DATA_IMAGE,                     ///< psImage
     PS_DATA_KERNEL,                    ///< psKernel
+    PS_DATA_LINE,                      ///< psLine
     PS_DATA_LIST,                      ///< psList
     PS_DATA_LOOKUPTABLE,               ///< psLookupTable
Index: /trunk/psLib/test/sys/Makefile.am
===================================================================
--- /trunk/psLib/test/sys/Makefile.am	(revision 7900)
+++ /trunk/psLib/test/sys/Makefile.am	(revision 7901)
@@ -12,5 +12,6 @@
 	tst_psString \
 	tst_psTrace \
-	tap_psStringSubstitute
+	tap_psStringSubstitute \
+	tst_psLine
 
 tst_psAbort_SOURCES =  tst_psAbort.c
@@ -21,4 +22,5 @@
 tst_psString_SOURCES =  tst_psString.c
 tst_psTrace_SOURCES =  tst_psTrace.c
+tst_psLine_SOURCES =  tst_psLine.c
 
 tap_psStringSubstitute_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/test/tap/src
Index: /trunk/psLib/test/sys/tst_psLine.c
===================================================================
--- /trunk/psLib/test/sys/tst_psLine.c	(revision 7901)
+++ /trunk/psLib/test/sys/tst_psLine.c	(revision 7901)
@@ -0,0 +1,142 @@
+/** @file  tst_psLine.c
+ *
+ *  @brief Test driver for psLine functions
+ *
+ *  @author  dRob, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2006-07-14 02:26:25 $
+ *
+ *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include "pslib_strict.h"
+#include "psTest.h"
+
+static psS32 testLineAlloc(void);
+static psS32 testLineInit(void);
+static psS32 testLineAdd(void);
+static psS32 testLineChk(void);
+
+testDescription tests[] = {
+                              {testLineAlloc, 0, "Verify Line Alloc/Free", 0, false},
+                              {testLineInit, 1, "Verify Line Init", 0, false},
+                              {testLineAdd, 2, "Verify Line Add", 0, false},
+                              {testLineChk, 3, "Verify Line MemCheck", 0, false},
+                              {NULL}
+                          };
+
+psS32 main( psS32 argc, char* argv[] )
+{
+    psLogSetLevel( PS_LOG_INFO );
+
+    return ( ! runTestSuite( stderr, "psLine", tests, argc, argv ) );
+}
+
+psS32 testLineAlloc(void)
+{
+    psLine *lineline = NULL;
+    lineline = psLineAlloc(20);
+
+    if (lineline->NLINE != 20) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                "psLine set NLINE parameter incorrectly during Allocation!\n");
+        return 2;
+    }
+    if (lineline->Nline != 0) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                "psLine set Nline parameter incorrectly during Allocation!\n");
+        return 2;
+    }
+    strncpy(lineline->line, "Hello World", 20);
+    if (strncmp(lineline->line, "Hello World", 20)) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                "psLine was unable to store a simple string!\n");
+        return 3;
+    }
+
+    psFree(lineline);
+
+    return 0;
+}
+
+psS32 testLineInit(void)
+{
+    psLine *line = NULL;
+    //Return false for NULL input
+    if (psLineInit(line) ) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                "psLineInit failed.  Expected false for NULL psLine input.\n");
+        return 1;
+    }
+    //Allocate a line and return true on Init
+    line = psLineAlloc(1);
+    if(!psLineInit(line) ) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                "psLineInit failed.  Expected true for valid psLine input.\n");
+        return 2;
+    }
+    if (line->NLINE != 1 || line->Nline != 0) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                "psLineInit failed to return the correct line parameters.\n");
+        return 3;
+    }
+
+    psFree(line);
+
+    return 0;
+}
+
+psS32 testLineAdd(void)
+{
+    psLine *line = NULL;
+    //Return false for NULL input
+    if (psLineAdd(line, "Hello World") ) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                "psLineAdd failed.  Expected false for NULL psLine input.\n");
+        return 1;
+    }
+    //Allocate and return true for valid input.
+    line = psLineAlloc(20);
+    if (!psLineAdd(line, "Hello %s", "World") ) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                "psLineAdd failed.  Expected true for valid psLine input.\n");
+        return 2;
+    }
+    if (line->NLINE != 20 || line->Nline != 11) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                "psLineAdd failed to return the correct line parameters.\n");
+        return 3;
+    }
+    if (strncmp(line->line, "Hello World", 20)) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                "psLineAdd failed to store the correct line string.\n");
+        printf("\n  %s\n", line->line);
+        return 4;
+    }
+
+    psFree(line);
+
+    return 0;
+}
+
+psS32 testLineChk(void)
+{
+    psLine *line = NULL;
+    //Return false for Null input line
+    if (psMemCheckLine(line)) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                "psMemCheckLine failed to return false for NULL line input.\n");
+        return 1;
+    }
+    line = psLineAlloc(1);
+    if (!psMemCheckLine(line)) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                "psMemCheckLine failed to return true for valid line input.\n");
+        return 2;
+    }
+    psFree(line);
+
+    return 0;
+}
Index: /trunk/psLib/test/sys/tst_psString.c
===================================================================
--- /trunk/psLib/test/sys/tst_psString.c	(revision 7900)
+++ /trunk/psLib/test/sys/tst_psString.c	(revision 7901)
@@ -20,6 +20,6 @@
  *  @author  Eric Van Alst, MHPCC
  *
- *  @version $Revision: 1.10 $  $Name: not supported by cvs2svn $
- *  @date  $Date: 2006-07-12 21:25:39 $
+ *  @version $Revision: 1.11 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2006-07-14 02:26:25 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -53,4 +53,5 @@
 static psS32 testStrSplit00(void);
 static psS32 testNULLStrings(void);
+static psS32 testStrCheck(void);
 
 testDescription tests[] = {
@@ -74,4 +75,5 @@
                               {testStrSplit00,15, "Test String Splitting", 0, false},
                               {testNULLStrings,666, "Test NULL String Error Handling", 0, false},
+                              {testStrCheck,16, "Test String Allocation and MemCheck", 0, false},
                               {NULL}
                           };
@@ -709,2 +711,30 @@
     return 0;
 }
+
+psS32 testStrCheck(void)
+{
+    psString str = NULL;
+    str = psStringAlloc(10);
+    strcpy(str, "Hello");
+    if (!psMemCheckString(str)) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                "psString wasn't properly allocated!\n");
+        return 1;
+    }
+    if (!psMemCheckType(PS_DATA_STRING, str)) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                "psString wasn't properly allocated!\n");
+        return 2;
+    }
+    psFree(str);
+
+    char charStr[10];
+    if (psMemCheckType(PS_DATA_STRING, charStr)) {
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                "Input string is not a psDataType!!!  (Should have returned false)\n");
+        return 3;
+    }
+
+    return 0;
+}
+
Index: /trunk/psLib/test/sys/verified/tst_psString.stderr
===================================================================
--- /trunk/psLib/test/sys/verified/tst_psString.stderr	(revision 7900)
+++ /trunk/psLib/test/sys/verified/tst_psString.stderr	(revision 7901)
@@ -175,2 +175,11 @@
 ---> TESTPOINT PASSED (psString{Test NULL String Error Handling} | tst_psString.c)
 
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psString.c                                             *
+*            TestPoint: psString{Test String Allocation and MemCheck}              *
+*             TestType: Positive                                                   *
+\**********************************************************************************/
+
+
+---> TESTPOINT PASSED (psString{Test String Allocation and MemCheck} | tst_psString.c)
+
Index: /trunk/psLib/test/types/verified/tst_psMetadata_06.stdout
===================================================================
--- /trunk/psLib/test/types/verified/tst_psMetadata_06.stdout	(revision 7900)
+++ /trunk/psLib/test/types/verified/tst_psMetadata_06.stdout	(revision 7901)
@@ -9,5 +9,5 @@
 Key Name:  myItem1  Key mdType: 0x00000104  Key Value:             222  Key Comment: I am a signed integer
 Key Name:  myItem2  Key mdType: 0x00000104  Key Value:             333  Key Comment: I am a signed integer
-Key Name:  myItem2  Key mdType: 0x00010009  Key Value:          psList  Key Comment: I am a list
+Key Name:  myItem2  Key mdType: 0x0001000a  Key Value:          psList  Key Comment: I am a list
 
 ---> TESTPOINT PASSED (psMetadata{Test A - Allocate metadata and items} | tst_psMetadata_06.c)
