IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 8, 2005, 1:40:46 PM (21 years ago)
Author:
desonia
Message:

added comments on the end of #endif and #else

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sys/psMemory.h

    r3682 r4162  
    1212 *  @ingroup MemoryManagement
    1313 *
    14  *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-04-07 20:27:41 $
     14 *  @version $Revision: 1.37 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-06-08 23:40:45 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
    1818 */
    1919
    20 #if !defined(PS_MEMORY_H)
     20#ifndef PS_MEMORY_H
    2121#define PS_MEMORY_H
    2222
     
    125125 *
    126126 *  @return psPtr pointer to the allocated buffer. This will not be NULL.
    127  *  @see psFree 
     127 *  @see psFree
    128128 */
    129129#ifdef DOXYGEN
    130130psPtr psAlloc(size_t size       ///< Size required
    131131             );
    132 #else
     132#else // #ifdef DOXYGEN
    133133psPtr p_psAlloc(size_t size,    ///< Size required
    134134                const char *file,       ///< File of call
     
    139139#ifndef SWIG
    140140#define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__)
    141 #endif
    142 
    143 #endif
     141#endif // ! SWIG
     142
     143#endif // ! DOXYGEN
    144144
    145145/** Set the deallocator routine
    146146 *
    147  *  A deallocator routine can optionally be assigned to a memory block to 
     147 *  A deallocator routine can optionally be assigned to a memory block to
    148148 *  ensure that associated memory blocks also get freed, e.g., memory buffers
    149149 *  referenced within a struct.
     
    157157/** Get the deallocator routine
    158158 *
    159  *  This function returns the deallocator for a memory block.  A deallocator 
    160  *  routine can optionally be assigned to a memory block to ensure that 
    161  *  associated memory blocks also get freed, e.g., memory buffers referenced 
    162  *  within a struct. 
     159 *  This function returns the deallocator for a memory block.  A deallocator
     160 *  routine can optionally be assigned to a memory block to ensure that
     161 *  associated memory blocks also get freed, e.g., memory buffers referenced
     162 *  within a struct.
    163163 *
    164164 *  @return psFreeFcn    the routine to be called at deallocation.
     
    170170/** Set the memory as persistent so that it is ignored when detecting memory leaks.
    171171 *
    172  *  Used to mark a memory block as persistent data within the library, 
     172 *  Used to mark a memory block as persistent data within the library,
    173173 *  i.e., non user-level data used to hold psLib's state or cache data.  Such
    174174 *  examples of this class of memory is psTrace's trace-levels and dynamic
     
    185185/** Get the memory's persistent flag.
    186186 *
    187  *  Checks if a memory block has been marked as persistent by 
     187 *  Checks if a memory block has been marked as persistent by
    188188 *  p_psMemSetPresistent.
    189189 *
     
    207207    size_t size                         ///< Size required
    208208);
    209 #else
     209#else // #ifdef DOXYGEN
    210210psPtr p_psRealloc(
    211211    psPtr ptr,                         ///< Pointer to re-allocate
     
    218218#ifndef SWIG
    219219#define psRealloc(ptr, size) p_psRealloc(ptr, size, __FILE__, __LINE__)
    220 #endif
    221 
    222 #endif
     220#endif // ! SWIG
     221
     222#endif // ! DOXYGEN
    223223
    224224/** Free memory.  This operates much like free().
     
    230230    psPtr ptr                          ///< Pointer to free, if NULL, function returns immediately.
    231231);
    232 #else
     232#else // #ifdef DOXYGEN
    233233void p_psFree(
    234234    psPtr ptr,                         ///< Pointer to free
     
    240240#ifndef SWIG
    241241#define psFree(ptr) p_psFree(ptr, __FILE__, __LINE__)
    242 #endif
    243 
    244 #endif
     242#endif // ! SWIG
     243
     244#endif // ! DOXYGEN
    245245
    246246/** Check for memory leaks.  This scans for allocated memory buffers not freed with an ID not less than id0.
     
    299299#ifndef SWIG
    300300#define psMemIncrRefCounter(vptr) p_psMemIncrRefCounter(vptr, __FILE__, __LINE__)
    301 #endif
    302 
    303 #endif
     301#endif // !SWIG
     302
     303#endif // !DOXYGEN
    304304
    305305/** Decrement reference counter and return the pointer
     
    307307 *  @ingroup memRefCount
    308308 *
    309  *  @return psPtr    the pointer deremented in refCount, or NULL if pointer is 
     309 *  @return psPtr    the pointer deremented in refCount, or NULL if pointer is
    310310 *                   fully dereferenced.
    311311 */
     
    314314    psPtr vptr                         ///< Pointer to decrement refCounter, and return
    315315);
    316 #else
     316#else // DOXYGEN
    317317psPtr p_psMemDecrRefCounter(
    318318    psPtr vptr,                        ///< Pointer to decrement refCounter, and return
     
    323323#ifndef SWIG
    324324#define psMemDecrRefCounter(vptr) p_psMemDecrRefCounter(vptr, __FILE__, __LINE__)
    325 #endif
    326 
    327 #endif
     325#endif // !SWIG
     326
     327#endif // !DOXYGEN
    328328
    329329/** Set callback for problems.
    330330 *
    331  *  At various occasions, the memory manager can check the state of the memory 
     331 *  At various occasions, the memory manager can check the state of the memory
    332332 *  stack. If any of these checks discover that the memory stack is corrupted,
    333333 *  the psMemProblemCallback is called.
     
    343343/** Set callback for out-of-memory.
    344344 *
    345  *  If not enough memory is available to satisfy a request by psAlloc or 
    346  *  psRealloc, these functions attempt to find an alternative solution by 
    347  *  calling the psMemExhaustedCallback, a function which may be set by the 
    348  *  programmer in appropriate circumstances, rather than immediately fail. 
    349  *  The typical use of such a feature may be when a program needs a large 
    350  *  chunk of memory to do an operation, but the exact size is not critical. 
    351  *  This feature gives the programmer the opportunity to make a smaller 
     345 *  If not enough memory is available to satisfy a request by psAlloc or
     346 *  psRealloc, these functions attempt to find an alternative solution by
     347 *  calling the psMemExhaustedCallback, a function which may be set by the
     348 *  programmer in appropriate circumstances, rather than immediately fail.
     349 *  The typical use of such a feature may be when a program needs a large
     350 *  chunk of memory to do an operation, but the exact size is not critical.
     351 *  This feature gives the programmer the opportunity to make a smaller
    352352 *  request and try again, limiting the size of the operating buffer.
    353353 *
     
    362362/** Set call back for when a particular memory block is allocated
    363363 *
    364  *  A private variable, p_psMemAllocateID, can be used to trace the allocation 
    365  *  and freeing of specific memory blocks. If p_psMemAllocateID is set and a 
    366  *  memory block with that ID is allocated, psMemAllocateCallback is called 
     364 *  A private variable, p_psMemAllocateID, can be used to trace the allocation
     365 *  and freeing of specific memory blocks. If p_psMemAllocateID is set and a
     366 *  memory block with that ID is allocated, psMemAllocateCallback is called
    367367 *  just before memory is returned to the calling function.
    368368 *
     
    377377/** Set call back for when a particular memory block is freed
    378378 *
    379  *  A private variable, p_psMemFreeID, can be used to trace the freeing of 
    380  *  specific memory blocks. If p_psMemFreeID is set and the memory block with 
     379 *  A private variable, p_psMemFreeID, can be used to trace the freeing of
     380 *  specific memory blocks. If p_psMemFreeID is set and the memory block with
    381381 *  the ID is about to be freed, the psMemFreeCallback callback is called just
    382382 *  before the memory block is freed.
     
    400400/** set p_psMemAllocateID to specific id
    401401 *
    402  *  A private variable, p_psMemAllocateID, can be used to trace the allocation 
    403  *  and freeing of specific memory blocks. If p_psMemAllocateID is set and a 
    404  *  memory block with that ID is allocated, psMemAllocateCallback is called 
     402 *  A private variable, p_psMemAllocateID, can be used to trace the allocation
     403 *  and freeing of specific memory blocks. If p_psMemAllocateID is set and a
     404 *  memory block with that ID is allocated, psMemAllocateCallback is called
    405405 *  just before memory is returned to the calling function.
    406406 *
    407407 *  @ingroup memCallback
    408408 *
    409  *  @return psMemoryId       
    410  *
    411  *  @see psMemAllocateCallbackSet   
     409 *  @return psMemoryId
     410 *
     411 *  @see psMemAllocateCallbackSet
    412412 */
    413413psMemoryId psMemAllocateCallbackSetID(
     
    417417/** set p_psMemFreeID to id
    418418 *
    419  *  A private variable, p_psMemFreeID, can be used to trace the freeing of 
    420  *  specific memory blocks. If p_psMemFreeID is set and the memory block with 
     419 *  A private variable, p_psMemFreeID, can be used to trace the freeing of
     420 *  specific memory blocks. If p_psMemFreeID is set and the memory block with
    421421 *  the ID is about to be freed, the psMemFreeCallback callback is called just
    422422 *  before the memory block is freed.
     
    442442#ifdef __GNUC__
    443443#pragma GCC poison malloc realloc calloc free
    444 #else
     444#else // __GNUC__
    445445#define malloc(S)       _Pragma("error Use of malloc is not allowed.  Use psAlloc instead.")
    446446#define realloc(P,S)    _Pragma("error Use of realloc is not allowed.  Use psRealloc instead.")
    447447#define calloc(S)       _Pragma("error Use of calloc is not allowed.  Use psAlloc instead.")
    448448#define free(P)         _Pragma("error Use of free is not allowed.  Use psFree instead.")
    449 #endif
    450 #endif
    451 
    452 #endif
    453 // doxygen skip
    454 
    455 #endif // end of header file
     449#endif // ! __GNUC__
     450#endif // #ifndef PS_ALLOW_MALLOC
     451
     452#endif // #ifndef DOXYGEN
     453
     454#endif // #ifndef PS_MEMORY_H
Note: See TracChangeset for help on using the changeset viewer.