Index: trunk/archive/pslib/include/psError.h
===================================================================
--- trunk/archive/pslib/include/psError.h	(revision 332)
+++ trunk/archive/pslib/include/psError.h	(revision 332)
@@ -0,0 +1,38 @@
+#if !defined(PS_ERROR_H)
+#define PS_ERROR_H
+#include <stdio.h>
+#include <errno.h>
+/*
+ * Classes of errors that Pan-STARRS uses; more or less the equivalent of the values of errno
+ *
+ * This initialisation is machine-generated from psError.dat
+ */
+#include "psErrorCodes.h"
+
+typedef struct {
+    char *name;				// category of code that caused the error
+    psErrorCode code;			// class of error (equivalent to errno)
+    char *msg;				// the message associated with the error
+} psErr;
+
+typedef enum {
+    PS_OLD_ERROR = 0,			///< This is an old error, and should append to the error stack
+    PS_NEW_ERROR = 1,			///< This is a new error and should clear the error stack
+} psErrorStatus;
+
+/// Prints an error message and doesn't abort; returns code
+int psError(const char *name,		///< Category of code that caused the error
+	    psErrorCode code,		///< class of error (equivalent to errno)
+	    psErrorStatus status,	///< is this a new error?
+	    const char *fmt,		///< Format
+	    ...				///< Extra arguments to use format
+    );
+
+const psErr *psGetError(int which);	// return specified error (or an "error" with code PS_ERR_NONE)
+const psErr *psLastError(void);		// return last error (or an "error" with code PS_ERR_NONE)
+
+void psErrorClear(void);		///< Clear the error stack
+
+void psErrorStackPrint(FILE *fd, const char *fmt, ...);	///< print the errorstack to this file descriptor
+
+#endif
