IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4556 for trunk/psLib/src/sys


Ignore:
Timestamp:
Jul 14, 2005, 4:33:54 PM (21 years ago)
Author:
desonia
Message:

fixed some dropped changes of last week.

Location:
trunk/psLib/src/sys
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sys/psError.c

    r4392 r4556  
    1010 *  @author Eric Van Alst, MHPCC
    1111 *
    12  *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2005-06-25 02:02:05 $
     12 *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2005-07-15 02:33:54 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    152152}
    153153
    154 psS32 psErrorGetStackSize()
     154unsigned int psErrorGetStackSize()
    155155{
    156156    return errorStackSize;
  • trunk/psLib/src/sys/psError.h

    r4342 r4556  
    1212 *  @author Eric Van Alst, MHPCC
    1313 *
    14  *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-06-22 02:05:41 $
     14 *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-07-15 02:33:54 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    7474 *  @return psS32   The number of items on the error stack
    7575 */
    76 psS32 psErrorGetStackSize();
     76unsigned int psErrorGetStackSize();
    7777
    7878/** Prints error stack to specified open file descriptor
     
    138138
    139139/** Reports an error message to the logging facility
    140  * 
     140 *
    141141 *  This function will invoke the psLogMsg function with a level of
    142142 *  PS_LOG_ERROR and pass the parameters name and fmt to generate a proper
    143143 *  log message.  This function is used to check a specific code location.
    144  * 
     144 *
    145145 *  This function modifies the error stack.
    146146 *
     
    158158
    159159/** Logs a warning message.
    160  * 
     160 *
    161161 *  This procedure logs a message to the destination set by a prior call to
    162  *  psLogSetDestination().  This is equivalent to calling psLogMsg with a level of 
     162 *  psLogSetDestination().  This is equivalent to calling psLogMsg with a level of
    163163 *  PS_LOG_WARN.  This function is used to check a specific code location.
    164  * 
     164 *
    165165*/
    166166void p_psWarning(
  • trunk/psLib/src/sys/psErrorCodes.c

    r4549 r4556  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-07-13 10:49:30 $
     9 *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-07-15 02:33:54 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
  • trunk/psLib/src/sys/psLogMsg.h

    r4367 r4556  
    1111 *  @author GLG, MHPCC
    1212 *
    13  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-06-23 03:50:29 $
     13 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-07-15 02:33:54 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6767void psLogMsg(
    6868    const char *name,                  ///< name of the log source
    69     int level,                       ///< severity level of this log message
    70     const char *format,                   ///< printf-style format command
     69    int level,                         ///< severity level of this log message
     70    const char *format,                ///< printf-style format command
    7171    ...
    7272);
  • trunk/psLib/src/sys/psMemory.c

    r4540 r4556  
    88*  @author Robert Lupton, Princeton University
    99*
    10 *  @version $Revision: 1.58 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2005-07-12 19:12:01 $
     10*  @version $Revision: 1.59 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2005-07-15 02:33:54 $
    1212*
    1313*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8484/*
    8585 * Default callback for both allocate and free. Note that the
    86  * value of p_psMemAllocateID/p_psMemFreeID is incremented
     86 * value of p_psMemAllocID/p_psMemFreeID is incremented
    8787 * by the return value (so returning 0 means that the callback
    8888 * isn't resignalled)
    8989 */
    90 static psMemId memAllocateCallbackDefault(const psMemBlock* ptr)
    91 {
    92     static psMemId incr = 0; // "p_psMemAllocateID += incr"
     90static psMemId memAllocCallbackDefault(const psMemBlock* ptr)
     91{
     92    static psMemId incr = 0; // "p_psMemAllocID += incr"
    9393
    9494    return incr;
     
    102102}
    103103
    104 static void memProblemCallbackDefault(const psMemBlock* ptr, const char *file, psS32 lineno)
     104static void memProblemCallbackDefault( psMemBlock* ptr, const char *file, unsigned int lineno)
    105105{
    106106    if (ptr->refCounter < 1) {
     
    158158 * The default callbacks
    159159 */
    160 static psMemAllocateCallback memAllocateCallback = memAllocateCallbackDefault;
     160static psMemAllocCallback memAllocCallback = memAllocCallbackDefault;
    161161static psMemFreeCallback memFreeCallback = memFreeCallbackDefault;
    162162static psMemProblemCallback memProblemCallback = memProblemCallbackDefault;
     
    194194 * Call the callbacks when these IDs are allocated/freed
    195195 */
    196 psMemId p_psMemAllocateID = 0;       // notify user this block is allocated
     196psMemId p_psMemAllocID = 0;       // notify user this block is allocated
    197197psMemId p_psMemFreeID = 0;   // notify user this block is freed
    198198
    199 psMemId psMemAllocateCallbackSetID(psMemId id)
    200 {
    201     psMemId old = p_psMemAllocateID;
    202 
    203     p_psMemAllocateID = id;
     199psMemId psMemAllocCallbackSetID(psMemId id)
     200{
     201    psMemId old = p_psMemAllocID;
     202
     203    p_psMemAllocID = id;
    204204
    205205    return old;
     
    215215}
    216216
    217 psMemAllocateCallback psMemAllocateCallbackSet(psMemAllocateCallback func)
    218 {
    219     psMemFreeCallback old = memAllocateCallback;
     217psMemAllocCallback psMemAllocCallbackSet(psMemAllocCallback func)
     218{
     219    psMemFreeCallback old = memAllocCallback;
    220220
    221221    if (func != NULL) {
    222         memAllocateCallback = func;
     222        memAllocCallback = func;
    223223    } else {
    224         memAllocateCallback = memAllocateCallbackDefault;
     224        memAllocCallback = memAllocCallbackDefault;
    225225    }
    226226
     
    286286}
    287287
    288 psPtr p_psAlloc(size_t size, const char *file, psS32 lineno)
     288psPtr p_psAlloc(size_t size, const char *file, unsigned int lineno)
    289289{
    290290
     
    363363
    364364    // Did the user ask to be informed about this allocation?
    365     if (ptr->id == p_psMemAllocateID) {
    366         p_psMemAllocateID += memAllocateCallback(ptr);
     365    if (ptr->id == p_psMemAllocID) {
     366        p_psMemAllocID += memAllocCallback(ptr);
    367367    }
    368368    // And return the user the memory that they allocated
     
    370370}
    371371
    372 psPtr p_psRealloc(psPtr vptr, size_t size, const char *file, psS32 lineno)
     372psPtr p_psRealloc(psPtr vptr, size_t size, const char *file, unsigned int lineno)
    373373{
    374374    size = (size < recycleBinSize[0]) ? recycleBinSize[0] : size; // set the minimum size to allocate
     
    416416
    417417        // Did the user ask to be informed about this allocation?
    418         if (ptr->id == p_psMemAllocateID) {
    419             p_psMemAllocateID += memAllocateCallback(ptr);
     418        if (ptr->id == p_psMemAllocID) {
     419            p_psMemAllocID += memAllocCallback(ptr);
    420420        }
    421421
     
    424424}
    425425
    426 void p_psFree(psPtr vptr, const char *file, psS32 lineno)
     426void p_psFree(psPtr vptr, const char *file, unsigned int lineno)
    427427{
    428428    if (vptr == NULL) {
  • trunk/psLib/src/sys/psMemory.h

    r4401 r4556  
    1212 *  @ingroup MemoryManagement
    1313 *
    14  *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-06-27 20:38:12 $
     14 *  @version $Revision: 1.45 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-07-15 02:33:54 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4949
    5050/// typedef for memory identification numbers.  Guaranteed to be some variety of integer.
    51 typedef psU64 psMemId;
     51typedef unsigned long psMemId;
    5252
    5353/// typedef for a memory block's reference count. Guaranteed to be some variety of integer.
    54 typedef psU64 psReferenceCount;
     54typedef unsigned long psReferenceCount;
    5555
    5656/// typedef for deallocator.
    57 typedef void (*psFreeFunc) (psPtr ptr);
     57typedef void (*psFreeFunc) (void* ptr);
    5858
    5959/** Book-keeping data for storage allocator.
     
    6464typedef struct psMemBlock
    6565{
    66     const psPtr startblock;            ///< initialised to p_psMEMMAGIC
     66    const void* startblock;            ///< initialised to p_psMEMMAGIC
    6767    struct psMemBlock* previousBlock;  ///< previous block in allocation list
    6868    struct psMemBlock* nextBlock;      ///< next block allocation list
     
    7171    const psMemId id;                  ///< a unique ID for this allocation
    7272    const char *file;                  ///< set from __FILE__ in e.g. p_psAlloc
    73     const psS32 lineno;                ///< set from __LINE__ in e.g. p_psAlloc
     73    const unsigned int lineno;         ///< set from __LINE__ in e.g. p_psAlloc
    7474    pthread_mutex_t refCounterMutex;   ///< mutex to ensure exclusive access to reference counter
    7575    psReferenceCount refCounter;       ///< how many times pointer is referenced
    76     psBool persistent;                 ///< marks if this non-user persistent data like error stack, etc.
    77     const psPtr endblock;              ///< initialised to p_psMEMMAGIC
     76    bool persistent;                   ///< marks if this non-user persistent data like error stack, etc.
     77    const void* endblock;              ///< initialised to p_psMEMMAGIC
    7878}
    7979psMemBlock;
     
    8181/** prototype of a basic callback used by memory functions
    8282 *
    83  *  @see psMemAllocateCallbackSet
    84  *  @ingroup memCallback
    85  */
    86 typedef psMemId(*psMemAllocateCallback) (
     83 *  @see psMemAllocCallbackSet
     84 *  @ingroup memCallback
     85 */
     86typedef psMemId(*psMemAllocCallback) (
    8787    const psMemBlock* ptr              ///< the psMemBlock just allocated
    8888);
     
    105105 */
    106106typedef void (*psMemProblemCallback) (
    107     const psMemBlock* ptr,             ///< the pointer to the problematic memory block.
    108     const char *file,                  ///< the file in which the problem originated
    109     psS32 lineno                         ///< the line number in which the problem originated
     107    psMemBlock* ptr,                   ///< the pointer to the problematic memory block.
     108    const char *filename,                    ///< the file in which the problem originated
     109    unsigned int lineno                ///< the line number in which the problem originated
    110110);
    111111
     
    118118 *  @ingroup memCallback
    119119 */
    120 typedef psPtr (*psMemExhaustedCallback) (
     120typedef void* (*psMemExhaustedCallback) (
    121121    size_t size                        ///< the size of buffer required
    122122);
     
    128128 */
    129129#ifdef DOXYGEN
    130 psPtr psAlloc(size_t size       ///< Size required
    131              );
     130
     131psPtr psAlloc(
     132    size_t size                        ///< Size required
     133);
     134
    132135#else // #ifdef DOXYGEN
    133 psPtr p_psAlloc(size_t size,    ///< Size required
    134                 const char *file,       ///< File of call
    135                 psS32 lineno      ///< Line number of call
    136                );
     136psPtr p_psAlloc(
     137    size_t size,                       ///< Size required
     138    const char *filename,              ///< File of call
     139    unsigned int lineno                ///< Line number of call
     140);
    137141
    138142/// Memory allocation. psAlloc sends file and line number to p_psAlloc.
     
    203207 */
    204208#ifdef DOXYGEN
     209
    205210psPtr psRealloc(
    206     psPtr ptr,                          ///< Pointer to re-allocate
    207     size_t size                         ///< Size required
     211    psPtr ptr,                         ///< Pointer to re-allocate
     212    size_t size                        ///< Size required
    208213);
    209214#else // #ifdef DOXYGEN
     215
    210216psPtr p_psRealloc(
    211217    psPtr ptr,                         ///< Pointer to re-allocate
    212218    size_t size,                       ///< Size required
    213     const char *file,                  ///< File of call
    214     psS32 lineno                       ///< Line number of call
     219    const char *filename,              ///< File of call
     220    unsigned int lineno                ///< Line number of call
    215221);
    216222
     
    234240    psPtr ptr,                         ///< Pointer to free
    235241    const char *file,                  ///< File of call
    236     psS32 lineno                       ///< Line number of call
     242    unsigned int lineno                ///< Line number of call
    237243);
    238244
     
    259265 */
    260266psS32 psMemCheckLeaks(
    261     psMemId id0,                    ///< don't list blocks with id < id0
     267    psMemId id0,                       ///< don't list blocks with id < id0
    262268    psMemBlock* ** arr,                ///< pointer to array of pointers to leaked blocks, or NULL
    263269    FILE * fd,                         ///< print list of leaks to fd (or NULL)
     
    288294#ifdef DOXYGEN
    289295psPtr psMemIncrRefCounter(
    290     const psPtr ptr                         ///< Pointer to increment refCounter, and return
     296    const psPtr ptr                    ///< Pointer to increment refCounter, and return
    291297);
    292298#else
     
    294300    psPtr vptr,                        ///< Pointer to increment refCounter, and return
    295301    const char *file,                  ///< File of call
    296     psS32 lineno                         ///< Line number of call
     302    psS32 lineno                       ///< Line number of call
    297303);
    298304
     
    318324    psPtr vptr,                        ///< Pointer to decrement refCounter, and return
    319325    const char *file,                  ///< File of call
    320     psS32 lineno                         ///< Line number of call
     326    psS32 lineno                       ///< Line number of call
    321327);
    322328
     
    362368/** Set call back for when a particular memory block is allocated
    363369 *
    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
     370 *  A private variable, p_psMemAllocID, can be used to trace the allocation
     371 *  and freeing of specific memory blocks. If p_psMemAllocID is set and a
     372 *  memory block with that ID is allocated, psMemAllocCallback is called
    367373 *  just before memory is returned to the calling function.
    368374 *
    369375 *  @ingroup memCallback
    370376 *
    371  *  @return psMemAllocateCallback      old psMemAllocateCallback function
    372  */
    373 psMemAllocateCallback psMemAllocateCallbackSet(
    374     psMemAllocateCallback func       ///< Function to run at memory allocation of specific mem block
     377 *  @return psMemAllocCallback      old psMemAllocCallback function
     378 */
     379psMemAllocCallback psMemAllocCallbackSet(
     380    psMemAllocCallback func            ///< Function to run at memory allocation of specific mem block
    375381);
    376382
     
    398404psMemId psMemGetId(void);
    399405
    400 /** set p_psMemAllocateID to specific id
    401  *
    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
     406/** set p_psMemAllocID to specific id
     407 *
     408 *  A private variable, p_psMemAllocID, can be used to trace the allocation
     409 *  and freeing of specific memory blocks. If p_psMemAllocID is set and a
     410 *  memory block with that ID is allocated, psMemAllocCallback is called
    405411 *  just before memory is returned to the calling function.
    406412 *
     
    409415 *  @return psMemId
    410416 *
    411  *  @see psMemAllocateCallbackSet
    412  */
    413 psMemId psMemAllocateCallbackSetID(
    414     psMemId id                      ///< ID to set
     417 *  @see psMemAllocCallbackSet
     418 */
     419psMemId psMemAllocCallbackSetID(
     420    psMemId id                         ///< ID to set
    415421);
    416422
     
    429435 */
    430436psMemId psMemFreeCallbackSetID(
    431     psMemId id                      ///< ID to set
     437    psMemId id                         ///< ID to set
    432438);
    433439
Note: See TracChangeset for help on using the changeset viewer.