Index: trunk/archive/pslib/include/psMetadata.h
===================================================================
--- trunk/archive/pslib/include/psMetadata.h	(revision 753)
+++ trunk/archive/pslib/include/psMetadata.h	(revision 1588)
@@ -22,31 +22,23 @@
 } psMetadataType;
 
-/** Metadata flags (not exclusive with psMetadataType). */
-typedef enum {
-    PS_META_TYPE_MASK =     0xffff,	///< the type enum must fit in this mask
-    PS_META_UNIQUE =       0x10000,	///< the name must be unique (default)
-    PS_META_NON_UNIQUE =   0x20000,	///< the name may be repeated, and should be disambiguated for us
-} psMetadataFlags;
-
 /** A struct to define a single item of metadata */
 typedef struct {
     const int id;			///< unique ID for this item
-    char *restrict name;		///< Name of item
+    const char *name;			///< Name of item
     psMetadataType type;		///< type of this item
-    psMetadataFlags flags;		///< flags associated with this item
-    union {
+    const union {
 	psS32 S32;			///< integer value
 	psF32 F32;			///< floating value
 	psF64 F64;			///< double value
-	void *V;			///< other type
+	void *void;			///< other type
     } data;				///< value of metadata
     char *comment;			///< optional comment ("", not NULL)
-    psDlist *restrict items;		///< list of psMetadataItems with the same name
+    psDlist *items;			///< list of psMetadataItems with the same name
 } psMetadataItem;
 
 /** A set of metadata */
 typedef struct {
-    psDlist *restrict list;		///< list of psMetadataItem
-    psHash *restrict table;		///< hash table of the same metadata
+    psDlist *list;			///< list of psMetadataItem
+    psHash *table;			///< hash table of the same metadata
 } psMetadata;
 
@@ -58,5 +50,5 @@
 /** Constructor */
 psMetadataItem *psMetadataItemAlloc(const char *name, ///< name of new item of metadata (sprintf format)
-				    int format, ///< type of this piece of metadata + flags
+				    psMetadataType type, ///< type of this piece of metadata
 				    const char *comment, ///< comment associated with item
 				    ...)	///< arguments for name and data
@@ -64,11 +56,7 @@
 
 psMetadataItem *psMetadataItemAllocV(const char *name, ///< name of new item of metadata (sprintf format)
-				    int format, ///< type of this piece of metadata + flags
+				    psMetadataType type, ///< type of this piece of metadata
 				    const char *comment, ///< comment associated with item
 				    va_list ap)	///< arguments for name and data
-;
-
-/** Destructor */
-void psMetadataItemFree(psMetadataItem *ms) ///< piece of metadata to destroy
 ;
 
@@ -77,26 +65,35 @@
 ;
 
-/** Destructor */
-void psMetadataFree(psMetadata *md) ///< destroy a set of metadata
-;
-
 /**** Utilities **********************************************************************/
 
 /// Add item to the end of the metadata
-psMetadataItem *psMetadataAppendItem(psMetadata *restrict md, ///< metadata to add to
-				     psMetadataItem *restrict item) ///< Metatdata item to add
+psMetadataItem *psMetadataAddItem(psMetadata *md, ///< metadata to add to
+				  int where, ///< Where to add item
+				  psMetadataItem *item) ///< Metatdata item to add
 ;
 
 /// Add item to the end of the metadata.  Combines psMetadataItemAlloc and psMetadataAppendItem
-psMetadataItem *psMetadataAppend(psMetadata *restrict md, ///< Metadata to add to
-				 const char *name, ///< name of new item of metadata (sprintf format)
-				 int format, ///< type of this piece of metadata + flags
-				 const char *comment, ///< comment associated with item
-				 ...)	///< possible arguments for name format
+psMetadataItem *psMetadataAdd(psMetadata *md, ///< Metadata to add to
+			      int where, ///< Where to add item
+			      const char *name, ///< name of new item of metadata (sprintf format)
+			      int format, ///< type of this piece of metadata + flags
+			      const char *comment, ///< comment associated with item
+			      ...)	///< possible arguments for name format
 ;
 
 /// delete item from the metadata
-psMetadataItem *psMetadataRemove(psMetadata *restrict md, ///< metadata to delete from
-				 const char *restrict key ///< Key to delete
+bool *psMetadataRemove(psMetadata *md,	///< metadata to delete from
+		       int where, 	///< Where to remove
+		       const char *key	///< Key to delete
+    );
+
+/// find the metadata with the specified key
+psMetadataItem *psMetadataLookup(const psMetadata *md, ///< metadata to look up
+				 const char *key ///< Key to find
+    );
+
+/// retrieve the metadata on the basis of entry position
+psMetadataItem *psMetadataGet(const psMetadata *md, ///< metadata to look up
+			      int which	///< entry position
     );
 
@@ -106,18 +103,19 @@
 
 /// get the next item in the sequence
-psMetadataItem *psMetadataGetNext(psMetadata *restrict md, ///< metadata to get from
-				  const char *restrict match, ///< Match this
+psMetadataItem *psMetadataGetNext(psMetadata *md, ///< metadata to get from
+				  const char *match, ///< String to match
 				  int which ///< Which iterator to use
     );
 
-/// find the metadata with the specified key
-psMetadataItem *psMetadataLookup(const psMetadata *restrict md, ///< metadata to look up
-				 const char *restrict key ///< Key to find
+/// get the next item in the sequence
+psMetadataItem *psMetadataGetPrevious(psMetadata *md, ///< metadata to get from
+				      const char *match, ///< String to match
+				      int which ///< Which iterator to use
     );
 
 /// print metadata item to the specified stream
-void psMetadataItemPrint(FILE *fd,		///< file descriptor to write to
-			 const psMetadataItem *restrict md, ///< item of metadata to print
-			 const char *prefix	   ///< print this at the beginning of each line
+void psMetadataItemPrint(FILE *fd,	///< file descriptor to write to
+			 const char *format, ///< Format of output
+			 const psMetadataItem *md ///< item of metadata to print
     );
 
