Index: /trunk/psLib/src/sys/psError.c
===================================================================
--- /trunk/psLib/src/sys/psError.c	(revision 1904)
+++ /trunk/psLib/src/sys/psError.c	(revision 1905)
@@ -10,6 +10,6 @@
  *  @author Eric Van Alst, MHPCC
  *   
- *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-24 21:59:29 $
+ *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-27 20:38:02 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -28,5 +28,4 @@
 static unsigned int errorStackSize = 0;
 pthread_mutex_t lockErrorStack = PTHREAD_MUTEX_INITIALIZER;
-
 
 static void pushErrorStack(psErr* err);
Index: /trunk/psLib/src/sys/psErrorCodes.c
===================================================================
--- /trunk/psLib/src/sys/psErrorCodes.c	(revision 1904)
+++ /trunk/psLib/src/sys/psErrorCodes.c	(revision 1905)
@@ -7,13 +7,16 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-24 01:09:18 $
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-27 20:38:02 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
 
+#include "psError.h"
 #include "psErrorCodes.h"
 #include "psList.h"
 #include "psMemory.h"
+
+#include "psSysUtilsErrors.h"
 
 /* N.B., lines between '//~Start' and '//~End' are automatic generated from
@@ -28,5 +31,5 @@
  */
 
-static psErrorDescription errorDescriptions[] = {
+static psErrorDescription staticErrorCodes[] = {
             {PS_ERR_NONE,"not an error"},
             {PS_ERR_BASE,"base error"},
@@ -46,35 +49,34 @@
         };
 
-static psList* errorCodes = NULL;
-static psErrorDescription* getErrorDescription(psErrorCode code);
+static psList* dynamicErrorCodes = NULL;
+static const psErrorDescription* getErrorDescription(psErrorCode code);
 
 
-static psErrorDescription* getErrorDescription(psErrorCode code)
+static const psErrorDescription* getErrorDescription(psErrorCode code)
 {
     // first, search the static error codes
 
     int n = 0;
-    while(errorDescriptions[n].code != PS_ERR_N_ERR_CLASSES &&
-            errorDescriptions[n].code != code) {
+    while(staticErrorCodes[n].code != PS_ERR_N_ERR_CLASSES &&
+            staticErrorCodes[n].code != code) {
         n++;
     }
 
-    if (errorDescriptions[n].code == code) {
-        return &errorDescriptions[n];
+    if (staticErrorCodes[n].code == code) {
+        return &staticErrorCodes[n];
     } else {
         psErrorDescription* desc;
         // make sure there is a list to search
-        if (errorCodes == NULL) {
+        if (dynamicErrorCodes == NULL) {
             return NULL;
         }
 
         // search dynamic list of error descriptions before giving up.
-        desc = (psErrorDescription*)psListGet(errorCodes,PS_LIST_HEAD);
-        while (desc != NULL && desc->code != code) {
-            desc = (psErrorDescription*)psListGetNext(errorCodes);
-        }
-
-        if (desc != NULL && desc->code == code) {
-            return psMemIncrRefCounter(desc);
+        desc = (psErrorDescription*)psListGet(dynamicErrorCodes,PS_LIST_HEAD);
+        while (desc != NULL) {
+            desc = (psErrorDescription*)psListGetNext(dynamicErrorCodes);
+            if (desc != NULL && desc->code == code) {
+                return desc;
+            }
         }
     }
@@ -89,5 +91,5 @@
     }
 
-    psErrorDescription* desc = getErrorDescription(code);
+    const psErrorDescription* desc = getErrorDescription(code);
 
     if (desc == NULL) {
@@ -98,2 +100,29 @@
 }
 
+void psErrorRegister(const psErrorDescription* errors,
+                     int nerror)
+{
+    if (nerror < 1) {
+        return;
+    }
+
+    if (errors == NULL) {
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psErrorRegister",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psErrorCode_NULL_ERRORDESCRIPTION);
+        return;
+    }
+
+    for (int i=0;i<nerror;i++) {
+        if (! psListAdd(dynamicErrorCodes,
+                        PS_LIST_HEAD,
+                        (void*)&errors[i]) ) {
+
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psErrorRegister",
+                       PS_ERR_UNKNOWN, false,
+                       PS_ERRORTEXT_psErrorCode_ERRORCODE_REGISTER_FAILED,
+                       i);
+        }
+    }
+}
+
Index: /trunk/psLib/src/sys/psErrorCodes.h
===================================================================
--- /trunk/psLib/src/sys/psErrorCodes.h	(revision 1904)
+++ /trunk/psLib/src/sys/psErrorCodes.h	(revision 1905)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-16 18:51:32 $
+ *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-27 20:38:02 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -75,4 +75,16 @@
 );
 
+/** Register an error code
+ *
+ *  Any project needed to use psLib must define the necessary error codes and
+ *  associated message strings.  This function registers an array of error 
+ *  codes with the error handling subsystem.
+ *
+ */
+void psErrorRegister(
+    const psErrorDescription* errors,  ///< Array of error codes to register
+    int nerror                         ///< number of errors in input array
+);
+
 /// @}
 
Index: /trunk/psLib/src/sysUtils/psError.c
===================================================================
--- /trunk/psLib/src/sysUtils/psError.c	(revision 1904)
+++ /trunk/psLib/src/sysUtils/psError.c	(revision 1905)
@@ -10,6 +10,6 @@
  *  @author Eric Van Alst, MHPCC
  *   
- *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-24 21:59:29 $
+ *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-27 20:38:02 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -28,5 +28,4 @@
 static unsigned int errorStackSize = 0;
 pthread_mutex_t lockErrorStack = PTHREAD_MUTEX_INITIALIZER;
-
 
 static void pushErrorStack(psErr* err);
Index: /trunk/psLib/src/sysUtils/psErrorCodes.c
===================================================================
--- /trunk/psLib/src/sysUtils/psErrorCodes.c	(revision 1904)
+++ /trunk/psLib/src/sysUtils/psErrorCodes.c	(revision 1905)
@@ -7,13 +7,16 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-24 01:09:18 $
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-27 20:38:02 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
 
+#include "psError.h"
 #include "psErrorCodes.h"
 #include "psList.h"
 #include "psMemory.h"
+
+#include "psSysUtilsErrors.h"
 
 /* N.B., lines between '//~Start' and '//~End' are automatic generated from
@@ -28,5 +31,5 @@
  */
 
-static psErrorDescription errorDescriptions[] = {
+static psErrorDescription staticErrorCodes[] = {
             {PS_ERR_NONE,"not an error"},
             {PS_ERR_BASE,"base error"},
@@ -46,35 +49,34 @@
         };
 
-static psList* errorCodes = NULL;
-static psErrorDescription* getErrorDescription(psErrorCode code);
+static psList* dynamicErrorCodes = NULL;
+static const psErrorDescription* getErrorDescription(psErrorCode code);
 
 
-static psErrorDescription* getErrorDescription(psErrorCode code)
+static const psErrorDescription* getErrorDescription(psErrorCode code)
 {
     // first, search the static error codes
 
     int n = 0;
-    while(errorDescriptions[n].code != PS_ERR_N_ERR_CLASSES &&
-            errorDescriptions[n].code != code) {
+    while(staticErrorCodes[n].code != PS_ERR_N_ERR_CLASSES &&
+            staticErrorCodes[n].code != code) {
         n++;
     }
 
-    if (errorDescriptions[n].code == code) {
-        return &errorDescriptions[n];
+    if (staticErrorCodes[n].code == code) {
+        return &staticErrorCodes[n];
     } else {
         psErrorDescription* desc;
         // make sure there is a list to search
-        if (errorCodes == NULL) {
+        if (dynamicErrorCodes == NULL) {
             return NULL;
         }
 
         // search dynamic list of error descriptions before giving up.
-        desc = (psErrorDescription*)psListGet(errorCodes,PS_LIST_HEAD);
-        while (desc != NULL && desc->code != code) {
-            desc = (psErrorDescription*)psListGetNext(errorCodes);
-        }
-
-        if (desc != NULL && desc->code == code) {
-            return psMemIncrRefCounter(desc);
+        desc = (psErrorDescription*)psListGet(dynamicErrorCodes,PS_LIST_HEAD);
+        while (desc != NULL) {
+            desc = (psErrorDescription*)psListGetNext(dynamicErrorCodes);
+            if (desc != NULL && desc->code == code) {
+                return desc;
+            }
         }
     }
@@ -89,5 +91,5 @@
     }
 
-    psErrorDescription* desc = getErrorDescription(code);
+    const psErrorDescription* desc = getErrorDescription(code);
 
     if (desc == NULL) {
@@ -98,2 +100,29 @@
 }
 
+void psErrorRegister(const psErrorDescription* errors,
+                     int nerror)
+{
+    if (nerror < 1) {
+        return;
+    }
+
+    if (errors == NULL) {
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psErrorRegister",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psErrorCode_NULL_ERRORDESCRIPTION);
+        return;
+    }
+
+    for (int i=0;i<nerror;i++) {
+        if (! psListAdd(dynamicErrorCodes,
+                        PS_LIST_HEAD,
+                        (void*)&errors[i]) ) {
+
+            psErrorMsg(PS_ERRORNAME_DOMAIN "psErrorRegister",
+                       PS_ERR_UNKNOWN, false,
+                       PS_ERRORTEXT_psErrorCode_ERRORCODE_REGISTER_FAILED,
+                       i);
+        }
+    }
+}
+
Index: /trunk/psLib/src/sysUtils/psErrorCodes.h
===================================================================
--- /trunk/psLib/src/sysUtils/psErrorCodes.h	(revision 1904)
+++ /trunk/psLib/src/sysUtils/psErrorCodes.h	(revision 1905)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-16 18:51:32 $
+ *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-27 20:38:02 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -75,4 +75,16 @@
 );
 
+/** Register an error code
+ *
+ *  Any project needed to use psLib must define the necessary error codes and
+ *  associated message strings.  This function registers an array of error 
+ *  codes with the error handling subsystem.
+ *
+ */
+void psErrorRegister(
+    const psErrorDescription* errors,  ///< Array of error codes to register
+    int nerror                         ///< number of errors in input array
+);
+
 /// @}
 
Index: /trunk/psLib/src/sysUtils/psSysUtilsErrors.dat
===================================================================
--- /trunk/psLib/src/sysUtils/psSysUtilsErrors.dat	(revision 1904)
+++ /trunk/psLib/src/sysUtils/psSysUtilsErrors.dat	(revision 1905)
@@ -38,2 +38,7 @@
 psTrace_MALFORMED_COMPONENT_NAME       Failed to add '%s' to the root component tree; component must start with '.'.
 psTrace_FAILED_TO_ADD_COMPONENT        Failed to set trace level (%d) to '%s'.
+#
+# Error Messages from psErrorCodes.c
+#
+psErrorCode_NULL_ERRORDESCRIPTION      Specified psErrorDescription pointer can not be NULL.
+psErrorCode_ERRORCODE_REGISTER_FAILED  Failed to add input psErrorDescription at array index %d.
Index: /trunk/psLib/src/sysUtils/psSysUtilsErrors.h
===================================================================
--- /trunk/psLib/src/sysUtils/psSysUtilsErrors.h	(revision 1904)
+++ /trunk/psLib/src/sysUtils/psSysUtilsErrors.h	(revision 1905)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-11 00:43:54 $
+ *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-27 20:38:02 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -45,5 +45,7 @@
 #define PS_ERRORTEXT_psTrace_ADD_NULL_COMPONENT "Failed to add null component to trace tree."
 #define PS_ERRORTEXT_psTrace_MALFORMED_COMPONENT_NAME "Failed to add '%s' to the root component tree; component must start with '.'."
-#define PS_ERRORTEXT_psTrace_FAILED_TO_ADD_COMPONENT "Failed to set trace level (%d) to '%s'"
+#define PS_ERRORTEXT_psTrace_FAILED_TO_ADD_COMPONENT "Failed to set trace level (%d) to '%s'."
+#define PS_ERRORTEXT_psErrorCode_NULL_ERRORDESCRIPTION "Specified psErrorDescription pointer can not be NULL."
+#define PS_ERRORTEXT_psErrorCode_ERRORCODE_REGISTER_FAILED "Failed to add input psErrorDescription at array index %d"
 //~End
 
