IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 26, 2004, 2:57:34 PM (22 years ago)
Author:
desonia
Message:

converted native C types to ps Types, where practical.

Location:
trunk/psLib/src/sysUtils
Files:
13 edited

Legend:

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

    r1905 r2204  
    1010 *  @author Eric Van Alst, MHPCC
    1111 *   
    12  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-09-27 20:38:02 $
     12 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-10-27 00:57:31 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    … …  
    2626#define MAX_ERROR_STACK_SIZE 64
    2727static psErr* errorStack[MAX_ERROR_STACK_SIZE];
    28 static unsigned int errorStackSize = 0;
     28static psU32 errorStackSize = 0;
    2929pthread_mutex_t lockErrorStack = PTHREAD_MUTEX_INITIALIZER;
    3030
    … …  
    8484{
    8585    pthread_mutex_lock(&lockErrorStack);
    86     for (int lcv=0;lcv<errorStackSize;lcv++) {
     86    for (psS32 lcv=0;lcv<errorStackSize;lcv++) {
    8787        p_psMemSetPersistent(errorStack[lcv]->msg,false);
    8888        p_psMemSetPersistent(errorStack[lcv]->name,false);
    … …  
    9494}
    9595
    96 psErrorCode psErrorMsg(const char *name, psErrorCode code, bool new, const char* fmt, ...)
     96psErrorCode psErrorMsg(const char *name, psErrorCode code, psBool new, const char* fmt, ...)
    9797{
    9898    char errMsg[1024];
    … …  
    131131}
    132132
    133 psErr* psErrorGet(int which)
     133psErr* psErrorGet(psS32 which)
    134134{
    135135    psErr* result;
    … …  
    180180        vfprintf(fd,fmt,va);
    181181
    182         for (int lcv=0;lcv<errorStackSize;lcv++) {
     182        for (psS32 lcv=0;lcv<errorStackSize;lcv++) {
    183183            if(errorStack[lcv]->code >= PS_ERR_BASE) {
    184184                fprintf(fd," -> %s: %s\n     %s\n",
  • trunk/psLib/src/sysUtils/psError.h

    r1869 r2204  
    1212 *  @author Eric Van Alst, MHPCC
    1313 *
    14  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-09-23 22:18:13 $
     14 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-10-27 00:57:31 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    … …  
    5151 */
    5252psErr* psErrorGet(
    53     int which                          ///< position in the error stack. 0 is last error on stack.
     53    psS32 which                          ///< position in the error stack. 0 is last error on stack.
    5454);
    5555
    … …  
    121121    const char *name,                  ///< Name of error in the form aaa.bbb.ccc
    122122    psErrorCode code,                  ///< Error class code
    123     bool new,                          ///< true if error originates at this location
     123    psBool new,                          ///< true if error originates at this location
    124124    const char* fmt,                   ///< printf style formatting statement defining error message
    125125    ...
  • trunk/psLib/src/sysUtils/psErrorCodes.c

    r2129 r2204  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-10-14 21:14:58 $
     9 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-10-27 00:57:31 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    … …  
    5959    // first, search the static error codes
    6060
    61     int n = 0;
     61    psS32 n = 0;
    6262    while(staticErrorCodes[n].code != PS_ERR_N_ERR_CLASSES &&
    6363            staticErrorCodes[n].code != code) {
    … …  
    8888static void freeErrorDescription(psErrorDescription* err)
    8989{
    90     psFree((void*)err->description);
     90    psFree((psPtr)err->description);
    9191}
    9292
    … …  
    125125
    126126void psErrorRegister(const psErrorDescription* errors,
    127                      int nerror)
     127                     psS32 nerror)
    128128{
    129129    if (nerror < 1) {
    … …  
    143143    }
    144144
    145     for (int i=0;i<nerror;i++) {
     145    for (psS32 i=0;i<nerror;i++) {
    146146        psErrorDescription* err = psErrorDescriptionAlloc(
    147147                                      errors[i].code, errors[i].description);
    148148        p_psMemSetPersistent(err,true);
    149         p_psMemSetPersistent((void*)err->description,true);
     149        p_psMemSetPersistent((psPtr)err->description,true);
    150150        if (! psListAdd(dynamicErrorCodes,
    151151                        PS_LIST_HEAD,
    … …  
    162162}
    163163
    164 bool p_psErrorUnregister(psErrorCode code)
     164psBool p_psErrorUnregister(psErrorCode code)
    165165{
    166166    // Check input argument is non-negative
    … …  
    179179    }
    180180
    181     return psListRemove(dynamicErrorCodes,PS_LIST_UNKNOWN,(void*)desc);
     181    return psListRemove(dynamicErrorCodes,PS_LIST_UNKNOWN,(psPtr)desc);
    182182}
  • trunk/psLib/src/sysUtils/psErrorCodes.h

    r2129 r2204  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-10-14 21:14:58 $
     9 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-10-27 00:57:31 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    … …  
    1515#ifndef PS_ERROR_CODES_H
    1616#define PS_ERROR_CODES_H
     17
     18#include "psType.h"
    1719
    1820/* N.B., lines between '//~Start' and '//~End' are automatic generated from
    … …  
    9395void psErrorRegister(
    9496    const psErrorDescription* errors,  ///< Array of error codes to register
    95     int nerror                         ///< number of errors in input array
     97    psS32 nerror                         ///< number of errors in input array
    9698);
    9799
    98100/** Clears error codes registered via psErrorRegister.
    99101 *
    100  *  @return bool    TRUE if given errorcode was removed, otherwise FALSE.
     102 *  @return psBool    TRUE if given errorcode was removed, otherwise FALSE.
    101103 */
    102 bool p_psErrorUnregister(
     104psBool p_psErrorUnregister(
    103105    psErrorCode code                   ///< the error code to find and remove
    104106);
  • trunk/psLib/src/sysUtils/psLogMsg.c

    r1807 r2204  
    1111 *  @author George Gusciora, MHPCC
    1212 *
    13  *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-09-14 20:01:52 $
     13 *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-10-27 00:57:31 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    … …  
    1919/*****************************************************************************
    2020NOTES: currently, the prototype code has the following global variables:
    21     static int p_psGlobalLogDest;
    22     static int p_psGlobalLogLevel;
    23     static int p_psLogTime;
    24     static int p_psLogHost;
    25     static int p_psLogLevel;
    26     static int p_psLogName;
    27     static int p_psLogMsg;
     21    static psS32 p_psGlobalLogDest;
     22    static psS32 p_psGlobalLogLevel;
     23    static psS32 p_psLogTime;
     24    static psS32 p_psLogHost;
     25    static psS32 p_psLogLevel;
     26    static psS32 p_psLogName;
     27    static psS32 p_psLogMsg;
    2828 *****************************************************************************/
    2929#include <limits.h>
    … …  
    3434#include <time.h>
    3535#include <unistd.h>
    36 #include <stdbool.h>
    3736
    3837#include "psLogMsg.h"
    … …  
    4948
    5049static FILE *logDest = (FILE *) 1;      // flag to initialize to stderr before using.
    51 static int globalLogLevel = PS_LOG_INFO;        // log all messages at this or above
    52 static bool logTime = true;     // Flag to include time info
    53 static bool logHost = true;     // Flag to include host info
    54 static bool logLevel = true;    // Flag to include level info
    55 static bool logName = true;     // Flag to include name info
    56 static bool logMsg = true;      // Flag to include message info
     50static psS32 globalLogLevel = PS_LOG_INFO;        // log all messages at this or above
     51static psBool logTime = true;     // Flag to include time info
     52static psBool logHost = true;     // Flag to include host info
     53static psBool logLevel = true;    // Flag to include level info
     54static psBool logName = true;     // Flag to include name info
     55static psBool logMsg = true;      // Flag to include message info
    5756
    5857/*****************************************************************************
    5958psLogSetLevel(): Set the current log level and return old level.
    6059Input:
    61  level (int): the new log level.
     60 level (psS32): the new log level.
    6261Output:
    6362 none
    … …  
    6564 The old log level.
    6665 *****************************************************************************/
    67 int psLogSetLevel(int level)
     66psS32 psLogSetLevel(psS32 level)
    6867{
    6968    // Save old global log level for changing it.
    70     int oldLevel = globalLogLevel;
     69    psS32 oldLevel = globalLogLevel;
    7170
    7271    if ((level < MIN_LOG_LEVEL) || (level > MAX_LOG_LEVEL)) {
    … …  
    8685 
    8786Input:
    88  dest (int): the new log destination
     87 dest (psS32): the new log destination
    8988Output:
    9089 None.
    … …  
    9291 An integer specifying the old log destination.
    9392 *****************************************************************************/
    94 bool psLogSetDestination(const char *dest)
     93psBool psLogSetDestination(const char *dest)
    9594{
    9695    char protocol[5];
    … …  
    245244 NULL.
    246245 *****************************************************************************/
    247 void psLogMsgV(const char *name, int level, const char *fmt, va_list ap)
    248 {
    249     static int first = 1;       // Flag for calling gethostname()
     246void psLogMsgV(const char *name, psS32 level, const char *fmt, va_list ap)
     247{
     248    static psS32 first = 1;       // Flag for calling gethostname()
    250249    static char hostname[HOST_NAME_MAX + 1];
    251250
    … …  
    254253    char head[MAX_LOG_LINE_LENGTH + 2]; // the added two are for the ending | and \0
    255254    char *head_ptr = head;      // where we've got to in head
    256     int maxLength = MAX_LOG_LINE_LENGTH;
     255    psS32 maxLength = MAX_LOG_LINE_LENGTH;
    257256    time_t clock = time(NULL);  // The current time.
    258257    struct tm *utc = gmtime(&clock);    // The current gm time.
    … …  
    375374 NULL
    376375 *****************************************************************************/
    377 void psLogMsg(const char *name, int level, const char *fmt, ...)
     376void psLogMsg(const char *name, psS32 level, const char *fmt, ...)
    378377{
    379378    va_list ap;
  • trunk/psLib/src/sysUtils/psLogMsg.h

    r1807 r2204  
    1111 *  @author George Gusciora, MHPCC
    1212 *
    13  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-09-14 20:01:52 $
     13 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-10-27 00:57:31 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    … …  
    1919#define PS_LOG_MSG_H
    2020#include <stdarg.h>
    21 #include <stdbool.h>
     21
     22#include "psType.h"
    2223
    2324/** @addtogroup LogTrace
    … …  
    3132 *  argument which can specify more general log destinations.
    3233 *
    33  *  @return int     true if set successfully, otherwise false.
     34 *  @return psS32     true if set successfully, otherwise false.
    3435 */
    35 bool psLogSetDestination(
     36psBool psLogSetDestination(
    3637    const char *dest                   ///< Specifies where to send messages.
    3738);
    … …  
    4344 *  be displayed.
    4445 *
    45  *  @return int    old logging level
     46 *  @return psS32    old logging level
    4647 */
    47 int psLogSetLevel(
    48     int level                          ///< Specifies the system log level
     48psS32 psLogSetLevel(
     49    psS32 level                          ///< Specifies the system log level
    4950);
    5051
    … …  
    6869void psLogMsg(
    6970    const char *name,                  ///< name of the log source
    70     int myLevel,                       ///< severity level of this log message
     71    psS32 myLevel,                       ///< severity level of this log message
    7172    const char *fmt,                   ///< printf-style format command
    7273    ...
    … …  
    7980void psLogMsgV(
    8081    const char *name,                  ///< name of the log source
    81     int myLevel,                       ///< severity level of this log message
     82    psS32 myLevel,                       ///< severity level of this log message
    8283    const char *fmt,                   ///< printf-style format command
    8384    va_list ap                         ///< varargs argument list
  • trunk/psLib/src/sysUtils/psMemory.c

    r1840 r2204  
    88*  @author Robert Lupton, Princeton University
    99*
    10 *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2004-09-21 22:30:19 $
     10*  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2004-10-27 00:57:31 $
    1212*
    1313*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    … …  
    1818#include <stdlib.h>
    1919#include <stdio.h>
    20 #include <stdbool.h>
    2120#include <stdint.h>
    2221
    … …  
    2827#include "psSysUtilsErrors.h"
    2928
    30 #define P_PS_MEMMAGIC (void *)0xdeadbeef   // Magic number in psMemBlock header
     29#define P_PS_MEMMAGIC (psPtr )0xdeadbeef   // Magic number in psMemBlock header
    3130
    3231#define P_PS_LARGE_BLOCK_SIZE 65536        // size where under, we try to recycle
    3332
    34 static int checkMemBlock(const psMemBlock* m, const char *funcName);
     33static psS32 checkMemBlock(const psMemBlock* m, const char *funcName);
    3534static psMemBlock* lastMemBlockAllocated = NULL;
    3635static pthread_mutex_t memBlockListMutex = PTHREAD_MUTEX_INITIALIZER;
    … …  
    3938static pthread_mutex_t recycleMemBlockListMutex = PTHREAD_MUTEX_INITIALIZER;
    4039
    41 static int recycleBins = 13;
    42 static int recycleBinSize[14] = {
    43                                     8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, P_PS_LARGE_BLOCK_SIZE
    44                                 };
     40static psS32 recycleBins = 13;
     41static psS32 recycleBinSize[14] = {
     42                                      8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, P_PS_LARGE_BLOCK_SIZE
     43                                  };
    4544
    4645// N.B. recycleBinSize should be terminated by P_PS_LARGE_BLOCK_SIZE (simplifies search loops)
    … …  
    6160 *  Default memExhausted callback.
    6261 */
    63 static void *memExhaustedCallbackDefault(size_t size)
    64 {
    65     void *ptr = NULL;
     62static psPtr memExhaustedCallbackDefault(size_t size)
     63{
     64    psPtr ptr = NULL;
    6665
    6766    pthread_mutex_lock(&recycleMemBlockListMutex);
    68     int level = recycleBins - 1;
     67    psS32 level = recycleBins - 1;
    6968
    7069    while (level >= 0 && ptr == NULL) {
    … …  
    9897}
    9998
    100 static void memProblemCallbackDefault(const psMemBlock* ptr, const char *file, int lineno)
     99static void memProblemCallbackDefault(const psMemBlock* ptr, const char *file, psS32 lineno)
    101100{
    102101    if (ptr->refCounter < 1) {
    … …  
    223222 */
    224223
    225 static int checkMemBlock(const psMemBlock* m, const char *funcName)
     224static psS32 checkMemBlock(const psMemBlock* m, const char *funcName)
    226225{
    227226    // n.b. since this is called by psMemCheckCorruption while the memblock list is mutex locked,
    … …  
    248247        return 1;
    249248    }
    250     if (*(void **)((int8_t *) (m + 1) + m->userMemorySize) != P_PS_MEMMAGIC) {
     249    if (*(psPtr *)((int8_t *) (m + 1) + m->userMemorySize) != P_PS_MEMMAGIC) {
    251250        psErrorMsg(PS_ERRORNAME_DOMAIN "checkMemBlock", true, PS_ERR_MEMORY_CORRUPTION,
    252251                   PS_ERRORTEXT_psMemory_OVERFLOW,
    … …  
    258257}
    259258
    260 int psMemCheckCorruption(bool abort_on_error)
    261 {
    262     int nbad = 0;               // number of bad blocks
    263     bool failure = false;
     259psS32 psMemCheckCorruption(psBool abort_on_error)
     260{
     261    psS32 nbad = 0;               // number of bad blocks
     262    psBool failure = false;
    264263
    265264    // get exclusive access to the memBlock list to avoid it changing on us while we use it.
    … …  
    289288}
    290289
    291 void *p_psAlloc(size_t size, const char *file, int lineno)
     290psPtr p_psAlloc(size_t size, const char *file, psS32 lineno)
    292291{
    293292
    … …  
    297296    if (size < P_PS_LARGE_BLOCK_SIZE) {
    298297        // find the bin we need.
    299         int level = 0;
     298        psS32 level = 0;
    300299
    301300        while (size > recycleBinSize[level]) {
    … …  
    323322
    324323    if (ptr == NULL) {
    325         ptr = malloc(sizeof(psMemBlock) + size + sizeof(void *));
     324        ptr = malloc(sizeof(psMemBlock) + size + sizeof(psPtr ));
    326325
    327326        if (ptr == NULL) {
    … …  
    332331        }
    333332
    334         ptr->startblock = P_PS_MEMMAGIC;
    335         ptr->endblock = P_PS_MEMMAGIC;
     333        *(psPtr*)&ptr->startblock = P_PS_MEMMAGIC;
     334        *(psPtr*)&ptr->endblock = P_PS_MEMMAGIC;
    336335        ptr->userMemorySize = size;
    337336        pthread_mutex_init(&ptr->refCounterMutex, NULL);
    … …  
    345344    ptr->freeFcn = NULL;
    346345    ptr->persistent = false;
    347     *(unsigned int *)&ptr->lineno = lineno;
    348     *(void **)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;
     346    *(psU32 *)&ptr->lineno = lineno;
     347    *(psPtr *)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;
    349348    ptr->previousBlock = NULL;
    350349
    … …  
    371370}
    372371
    373 void *p_psRealloc(void *vptr, size_t size, const char *file, int lineno)
     372psPtr p_psRealloc(psPtr vptr, size_t size, const char *file, psS32 lineno)
    374373{
    375374    if (vptr == NULL) {
    … …  
    377376    } else {
    378377        psMemBlock* ptr = ((psMemBlock* ) vptr) - 1;
    379         bool isBlockLast = false;
     378        psBool isBlockLast = false;
    380379
    381380        if (checkMemBlock(ptr, __func__) != 0) {
    … …  
    389388        isBlockLast = (ptr == lastMemBlockAllocated);
    390389
    391         ptr = (psMemBlock* ) realloc(ptr, sizeof(psMemBlock) + size + sizeof(void *));
     390        ptr = (psMemBlock* ) realloc(ptr, sizeof(psMemBlock) + size + sizeof(psPtr ));
    392391
    393392        if (ptr == NULL) {
    … …  
    399398
    400399        ptr->userMemorySize = size;
    401         *(void **)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;
     400        *(psPtr *)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;
    402401
    403402        if (isBlockLast) {
    … …  
    423422}
    424423
    425 void p_psFree(void *vptr, const char *file, int lineno)
     424void p_psFree(psPtr vptr, const char *file, psS32 lineno)
    426425{
    427426    if (vptr == NULL) {
    … …  
    444443 * Check for memory leaks.
    445444 */
    446 int psMemCheckLeaks(psMemoryId id0, psMemBlock* ** arr, FILE * fd)
    447 {
    448     int nleak = 0;
    449     int j = 0;
     445psS32 psMemCheckLeaks(psMemoryId id0, psMemBlock* ** arr, FILE * fd)
     446{
     447    psS32 nleak = 0;
     448    psS32 j = 0;
    450449    psMemBlock* topBlock = lastMemBlockAllocated;
    451450
    … …  
    499498 */
    500499// return refCounter
    501 psReferenceCount psMemGetRefCounter(void *vptr)
     500psReferenceCount psMemGetRefCounter(psPtr vptr)
    502501{
    503502    psMemBlock* ptr;
    504     unsigned int refCount;
     503    psU32 refCount;
    505504
    506505    if (vptr == NULL) {
    … …  
    522521
    523522// increment and return refCounter
    524 void *p_psMemIncrRefCounter(void *vptr, const char *file, int lineno)
     523psPtr p_psMemIncrRefCounter(psPtr vptr, const char *file, psS32 lineno)
    525524{
    526525    psMemBlock* ptr;
    … …  
    544543
    545544// decrement and return refCounter
    546 void *p_psMemDecrRefCounter(void *vptr, const char *file, int lineno)
     545psPtr p_psMemDecrRefCounter(psPtr vptr, const char *file, psS32 lineno)
    547546{
    548547    if (vptr == NULL) {
    … …  
    593592        if (ptr->userMemorySize < P_PS_LARGE_BLOCK_SIZE) {
    594593
    595             int level = 1;
     594            psS32 level = 1;
    596595
    597596            while (ptr->userMemorySize >= recycleBinSize[level]) {
    … …  
    635634}
    636635
    637 void p_psMemSetDeallocator(void *vptr, psFreeFcn freeFcn)
     636void p_psMemSetDeallocator(psPtr vptr, psFreeFcn freeFcn)
    638637{
    639638    if (vptr == NULL) {
    … …  
    650649
    651650}
    652 psFreeFcn p_psMemGetDeallocator(void *vptr)
     651psFreeFcn p_psMemGetDeallocator(psPtr vptr)
    653652{
    654653    if (vptr == NULL) {
    … …  
    665664}
    666665
    667 bool p_psMemGetPersistent(void *vptr)
     666psBool p_psMemGetPersistent(psPtr vptr)
    668667{
    669668    if (vptr == NULL) {
    … …  
    680679}
    681680
    682 void p_psMemSetPersistent(void *vptr,bool value)
     681void p_psMemSetPersistent(psPtr vptr,psBool value)
    683682{
    684683    if (vptr == NULL) {
  • trunk/psLib/src/sysUtils/psMemory.h

    r1810 r2204  
    1212 *  @ingroup MemoryManagement
    1313 *
    14  *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-09-14 23:48:25 $
     14 *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-10-27 00:57:31 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    … …  
    2222
    2323#include <stdio.h>                     // needed for FILE
    24 #include <stdbool.h>
    2524#include <pthread.h>                   // we need a mutex to make this stuff thread safe.
     25
     26#include "psType.h"
    2627
    2728/** @addtogroup MemoryManagement
    … …  
    4849
    4950/// typedef for memory identification numbers.  Guaranteed to be some variety of integer.
    50 typedef unsigned long psMemoryId;
     51typedef psU64 psMemoryId;
    5152
    5253/// typedef for a memory block's reference count. Guaranteed to be some variety of integer.
    53 typedef unsigned long psReferenceCount;
     54typedef psU64 psReferenceCount;
    5455
    5556/// typedef for deallocator.
    56 typedef void (*psFreeFcn) (void *ptr);
     57typedef void (*psFreeFcn) (psPtr ptr);
    5758
    5859/** Book-keeping data for storage allocator.
    … …  
    6364typedef struct psMemBlock
    6465{
    65     const void *startblock;            ///< initialised to p_psMEMMAGIC
     66    const psPtr startblock;            ///< initialised to p_psMEMMAGIC
    6667    struct psMemBlock* previousBlock;  ///< previous block in allocation list
    6768    struct psMemBlock* nextBlock;      ///< next block allocation list
    … …  
    7071    const psMemoryId id;               ///< a unique ID for this allocation
    7172    const char *file;                  ///< set from __FILE__ in e.g. p_psAlloc
    72     const int lineno;                  ///< set from __LINE__ in e.g. p_psAlloc
     73    const psS32 lineno;                  ///< set from __LINE__ in e.g. p_psAlloc
    7374    pthread_mutex_t refCounterMutex;   ///< mutex to ensure exclusive access to reference counter
    7475    psReferenceCount refCounter;       ///< how many times pointer is referenced
    75     bool persistent;                   ///< marks if this non-user persistent data like error stack, etc.
    76     const void *endblock;              ///< initialised to p_psMEMMAGIC
     76    psBool persistent;                   ///< marks if this non-user persistent data like error stack, etc.
     77    const psPtr endblock;              ///< initialised to p_psMEMMAGIC
    7778}
    7879psMemBlock;
    … …  
    106107    const psMemBlock* ptr,             ///< the pointer to the problematic memory block.
    107108    const char *file,                  ///< the file in which the problem originated
    108     int lineno                         ///< the line number in which the problem originated
     109    psS32 lineno                         ///< the line number in which the problem originated
    109110);
    110111
    111112/** prototype of a callback function used when memory runs out
    112113 *
    113  *  @return void* pointer to requested buffer of the size size_t, or NULL if memory could not
     114 *  @return psPtr pointer to requested buffer of the size size_t, or NULL if memory could not
    114115 *          be found.
    115116 *
    … …  
    117118 *  @ingroup memCallback
    118119 */
    119 typedef void *(*psMemExhaustedCallback) (
     120typedef psPtr (*psMemExhaustedCallback) (
    120121    size_t size                        ///< the size of buffer required
    121122);
    … …  
    123124/** Memory allocation.  This operates much like malloc(), but is guaranteed to return a non-NULL value.
    124125 *
    125  *  @return void* pointer to the allocated buffer. This will not be NULL.
     126 *  @return psPtr pointer to the allocated buffer. This will not be NULL.
    126127 *  @see psFree
    127128 */
    128129#ifdef DOXYGEN
    129 void *psAlloc(size_t size       ///< Size required
     130psPtr psAlloc(size_t size       ///< Size required
    130131             );
    131132#else
    132133
    133 void *p_psAlloc(size_t size,    ///< Size required
     134psPtr p_psAlloc(size_t size,    ///< Size required
    134135                const char *file,       ///< File of call
    135                 int lineno      ///< Line number of call
     136                psS32 lineno      ///< Line number of call
    136137               );
    137138
    … …  
    148149 */
    149150void p_psMemSetDeallocator(
    150     void *ptr,                         ///< the memory block to operate on
     151    psPtr ptr,                         ///< the memory block to operate on
    151152    psFreeFcn freeFcn                  ///< the function to be executed at deallocation
    152153);
    … …  
    162163 */
    163164psFreeFcn p_psMemGetDeallocator(
    164     void *ptr                          ///< the memory block
     165    psPtr ptr                          ///< the memory block
    165166);
    166167
    … …  
    176177 */
    177178void p_psMemSetPersistent(
    178     void *ptr,                         ///< the memory block to operate on
    179     bool value                         ///< true if memory is persistent, otherwise false
     179    psPtr ptr,                         ///< the memory block to operate on
     180    psBool value                         ///< true if memory is persistent, otherwise false
    180181);
    181182
    … …  
    187188 *  Memory marked as persistent is excluded from memory leak checks.
    188189 *
    189  *  @return bool    true if memory is marked persistent, otherwise false.
    190  */
    191 bool p_psMemGetPersistent(
    192     void *ptr                          ///< the memory block to check.
     190 *  @return psBool    true if memory is marked persistent, otherwise false.
     191 */
     192psBool p_psMemGetPersistent(
     193    psPtr ptr                          ///< the memory block to check.
    193194);
    194195
    … …  
    196197/** Memory re-allocation.  This operates much like realloc(), but is guaranteed to return a non-NULL value.
    197198 *
    198  *  @return void* pointer to resized buffer. This will not be NULL.
     199 *  @return psPtr pointer to resized buffer. This will not be NULL.
    199200 *  @see psAlloc, psFree
    200201 */
    201202#ifdef DOXYGEN
    202 void *psRealloc(
    203     void *ptr                          ///< Pointer to re-allocate
     203psPtr psRealloc(
     204    psPtr ptr                          ///< Pointer to re-allocate
    204205    size_t size,                       ///< Size required
    205206);
    206207#else
    207208
    208 void *p_psRealloc(
    209     void *ptr,                         ///< Pointer to re-allocate
     209psPtr p_psRealloc(
     210    psPtr ptr,                         ///< Pointer to re-allocate
    210211    size_t size,                       ///< Size required
    211212    const char *file,                  ///< File of call
    212     int lineno                         ///< Line number of call
     213    psS32 lineno                         ///< Line number of call
    213214);
    214215
    … …  
    224225#ifdef DOXYGEN
    225226void psFree(
    226     void *ptr,                         ///< Pointer to free, if NULL, function returns immediately.
     227    psPtr ptr,                         ///< Pointer to free, if NULL, function returns immediately.
    227228);
    228229#else
    229230
    230231void p_psFree(
    231     void *ptr,                        ///< Pointer to free
     232    psPtr ptr,                        ///< Pointer to free
    232233    const char *file,                 ///< File of call
    233     int lineno                        ///< Line number of call
     234    psS32 lineno                        ///< Line number of call
    234235);
    235236
    … …  
    248249 *  If memory leaks are found, the Memory Problem callback will be called as well.
    249250 *
    250  *  return int  number of memory blocks found as 'leaks', i.e., the number of currently allocated memory
     251 *  return psS32  number of memory blocks found as 'leaks', i.e., the number of currently allocated memory
    251252 *              blocks above id0 that have not been freed.
    252253 *  @see psAlloc, psFree, psgetMemId, psMemProblemCallbackSet
    253254 *  @ingroup memTracing
    254255 */
    255 int psMemCheckLeaks(
     256psS32 psMemCheckLeaks(
    256257    psMemoryId id0,                    ///< don't list blocks with id < id0
    257258    psMemBlock* ** arr,                ///< pointer to array of pointers to leaked blocks, or NULL
    … …  
    264265 *  @ingroup memTracing
    265266 */
    266 int psMemCheckCorruption(
    267     bool abort_on_error                ///< Abort on detecting corruption?
     267psS32 psMemCheckCorruption(
     268    psBool abort_on_error                ///< Abort on detecting corruption?
    268269);
    269270
    … …  
    273274 */
    274275psReferenceCount psMemGetRefCounter(
    275     void *vptr                         ///< Pointer to get refCounter for
     276    psPtr vptr                         ///< Pointer to get refCounter for
    276277);
    277278
    … …  
    281282 */
    282283#ifdef DOXYGEN
    283 void *psMemIncrRefCounter(
    284     void *vptr                         ///< Pointer to increment refCounter, and return
    285 );
    286 #else
    287 
    288 void *p_psMemIncrRefCounter(
    289     void *vptr,                        ///< Pointer to increment refCounter, and return
     284psPtr psMemIncrRefCounter(
     285    psPtr vptr                         ///< Pointer to increment refCounter, and return
     286);
     287#else
     288
     289psPtr p_psMemIncrRefCounter(
     290    psPtr vptr,                        ///< Pointer to increment refCounter, and return
    290291    const char *file,                  ///< File of call
    291     int lineno                         ///< Line number of call
     292    psS32 lineno                         ///< Line number of call
    292293);
    293294
    … …  
    299300 *  @ingroup memRefCount
    300301 *
    301  *  @return void*    the pointer deremented in refCount, or NULL if pointer is
     302 *  @return psPtr    the pointer deremented in refCount, or NULL if pointer is
    302303 *                   fully dereferenced.
    303304 */
    304305#ifdef DOXYGEN
    305 void* psMemDecrRefCounter(
    306     void* vptr                         ///< Pointer to decrement refCounter, and return
    307 );
    308 #else
    309 
    310 void *p_psMemDecrRefCounter(
    311     void *vptr,                        ///< Pointer to decrement refCounter, and return
     306psPtr psMemDecrRefCounter(
     307    psPtr vptr                         ///< Pointer to decrement refCounter, and return
     308);
     309#else
     310
     311psPtr p_psMemDecrRefCounter(
     312    psPtr vptr,                        ///< Pointer to decrement refCounter, and return
    312313    const char *file,                  ///< File of call
    313     int lineno                         ///< Line number of call
     314    psS32 lineno                         ///< Line number of call
    314315);
    315316
  • trunk/psLib/src/sysUtils/psString.c

    r1969 r2204  
    99 *  @author Eric Van Alst, MHPCC
    1010 *
    11  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-06 01:05:41 $
     11 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 00:57:31 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    … …  
    3131}
    3232
    33 char *psStringNCopy(const char *str, int nChar)
     33char *psStringNCopy(const char *str, psS32 nChar)
    3434{
    3535    char *returnValue = NULL;
  • trunk/psLib/src/sysUtils/psString.h

    r1448 r2204  
    1010 *  @author Eric Van Alst, MHPCC
    1111 *
    12  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-10 01:55:34 $
     12 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-10-27 00:57:31 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    … …  
    1919#define PS_STRING_H
    2020
     21#include "psType.h"
    2122
    2223/** This macro will convert the argument to a quoted string */
    … …  
    6263    /**< Input string of characters to copy */
    6364
    64     int nChar
     65    psS32 nChar
    6566    /**< Number of bytes to allocate for string copy */
    6667);
  • trunk/psLib/src/sysUtils/psTrace.c

    r1834 r2204  
    99 *  @author George Gusciora, MHPCC
    1010 *
    11  *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-09-20 22:03:35 $
     11 *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 00:57:31 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    … …  
    3434 
    3535    PS_DEFAULT_TRACE_LEVEL: This should only be used when adding the
    36     intermediate components of a long name.  Ie. the "B" in .A.B.C
     36    intermediate components of a psS64 name.  Ie. the "B" in .A.B.C
    3737 
    3838 *****************************************************************************/
    … …  
    5656
    5757static void componentFree(p_psComponent* comp);
    58 static p_psComponent* componentAlloc(const char *name, int level);
     58static p_psComponent* componentAlloc(const char *name, psS32 level);
    5959
    6060/*****************************************************************************
    6161componentAlloc(): allocate memory for a new node, and initialize members.
    6262 *****************************************************************************/
    63 static p_psComponent* componentAlloc(const char *name, int level)
     63static p_psComponent* componentAlloc(const char *name, psS32 level)
    6464{
    6565    p_psComponent* comp = psAlloc(sizeof(p_psComponent));
    … …  
    6868    p_psMemSetDeallocator(comp, (psFreeFcn) componentFree);
    6969    comp->name = psStringCopy(name);
    70     p_psMemSetPersistent((void*)comp->name,true);
     70    p_psMemSetPersistent((psPtr)comp->name,true);
    7171    comp->level = level;
    7272    comp->n = 0;
    … …  
    8686
    8787    if (comp->subcomp != NULL) {
    88         for (int i = 0; i < comp->n; i++) {
     88        for (psS32 i = 0; i < comp->n; i++) {
    8989            p_psMemSetPersistent(comp->subcomp[i],false);
    9090            psFree(comp->subcomp[i]);
    … …  
    9494    }
    9595
    96     p_psMemSetPersistent((void*)comp->name,false);
    97     psFree((void*)comp->name);
     96    p_psMemSetPersistent((psPtr)comp->name,false);
     97    psFree((psPtr)comp->name);
    9898}
    9999
    … …  
    115115void p_psTraceReset(p_psComponent* currentNode)
    116116{
    117     int i = 0;
     117    psS32 i = 0;
    118118
    119119    if (NULL == currentNode) {
    … …  
    149149to ANSI-C.
    150150 *****************************************************************************/
    151 static bool componentAdd(const char *addNodeName, int level)
    152 {
    153     int i = 0;                  // Loop index variable.
     151static psBool componentAdd(const char *addNodeName, psS32 level)
     152{
     153    psS32 i = 0;                  // Loop index variable.
    154154    char name[strlen(addNodeName) + 1]; // buffer for writeable copy.
    155155    char *pname = name;
    156156    char *firstComponent = NULL;        // first component of name
    157157    p_psComponent* currentNode = cRoot;
    158     int nodeExists = 0;
     158    psS32 nodeExists = 0;
    159159
    160160    // XXX: Verify that this is the correct behavior.
    … …  
    240240 zero
    241241*****************************************************************************/
    242 bool psTraceSetLevel(const char *comp,   // component of interest
    243                      int level)  // desired trace level
     242psBool psTraceSetLevel(const char *comp,   // component of interest
     243                       psS32 level)  // desired trace level
    244244{
    245245    char *compName = NULL;
    … …  
    299299 The trace level of the "name" component.
    300300 *****************************************************************************/
    301 static int doGetTraceLevel(const char *aname)
     301static psS32 doGetTraceLevel(const char *aname)
    302302{
    303303    char name[strlen(aname) + 1];       // need a writeable copy: for strsep()
    … …  
    305305    char *firstComponent = NULL;        // first component of name
    306306    p_psComponent* currentNode = cRoot;
    307     int i = 0;
    308     int defaultLevel = 0;
     307    psS32 i = 0;
     308    psS32 defaultLevel = 0;
    309309
    310310    if (NULL == currentNode) {
    … …  
    365365 The level of "name" in the root component tree.
    366366 *****************************************************************************/
    367 int psTraceGetLevel(const char *name)
     367psS32 psTraceGetLevel(const char *name)
    368368{
    369369    char *compName = NULL;
    370     int traceLevel;
     370    psS32 traceLevel;
    371371
    372372    if (cRoot == NULL) {
    … …  
    401401 *****************************************************************************/
    402402static void doPrintTraceLevels(const p_psComponent* comp,
    403                                int depth,
    404                                int defLevel)
    405 {
    406     int i = 0;
     403                               psS32 depth,
     404                               psS32 defLevel)
     405{
     406    psS32 i = 0;
    407407
    408408    if (comp->name[0] == '\0') {
    … …  
    472472 *****************************************************************************/
    473473void p_psTrace(const char *comp,        // component being traced
    474                int level,       // desired trace level
     474               psS32 level,       // desired trace level
    475475               ...)             // arguments
    476476{
    477477    char *fmt = NULL;
    478478    va_list ap;
    479     int i = 0;
     479    psS32 i = 0;
    480480
    481481    if (NULL == comp) {
  • trunk/psLib/src/sysUtils/psTrace.h

    r2202 r2204  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-10-26 23:14:04 $
     11 *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-10-27 00:57:31 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    … …  
    5050    {
    5151        const char *name;           // last part of name of component
    52         int level;                  // trace level for this component
    53         int n;                      // number of subcomponents
     52        psS32 level;                  // trace level for this component
     53        psS32 n;                      // number of subcomponents
    5454        struct p_psComponent* *subcomp;     // next level of subcomponents
    5555    }
    … …  
    5959/// Send a trace message
    6060void p_psTrace(const char *facil,       ///< facilty of interest
    61                int myLevel,     ///< desired trace level
     61               psS32 myLevel,     ///< desired trace level
    6262               ...)             ///< trace message arguments
    6363;
    … …  
    6565
    6666/// Set trace level
    67 bool psTraceSetLevel(const char *facil,     ///< facilty of interest
    68                      int level)     ///< desired trace level
     67psBool psTraceSetLevel(const char *facil,     ///< facilty of interest
     68                       psS32 level)     ///< desired trace level
    6969;
    7070
    7171/// Get the trace level
    72 int psTraceGetLevel(const char *facil)     ///< facilty of interest
     72psS32 psTraceGetLevel(const char *facil)     ///< facilty of interest
    7373;
    7474
  • trunk/psLib/src/sysUtils/psType.h

    r1984 r2204  
    1111*  @author Ross Harman, MHPCC
    1212*
    13 *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2004-10-06 21:40:13 $
     13*  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2004-10-27 00:57:31 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    … …  
    2323#include <stdint.h>
    2424#include <float.h>
     25#include <stdbool.h>
    2526
    2627/// @addtogroup DataContainer
    … …  
    5253typedef float _Complex psC32;          ///< complex with 32-bit floating point Real and Imagary numbers
    5354typedef double _Complex psC64;         ///< complex with 64-bit floating point Real and Imagary numbers
    54 typedef void *psPTR;                   ///< void pointer
     55typedef void* psPtr;                   ///< void pointer
     56typedef bool psBool;                   ///< boolean value
    5557
    5658typedef enum {
    … …  
    6062    PS_TYPE_S64 = 0x0108,              ///< Long integer.
    6163    PS_TYPE_U8 = 0x0301,               ///< Unsigned character.
    62     PS_TYPE_U16 = 0x0302,              ///< Unsigned short integer.
     64    PS_TYPE_U16 = 0x0302,              ///< Unsigned psS16 integer.
    6365    PS_TYPE_U32 = 0x0304,              ///< Unsigned integer.
    64     PS_TYPE_U64 = 0x0308,              ///< Unsigned long integer.
     66    PS_TYPE_U64 = 0x0308,              ///< Unsigned psS64 integer.
    6567    PS_TYPE_F32 = 0x0404,              ///< Single-precision Floating point.
    6668    PS_TYPE_F64 = 0x0408,              ///< Double-precision floating point.
    … …  
    115117#define PS_TYPE_C32_NAME "psC32"
    116118#define PS_TYPE_C64_NAME "psC64"
    117 #define PS_TYPE_PTR_NAME "psPTR"
     119#define PS_TYPE_PTR_NAME "psPtr"
    118120
    119121#define PS_TYPE_NAME(value,type) \
    … …  
    183185#define PS_IS_PSELEMTYPE_COMPLEX(x) ((x & 0x800) == 0x800)
    184186/// Macro to determine the storage size, in bytes, of the psElemType.
    185 #define PSELEMTYPE_SIZEOF(x) ( (x==PS_TYPE_PTR) ? sizeof(void*) :(x & 0xFF) )
     187#define PSELEMTYPE_SIZEOF(x) ( (x==PS_TYPE_PTR) ? sizeof(psPtr) :(x & 0xFF) )
    186188
    187189/** Dimensions of a data type.
Note: See TracChangeset for help on using the changeset viewer.