Index: /trunk/psphot/src/errorCodes.c.in
===================================================================
--- /trunk/psphot/src/errorCodes.c.in	(revision 7336)
+++ /trunk/psphot/src/errorCodes.c.in	(revision 7336)
@@ -0,0 +1,26 @@
+/*
+ * The line
+    { PSPHOT_ERR_$X{ErrorCode}, "$X{ErrorDescription}"},
+ * (without the Xs)
+ * will be replaced by values from errorCodes.dat
+ */
+#include "pslib.h"
+#include "psphotErrorCodes.h"
+
+void psphotErrorRegister(void)
+{
+    static psErrorDescription errors[] = {
+       { PSPHOT_ERR_BASE, "First value we use; lower values belong to psLib" },
+       { PSPHOT_ERR_${ErrorCode}, "${ErrorDescription}"},
+    };
+    static int nerror = PSPHOT_ERR_NERROR - PSPHOT_ERR_BASE; // number of values in enum
+
+    for (int i = 0; i < nerror; i++) {
+       psErrorDescription *tmp = psAlloc(sizeof(psErrorDescription));
+       p_psMemSetPersistent(tmp, true);
+       *tmp = errors[i];
+       psErrorRegister(tmp, 1);
+       psFree(tmp);			/* it's on the internal list */
+    }
+    nerror = 0;			                // don't register more than once
+}
Index: /trunk/psphot/src/errorCodes.dat
===================================================================
--- /trunk/psphot/src/errorCodes.dat	(revision 7336)
+++ /trunk/psphot/src/errorCodes.dat	(revision 7336)
@@ -0,0 +1,11 @@
+#
+# This file is used to generate pmErrorClasses.h
+#
+BASE = 512		First value we use; lower values belong to psLib
+UNKNOWN			Unknown PM error code
+NOT_IMPLEMENTED		Desired feature is not yet implemented
+ARGUMENTS		Incorrect arguments
+CONFIG			Problem in configure files
+FITS			Problem in FITS I/O
+FITS_WCS		Error interpreting FITS WCS information
+PHOTOM			Problem in photometry
Index: /trunk/psphot/src/psphotErrorCodes.h.in
===================================================================
--- /trunk/psphot/src/psphotErrorCodes.h.in	(revision 7336)
+++ /trunk/psphot/src/psphotErrorCodes.h.in	(revision 7336)
@@ -0,0 +1,18 @@
+#if !defined(PSPHOT_ERROR_CODES_H)
+#define PSPHOT_ERROR_CODES_H
+/*
+ * The line
+ *  PSPHOT_ERR_$X{ErrorCode},
+ * (without the X)
+ *
+ * will be replaced by values from errorCodes.dat
+ */
+typedef enum {
+    PSPHOT_ERR_BASE = 512,
+    PSPHOT_ERR_${ErrorCode},
+    PSPHOT_ERR_NERROR
+} actErrorCode;
+
+void psphotErrorRegister(void);
+
+#endif
