IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4556


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
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/db/psDB.c

    r4540 r4556  
    1212 *  @author Joshua Hoblitt
    1313 *
    14  *  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-07-12 19:12:00 $
     14 *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-07-15 02:33:52 $
    1616 *
    1717 *  Copyright 2005 Joshua Hoblitt, University of Hawaii
     
    14091409        // invert the PSToSQL table
    14101410        psToSQLTable = psDBGetPTypeToSQLTable();
    1411         lookupTable = psHashAlloc(psToSQLTable->nbucket);
     1411        lookupTable = psHashAlloc(psToSQLTable->n);
    14121412
    14131413        list = psHashKeyList(psToSQLTable);
  • trunk/psLib/src/fits/psFits.c

    r4540 r4556  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-07-12 19:12:01 $
     9 *  @version $Revision: 1.41 $ $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
     
    14741474
    14751475    // find all the columns needed
    1476     psArray* columns = psArrayAlloc(((psMetadata*)table->data[0])->list->size);
     1476    psArray* columns = psArrayAlloc(((psMetadata*)table->data[0])->list->n);
    14771477    columns->n=0;
    14781478
  • 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
  • trunk/psLib/src/types/psArray.c

    r4540 r4556  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-07-12 19:12:01 $
     11 *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-07-15 02:33:54 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4949  FUNCTION IMPLEMENTATION - PUBLIC
    5050 *****************************************************************************/
    51 psArray* psArrayAlloc(unsigned long nalloc)
     51psArray* psArrayAlloc(long nalloc)
    5252{
    5353    psArray* psArr = NULL;
     
    6666}
    6767
    68 psArray* psArrayRealloc(psArray* in, unsigned long nalloc)
     68psArray* psArrayRealloc(psArray* in, long nalloc)
    6969{
    7070    if (in == NULL) {
     
    160160/// Set an element in the array.
    161161bool psArraySet(psArray* array,                      ///< input array to set element in
    162                 unsigned long position,            ///< the element position to set
     162                long position,                      ///< the element position to set
    163163                psPtr data)                        ///< the value to set it to
    164164{
     
    185185
    186186/// Get an element in the array.
    187 psPtr psArrayGet(const psArray* array, unsigned long position )
     187psPtr psArrayGet(const psArray* array, long position )
    188188{
    189189    if (array == NULL) {
  • trunk/psLib/src/types/psArray.h

    r4367 r4556  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-06-23 03:50:29 $
     14 *  @version $Revision: 1.28 $ $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
     
    3434typedef struct
    3535{
    36     psU32 nalloc;                      ///< Total number of elements available.
    37     psU32 n;                           ///< Number of elements in use.
     36    long nalloc;                       ///< Total number of elements available.
     37    long n;                            ///< Number of elements in use.
    3838    psPtr* data;                       ///< An Array of pointer elements
     39    void *lock;                        ///< Optional lock for thread safety
    3940}
    4041psArray;
     
    5556 */
    5657psArray* psArrayAlloc(
    57     unsigned long nalloc               ///< Total number of elements to make available.
    58 );
     58    long nalloc                        ///< Total number of elements to make available.
     59)
     60;
    5961
    6062/** Reallocate an array.
     
    6870psArray* psArrayRealloc(
    6971    psArray* array,                    ///< array to reallocate.
    70     unsigned long nalloc               ///< Total number of elements to make available.
     72    long nalloc                        ///< Total number of elements to make available.
    7173);
    7274
     
    133135bool psArraySet(
    134136    psArray* array,                    ///< input array to set element in
    135     unsigned long position,            ///< the element position to set
     137    long position,                     ///< the element position to set
    136138    psPtr data                         ///< the value to set it to
    137139);
     
    143145psPtr psArrayGet(
    144146    const psArray* array,              ///< input array to get element from
    145     unsigned long position             ///< the element position to get
     147    long position                      ///< the element position to get
    146148);
    147149
  • trunk/psLib/src/types/psBitSet.c

    r4540 r4556  
    1111 *  @author Robert DeSonia, MHPCC
    1212 *
    13  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-07-12 19:12:01 $
     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
  • trunk/psLib/src/types/psBitSet.h

    r4342 r4556  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-06-22 02:05:41 $
     14 *  @version $Revision: 1.21 $ $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
     
    3737typedef struct
    3838{
    39     psS32 n;                             ///< Number of bytes in the array
    40     char *bits;                        ///< Aray of bytes holding bits
     39    long n;                            ///< Number of bytes in the array
     40    psU8 *bits;                        ///< Aray of bytes holding bits
     41    void *lock;                        ///< Optional lock for thread safety
    4142}
    4243psBitSet;
     
    5758psBitSet* psBitSetAlloc(
    5859    long nalloc                            ///< Number of bits in psBitSet array
    59 );
     60)
     61;
    6062
    6163/** Set a bit.
     
    7072    /* @returned@ */
    7173    psBitSet* bitSet,                  ///< Pointer to psBitSet to be set.
    72     long bit                          ///< Bit to be set.
     74    long bit                           ///< Bit to be set.
    7375);
    7476
  • trunk/psLib/src/types/psHash.c

    r4540 r4556  
    1212*  @author GLG, MHPCC
    1313*
    14 *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2005-07-12 19:12:01 $
     14*  @version $Revision: 1.23 $ $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
     
    5757    // Loop through every bucket in the hash table.  If that bucket is not
    5858    // NULL, then add the bucket's key to the linked list.
    59     for (i = 0; i < hash->nbucket; i++) {
     59    for (i = 0; i < hash->n; i++) {
    6060        if (hash->buckets[i] != NULL) {
    6161            // Since a bucket contains a linked list of keys/data, we must
     
    128128
    129129/******************************************************************************
    130 psHashAlloc(nbucket): this procedure creates a new hash table with the
     130psHashAlloc(n): this procedure creates a new hash table with the
    131131specified number of buckets.
    132132Inputs:
    133     nbucket: initial number of buckets
     133    n: initial number of buckets
    134134Return:
    135135    The new hash table.
     
    146146    // Allocate memory for the buckets.
    147147    table->buckets = psAlloc(nalloc * sizeof(psHashBucket* ));
    148     table->nbucket = nalloc;
     148    table->n = nalloc;
    149149
    150150    psTrace("utils.hash", 1, "Creating %d-element hash table\n", nalloc);
     
    179179    // Loop through each bucket in the hash table.  If that bucket is not
    180180    // NULL, then free the bucket via a function call to hashBucketFree();
    181     for (i = 0; i < table->nbucket; i++) {
     181    for (i = 0; i < table->n; i++) {
    182182
    183183        // A bucket is composed of a linked list of buckets.
     
    238238    // hash = (hash << 1) ^ key[i];
    239239    // }
    240     // hash &= (table->nbucket - 1);
     240    // hash &= (table->n - 1);
    241241
    242242    // This hash algorithm is from Sedgewick.  NOTE: must reread to ensure that
     
    244244    tmpchar = (char *)key;
    245245    for (hash = 0; *tmpchar != '\0'; tmpchar++) {
    246         hash = (64 * hash + *tmpchar) % (table->nbucket);
     246        hash = (64 * hash + *tmpchar) % (table->n);
    247247    }
    248248
    249249    // NOTE: This should not be necessary, but for now, I'm checking bounds
    250250    // anyway.
    251     if ((hash < 0) || (hash >= table->nbucket)) {
     251    if ((hash < 0) || (hash >= table->n)) {
    252252        psError(PS_ERR_UNKNOWN, true,
    253253                "Internal hash function out of range (%d)", hash);
     
    409409    // psArray we need to allocate.
    410410    int nElements = 0;
    411     int nbucket = hash->nbucket;
     411    int nbucket = hash->n;
    412412    for (int i = 0; i < nbucket; i++) {
    413413        psHashBucket* tmpBucket = hash->buckets[i];
  • trunk/psLib/src/types/psHash.h

    r4352 r4556  
    1111 *  @author GLG, MHPCC
    1212 *
    13  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-06-22 23:48:39 $
     13 *  @version $Revision: 1.13 $ $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
     
    4040typedef struct psHash
    4141{
    42     psS32 nbucket;                     ///< Number of buckets in hash table.
     42    long n;                            ///< Number of buckets in hash table.
    4343    psHashBucket* *buckets;            ///< The bucket data.
     44    void *lock;                        ///< Optional lock for thread safety.
    4445}
    4546psHash;
     
    4849psHash* psHashAlloc(
    4950    long nalloc                        ///< The number of buckets to allocate.
    50 );
     51)
     52;
    5153
    5254/// Insert entry into table.
  • trunk/psLib/src/types/psList.c

    r4540 r4556  
    66 *  @author Robert Daniel DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-07-12 19:12:01 $
     8 *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-07-15 02:33:54 $
    1010 *
    1111 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    113113    }
    114114
    115     list->size--;
     115    list->n--;
    116116
    117117    pthread_mutex_unlock(&list->lock)
     
    131131    psMemSetDeallocator(list, (psFreeFunc) listFree);
    132132
    133     list->size = 0;
     133    list->n = 0;
    134134    list->head = list->tail = NULL;
    135135    list->iterators = psArrayAlloc(16);
     
    182182
    183183bool psListIteratorSet(psListIterator* iterator,
    184                        int location)
     184                       long location)
    185185{
    186186    if (iterator == NULL) {
     
    192192    if (location == PS_LIST_TAIL) {
    193193        iterator->cursor = list->tail;
    194         iterator->index = list->size - 1;
     194        iterator->index = list->n - 1;
    195195        iterator->offEnd = false;
    196196        return true;
     
    205205
    206206    if (location < 0) {
    207         location = list->size + location;
    208     }
    209 
    210     if (location < 0 || location >= (int)list->size) {
     207        location = list->n + location;
     208    }
     209
     210    if (location < 0 || location >= (int)list->n) {
    211211        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    212212                PS_ERRORTEXT_psList_LOCATION_INVALID,
     
    218218    int index = iterator->index;
    219219    if (cursor == NULL) {      // set the cursor to the head if it is NULL
    220         if (location > list->size/2) { // closer to tail or head?
     220        if (location > list->n/2) { // closer to tail or head?
    221221            cursor = list->tail;
    222             index = list->size - 1;
     222            index = list->n - 1;
    223223        } else {
    224224            cursor = list->head;
     
    262262    }
    263263
    264     if (location > 0 && location >= (int)list->size) {
     264    if (location > 0 && location >= (int)list->n) {
    265265        psLogMsg(__func__,PS_LOG_WARN,
    266266                 "Specified location, %d, is beyond the end of the list.  "
     
    337337    elem->data = psMemIncrRefCounter(data);
    338338
    339     list->size++;
     339    list->n++;
    340340
    341341    if (cursor == list->tail) {
     
    412412    elem->data = psMemIncrRefCounter(data);
    413413
    414     list->size++;
     414    list->n++;
    415415
    416416    if (cursor == list->head) {
     
    548548    if ( (iterator->cursor == NULL) && (iterator->offEnd) ) {
    549549        iterator->cursor = iterator->list->tail;
    550         iterator->index = iterator->list->size-1;
     550        iterator->index = iterator->list->n-1;
    551551        iterator->offEnd = false;
    552552        return NULL;
     
    574574    }
    575575
    576     if (list->size > 0) {
    577         arr = psArrayAlloc(list->size);
     576    if (list->n > 0) {
     577        arr = psArrayAlloc(list->n);
    578578    } else {
    579579        arr = psArrayAlloc(1);
    580580    }
    581581
    582     arr->n = list->size;
     582    arr->n = list->n;
    583583
    584584    ptr = list->head;
    585     n = list->size;
     585    n = list->n;
    586586    for (psS32 i = 0; i < n; i++) {
    587587        arr->data[i] = psMemIncrRefCounter(ptr->data);
  • trunk/psLib/src/types/psList.h

    r4367 r4556  
    77 *  @ingroup LinkedList
    88 *
    9  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-06-23 03:50:29 $
     9 *  @version $Revision: 1.29 $ $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
     
    5252typedef struct
    5353{
    54     psU32 size;                        ///< number of elements on list
     54    long n;                            ///< number of elements on list
    5555    psListElem* head;                  ///< first element on list (may be NULL)
    5656    psListElem* tail;                  ///< last element on list (may be NULL)
     
    6161
    6262    pthread_mutex_t lock;              ///< mutex to lock a node during changes
     63//    void *lock;                        ///< Optional lock for thread safety
    6364}
    6465psList;
     
    110111 */
    111112bool psListIteratorSet(
    112     psListIterator* iterator,            ///< list iterator
    113     int location                         ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL
     113    psListIterator* iterator,          ///< list iterator
     114    long location                      ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL
    114115);
    115116
     
    120121bool psListAdd(
    121122    psList* list,                      ///< list to add item to
    122     long location,                    ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location.
     123    long location,                     ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location.
    123124    psPtr data                         ///< data item to add.  If NULL, list is not modified.
    124125);
  • trunk/psLib/src/types/psLookupTable.c

    r4540 r4556  
    77*  @author Ross Harman, MHPCC
    88*
    9 *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2005-07-12 19:12:01 $
     9*  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2005-07-15 02:33:54 $
    1111*
    1212*  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
     
    275275
    276276    // Valid ranges. Automatically set by table read if both zero.
    277     outTable->validFrom = 0;
    278     outTable->validTo = 0;
     277    *(double *)&outTable->validFrom = 0;
     278    *(double *)&outTable->validTo = 0;
    279279    outTable->indexCol = indexCol;
    280280
     
    291291switch (TABLE->index->type.type) {                                              \
    292292case PS_TYPE_U8:                                                                \
    293     TABLE->validFrom = (psF64)TABLE->index->data.U8[0];                         \
    294     TABLE->validTo   = (psF64)TABLE->index->data.U8[TABLE->index->n-1];         \
     293    *(double *)&TABLE->validFrom = (psF64)TABLE->index->data.U8[0];                         \
     294    *(double *)&TABLE->validTo   = (psF64)TABLE->index->data.U8[TABLE->index->n-1];         \
    295295    break;                                                                      \
    296296case PS_TYPE_S8:                                                                \
    297     TABLE->validFrom = (psF64)TABLE->index->data.S8[0];                         \
    298     TABLE->validTo   = (psF64)TABLE->index->data.S8[TABLE->index->n-1];         \
     297    *(double *)&TABLE->validFrom = (psF64)TABLE->index->data.S8[0];                         \
     298    *(double *)&TABLE->validTo   = (psF64)TABLE->index->data.S8[TABLE->index->n-1];         \
    299299    break;                                                                      \
    300300case PS_TYPE_U16:                                                               \
    301     TABLE->validFrom = (psF64)TABLE->index->data.U16[0];                        \
    302     TABLE->validTo   = (psF64)TABLE->index->data.U16[TABLE->index->n-1];        \
     301    *(double *)&TABLE->validFrom = (psF64)TABLE->index->data.U16[0];                        \
     302    *(double *)&TABLE->validTo   = (psF64)TABLE->index->data.U16[TABLE->index->n-1];        \
    303303    break;                                                                      \
    304304case PS_TYPE_S16:                                                               \
    305     TABLE->validFrom = (psF64)TABLE->index->data.S16[0];                        \
    306     TABLE->validTo   = (psF64)TABLE->index->data.S16[TABLE->index->n-1];        \
     305    *(double *)&TABLE->validFrom = (psF64)TABLE->index->data.S16[0];                        \
     306    *(double *)&TABLE->validTo   = (psF64)TABLE->index->data.S16[TABLE->index->n-1];        \
    307307    break;                                                                      \
    308308case PS_TYPE_U32:                                                               \
    309     TABLE->validFrom = (psF64)TABLE->index->data.U32[0];                        \
    310     TABLE->validTo   = (psF64)TABLE->index->data.U32[TABLE->index->n-1];        \
     309    *(double *)&TABLE->validFrom = (psF64)TABLE->index->data.U32[0];                        \
     310    *(double *)&TABLE->validTo   = (psF64)TABLE->index->data.U32[TABLE->index->n-1];        \
    311311    break;                                                                      \
    312312case PS_TYPE_S32:                                                               \
    313     TABLE->validFrom = (psF64)TABLE->index->data.S32[0];                        \
    314     TABLE->validTo   = (psF64)TABLE->index->data.S32[TABLE->index->n-1];        \
     313    *(double *)&TABLE->validFrom = (psF64)TABLE->index->data.S32[0];                        \
     314    *(double *)&TABLE->validTo   = (psF64)TABLE->index->data.S32[TABLE->index->n-1];        \
    315315    break;                                                                      \
    316316case PS_TYPE_U64:                                                               \
    317     TABLE->validFrom = (psF64)TABLE->index->data.U64[0];                        \
    318     TABLE->validTo   = (psF64)TABLE->index->data.U64[TABLE->index->n-1];        \
     317    *(double *)&TABLE->validFrom = (psF64)TABLE->index->data.U64[0];                        \
     318    *(double *)&TABLE->validTo   = (psF64)TABLE->index->data.U64[TABLE->index->n-1];        \
    319319    break;                                                                      \
    320320case PS_TYPE_S64:                                                               \
    321     TABLE->validFrom = (psF64)TABLE->index->data.S64[0];                        \
    322     TABLE->validTo   = (psF64)TABLE->index->data.S64[TABLE->index->n-1];        \
     321    *(double *)&TABLE->validFrom = (psF64)TABLE->index->data.S64[0];                        \
     322    *(double *)&TABLE->validTo   = (psF64)TABLE->index->data.S64[TABLE->index->n-1];        \
    323323    break;                                                                      \
    324324case PS_TYPE_F32:                                                               \
    325     TABLE->validFrom = (psF64)TABLE->index->data.F32[0];                        \
    326     TABLE->validTo   = (psF64)TABLE->index->data.F32[TABLE->index->n-1];        \
     325    *(double *)&TABLE->validFrom = (psF64)TABLE->index->data.F32[0];                        \
     326    *(double *)&TABLE->validTo   = (psF64)TABLE->index->data.F32[TABLE->index->n-1];        \
    327327    break;                                                                      \
    328328case PS_TYPE_F64:                                                               \
    329     TABLE->validFrom = (psF64)TABLE->index->data.F64[0];                        \
    330     TABLE->validTo   = (psF64)TABLE->index->data.F64[TABLE->index->n-1];        \
     329    *(double *)&TABLE->validFrom = (psF64)TABLE->index->data.F64[0];                        \
     330    *(double *)&TABLE->validTo   = (psF64)TABLE->index->data.F64[TABLE->index->n-1];        \
    331331    break;                                                                      \
    332332default:                                                                        \
    333     TABLE->validFrom = (psF64)0;                                                \
    334     TABLE->validTo   = (psF64)0;                                                \
     333    *(double *)&TABLE->validFrom = (psF64)0;                                                \
     334    *(double *)&TABLE->validTo   = (psF64)0;                                                \
    335335    break;                                                                      \
    336336}
     
    641641long psLookupTableRead(psLookupTable* table)
    642642{
    643     psS32           numRows  = 0;
     643    long            numRows  = 0;
    644644    psArray*        vectors  = NULL;
    645645    psLookupTable*  outTable = NULL;
     
    745745}
    746746
    747 psF64 psLookupTableInterpolate(const psLookupTable *table, psF64 index, psS32 column)
     747double psLookupTableInterpolate(const psLookupTable *table, double index, long column)
    748748{
    749749    psU64 hiIdx = 0;
    750750    psU64 loIdx = 0;
    751     psU64 numRows = 0;
    752     psU64 numCols = 0;
     751    long numRows = 0;
     752    long numCols = 0;
    753753    psF64 out = 0.0;
    754754    psF64 denom = 0.0;
     
    818818}
    819819
    820 psVector* psLookupTableInterpolateAll(psLookupTable *table, psF64 index)
    821 {
    822     psU64 numCols = 0;
     820psVector* psLookupTableInterpolateAll(const psLookupTable *table, double index)
     821{
     822    long numCols = 0;
    823823    psVector *outVector = NULL;
    824824
  • trunk/psLib/src/types/psLookupTable.h

    r4366 r4556  
    77*  @author Ross Harman, MHPCC
    88*
    9 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2005-06-23 03:19:29 $
     9*  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2005-07-15 02:33:54 $
    1111*
    1212*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3333    psVector *index;                   ///< Vector of independent index values
    3434    psArray *values;                   ///< Array of dependent table values corresponding to index values
    35     psF64 validFrom;                   ///< Lower bound for rable read
    36     psF64 validTo;                     ///< Upper bound for table read
     35    const double validFrom;            ///< Lower bound for rable read
     36    const double validTo;              ///< Upper bound for table read
    3737}
    3838psLookupTable;
     
    100100 *  Reads a lookup table and fills corresponding psLookupTable struct.
    101101 *
    102  *  @return psS32     Number of valid lines read
     102 *  @return long:     Number of valid lines read
    103103 */
    104104long psLookupTableRead(
     
    111111 *  conditions.
    112112 *
    113  *  @return psLookupTable*     New psLookupTable struct
     113 *  @return double     Interpolation value at index
    114114 */
    115 psF64 psLookupTableInterpolate(
    116     const psLookupTable *table,     ///< Table with data
    117     psF64 index,                    ///< Value to be interpolated
    118     psS32 column                    ///< Column in table to be interpolated
     115double psLookupTableInterpolate(
     116    const psLookupTable *table,        ///< Table with data
     117    double index,                      ///< Value to be interpolated
     118    long column                        ///< Column in table to be interpolated
    119119);
    120120
     
    124124 *  conditions.
    125125 *
    126  *  @return psLookupTable*     New psLookupTable struct
     126 *  @return psVector*     Interpolation values calculated at index
    127127 */
    128128psVector* psLookupTableInterpolateAll(
    129     psLookupTable *table,           ///< Table with data
    130     psF64 index                     ///< Value to be interpolated
     129    const psLookupTable *table,        ///< Table with data
     130    double index                       ///< Value to be interpolated
    131131);
    132132
  • trunk/psLib/src/types/psMetadata.c

    r4540 r4556  
    1212*  @author Ross Harman, MHPCC
    1313*
    14 *  @version $Revision: 1.70 $ $Name: not supported by cvs2svn $
    15 *  @date $Date: 2005-07-12 19:12:01 $
     14*  @version $Revision: 1.71 $ $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
     
    122122    psFree(iter->iter);
    123123
    124     if (iter->preg != NULL) {
    125         regfree(iter->preg);
     124    if (iter->regex != NULL) {
     125        regfree(iter->regex);
    126126    }
    127127}
     
    268268}
    269269
    270 bool psMetadataAddItem(psMetadata *md, const psMetadataItem *item, psS32 location, psS32 flags)
     270bool psMetadataAddItem(psMetadata *md, const psMetadataItem *item, long location, psS32 flags)
    271271{
    272272    char * key = NULL;
     
    360360}
    361361
    362 bool psMetadataAdd(psMetadata *md, int location, const char *name,
     362bool psMetadataAdd(psMetadata *md, long location, const char *name,
    363363                   int format, const char *comment, ...)
    364364{
     
    372372}
    373373
    374 bool psMetadataAddV(psMetadata *md, int location, const char *name,
     374bool psMetadataAddV(psMetadata *md, long location, const char *name,
    375375                    int format, const char *comment, va_list list)
    376376{
     
    391391
    392392#define METADATA_ADD_TYPE(NAME,TYPE,METATYPE) \
    393 psBool psMetadataAdd##NAME(psMetadata* md, psS32 where, const char* name, \
     393psBool psMetadataAdd##NAME(psMetadata* md, long where, const char* name, \
    394394                           const char* comment, TYPE value) { \
    395395    return psMetadataAdd(md,where,name, METATYPE,comment,value); \
     
    409409METADATA_ADD_TYPE(Array,psArray*,PS_META_ARRAY)
    410410
    411 psBool psMetadataRemove(psMetadata *md, psS32 where, const char *key)
     411psBool psMetadataRemove(psMetadata *md, long where, const char *key)
    412412{
    413413    PS_ASSERT_PTR_NON_NULL(md,NULL);
     
    580580psMetadataLookupNumTYPE(Bool)
    581581
    582 psMetadataItem* psMetadataGet(const psMetadata *md, int location)
     582psMetadataItem* psMetadataGet(const psMetadata *md, long location)
    583583{
    584584    psMetadataItem* entry = NULL;
     
    597597
    598598psMetadataIterator* psMetadataIteratorAlloc(psMetadata* md,
    599         int location,
     599        long location,
    600600        const char* regex)
    601601{
     
    604604
    605605    psMetadataIterator* newIter = psAlloc(sizeof(psMetadataIterator));
    606     newIter->preg = NULL;
     606    newIter->regex = NULL;
    607607    newIter->iter = NULL;
    608608
     
    614614        return newIter;
    615615    } else {
    616         int regRtn = regcomp(newIter->preg,regex,0);
     616        int regRtn = regcomp(newIter->regex,regex,0);
    617617        if (regRtn != 0) {
    618618            char errMsg[256];
    619             regerror(regRtn, newIter->preg, errMsg, 256);
    620             regfree(newIter->preg);
     619            regerror(regRtn, newIter->regex, errMsg, 256);
     620            regfree(newIter->regex);
    621621            psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    622622                    PS_ERRORTEXT_psMetadata_REGEX_INVALID,
     
    633633
    634634bool psMetadataIteratorSet(psMetadataIterator* iterator,
    635                            int location)
     635                           long location)
    636636{
    637637    int match;
     
    643643    PS_ASSERT_PTR_NON_NULL(iterator->iter,NULL);
    644644
    645     regex_t* preg = iterator->preg;
     645    regex_t* regex = iterator->regex;
    646646
    647647    // handle trivial case where no regex subsetting is required.
    648     if (preg == NULL) {
     648    if (regex == NULL) {
    649649        return psListIteratorSet(iter,location);
    650650    }
     
    655655        psListIteratorSet(iter,PS_LIST_TAIL);
    656656        while ( (cursor=(psMetadataItem*)iter->cursor) != NULL) {
    657             if (regexec(preg, cursor->name, 0, NULL, 0) == 0) {
     657            if (regexec(regex, cursor->name, 0, NULL, 0) == 0) {
    658658                // this key is a match
    659659                match--;
     
    671671    psListIteratorSet(iter,PS_LIST_HEAD);
    672672    while ( (cursor=(psMetadataItem*)iter->cursor) != NULL) {
    673         if (regexec(preg, cursor->name, 0, NULL, 0) == 0) {
     673        if (regexec(regex, cursor->name, 0, NULL, 0) == 0) {
    674674            // this key is a match
    675675            match++;
     
    692692    PS_ASSERT_PTR_NON_NULL(iterator->iter,NULL);
    693693
    694     regex_t* preg = iterator->preg;
     694    regex_t* regex = iterator->regex;
    695695
    696696    // handle trivial case where no regex subsetting is required.
    697     if (preg == NULL) {
     697    if (regex == NULL) {
    698698        return (psMetadataItem*)psListGetAndIncrement(iter);
    699699    }
     
    703703    while (psListGetAndIncrement(iter) != NULL) {
    704704        if (iter->cursor != NULL &&
    705                 regexec(preg, ((psMetadataItem*)iter->cursor)->name, 0, NULL, 0) == 0) {
     705                regexec(regex, ((psMetadataItem*)iter->cursor)->name, 0, NULL, 0) == 0) {
    706706            // this key is a match
    707707            break;
     
    720720    PS_ASSERT_PTR_NON_NULL(iterator->iter,NULL);
    721721
    722     regex_t* preg = iterator->preg;
     722    regex_t* regex = iterator->regex;
    723723
    724724    // handle trivial case where no regex subsetting is required.
    725     if (preg == NULL) {
     725    if (regex == NULL) {
    726726        return (psMetadataItem*)psListGetAndDecrement(iter);
    727727    }
     
    731731    while (psListGetAndDecrement(iter) != NULL) {
    732732        if (iter->cursor != NULL &&
    733                 regexec(preg, ((psMetadataItem*)iter->cursor)->name, 0, NULL, 0) == 0) {
     733                regexec(regex, ((psMetadataItem*)iter->cursor)->name, 0, NULL, 0) == 0) {
    734734            // this key is a match
    735735            break;
  • trunk/psLib/src/types/psMetadata.h

    r4401 r4556  
    1111*  @author Ross Harman, MHPCC
    1212*
    13 *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2005-06-27 20:38:12 $
     13*  @version $Revision: 1.53 $ $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
     
    5555    PS_META_ARRAY                      ///< Array data (Stored as item.data.V).
    5656} psMetadataType;
    57 
    5857#define PS_META_IS_PRIMITIVE(TYPE) \
    5958(TYPE == PS_META_S32 || \
     
    7776    PS_META_DEFAULT = 0,               ///< default behaviour (duplicate entry is an error)
    7877    PS_META_REPLACE = 0x1000000,       ///< allow entry to be replaced
    79     PS_META_DUPLICATE_OK = 0x2000000   ///< allow duplicate entries
     78    PS_META_DUPLICATE_OK = 0x2000000,  ///< allow duplicate entries
     79    PS_META_NULL = 0x4000000           ///< psMetadataItem.data is a NULL value
    8080} psMetadataFlags;
    8181
     
    9494    psList*  list;                     ///< Metadata in linked-list
    9595    psHash*  table;                    ///< Metadata in a hash table
     96    void *lock;                        ///< Optional lock for thread safety
    9697}
    9798psMetadata;
     
    104105{
    105106    psListIterator* iter;              ///< iterator for the psMetadata's psList
    106     regex_t* preg;                     ///< the subsetting regular expression
     107    regex_t* regex;                    ///< the subsetting regular expression
    107108}
    108109psMetadataIterator;
     
    116117{
    117118    const psS32 id;                    ///< Unique ID for metadata item.
    118     char *name;                        ///< Name of metadata item.
     119    psString name;                     ///< Name of metadata item.
    119120    psMetadataType type;               ///< Type of metadata item.
    120121    union {
     
    127128        psPtr V;                       ///< Pointer to other type of data.
    128129    } data;                            ///< Union for data types.
    129     char *comment;                     ///< Optional comment ("", not NULL).
     130    psString comment;                  ///< Optional comment ("", not NULL).
    130131}
    131132psMetadataItem;
     
    151152    const char *comment,               ///< Comment for metadata item.
    152153    ...                                ///< Arguments for name formatting and metadata item data.
    153 );
     154)
     155;
    154156
    155157/** Create a metadata item with specified string data.
     
    261263    psMetadata*  md,                   ///< Metadata collection to insert metadat item.
    262264    const psMetadataItem* item,        ///< Metadata item to be added.
    263     psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     265    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
    264266    psS32 flags                        ///< Options flag mask, see psMetadataFlags enum
    265267);
     
    273275bool psMetadataAdd(
    274276    psMetadata* md,                    ///< Metadata collection to insert metadata item.
    275     int location,                      ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     277    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
    276278    const char *name,                  ///< Name of metadata item.
    277279    int format,                        ///< Type of metadata item (psMetadataType) and options (psMetadataFlags)
     
    289291bool psMetadataAddV(
    290292    psMetadata* md,                    ///< Metadata collection to insert metadata item.
    291     int location,                      ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     293    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
    292294    const char *name,                  ///< Name of metadata item.
    293295    int format,                        ///< Type of metadata item (psMetadataType) and options (psMetadataFlags)
     
    298300
    299301/** Add a psS32 value to metadata collection.
    300  * 
    301  *  @return bool:  True for success, False for failure. 
     302 *
     303 *  @return bool:  True for success, False for failure.
    302304 */
    303305bool psMetadataAddS32(
    304306    psMetadata* md,                    ///< Metadata collection to insert metadata item
    305     psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     307    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
    306308    const char* name,                  ///< Name of metadata item
    307309    const char* comment,               ///< Comment for metadata item
     
    310312
    311313/** Add a psF32 value to metadata collection.
    312  * 
     314 *
    313315 *  @return bool:  True for success, False for failure.
    314316*/
    315317bool psMetadataAddF32(
    316318    psMetadata* md,                    ///< Metadata collection to insert metadata item
    317     psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     319    long location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
    318320    const char* name,                  ///< Name of metadata item
    319321    const char* comment,               ///< Comment for metadata item
     
    322324
    323325/** Add a psF64 value to metadata collection.
    324  * 
     326 *
    325327 *  @return bool:  True for success, False for failure.
    326328*/
    327329bool psMetadataAddF64(
    328330    psMetadata* md,                    ///< Metadata collection to insert metadata item
    329     psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     331    long location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
    330332    const char* name,                  ///< Name of metadata item
    331333    const char* comment,               ///< Comment for metadata item
     
    334336
    335337/** Add a psList to metadata collection.
    336  *       
     338 *
    337339 *  @return psBool:  True for success, False for failure.
    338340 */
    339341psBool psMetadataAddList(
    340342    psMetadata* md,                    ///< Metadata collection to insert metadata item
    341     psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     343    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
    342344    const char* name,                  ///< Name of metadata item
    343345    const char* comment,               ///< Comment for metadata item
     
    346348
    347349/** Add a string to metadata collection.
    348  * 
     350 *
    349351 *  @return bool:  True for success, False for failure.
    350352 */
    351353bool psMetadataAddStr(
    352354    psMetadata* md,                    ///< Metadata collection to insert metadata item
    353     psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     355    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
    354356    const char* name,                  ///< Name of metadata item
    355357    const char* comment,               ///< Comment for metadata item
     
    358360
    359361/** Add a vector to metadata collection.
    360  * 
     362 *
    361363 *  @return psBool:  True for success, False for failure.
    362364 */
    363365psBool psMetadataAddVector(
    364366    psMetadata* md,                    ///< Metadata collection to insert metadata item
    365     psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     367    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
    366368    const char* name,                  ///< Name of metadata item
    367369    const char* comment,               ///< Comment for metadata item
     
    370372
    371373/** Add a array to metadata collection.
    372  * 
     374 *
    373375 *  @return psBool:  True for success, False for failure.
    374376 */
    375377psBool psMetadataAddArray(
    376378    psMetadata* md,                    ///< Metadata collection to insert metadata item
    377     psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     379    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
    378380    const char* name,                  ///< Name of metadata item
    379381    const char* comment,               ///< Comment for metadata item
     
    382384
    383385/** Add an Image to metadata collection.
    384  * 
     386 *
    385387 *  @return psBool:  True for success, False for failure.
    386388 */
    387389psBool psMetadataAddImage(
    388390    psMetadata* md,                    ///< Metadata collection to insert metadata item
    389     psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     391    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
    390392    const char* name,                  ///< Name of metadata item
    391393    const char* comment,               ///< Comment for metadata item
     
    394396
    395397/** Add a Hash to metadata collection.
    396  * 
     398 *
    397399 *  @return psBool:  True for success, False for failure.
    398400 */
    399401psBool psMetadataAddHash(
    400402    psMetadata* md,                    ///< Metadata collection to insert metadata item
    401     psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     403    long location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
    402404    const char* name,                  ///< Name of metadata item
    403405    const char* comment,               ///< Comment for metadata item
     
    406408
    407409/** Add a LookupTable to metadata collection.
    408  * 
     410 *
    409411 *  @return psBool:  True for success, False for failure.
    410412 */
    411413psBool psMetadataAddLookupTable(
    412414    psMetadata* md,                    ///< Metadata collection to insert metadata item
    413     psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     415    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
    414416    const char* name,                  ///< Name of metadata item
    415417    const char* comment,               ///< Comment for metadata item
     
    418420
    419421/** Add an Unknown (psPtr) to metadata collection.
    420  * 
     422 *
    421423 *  @return psBool:  True for success, False for failure.
    422424 */
    423425psBool psMetadataAddUnknown(
    424426    psMetadata* md,                    ///< Metadata collection to insert metadata item
    425     psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     427    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
    426428    const char* name,                  ///< Name of metadata item
    427429    const char* comment,               ///< Comment for metadata item
     
    430432
    431433/** Add Metadata to metadata collection.
    432  * 
     434 *
    433435 *  @return psBool:  True for success, False for failure.
    434436 */
    435437psBool psMetadataAddMetadata(
    436438    psMetadata* md,                    ///< Metadata collection to insert metadata item
    437     psS32 location,                    ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     439    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
    438440    const char* name,                  ///< Name of metadata item
    439441    const char* comment,               ///< Comment for metadata item
     
    453455bool psMetadataRemove(
    454456    psMetadata*  md,                   ///< Metadata collection to remove metadata item.
    455     int location,                      ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     457    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
    456458    const char * key                   ///< Name of metadata key.
    457459);
     
    549551psMetadataItem* psMetadataGet(
    550552    const psMetadata* md,              ///< Metadata collection to retrieve metadata item.
    551     int location                       ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     553    long location                      ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
    552554);
    553555
     
    562564psMetadataIterator* psMetadataIteratorAlloc(
    563565    psMetadata* md,                    ///< the psMetadata to iterate with
    564     int location,                      ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
     566    long location,                     ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL
    565567    const char* regex
    566568    ///< A regular expression for subsetting the psMetadata.  If NULL, no
     
    575577bool psMetadataIteratorSet(
    576578    psMetadataIterator* iterator,      ///< psMetadata iterator
    577     int location                       ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL
     579    long location                      ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL
    578580);
    579581
  • trunk/psLib/src/types/psMetadataConfig.c

    r4540 r4556  
    1 /** @file  psMetadataConfig.c
     1/** @file  psMetadataIO.c
    22*
    33*  @brief Contains metadata input/output functions.
     
    1010*  @author Eric Van Alst, MHPCC
    1111*
    12 *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-07-12 19:12:01 $
     12*  @version $Revision: 1.36 $ $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
    1616*/
    1717
     18#include <libxml/parser.h>
    1819#include <fitsio.h>
    1920#include <string.h>
     
    3334#include "psConstants.h"
    3435#include "psErrorText.h"
     36
     37/******************************************************************************/
     38/*  DEFINE STATEMENTS                                                         */
     39/******************************************************************************/
    3540
    3641/** Check for FITS errors */
     
    5459#define MAX_STRING_LENGTH 256
    5560
     61
     62/******************************************************************************/
     63/*  TYPE DEFINITIONS                                                          */
     64/******************************************************************************/
     65
     66// None
     67
     68/*****************************************************************************/
     69/*  GLOBAL VARIABLES                                                         */
     70/*****************************************************************************/
     71
     72// None
     73
     74/*****************************************************************************/
     75/*  FILE STATIC VARIABLES                                                    */
     76/*****************************************************************************/
     77
     78// None
     79
     80/*****************************************************************************/
     81/*  FUNCTION IMPLEMENTATION - LOCAL                                          */
     82/*****************************************************************************/
     83
    5684static psMetadata* getMetadataType(char *linePtr);
    57 
    5885static psMetadata* setMetadataItem(psMetadata* template, char* linePtr)
    5986;
    60 
    6187static void parseLevelInfoFree(p_psParseLevelInfo* info);
    62 
    6388static psBool parseLine(psS32* level,   psArray* levelArray,
    64                         char*  linePtr, psS32 lineCount, char* fileName,
    65                         psBool overwrite);
    66 
    67 static psBool parseMetadataItem(char* keyName, psS32* level,
    68                                 psArray* levelArray, char* linePtr,
    69                                 psS32 lineCount, char* fileName,
    70                                 psMetadataFlags flags);
     89                        char*  linePtr, psS32 lineCount,     char* fileName, psBool overwrite);
     90static psBool parseMetadataItem(char* keyName, psS32* level,     psArray* levelArray,
     91                                char* linePtr, psS32  lineCount, char*    fileName,    psMetadataFlags flags);
    7192
    7293static void parseLevelInfoFree(p_psParseLevelInfo* info)
     
    594615
    595616    // Determine the number of items in template
    596     items = template->list->size;
     617    items = template->list->n;
    597618    if(items > 0 ) {
    598619
  • trunk/psLib/src/types/psMetadataConfig.h

    r4540 r4556  
    1010 *  @author Robert DeSonia, MHPCC
    1111 *
    12  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2005-07-12 19:12:01 $
     12 *  @version $Revision: 1.17 $ $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
     
    1717#ifndef PS_METADATACONFIG_H
    1818#define PS_METADATACONFIG_H
    19 
    20 #include "psMetadata.h"
    2119
    2220/// @addtogroup Metadata
  • trunk/psLib/src/types/psPixels.c

    r4540 r4556  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-07-12 19:12:01 $
     9 *  @version $Revision: 1.14 $ $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
     
    5555}
    5656
    57 psPixels* psPixelsAlloc(psU32 nalloc)
     57psPixels* psPixelsAlloc(long nalloc)
    5858{
    5959    psPixels* out = psAlloc(sizeof(psPixels));
     
    7272}
    7373
    74 psPixels* psPixelsRealloc(psPixels* pixels, psU32 nalloc)
     74psPixels* psPixelsRealloc(psPixels* pixels, long nalloc)
    7575{
    7676    if (pixels == NULL) {
     
    9494}
    9595
    96 psPixels* p_psPixelsAppend(psPixels* pixels, int growth, psS32 x, psS32 y)
     96psPixels* p_psPixelsAppend(psPixels* pixels, long growth, int x, int y)
    9797{
    9898    if (growth < 1) {
  • trunk/psLib/src/types/psPixels.h

    r4401 r4556  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-06-27 20:38:12 $
     9 *  @version $Revision: 1.9 $ $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
     
    2424typedef struct
    2525{
    26     psS32 x;                           ///< x coordinate
    27     psS32 y;                           ///< y coordinate
     26    int x;                             ///< x coordinate
     27    int y;                             ///< y coordinate
    2828}
    2929psPixelCoord;
     
    4141typedef struct
    4242{
    43     int n;                             ///< Number in usa
    44     int nalloc;                        ///< Number allocated
     43    long n;                            ///< Number in usa
     44    long nalloc;                       ///< Number allocated
    4545    psPixelCoord* data;                ///< The pixel coordinates
     46    void *lock;                        ///< Option lock for thread safety
    4647}
    4748psPixels;
     
    5354 */
    5455psPixels* psPixelsAlloc(
    55     psU32 nalloc                       ///< the size of the coordinate vectors
    56 );
     56    long nalloc                       ///< the size of the coordinate vectors
     57)
     58;
    5759
    5860/** resizes a psPixels structure
     
    6264psPixels* psPixelsRealloc(
    6365    psPixels* pixels,                  ///< psPixels to resize, or NULL to create new psPixels
    64     psU32 nalloc                       ///< the size of the coordinate vectors
     66    long nalloc                       ///< the size of the coordinate vectors
    6567);
    6668
     
    7173psPixels* p_psPixelsAppend(
    7274    psPixels* pixels,                  ///< psPixels to append new coordinate to.  NULL creates a new one.
    73     int growth,                        ///< number of elements to grow the psPixels list, if necessary.  if growth < 1, 10 is used.
    74     psS32 x,                           ///< x coordinate to append
    75     psS32 y                            ///< y coordinate to append
     75    long growth,                        ///< number of elements to grow the psPixels list, if necessary.  if growth < 1, 10 is used.
     76    int x,                             ///< x coordinate to append
     77    int y                              ///< y coordinate to append
    7678);
    7779
     
    138140
    139141/** Prints a psPixels to specified destination.
    140  * 
     142 *
    141143 *  @return bool:    True if successful.
    142144*/
Note: See TracChangeset for help on using the changeset viewer.