Index: trunk/psLib/src/sys/psMemory.h
===================================================================
--- trunk/psLib/src/sys/psMemory.h	(revision 1406)
+++ trunk/psLib/src/sys/psMemory.h	(revision 1407)
@@ -1,4 +1,5 @@
 #if !defined(PS_MEMORY_H)
-#define PS_MEMORY_H
+#    define PS_MEMORY_H
+
 /** @file  psMemory.h
  *
@@ -14,13 +15,13 @@
  *  @ingroup MemoryManagement
  *
- *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
 
-#include <stdio.h>                      // needed for FILE
-#include <stdbool.h>
-#include <pthread.h>                    // we need a mutex to make this stuff thread safe.
+#    include <stdio.h>                     // needed for FILE
+#    include <stdbool.h>
+#    include <pthread.h>                   // we need a mutex to make this stuff thread safe.
 
 /** @addtogroup MemoryManagement
@@ -53,5 +54,5 @@
 
 /// typedef for deallocator.
-typedef void (*psFreeFcn)(void* ptr);
+typedef void (*psFreeFcn) (void *ptr);
 
 /** Book-keeping data for storage allocator.
@@ -62,15 +63,15 @@
 typedef struct psMemBlock
 {
-    const void* startblock;            ///< initialised to p_psMEMMAGIC
-    struct psMemBlock* previousBlock;  ///< previous block in allocation list
-    struct psMemBlock* nextBlock;      ///< next block allocation list
-    psFreeFcn freeFcn;                 ///< deallocator.  If NULL, use generic deallocation.
-    size_t  userMemorySize;            ///< the size of the user-portion of the memory block
-    const psMemoryId id;               ///< a unique ID for this allocation
-    const char* file;                  ///< set from __FILE__ in e.g. p_psAlloc
-    const int lineno;                  ///< set from __LINE__ in e.g. p_psAlloc
-    pthread_mutex_t   refCounterMutex; ///< mutex to ensure exclusive access to reference counter
-    psReferenceCount refCounter;       ///< how many times pointer is referenced
-    const void* endblock;              ///< initialised to p_psMEMMAGIC
+    const void *startblock;     // /< initialised to p_psMEMMAGIC
+    struct psMemBlock *previousBlock;   // /< previous block in allocation list
+    struct psMemBlock *nextBlock;       // /< next block allocation list
+    psFreeFcn freeFcn;          // /< deallocator.  If NULL, use generic deallocation.
+    size_t userMemorySize;      // /< the size of the user-portion of the memory block
+    const psMemoryId id;        // /< a unique ID for this allocation
+    const char *file;           // /< set from __FILE__ in e.g. p_psAlloc
+    const int lineno;           // /< set from __LINE__ in e.g. p_psAlloc
+    pthread_mutex_t refCounterMutex;    // /< mutex to ensure exclusive access to reference counter
+    psReferenceCount refCounter;        // /< how many times pointer is referenced
+    const void *endblock;       // /< initialised to p_psMEMMAGIC
 }
 psMemBlock;
@@ -81,7 +82,6 @@
  *  @ingroup memCallback
  */
-typedef psMemoryId (*psMemAllocateCallback)(
-    const psMemBlock *ptr           ///< the psMemBlock just allocated
-);
+typedef psMemoryId(*psMemAllocateCallback) (const psMemBlock * ptr      // /< the psMemBlock just allocated
+                                           );
 
 /** prototype of memory free callback used by memory functions
@@ -90,7 +90,6 @@
  *  @ingroup memCallback
  */
-typedef psMemoryId (*psMemFreeCallback)(
-    const psMemBlock *ptr           ///< the psMemBlock being freed
-);
+typedef psMemoryId(*psMemFreeCallback) (const psMemBlock * ptr  // /< the psMemBlock being freed
+                                       );
 
 /** prototype of a callback used in error conditions
@@ -101,9 +100,9 @@
  *  @ingroup memCallback
  */
