Index: /trunk/archive/pslib/include/psAstrom.h
===================================================================
--- /trunk/archive/pslib/include/psAstrom.h	(revision 197)
+++ /trunk/archive/pslib/include/psAstrom.h	(revision 198)
@@ -10,4 +10,5 @@
 /* Include colour definitions */
 #include "psColour.h"
+#include "psMatrix.h"
 
 
@@ -21,5 +22,5 @@
     int xyColourOrder;		        //!< Spatial (x,y) order of polynomial in colour times x and y
     int xyMagOrder;		        //!< Spatial (x,y) order of polynomial in magnitude times x and y
-    enum psColourRef colourRef;	        //!< Colour reference
+    psColourRef colourRef;	        //!< Colour reference
     psDoubleArray *restrict coeff;	//!< Coefficients of astrometric solution
     psDoubleArray *restrict coeffErr;	//!< Error in coefficients
@@ -28,10 +29,10 @@
 /** Constructor */
 psAstromCoeffs *
-psAstromCoeffsAlloc(int xyOrder,		//!< Spatial (x,y) order of polynomial
-		  int colourOrder,	//!< Order of polynomial in colour
-		  int magOrder,		//!< Order of polynomial in magnitude
-		  int xyColourOrder,	//!< Spatial (x,y) order of polynomial in colour times x and y
-		  int xyMagOrder,	//!< Spatial (x,y) order of polynomial in magnitude times x and y
-		  enum psColourRef colourRef //!< Colour reference
+psAstromCoeffsAlloc(int xyOrder,	//!< Spatial (x,y) order of polynomial
+		    int colourOrder,	//!< Order of polynomial in colour
+		    int magOrder,	//!< Order of polynomial in magnitude
+		    int xyColourOrder,	//!< Spatial (x,y) order of polynomial in colour times x and y
+		    int xyMagOrder,	//!< Spatial (x,y) order of polynomial in magnitude times x and y
+		    psColourRef colourRef //!< Colour reference
     );
 
@@ -112,5 +113,5 @@
     float rotation;			//!< Rotation of OTA on the focal plane.  Specified from +x through +y
     psCellDescriptionArray *restrict cells; //!< Cell descriptions
-    psOTAAstrom *astrom;		//!< OTA astrometry
+    struct psOTAAstrom *astrom;		    //!< OTA astrometry
 } psOTADescription;
 
@@ -157,11 +158,11 @@
 
 /** Constructor */
