Index: branches/tap_branches/ppStack/src/ppStack.h
===================================================================
--- branches/tap_branches/ppStack/src/ppStack.h	(revision 25900)
+++ branches/tap_branches/ppStack/src/ppStack.h	(revision 27838)
@@ -9,12 +9,15 @@
 
 #include "ppStackOptions.h"
+#include "ppStackErrorCodes.h"
 
 // Mask values for inputs
 typedef enum {
+    PPSTACK_MASK_NONE   = 0x00,         // Nothing wrong
     PPSTACK_MASK_CAL    = 0x01,         // Photometric calibration failed
-    PPSTACK_MASK_MATCH  = 0x02,         // PSF-matching failed
-    PPSTACK_MASK_CHI2   = 0x04,         // Chi^2 too deviant
-    PPSTACK_MASK_REJECT = 0x08,         // Rejection failed
-    PPSTACK_MASK_BAD    = 0x10,         // Bad image (too many pixels rejected)
+    PPSTACK_MASK_PSF    = 0x02,         // PSF measurement failed
+    PPSTACK_MASK_MATCH  = 0x04,         // PSF-matching failed
+    PPSTACK_MASK_CHI2   = 0x08,         // Chi^2 too deviant
+    PPSTACK_MASK_REJECT = 0x10,         // Rejection failed
+    PPSTACK_MASK_BAD    = 0x20,         // Bad image (too many pixels rejected)
     PPSTACK_MASK_ALL    = 0xff          // All errors
 } ppStackMask;
@@ -24,5 +27,6 @@
     PPSTACK_FILES_PREPARE,              // Files for preparation
     PPSTACK_FILES_CONVOLVE,             // Files for convolution
-    PPSTACK_FILES_COMBINE,              // Files for combination
+    PPSTACK_FILES_STACK,                // Stack files
+    PPSTACK_FILES_UNCONV,               // Unconvolved stack files
     PPSTACK_FILES_PHOT                  // Files for photometry
 } ppStackFileList;
@@ -59,5 +63,5 @@
 // Perform stacking on a readout
 //
-// Returns an array of pixels to inspect for each input image
+// Returns two arrays: pixels to inspect for each input image, and pixels to reject for each input image.
 psArray *ppStackReadoutInitial(const pmConfig *config,   // Configuration
                                pmReadout *outRO,   // Output readout
@@ -65,4 +69,5 @@
                                const psVector *mask, // Mask for input readouts
                                const psVector *weightings, // Weighting factors for each image
+                               const psVector *exposures,  // Exposure time for each image
                                const psVector *addVariance // Additional variance for rejection
     );
@@ -79,9 +84,13 @@
 bool ppStackReadoutFinal(const pmConfig *config,   // Configuration
                          pmReadout *outRO,   // Output readout
+                         pmReadout *expRO,   // Exposure readout
                          const psArray *readouts, // Input readouts
                          const psVector *mask, // Mask for input readouts
                          const psArray *rejected, // Array with pixels rejected in each image
                          const psVector *weightings, // Weighting factors for each image
-                         const psVector *addVariance // Additional variance for rejection
+                         const psVector *exposures,  // Exposure times for each image
+                         const psVector *addVariance, // Additional variance for rejection
+                         bool safety,                 // Enable safety switch?
+                         const psVector *norm         // Normalisations to apply
     );
 
@@ -164,4 +173,6 @@
     );
 
+/// Return an appropriate exit code based on the error code
+psExit ppStackExitCode(psExit exitValue);
 
 #endif