-typedef void (*psMemProblemCallback)(
-    const psMemBlock *ptr,          ///< the pointer to the problematic memory block.
-    const char *file,               ///< the file in which the problem originated
-    int lineno                      ///< the line number in which the problem originated
-);
+typedef void (*psMemProblemCallback) (const psMemBlock * ptr,   // /< the pointer to the problematic memory
+                                      // block.
+                                      const char *file, // /< the file in which the problem originated
+                                      int lineno        // /< the line number in which the problem originated
+                                     );
 
 /** prototype of a callback function used when memory runs out
@@ -115,7 +114,6 @@
  *  @ingroup memCallback
  */
-typedef void *(*psMemExhaustedCallback)(
-    size_t size                     //< the size of buffer required
-);
+typedef void *(*psMemExhaustedCallback) (size_t size    // < the size of buffer required
+                                        );
 
 /** Memory allocation.  This operates much like malloc(), but is guaranteed to return a non-NULL value.
@@ -124,22 +122,19 @@
  *  @see psFree 
  */
-#ifdef DOXYGEN
-void* psAlloc(
-    size_t size                     ///< Size required
-);
-#else
-void* p_psAlloc(
-    size_t size,                    ///< Size required
-    const char *file,               ///< File of call
-    int lineno                      ///< Line number of call
-);
-
-void p_psMemSetDeallocator(void* ptr, psFreeFcn freeFcn);
-psFreeFcn p_psMemGetDeallocator(void* ptr);
+#    ifdef DOXYGEN
+void *psAlloc(size_t size       // /< Size required
+             );
+#    else
+    void *p_psAlloc(size_t size,    // /< Size required
+                    const char *file,       // /< File of call
+                    int lineno      // /< Line number of call
+                   );
+
+void p_psMemSetDeallocator(void *ptr, psFreeFcn freeFcn);
+psFreeFcn p_psMemGetDeallocator(void *ptr);
 
 /// Memory allocation. psAlloc sends file and line number to p_psAlloc.
-#define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__)
-#endif
-
+#        define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__)
+#    endif
 
 /** Memory re-allocation.  This operates much like realloc(), but is guaranteed to return a non-NULL value.
@@ -148,38 +143,37 @@
  *  @see psAlloc, psFree
  */