-psAstrom *
-psAstromAlloc(const psTelPointing *telescope //!< Telescope pointing, used to initialise the tp data.
-    );
-
-/** Destructor */
-void
-psAstromFree(psAstrom *restrict myAstrom	//!< Object to destroy
+psOTAAstrom *
+psOTAAstromAlloc(const psTelPointing *telescope //!< Telescope pointing, used to initialise the tp data.
+    );
+
+/** Destructor */
+void
+psOTAAstromFree(psOTAAstrom *restrict myAstrom	//!< Object to destroy
     );
 
@@ -204,5 +205,5 @@
 float
 psGetParallactic(const psSkyPos *restrict position, //!< Position on the sky
-		 real siderealTime	//!< Sidereal time
+		 float siderealTime	//!< Sidereal time
 		 );
 
@@ -210,5 +211,5 @@
 float
 psGetRefraction(float colour,		//!< Colour of object
-		enum psColourRef colourRef; //!< Colour reference
+		psColourRef colourRef,	//!< Colour reference
 		psTelPointing telescope	//!< Telescope pointing information, for airmass, temp and pressure
     );
Index: /trunk/archive/pslib/include/psColour.h
===================================================================
--- /trunk/archive/pslib/include/psColour.h	(revision 197)
+++ /trunk/archive/pslib/include/psColour.h	(revision 198)
@@ -7,5 +7,5 @@
  * 0.69 mag, y = 0.69 mag, w = 0.80 mag
  */
-enum {
+typedef enum {
     PS_COLOUR_NO_INFO,			//!< No colour information
     PS_COLOUR_G_MINUS_R,		//!< Reference is g-r = 0.5 mag
Index: /trunk/archive/pslib/include/psImages.h
===================================================================
--- /trunk/archive/pslib/include/psImages.h	(revision 197)
+++ /trunk/archive/pslib/include/psImages.h	(revision 198)
@@ -1,4 +1,10 @@
 # ifndef PS_IMAGES_H
 # define PS_IMAGES_H
+
+#include "psStdArrays.h"
+#include "psUtils.h"
+#include "psObjects.h"
+#include "psMetaData.h"
+#include "psStats.h"
 
 /** General image manipulation functions.
@@ -15,5 +21,4 @@
 
 PS_DECLARE_ARRAY_TYPE(psFloatArray);	///< Declare an array of real vectors (psFloatArrayArray).
-PS_CREATE_ARRAY_TYPE(psFloatArray); 	///< Create the data type (psFloatArrayArray).
 
 typedef unsigned char  psU8;		///< BITPIX 8   (unsigned short)
@@ -34,9 +39,9 @@
     psF32 **rows_f32;			///< pointers to psF32 data 
     psF64 **rows_f64;			///< pointers to psF64 data 
-    psImage *parent;			///< parent, if a subimage 
-    psImage *children;			///< children of this region 
+    struct psImage *parent;		///< parent, if a subimage 
+    struct psImage *children;		///< children of this region 
     int Nchildren;			///< number of subimages 
-    psDlist md;				///< metadata associated with image
-    psObjectTable objtable;		///< objects associated with image
+    struct psMetaDataSet *md;		///< metadata associated with image
+    psObjectArray *objtable;		///< objects associated with image
 } psImage;
 
@@ -75,4 +80,7 @@
 
 /*** various image pixel extractions ***/
+
+typedef enum { PS_STAT_MODE_MEDIAN } psStatMode;
+
 /// Extract pixels from rectlinear region to a vector.
 psFloatArray *
@@ -82,6 +90,6 @@
 	      int nx, 			///< width of region in x
 	      int ny, 			///< width of region in y
-	      enum direction, 		///< direction of vector along slice
-	      enum statmode		///< statistic applied to pixel group to find output value
+	      int direction,		///< direction of vector along slice
+	      psStatMode statmode	///< statistic applied to pixel group to find output value
 );
 
@@ -94,6 +102,6 @@
 	    float ye, 			///< ending y coord of cut
 	    float dw, 			///< width of cut
-	    enum statmode		///< statistic applied to pixel group to find output value
-);
+	    psStatMode statmode		///< statistic applied to pixel group to find output value
+    );
 
 /// Extract radial annulii data to a vector.
@@ -104,6 +112,6 @@
 		  float radius, 	///< outer radius of annulii
 		  float dr,		///< radial step size of annulii
-		  enum statmode		///< statistic applied to pixel group to find output value
-);
+		  psStatMode statmode	///< statistic applied to pixel group to find output value
+    );
 
 /// Extract a 2-d contour from an image at the given threshold.
@@ -114,10 +122,4 @@
 );
 
-/// Extract a 2-d contour from an image at the given threshold.
-psSpanArray *
-psImageContour (psImage *input, 	///< create contour for this image
-		float threshold		///<  image at this threshold
-);
-
 /*** various image geometry manipulation ***/
 /// Rebin image to new scale.
@@ -125,5 +127,5 @@
 psImageRebin (psImage *input, 		///< rebin this image
 	      float scale, 		///< rebinning scale: doutput = scale*dinput
-	      enum statmode		///< statistic used in performing interpolation / summing
+	      psStatMode statmode	///< statistic used in performing interpolation / summing
 );
 
@@ -155,16 +157,16 @@
 /// How to represent the output values?
 void
-psImageGetStats (psImage *input, enum statmode);
+psImageGetStats (psImage *input, psStatMode statmode);
 
 /// Construct a histogram from an image (or subimage).
 psHistogram *