-#ifdef DOXYGEN
-void* psRealloc(void *ptr               ///< Pointer to re-allocate
-                size_t size,            ///< Size required
+#    ifdef DOXYGEN
+void *psRealloc(void *ptr       // /< Pointer to re-allocate
+                size_t size,    // /< Size required
                );
-#else
-void* p_psRealloc(void *ptr,            ///< Pointer to re-allocate
-                  size_t size,          ///< Size required
-                  const char *file,     ///< File of call
-                  int lineno            ///< Line number of call
+#    else
+    void *p_psRealloc(void *ptr,    // /< Pointer to re-allocate
+                      size_t size,  // /< Size required
+                      const char *file,     // /< File of call
+                      int lineno    // /< Line number of call
+                     );
+
+/// Memory re-allocation.  psRealloc sends file and line number to p_psRealloc.
+#        define psRealloc(ptr, size) p_psRealloc(ptr, size, __FILE__, __LINE__)
+
+#    endif
+
+/** Free memory.  This operates much like free().
+ *
+ *  @see psAlloc, psRealloc
+ */
+#    ifdef DOXYGEN
+void psFree(void *ptr,          // /< Pointer to free, if NULL, function returns immediately.
+           );
+#    else
+    void p_psFree(void *ptr,        // /< Pointer to free
+                  const char *file, // /< File of call
+                  int lineno        // /< Line number of call
                  );
 
-/// Memory re-allocation.  psRealloc sends file and line number to p_psRealloc.
-#define psRealloc(ptr, size) p_psRealloc(ptr, size, __FILE__, __LINE__)
-
-#endif
-
-
-/** Free memory.  This operates much like free().
- *
- *  @see psAlloc, psRealloc
- */
-#ifdef DOXYGEN
-void psFree(void *ptr,                  ///< Pointer to free, if NULL, function returns immediately.
-           );
-#else
-void p_psFree(void *ptr,                ///< Pointer to free
-              const char *file,         ///< File of call
-              int lineno                ///< Line number of call
-             );
-
 /// Free memory.  psFree sends file and line number to p_psFree.
-#define psFree(size) p_psFree(size, __FILE__, __LINE__)
-
-#endif
+#        define psFree(size) p_psFree(size, __FILE__, __LINE__)
+
+#    endif
 
 /** Check for memory leaks.  This scans for allocated memory buffers not freed with an ID not less than id0.
@@ -197,9 +191,8 @@
  *  @ingroup memTracing
  */
-int psMemCheckLeaks(
-    psMemoryId id0,              ///< don't list blocks with id < id0
-    psMemBlock ***arr,              ///< pointer to array of pointers to leaked blocks, or NULL
-    FILE *fd                        ///< print list of leaks to fd (or NULL)
-);
+int psMemCheckLeaks(psMemoryId id0,     // /< don't list blocks with id < id0
+                    psMemBlock *** arr, // /< pointer to array of pointers to leaked blocks, or NULL
+                    FILE * fd   // /< print list of leaks to fd (or NULL)
+                   );
 
 /** Check for memory corruption.  Scans all currently allocated memory buffers and checks for corruptions,
@@ -208,7 +201,6 @@
  *  @ingroup memTracing
  */
-int psMemCheckCorruption(
-    bool abort_on_error              ///< Abort on detecting corruption?
-);
+int psMemCheckCorruption(bool abort_on_error    // /< Abort on detecting corruption?
+                        );
 
 /** Return reference counter
@@ -216,7 +208,6 @@
  *  @ingroup memRefCount
  */
-psReferenceCount psMemGetRefCounter(
-    void *vptr                      ///< Pointer to get refCounter for
-);
+psReferenceCount psMemGetRefCounter(void *vptr  // /< Pointer to get refCounter for
+                                   );
 
 /** Increment reference counter and return the pointer
@@ -224,16 +215,15 @@
  *  @ingroup memRefCount
  */
-#ifdef DOXYGEN
-void* psMemIncrRefCounter(
-    void *vptr                         ///< Pointer to increment refCounter, and return
-);
-#else
-void* p_psMemIncrRefCounter(
-    void *vptr,                        ///< Pointer to increment refCounter, and return
-    const char *file,                  ///< File of call
-    int lineno                         ///< Line number of call
-);
-#define psMemIncrRefCounter(vptr) p_psMemIncrRefCounter(vptr, __FILE__, __LINE__)
-#endif
+#    ifdef DOXYGEN
+void *psMemIncrRefCounter(void *vptr    // /< Pointer to increment refCounter, and return
+                         );
+#    else
+    void *p_psMemIncrRefCounter(void *vptr, // /< Pointer to increment refCounter, and return
+                                const char *file,   // /< File of call
+                                int lineno  // /< Line number of call
+                               );
+
+#        define psMemIncrRefCounter(vptr) p_psMemIncrRefCounter(vptr, __FILE__, __LINE__)
+#    endif
 
 /** Decrement reference counter and return the pointer
@@ -241,23 +231,21 @@
  *  @ingroup memRefCount
  */
-#ifdef DOXYGEN
-void* psMemDecrRefCounter(
-    void *vptr                         ///< Pointer to decrement refCounter, and return
-);
-#else
-void* p_psMemDecrRefCounter(
-    void *vptr,                        ///< Pointer to decrement refCounter, and return
-    const char *file,                  ///< File of call
-    int lineno                         ///< Line number of call
-);
-#define psMemDecrRefCounter(vptr) p_psMemDecrRefCounter(vptr, __FILE__, __LINE__)
-#endif
+#    ifdef DOXYGEN
+void *psMemDecrRefCounter(void *vptr    // /< Pointer to decrement refCounter, and return
+                         );
+#    else
+    void *p_psMemDecrRefCounter(void *vptr, // /< Pointer to decrement refCounter, and return
+                                const char *file,   // /< File of call
+                                int lineno  // /< Line number of call
+                               );
+
+#        define psMemDecrRefCounter(vptr) p_psMemDecrRefCounter(vptr, __FILE__, __LINE__)
+#    endif
 
 /** Set callback for problems
  *  @ingroup memCallback
  */
-psMemProblemCallback psMemProblemCallbackSet(
-    psMemProblemCallback func       ///< Function to run
-);
+psMemProblemCallback psMemProblemCallbackSet(psMemProblemCallback func  // /< Function to run
+                                            );
 
 /** Set callback for out-of-memory
@@ -265,7 +253,6 @@
  *  @ingroup memCallback
  */
-psMemExhaustedCallback psMemExhaustedCallbackSet(
-    psMemExhaustedCallback func     ///< Function to run
-);
+psMemExhaustedCallback psMemExhaustedCallbackSet(psMemExhaustedCallback func    // /< Function to run
+                                                );
 
 /** Set call back for when a particular memory block is allocated
@@ -273,7 +260,6 @@
  *  @ingroup memCallback
  */
-psMemAllocateCallback psMemAllocateCallbackSet(
-    psMemAllocateCallback func          ///< Function to run
-);
+psMemAllocateCallback psMemAllocateCallbackSet(psMemAllocateCallback func       // /< Function to run
+                                              );
 
 /** Set call back for when a particular memory block is freed
@@ -281,7 +267,6 @@
  *  @ingroup memCallback
  */
-psMemFreeCallback psMemFreeCallbackSet(
-    psMemFreeCallback func              ///< Function to run
-);
+psMemFreeCallback psMemFreeCallbackSet(psMemFreeCallback func   // /< Function to run
+                                      );
 
 /** get next memory ID
@@ -295,7 +280,6 @@
  *  @ingroup memCallback
  */
-psMemoryId psMemAllocateCallbackSetID(
-    psMemoryId id                       ///< ID to set
-);
+psMemoryId psMemAllocateCallbackSetID(psMemoryId id     // /< ID to set
+                                     );
 
 /** set p_psMemFreeID to id
@@ -303,27 +287,27 @@
  *  @ingroup memCallback
  */
-psMemoryId psMemFreeCallbackSetID(
-    psMemoryId id                       ///< ID to set
-);
+psMemoryId psMemFreeCallbackSetID(psMemoryId id // /< ID to set
+                                 );
 
 //@} End of Memory Management Functions
 
-#ifndef DOXYGEN
+#    ifndef DOXYGEN
 
 /*
  * Ensure that any program using malloc/realloc/free will fail to compile
  */
-#ifndef PS_ALLOW_MALLOC
-#ifdef __GNUC__
-#pragma GCC poison malloc realloc calloc free
-#else
-#define malloc(S)       _Pragma("error Use of malloc is not allowed.  Use psAlloc instead.")
-#define realloc(P,S)    _Pragma("error Use of realloc is not allowed.  Use psRealloc instead.")
-#define calloc(S)       _Pragma("error Use of calloc is not allowed.  Use psAlloc instead.")
-#define free(P)         _Pragma("error Use of free is not allowed.  Use psFree instead.")
-#endif
-#endif
-
-#endif // doxygen skip
-
-#endif // end of header file
+#        ifndef PS_ALLOW_MALLOC
+#            ifdef __GNUC__
+#                pragma GCC poison malloc realloc calloc free
+#            else
+    #                define malloc(S)       _Pragma("error Use of malloc is not allowed.  Use psAlloc instead.")
+    #                define realloc(P,S)    _Pragma("error Use of realloc is not allowed.  Use psRealloc instead.")
+    #                define calloc(S)       _Pragma("error Use of calloc is not allowed.  Use psAlloc instead.")
+    #                define free(P)         _Pragma("error Use of free is not allowed.  Use psFree instead.")
+    #            endif
+    #        endif
+
+    #    endif
+    // doxygen skip
+
+    #endif // end of header file