-psImageHistogram (psHistogram,		///< input histogram description & target
-		  psImage *input,	///< determine histogram of this image
-);
+psImageHistogram (psHistogram *hist,	///< input histogram description & target
+		  psImage *input	///< determine histogram of this image
+    );
 
 /// Fit a 2-D polynomial surface to an image.
 psFloatArrayArray *
 psImageFitPolynomial (psImage *input, 	///< image to fit
-		      int xorder	///< order of polynomial in x-dir
+		      int xorder,	///< order of polynomial in x-dir
 		      int yorder	///< order of polynomial in y-dir
 );
@@ -207,22 +209,22 @@
 /// Write an image section to named file (which may exist).
 psImage *
-psImageFWriteSection (psImage *input,	///< image to write out
-		      int x, 		///< starting x coord of region		   
-		      int y, 		///< starting y coord of region		   
-		      int z, 		///< plane of interest			   
-		      char *extname, 	///< MEF extension name			   
-		      FILE *f		///< file descriptor to write data to		   
+psImageFWriteSection(psImage *input,	///< image to write out
+		     int x, 		///< starting x coord of region		   
+		     int y, 		///< starting y coord of region		   
+		     int z, 		///< plane of interest			   
+		     char *extname, 	///< MEF extension name			   
+		     FILE *f		///< file descriptor to write data to		   
 );
 
 /// Read only header from image file.
-psMetadata *
-psImageReadHeader (psMetadata *output, 	///< read data to this structure
-		   char *extname, 	///< MEF extension name ("PHU" for primary header)
-		   char *filename	///< file to read from
+struct psMetadata *
+psImageReadHeader(struct psMetadata *output, 	///< read data to this structure
+		  char *extname, 	///< MEF extension name ("PHU" for primary header)
+		  char *filename	///< file to read from
 ); 
 
 /// Read only header from image file descriptor.
-psMetadata *
-psImageFReadHeader (psMetadata *output, 	///< read data to this structure
+struct psMetadata *
+psImageFReadHeader (struct psMetadata *output, ///< read data to this structure
 		   char *extname, 	///< MEF extension name ("PHU" for primary header)
 		   FILE *f		///< file descriptor to read from
@@ -233,5 +235,5 @@
 psImage *
 psImageFFT (psImage *input, 		///< image to FFT
-	    enum direction		///< FFT direction 
+	    int direction		///< FFT direction 
 );
 
Index: /trunk/archive/pslib/include/psObjects.h
===================================================================
--- /trunk/archive/pslib/include/psObjects.h	(revision 197)
+++ /trunk/archive/pslib/include/psObjects.h	(revision 198)
@@ -17,5 +17,4 @@
 #include "psImages.h"
 
-
 /***********************************************************************************************************/
 
@@ -31,5 +30,5 @@
     float sky, skyErr;			//!< Local sky level, and associated error
     float colour, colourErr;		//!< Colour and associated error, if known
-    enum psColourRef colourRef;		//!< Colour reference
+    psColourRef colourRef;		//!< Colour reference
     psBitMask *quality;			//!< Bit mask for quality information
 } psObject;
@@ -53,5 +52,5 @@
 /** Associates objects on an image with the image */
 typedef struct {
-    const psImage *image;		//!< Image that produced the objects, which has metadata we need
+    const struct psImage *image;	//!< Image that produced the objects, which has metadata we need
     psObjectArray *objects;		//!< The objects
 } psImageObjects;
@@ -59,7 +58,7 @@
 /** Constructor */
 psImageObjects *
-psImageObjectsAlloc(const psImage *image,	//!< Image that produced the objects, which has metadata we need
-		  psObjectArray *objects //!< The objects
-		  );
+psImageObjectsAlloc(const struct psImage *image, //!< Image that produced the objects, with needed metadata
+		    psObjectArray *objects //!< The objects
+    );
 
 /** Destructor */
@@ -72,5 +71,5 @@
 /** Objects from a catalogue */
 typedef struct {
-    enum psCatalogue catalogue;		//!< Source catalogue from which objects come
+    psCatalogue catalogue;		//!< Source catalogue from which objects come
     psObjectArray *object;		//!< The objects
 } psCatalogueObjects;
@@ -79,10 +78,10 @@
 psCatalogueObjects *
 psCatalogueObjectsAlloc(enum psCatalogue *catalogue, //!< Source catalogue
-		      psObjectArray *objects //!< The objects
-		      );
+			psObjectArray *objects //!< The objects
+    );
 
 /** Destructor */
 void
-psCatalogueObjectsFree(psCatalogeObjects *restrict myCatalogueObjects //!< Object to destroy
+psCatalogueObjectsFree(psCatalogueObjects *restrict myCatalogueObjects //!< Object to destroy
 		      );
 
@@ -91,5 +90,5 @@
 /** A "super" object --- an object with multiple detections in different images */
 typedef struct {
-    const psImageArray *images;		//!< Images that provided the different measurements
+    const struct  psImageArray *images;	//!< Images that provided the different measurements
     const psObjectArray *objects;	//!< Individual object measurements
 
@@ -103,7 +102,7 @@
 /** Constructor */
 psSuperObject *
-psSuperObjectAlloc(const psImageArray *images, //!< The images with the measurements
-		 const psObjectArray *objects //!< Object measurements
-		 );
+psSuperObjectAlloc(const struct psImageArray *images, //!< The images with the measurements
+		   const psObjectArray *objects //!< Object measurements
+    );
 
 /** Destructor */
@@ -167,5 +166,5 @@
 		     float magLower,	//!< Lower bound for colour
 		     float magUpper,	//!< Upper bound for colour
-		     enum psColourRef colourRef	//!< Only select those with this colour reference
+		     psColourRef colourRef //!< Only select those with this colour reference
 		     );
 
Index: /trunk/archive/pslib/include/psPosition.h
===================================================================
--- /trunk/archive/pslib/include/psPosition.h	(revision 197)
+++ /trunk/archive/pslib/include/psPosition.h	(revision 198)
@@ -4,4 +4,5 @@
 /* Include array declaration macros */
 #include "psArray.h"
+#include "psObjects.h"
 
 /***********************************************************************************************************/
@@ -16,5 +17,5 @@
 
 /** Planets */
-enum {
+typedef enum {
     PS_MERCURY = 1,
     PS_VENUS = 2,
@@ -28,5 +29,5 @@
 
 /** Catalogues */
-enum {
+typedef enum {
     PS_PANSTARRS,			//!< Pan-STARRS object catalogue
     PS_USNO,				//!< USNO-B1 catalogue
@@ -148,15 +149,15 @@
 /** Get Planet positions */
 psSkyPos *
-psGetPlanetPos(enum psPlanetNum myPlanetNum, //!< Number for planet
+psGetPlanetPos(psPlanetNum myPlanetNum, //!< Number for planet
 	       float mjd		//!< MJD to get position for
 	       );
 
 /** Get star list from catalogue */
-psObjectArray *
+struct psObjectArray *
 psReadStarCatalogue(double ra,		//!< RA of centre of search
 		    double dec,		//!< Declination of centre of search
 		    float radius,	//!< Radius of search for stars in catalogue
 		    float mjd,		//!< The epoch (in MJD) for which to get positions
-		    enum psCatalogue myCatalogue //!< The catalogue to use
+		    psCatalogue myCatalogue //!< The catalogue to use
     );
 
@@ -186,2 +187,3 @@
 
 /***********************************************************************************************************/
+#endif
Index: /trunk/archive/pslib/include/psStdArrays.h
===================================================================
--- /trunk/archive/pslib/include/psStdArrays.h	(revision 197)
+++ /trunk/archive/pslib/include/psStdArrays.h	(revision 198)
@@ -2,4 +2,5 @@
 #define PS_TYPES_H
 
+#include <complex.h>
 #include "psArray.h"
 
