Changeset 4556
- Timestamp:
- Jul 14, 2005, 4:33:54 PM (21 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 24 edited
-
db/psDB.c (modified) (2 diffs)
-
fits/psFits.c (modified) (2 diffs)
-
sys/psError.c (modified) (2 diffs)
-
sys/psError.h (modified) (4 diffs)
-
sys/psErrorCodes.c (modified) (1 diff)
-
sys/psLogMsg.h (modified) (2 diffs)
-
sys/psMemory.c (modified) (11 diffs)
-
sys/psMemory.h (modified) (18 diffs)
-
types/psArray.c (modified) (5 diffs)
-
types/psArray.h (modified) (6 diffs)
-
types/psBitSet.c (modified) (1 diff)
-
types/psBitSet.h (modified) (4 diffs)
-
types/psHash.c (modified) (8 diffs)
-
types/psHash.h (modified) (3 diffs)
-
types/psList.c (modified) (12 diffs)
-
types/psList.h (modified) (5 diffs)
-
types/psLookupTable.c (modified) (6 diffs)
-
types/psLookupTable.h (modified) (5 diffs)
-
types/psMetadata.c (modified) (19 diffs)
-
types/psMetadata.h (modified) (27 diffs)
-
types/psMetadataConfig.c (modified) (5 diffs)
-
types/psMetadataConfig.h (modified) (2 diffs)
-
types/psPixels.c (modified) (4 diffs)
-
types/psPixels.h (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/db/psDB.c
r4540 r4556 12 12 * @author Joshua Hoblitt 13 13 * 14 * @version $Revision: 1.3 8$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-07-1 2 19:12:00$14 * @version $Revision: 1.39 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-07-15 02:33:52 $ 16 16 * 17 17 * Copyright 2005 Joshua Hoblitt, University of Hawaii … … 1409 1409 // invert the PSToSQL table 1410 1410 psToSQLTable = psDBGetPTypeToSQLTable(); 1411 lookupTable = psHashAlloc(psToSQLTable->n bucket);1411 lookupTable = psHashAlloc(psToSQLTable->n); 1412 1412 1413 1413 list = psHashKeyList(psToSQLTable); -
trunk/psLib/src/fits/psFits.c
r4540 r4556 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.4 0$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-07-1 2 19:12:01$9 * @version $Revision: 1.41 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-07-15 02:33:54 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1474 1474 1475 1475 // 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); 1477 1477 columns->n=0; 1478 1478 -
trunk/psLib/src/sys/psError.c
r4392 r4556 10 10 * @author Eric Van Alst, MHPCC 11 11 * 12 * @version $Revision: 1.2 7$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-0 6-25 02:02:05$12 * @version $Revision: 1.28 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-07-15 02:33:54 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 152 152 } 153 153 154 psS32psErrorGetStackSize()154 unsigned int psErrorGetStackSize() 155 155 { 156 156 return errorStackSize; -
trunk/psLib/src/sys/psError.h
r4342 r4556 12 12 * @author Eric Van Alst, MHPCC 13 13 * 14 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-0 6-22 02:05:41$14 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-07-15 02:33:54 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 74 74 * @return psS32 The number of items on the error stack 75 75 */ 76 psS32psErrorGetStackSize();76 unsigned int psErrorGetStackSize(); 77 77 78 78 /** Prints error stack to specified open file descriptor … … 138 138 139 139 /** Reports an error message to the logging facility 140 * 140 * 141 141 * This function will invoke the psLogMsg function with a level of 142 142 * PS_LOG_ERROR and pass the parameters name and fmt to generate a proper 143 143 * log message. This function is used to check a specific code location. 144 * 144 * 145 145 * This function modifies the error stack. 146 146 * … … 158 158 159 159 /** Logs a warning message. 160 * 160 * 161 161 * 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 163 163 * PS_LOG_WARN. This function is used to check a specific code location. 164 * 164 * 165 165 */ 166 166 void p_psWarning( -
trunk/psLib/src/sys/psErrorCodes.c
r4549 r4556 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.2 3$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-07-1 3 10:49:30$9 * @version $Revision: 1.24 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-07-15 02:33:54 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii -
trunk/psLib/src/sys/psLogMsg.h
r4367 r4556 11 11 * @author GLG, MHPCC 12 12 * 13 * @version $Revision: 1.2 8$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-0 6-23 03:50:29$13 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-07-15 02:33:54 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 67 67 void psLogMsg( 68 68 const char *name, ///< name of the log source 69 int level, ///< severity level of this log message70 const char *format, ///< printf-style format command69 int level, ///< severity level of this log message 70 const char *format, ///< printf-style format command 71 71 ... 72 72 ); -
trunk/psLib/src/sys/psMemory.c
r4540 r4556 8 8 * @author Robert Lupton, Princeton University 9 9 * 10 * @version $Revision: 1.5 8$ $Name: not supported by cvs2svn $11 * @date $Date: 2005-07-1 2 19:12:01$10 * @version $Revision: 1.59 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-07-15 02:33:54 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 84 84 /* 85 85 * Default callback for both allocate and free. Note that the 86 * value of p_psMemAlloc ateID/p_psMemFreeID is incremented86 * value of p_psMemAllocID/p_psMemFreeID is incremented 87 87 * by the return value (so returning 0 means that the callback 88 88 * isn't resignalled) 89 89 */ 90 static psMemId memAlloc ateCallbackDefault(const psMemBlock* ptr)91 { 92 static psMemId incr = 0; // "p_psMemAlloc ateID += incr"90 static psMemId memAllocCallbackDefault(const psMemBlock* ptr) 91 { 92 static psMemId incr = 0; // "p_psMemAllocID += incr" 93 93 94 94 return incr; … … 102 102 } 103 103 104 static void memProblemCallbackDefault( const psMemBlock* ptr, const char *file, psS32lineno)104 static void memProblemCallbackDefault( psMemBlock* ptr, const char *file, unsigned int lineno) 105 105 { 106 106 if (ptr->refCounter < 1) { … … 158 158 * The default callbacks 159 159 */ 160 static psMemAlloc ateCallback memAllocateCallback = memAllocateCallbackDefault;160 static psMemAllocCallback memAllocCallback = memAllocCallbackDefault; 161 161 static psMemFreeCallback memFreeCallback = memFreeCallbackDefault; 162 162 static psMemProblemCallback memProblemCallback = memProblemCallbackDefault; … … 194 194 * Call the callbacks when these IDs are allocated/freed 195 195 */ 196 psMemId p_psMemAlloc ateID = 0; // notify user this block is allocated196 psMemId p_psMemAllocID = 0; // notify user this block is allocated 197 197 psMemId p_psMemFreeID = 0; // notify user this block is freed 198 198 199 psMemId psMemAlloc ateCallbackSetID(psMemId id)200 { 201 psMemId old = p_psMemAlloc ateID;202 203 p_psMemAlloc ateID = id;199 psMemId psMemAllocCallbackSetID(psMemId id) 200 { 201 psMemId old = p_psMemAllocID; 202 203 p_psMemAllocID = id; 204 204 205 205 return old; … … 215 215 } 216 216 217 psMemAlloc ateCallback psMemAllocateCallbackSet(psMemAllocateCallback func)218 { 219 psMemFreeCallback old = memAlloc ateCallback;217 psMemAllocCallback psMemAllocCallbackSet(psMemAllocCallback func) 218 { 219 psMemFreeCallback old = memAllocCallback; 220 220 221 221 if (func != NULL) { 222 memAlloc ateCallback = func;222 memAllocCallback = func; 223 223 } else { 224 memAlloc ateCallback = memAllocateCallbackDefault;224 memAllocCallback = memAllocCallbackDefault; 225 225 } 226 226 … … 286 286 } 287 287 288 psPtr p_psAlloc(size_t size, const char *file, psS32lineno)288 psPtr p_psAlloc(size_t size, const char *file, unsigned int lineno) 289 289 { 290 290 … … 363 363 364 364 // Did the user ask to be informed about this allocation? 365 if (ptr->id == p_psMemAlloc ateID) {366 p_psMemAlloc ateID += memAllocateCallback(ptr);365 if (ptr->id == p_psMemAllocID) { 366 p_psMemAllocID += memAllocCallback(ptr); 367 367 } 368 368 // And return the user the memory that they allocated … … 370 370 } 371 371 372 psPtr p_psRealloc(psPtr vptr, size_t size, const char *file, psS32lineno)372 psPtr p_psRealloc(psPtr vptr, size_t size, const char *file, unsigned int lineno) 373 373 { 374 374 size = (size < recycleBinSize[0]) ? recycleBinSize[0] : size; // set the minimum size to allocate … … 416 416 417 417 // Did the user ask to be informed about this allocation? 418 if (ptr->id == p_psMemAlloc ateID) {419 p_psMemAlloc ateID += memAllocateCallback(ptr);418 if (ptr->id == p_psMemAllocID) { 419 p_psMemAllocID += memAllocCallback(ptr); 420 420 } 421 421 … … 424 424 } 425 425 426 void p_psFree(psPtr vptr, const char *file, psS32lineno)426 void p_psFree(psPtr vptr, const char *file, unsigned int lineno) 427 427 { 428 428 if (vptr == NULL) { -
trunk/psLib/src/sys/psMemory.h
r4401 r4556 12 12 * @ingroup MemoryManagement 13 13 * 14 * @version $Revision: 1.4 4$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-0 6-27 20:38:12$14 * @version $Revision: 1.45 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-07-15 02:33:54 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 49 49 50 50 /// typedef for memory identification numbers. Guaranteed to be some variety of integer. 51 typedef psU64psMemId;51 typedef unsigned long psMemId; 52 52 53 53 /// typedef for a memory block's reference count. Guaranteed to be some variety of integer. 54 typedef psU64psReferenceCount;54 typedef unsigned long psReferenceCount; 55 55 56 56 /// typedef for deallocator. 57 typedef void (*psFreeFunc) ( psPtrptr);57 typedef void (*psFreeFunc) (void* ptr); 58 58 59 59 /** Book-keeping data for storage allocator. … … 64 64 typedef struct psMemBlock 65 65 { 66 const psPtrstartblock; ///< initialised to p_psMEMMAGIC66 const void* startblock; ///< initialised to p_psMEMMAGIC 67 67 struct psMemBlock* previousBlock; ///< previous block in allocation list 68 68 struct psMemBlock* nextBlock; ///< next block allocation list … … 71 71 const psMemId id; ///< a unique ID for this allocation 72 72 const char *file; ///< set from __FILE__ in e.g. p_psAlloc 73 const psS32 lineno;///< set from __LINE__ in e.g. p_psAlloc73 const unsigned int lineno; ///< set from __LINE__ in e.g. p_psAlloc 74 74 pthread_mutex_t refCounterMutex; ///< mutex to ensure exclusive access to reference counter 75 75 psReferenceCount refCounter; ///< how many times pointer is referenced 76 psBool persistent;///< marks if this non-user persistent data like error stack, etc.77 const psPtrendblock; ///< initialised to p_psMEMMAGIC76 bool persistent; ///< marks if this non-user persistent data like error stack, etc. 77 const void* endblock; ///< initialised to p_psMEMMAGIC 78 78 } 79 79 psMemBlock; … … 81 81 /** prototype of a basic callback used by memory functions 82 82 * 83 * @see psMemAlloc ateCallbackSet84 * @ingroup memCallback 85 */ 86 typedef psMemId(*psMemAlloc ateCallback) (83 * @see psMemAllocCallbackSet 84 * @ingroup memCallback 85 */ 86 typedef psMemId(*psMemAllocCallback) ( 87 87 const psMemBlock* ptr ///< the psMemBlock just allocated 88 88 ); … … 105 105 */ 106 106 typedef void (*psMemProblemCallback) ( 107 const psMemBlock* ptr,///< the pointer to the problematic memory block.108 const char *file ,///< the file in which the problem originated109 psS32 lineno///< the line number in which the problem originated107 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 110 110 ); 111 111 … … 118 118 * @ingroup memCallback 119 119 */ 120 typedef psPtr(*psMemExhaustedCallback) (120 typedef void* (*psMemExhaustedCallback) ( 121 121 size_t size ///< the size of buffer required 122 122 ); … … 128 128 */ 129 129 #ifdef DOXYGEN 130 psPtr psAlloc(size_t size ///< Size required 131 ); 130 131 psPtr psAlloc( 132 size_t size ///< Size required 133 ); 134 132 135 #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 ); 136 psPtr p_psAlloc( 137 size_t size, ///< Size required 138 const char *filename, ///< File of call 139 unsigned int lineno ///< Line number of call 140 ); 137 141 138 142 /// Memory allocation. psAlloc sends file and line number to p_psAlloc. … … 203 207 */ 204 208 #ifdef DOXYGEN 209 205 210 psPtr psRealloc( 206 psPtr ptr, ///< Pointer to re-allocate207 size_t size ///< Size required211 psPtr ptr, ///< Pointer to re-allocate 212 size_t size ///< Size required 208 213 ); 209 214 #else // #ifdef DOXYGEN 215 210 216 psPtr p_psRealloc( 211 217 psPtr ptr, ///< Pointer to re-allocate 212 218 size_t size, ///< Size required 213 const char *file ,///< File of call214 psS32 lineno///< Line number of call219 const char *filename, ///< File of call 220 unsigned int lineno ///< Line number of call 215 221 ); 216 222 … … 234 240 psPtr ptr, ///< Pointer to free 235 241 const char *file, ///< File of call 236 psS32 lineno///< Line number of call242 unsigned int lineno ///< Line number of call 237 243 ); 238 244 … … 259 265 */ 260 266 psS32 psMemCheckLeaks( 261 psMemId id0, ///< don't list blocks with id < id0267 psMemId id0, ///< don't list blocks with id < id0 262 268 psMemBlock* ** arr, ///< pointer to array of pointers to leaked blocks, or NULL 263 269 FILE * fd, ///< print list of leaks to fd (or NULL) … … 288 294 #ifdef DOXYGEN 289 295 psPtr psMemIncrRefCounter( 290 const psPtr ptr ///< Pointer to increment refCounter, and return296 const psPtr ptr ///< Pointer to increment refCounter, and return 291 297 ); 292 298 #else … … 294 300 psPtr vptr, ///< Pointer to increment refCounter, and return 295 301 const char *file, ///< File of call 296 psS32 lineno ///< Line number of call302 psS32 lineno ///< Line number of call 297 303 ); 298 304 … … 318 324 psPtr vptr, ///< Pointer to decrement refCounter, and return 319 325 const char *file, ///< File of call 320 psS32 lineno ///< Line number of call326 psS32 lineno ///< Line number of call 321 327 ); 322 328 … … 362 368 /** Set call back for when a particular memory block is allocated 363 369 * 364 * A private variable, p_psMemAlloc ateID, can be used to trace the allocation365 * and freeing of specific memory blocks. If p_psMemAlloc ateID is set and a366 * memory block with that ID is allocated, psMemAlloc ateCallback is called370 * 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 367 373 * just before memory is returned to the calling function. 368 374 * 369 375 * @ingroup memCallback 370 376 * 371 * @return psMemAlloc ateCallback old psMemAllocateCallback function372 */ 373 psMemAlloc ateCallback psMemAllocateCallbackSet(374 psMemAlloc ateCallback func///< Function to run at memory allocation of specific mem block377 * @return psMemAllocCallback old psMemAllocCallback function 378 */ 379 psMemAllocCallback psMemAllocCallbackSet( 380 psMemAllocCallback func ///< Function to run at memory allocation of specific mem block 375 381 ); 376 382 … … 398 404 psMemId psMemGetId(void); 399 405 400 /** set p_psMemAlloc ateID to specific id401 * 402 * A private variable, p_psMemAlloc ateID, can be used to trace the allocation403 * and freeing of specific memory blocks. If p_psMemAlloc ateID is set and a404 * memory block with that ID is allocated, psMemAlloc ateCallback is called406 /** 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 405 411 * just before memory is returned to the calling function. 406 412 * … … 409 415 * @return psMemId 410 416 * 411 * @see psMemAlloc ateCallbackSet412 */ 413 psMemId psMemAlloc ateCallbackSetID(414 psMemId id ///< ID to set417 * @see psMemAllocCallbackSet 418 */ 419 psMemId psMemAllocCallbackSetID( 420 psMemId id ///< ID to set 415 421 ); 416 422 … … 429 435 */ 430 436 psMemId psMemFreeCallbackSetID( 431 psMemId id ///< ID to set437 psMemId id ///< ID to set 432 438 ); 433 439 -
trunk/psLib/src/types/psArray.c
r4540 r4556 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.3 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-07-1 2 19:12:01$11 * @version $Revision: 1.34 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-07-15 02:33:54 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 49 49 FUNCTION IMPLEMENTATION - PUBLIC 50 50 *****************************************************************************/ 51 psArray* psArrayAlloc( unsignedlong nalloc)51 psArray* psArrayAlloc(long nalloc) 52 52 { 53 53 psArray* psArr = NULL; … … 66 66 } 67 67 68 psArray* psArrayRealloc(psArray* in, unsignedlong nalloc)68 psArray* psArrayRealloc(psArray* in, long nalloc) 69 69 { 70 70 if (in == NULL) { … … 160 160 /// Set an element in the array. 161 161 bool psArraySet(psArray* array, ///< input array to set element in 162 unsigned long position,///< the element position to set162 long position, ///< the element position to set 163 163 psPtr data) ///< the value to set it to 164 164 { … … 185 185 186 186 /// Get an element in the array. 187 psPtr psArrayGet(const psArray* array, unsignedlong position )187 psPtr psArrayGet(const psArray* array, long position ) 188 188 { 189 189 if (array == NULL) { -
trunk/psLib/src/types/psArray.h
r4367 r4556 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.2 7$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-0 6-23 03:50:29$14 * @version $Revision: 1.28 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-07-15 02:33:54 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 34 34 typedef struct 35 35 { 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. 38 38 psPtr* data; ///< An Array of pointer elements 39 void *lock; ///< Optional lock for thread safety 39 40 } 40 41 psArray; … … 55 56 */ 56 57 psArray* 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 ; 59 61 60 62 /** Reallocate an array. … … 68 70 psArray* psArrayRealloc( 69 71 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. 71 73 ); 72 74 … … 133 135 bool psArraySet( 134 136 psArray* array, ///< input array to set element in 135 unsigned long position,///< the element position to set137 long position, ///< the element position to set 136 138 psPtr data ///< the value to set it to 137 139 ); … … 143 145 psPtr psArrayGet( 144 146 const psArray* array, ///< input array to get element from 145 unsigned long position///< the element position to get147 long position ///< the element position to get 146 148 ); 147 149 -
trunk/psLib/src/types/psBitSet.c
r4540 r4556 11 11 * @author Robert DeSonia, MHPCC 12 12 * 13 * @version $Revision: 1.2 8$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-07-1 2 19:12:01$13 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-07-15 02:33:54 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii -
trunk/psLib/src/types/psBitSet.h
r4342 r4556 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.2 0$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-0 6-22 02:05:41$14 * @version $Revision: 1.21 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-07-15 02:33:54 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 37 37 typedef struct 38 38 { 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 41 42 } 42 43 psBitSet; … … 57 58 psBitSet* psBitSetAlloc( 58 59 long nalloc ///< Number of bits in psBitSet array 59 ); 60 ) 61 ; 60 62 61 63 /** Set a bit. … … 70 72 /* @returned@ */ 71 73 psBitSet* bitSet, ///< Pointer to psBitSet to be set. 72 long bit ///< Bit to be set.74 long bit ///< Bit to be set. 73 75 ); 74 76 -
trunk/psLib/src/types/psHash.c
r4540 r4556 12 12 * @author GLG, MHPCC 13 13 * 14 * @version $Revision: 1.2 2$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-07-1 2 19:12:01$14 * @version $Revision: 1.23 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-07-15 02:33:54 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 57 57 // Loop through every bucket in the hash table. If that bucket is not 58 58 // NULL, then add the bucket's key to the linked list. 59 for (i = 0; i < hash->n bucket; i++) {59 for (i = 0; i < hash->n; i++) { 60 60 if (hash->buckets[i] != NULL) { 61 61 // Since a bucket contains a linked list of keys/data, we must … … 128 128 129 129 /****************************************************************************** 130 psHashAlloc(n bucket): this procedure creates a new hash table with the130 psHashAlloc(n): this procedure creates a new hash table with the 131 131 specified number of buckets. 132 132 Inputs: 133 n bucket: initial number of buckets133 n: initial number of buckets 134 134 Return: 135 135 The new hash table. … … 146 146 // Allocate memory for the buckets. 147 147 table->buckets = psAlloc(nalloc * sizeof(psHashBucket* )); 148 table->n bucket= nalloc;148 table->n = nalloc; 149 149 150 150 psTrace("utils.hash", 1, "Creating %d-element hash table\n", nalloc); … … 179 179 // Loop through each bucket in the hash table. If that bucket is not 180 180 // NULL, then free the bucket via a function call to hashBucketFree(); 181 for (i = 0; i < table->n bucket; i++) {181 for (i = 0; i < table->n; i++) { 182 182 183 183 // A bucket is composed of a linked list of buckets. … … 238 238 // hash = (hash << 1) ^ key[i]; 239 239 // } 240 // hash &= (table->n bucket- 1);240 // hash &= (table->n - 1); 241 241 242 242 // This hash algorithm is from Sedgewick. NOTE: must reread to ensure that … … 244 244 tmpchar = (char *)key; 245 245 for (hash = 0; *tmpchar != '\0'; tmpchar++) { 246 hash = (64 * hash + *tmpchar) % (table->n bucket);246 hash = (64 * hash + *tmpchar) % (table->n); 247 247 } 248 248 249 249 // NOTE: This should not be necessary, but for now, I'm checking bounds 250 250 // anyway. 251 if ((hash < 0) || (hash >= table->n bucket)) {251 if ((hash < 0) || (hash >= table->n)) { 252 252 psError(PS_ERR_UNKNOWN, true, 253 253 "Internal hash function out of range (%d)", hash); … … 409 409 // psArray we need to allocate. 410 410 int nElements = 0; 411 int nbucket = hash->n bucket;411 int nbucket = hash->n; 412 412 for (int i = 0; i < nbucket; i++) { 413 413 psHashBucket* tmpBucket = hash->buckets[i]; -
trunk/psLib/src/types/psHash.h
r4352 r4556 11 11 * @author GLG, MHPCC 12 12 * 13 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-0 6-22 23:48:39$13 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-07-15 02:33:54 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 40 40 typedef struct psHash 41 41 { 42 psS32 nbucket;///< Number of buckets in hash table.42 long n; ///< Number of buckets in hash table. 43 43 psHashBucket* *buckets; ///< The bucket data. 44 void *lock; ///< Optional lock for thread safety. 44 45 } 45 46 psHash; … … 48 49 psHash* psHashAlloc( 49 50 long nalloc ///< The number of buckets to allocate. 50 ); 51 ) 52 ; 51 53 52 54 /// Insert entry into table. -
trunk/psLib/src/types/psList.c
r4540 r4556 6 6 * @author Robert Daniel DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.4 0$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-07-1 2 19:12:01$8 * @version $Revision: 1.41 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-07-15 02:33:54 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 113 113 } 114 114 115 list-> size--;115 list->n--; 116 116 117 117 pthread_mutex_unlock(&list->lock) … … 131 131 psMemSetDeallocator(list, (psFreeFunc) listFree); 132 132 133 list-> size= 0;133 list->n = 0; 134 134 list->head = list->tail = NULL; 135 135 list->iterators = psArrayAlloc(16); … … 182 182 183 183 bool psListIteratorSet(psListIterator* iterator, 184 intlocation)184 long location) 185 185 { 186 186 if (iterator == NULL) { … … 192 192 if (location == PS_LIST_TAIL) { 193 193 iterator->cursor = list->tail; 194 iterator->index = list-> size- 1;194 iterator->index = list->n - 1; 195 195 iterator->offEnd = false; 196 196 return true; … … 205 205 206 206 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) { 211 211 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 212 212 PS_ERRORTEXT_psList_LOCATION_INVALID, … … 218 218 int index = iterator->index; 219 219 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? 221 221 cursor = list->tail; 222 index = list-> size- 1;222 index = list->n - 1; 223 223 } else { 224 224 cursor = list->head; … … 262 262 } 263 263 264 if (location > 0 && location >= (int)list-> size) {264 if (location > 0 && location >= (int)list->n) { 265 265 psLogMsg(__func__,PS_LOG_WARN, 266 266 "Specified location, %d, is beyond the end of the list. " … … 337 337 elem->data = psMemIncrRefCounter(data); 338 338 339 list-> size++;339 list->n++; 340 340 341 341 if (cursor == list->tail) { … … 412 412 elem->data = psMemIncrRefCounter(data); 413 413 414 list-> size++;414 list->n++; 415 415 416 416 if (cursor == list->head) { … … 548 548 if ( (iterator->cursor == NULL) && (iterator->offEnd) ) { 549 549 iterator->cursor = iterator->list->tail; 550 iterator->index = iterator->list-> size-1;550 iterator->index = iterator->list->n-1; 551 551 iterator->offEnd = false; 552 552 return NULL; … … 574 574 } 575 575 576 if (list-> size> 0) {577 arr = psArrayAlloc(list-> size);576 if (list->n > 0) { 577 arr = psArrayAlloc(list->n); 578 578 } else { 579 579 arr = psArrayAlloc(1); 580 580 } 581 581 582 arr->n = list-> size;582 arr->n = list->n; 583 583 584 584 ptr = list->head; 585 n = list-> size;585 n = list->n; 586 586 for (psS32 i = 0; i < n; i++) { 587 587 arr->data[i] = psMemIncrRefCounter(ptr->data); -
trunk/psLib/src/types/psList.h
r4367 r4556 7 7 * @ingroup LinkedList 8 8 * 9 * @version $Revision: 1.2 8$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-0 6-23 03:50:29$9 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-07-15 02:33:54 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 52 52 typedef struct 53 53 { 54 psU32 size;///< number of elements on list54 long n; ///< number of elements on list 55 55 psListElem* head; ///< first element on list (may be NULL) 56 56 psListElem* tail; ///< last element on list (may be NULL) … … 61 61 62 62 pthread_mutex_t lock; ///< mutex to lock a node during changes 63 // void *lock; ///< Optional lock for thread safety 63 64 } 64 65 psList; … … 110 111 */ 111 112 bool psListIteratorSet( 112 psListIterator* iterator, ///< list iterator113 int location///< index number, PS_LIST_HEAD, or PS_LIST_TAIL113 psListIterator* iterator, ///< list iterator 114 long location ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL 114 115 ); 115 116 … … 120 121 bool psListAdd( 121 122 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. 123 124 psPtr data ///< data item to add. If NULL, list is not modified. 124 125 ); -
trunk/psLib/src/types/psLookupTable.c
r4540 r4556 7 7 * @author Ross Harman, MHPCC 8 8 * 9 * @version $Revision: 1.2 2$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-07-1 2 19:12:01$9 * @version $Revision: 1.23 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-07-15 02:33:54 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii … … 275 275 276 276 // 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; 279 279 outTable->indexCol = indexCol; 280 280 … … 291 291 switch (TABLE->index->type.type) { \ 292 292 case 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]; \ 295 295 break; \ 296 296 case 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]; \ 299 299 break; \ 300 300 case 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]; \ 303 303 break; \ 304 304 case 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]; \ 307 307 break; \ 308 308 case 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]; \ 311 311 break; \ 312 312 case 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]; \ 315 315 break; \ 316 316 case 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]; \ 319 319 break; \ 320 320 case 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]; \ 323 323 break; \ 324 324 case 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]; \ 327 327 break; \ 328 328 case 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]; \ 331 331 break; \ 332 332 default: \ 333 TABLE->validFrom = (psF64)0; \334 TABLE->validTo = (psF64)0; \333 *(double *)&TABLE->validFrom = (psF64)0; \ 334 *(double *)&TABLE->validTo = (psF64)0; \ 335 335 break; \ 336 336 } … … 641 641 long psLookupTableRead(psLookupTable* table) 642 642 { 643 psS32numRows = 0;643 long numRows = 0; 644 644 psArray* vectors = NULL; 645 645 psLookupTable* outTable = NULL; … … 745 745 } 746 746 747 psF64 psLookupTableInterpolate(const psLookupTable *table, psF64 index, psS32column)747 double psLookupTableInterpolate(const psLookupTable *table, double index, long column) 748 748 { 749 749 psU64 hiIdx = 0; 750 750 psU64 loIdx = 0; 751 psU64numRows = 0;752 psU64numCols = 0;751 long numRows = 0; 752 long numCols = 0; 753 753 psF64 out = 0.0; 754 754 psF64 denom = 0.0; … … 818 818 } 819 819 820 psVector* psLookupTableInterpolateAll( psLookupTable *table, psF64index)821 { 822 psU64numCols = 0;820 psVector* psLookupTableInterpolateAll(const psLookupTable *table, double index) 821 { 822 long numCols = 0; 823 823 psVector *outVector = NULL; 824 824 -
trunk/psLib/src/types/psLookupTable.h
r4366 r4556 7 7 * @author Ross Harman, MHPCC 8 8 * 9 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-0 6-23 03:19:29$9 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-07-15 02:33:54 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 33 33 psVector *index; ///< Vector of independent index values 34 34 psArray *values; ///< Array of dependent table values corresponding to index values 35 psF64 validFrom;///< Lower bound for rable read36 psF64 validTo;///< Upper bound for table read35 const double validFrom; ///< Lower bound for rable read 36 const double validTo; ///< Upper bound for table read 37 37 } 38 38 psLookupTable; … … 100 100 * Reads a lookup table and fills corresponding psLookupTable struct. 101 101 * 102 * @return psS32Number of valid lines read102 * @return long: Number of valid lines read 103 103 */ 104 104 long psLookupTableRead( … … 111 111 * conditions. 112 112 * 113 * @return psLookupTable* New psLookupTable struct113 * @return double Interpolation value at index 114 114 */ 115 psF64psLookupTableInterpolate(116 const psLookupTable *table, ///< Table with data117 psF64 index,///< Value to be interpolated118 psS32 column///< Column in table to be interpolated115 double psLookupTableInterpolate( 116 const psLookupTable *table, ///< Table with data 117 double index, ///< Value to be interpolated 118 long column ///< Column in table to be interpolated 119 119 ); 120 120 … … 124 124 * conditions. 125 125 * 126 * @return ps LookupTable* New psLookupTable struct126 * @return psVector* Interpolation values calculated at index 127 127 */ 128 128 psVector* psLookupTableInterpolateAll( 129 psLookupTable *table,///< Table with data130 psF64 index///< Value to be interpolated129 const psLookupTable *table, ///< Table with data 130 double index ///< Value to be interpolated 131 131 ); 132 132 -
trunk/psLib/src/types/psMetadata.c
r4540 r4556 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.7 0$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-07-1 2 19:12:01$14 * @version $Revision: 1.71 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-07-15 02:33:54 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 122 122 psFree(iter->iter); 123 123 124 if (iter-> preg!= NULL) {125 regfree(iter-> preg);124 if (iter->regex != NULL) { 125 regfree(iter->regex); 126 126 } 127 127 } … … 268 268 } 269 269 270 bool psMetadataAddItem(psMetadata *md, const psMetadataItem *item, psS32location, psS32 flags)270 bool psMetadataAddItem(psMetadata *md, const psMetadataItem *item, long location, psS32 flags) 271 271 { 272 272 char * key = NULL; … … 360 360 } 361 361 362 bool psMetadataAdd(psMetadata *md, intlocation, const char *name,362 bool psMetadataAdd(psMetadata *md, long location, const char *name, 363 363 int format, const char *comment, ...) 364 364 { … … 372 372 } 373 373 374 bool psMetadataAddV(psMetadata *md, intlocation, const char *name,374 bool psMetadataAddV(psMetadata *md, long location, const char *name, 375 375 int format, const char *comment, va_list list) 376 376 { … … 391 391 392 392 #define METADATA_ADD_TYPE(NAME,TYPE,METATYPE) \ 393 psBool psMetadataAdd##NAME(psMetadata* md, psS32where, const char* name, \393 psBool psMetadataAdd##NAME(psMetadata* md, long where, const char* name, \ 394 394 const char* comment, TYPE value) { \ 395 395 return psMetadataAdd(md,where,name, METATYPE,comment,value); \ … … 409 409 METADATA_ADD_TYPE(Array,psArray*,PS_META_ARRAY) 410 410 411 psBool psMetadataRemove(psMetadata *md, psS32where, const char *key)411 psBool psMetadataRemove(psMetadata *md, long where, const char *key) 412 412 { 413 413 PS_ASSERT_PTR_NON_NULL(md,NULL); … … 580 580 psMetadataLookupNumTYPE(Bool) 581 581 582 psMetadataItem* psMetadataGet(const psMetadata *md, intlocation)582 psMetadataItem* psMetadataGet(const psMetadata *md, long location) 583 583 { 584 584 psMetadataItem* entry = NULL; … … 597 597 598 598 psMetadataIterator* psMetadataIteratorAlloc(psMetadata* md, 599 intlocation,599 long location, 600 600 const char* regex) 601 601 { … … 604 604 605 605 psMetadataIterator* newIter = psAlloc(sizeof(psMetadataIterator)); 606 newIter-> preg= NULL;606 newIter->regex = NULL; 607 607 newIter->iter = NULL; 608 608 … … 614 614 return newIter; 615 615 } else { 616 int regRtn = regcomp(newIter-> preg,regex,0);616 int regRtn = regcomp(newIter->regex,regex,0); 617 617 if (regRtn != 0) { 618 618 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); 621 621 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 622 622 PS_ERRORTEXT_psMetadata_REGEX_INVALID, … … 633 633 634 634 bool psMetadataIteratorSet(psMetadataIterator* iterator, 635 intlocation)635 long location) 636 636 { 637 637 int match; … … 643 643 PS_ASSERT_PTR_NON_NULL(iterator->iter,NULL); 644 644 645 regex_t* preg = iterator->preg;645 regex_t* regex = iterator->regex; 646 646 647 647 // handle trivial case where no regex subsetting is required. 648 if ( preg== NULL) {648 if (regex == NULL) { 649 649 return psListIteratorSet(iter,location); 650 650 } … … 655 655 psListIteratorSet(iter,PS_LIST_TAIL); 656 656 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) { 658 658 // this key is a match 659 659 match--; … … 671 671 psListIteratorSet(iter,PS_LIST_HEAD); 672 672 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) { 674 674 // this key is a match 675 675 match++; … … 692 692 PS_ASSERT_PTR_NON_NULL(iterator->iter,NULL); 693 693 694 regex_t* preg = iterator->preg;694 regex_t* regex = iterator->regex; 695 695 696 696 // handle trivial case where no regex subsetting is required. 697 if ( preg== NULL) {697 if (regex == NULL) { 698 698 return (psMetadataItem*)psListGetAndIncrement(iter); 699 699 } … … 703 703 while (psListGetAndIncrement(iter) != NULL) { 704 704 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) { 706 706 // this key is a match 707 707 break; … … 720 720 PS_ASSERT_PTR_NON_NULL(iterator->iter,NULL); 721 721 722 regex_t* preg = iterator->preg;722 regex_t* regex = iterator->regex; 723 723 724 724 // handle trivial case where no regex subsetting is required. 725 if ( preg== NULL) {725 if (regex == NULL) { 726 726 return (psMetadataItem*)psListGetAndDecrement(iter); 727 727 } … … 731 731 while (psListGetAndDecrement(iter) != NULL) { 732 732 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) { 734 734 // this key is a match 735 735 break; -
trunk/psLib/src/types/psMetadata.h
r4401 r4556 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.5 2$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-0 6-27 20:38:12$13 * @version $Revision: 1.53 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-07-15 02:33:54 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 55 55 PS_META_ARRAY ///< Array data (Stored as item.data.V). 56 56 } psMetadataType; 57 58 57 #define PS_META_IS_PRIMITIVE(TYPE) \ 59 58 (TYPE == PS_META_S32 || \ … … 77 76 PS_META_DEFAULT = 0, ///< default behaviour (duplicate entry is an error) 78 77 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 80 80 } psMetadataFlags; 81 81 … … 94 94 psList* list; ///< Metadata in linked-list 95 95 psHash* table; ///< Metadata in a hash table 96 void *lock; ///< Optional lock for thread safety 96 97 } 97 98 psMetadata; … … 104 105 { 105 106 psListIterator* iter; ///< iterator for the psMetadata's psList 106 regex_t* preg;///< the subsetting regular expression107 regex_t* regex; ///< the subsetting regular expression 107 108 } 108 109 psMetadataIterator; … … 116 117 { 117 118 const psS32 id; ///< Unique ID for metadata item. 118 char *name;///< Name of metadata item.119 psString name; ///< Name of metadata item. 119 120 psMetadataType type; ///< Type of metadata item. 120 121 union { … … 127 128 psPtr V; ///< Pointer to other type of data. 128 129 } data; ///< Union for data types. 129 char *comment;///< Optional comment ("", not NULL).130 psString comment; ///< Optional comment ("", not NULL). 130 131 } 131 132 psMetadataItem; … … 151 152 const char *comment, ///< Comment for metadata item. 152 153 ... ///< Arguments for name formatting and metadata item data. 153 ); 154 ) 155 ; 154 156 155 157 /** Create a metadata item with specified string data. … … 261 263 psMetadata* md, ///< Metadata collection to insert metadat item. 262 264 const psMetadataItem* item, ///< Metadata item to be added. 263 psS32 location,///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL265 long location, ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL 264 266 psS32 flags ///< Options flag mask, see psMetadataFlags enum 265 267 ); … … 273 275 bool psMetadataAdd( 274 276 psMetadata* md, ///< Metadata collection to insert metadata item. 275 int location,///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL277 long location, ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL 276 278 const char *name, ///< Name of metadata item. 277 279 int format, ///< Type of metadata item (psMetadataType) and options (psMetadataFlags) … … 289 291 bool psMetadataAddV( 290 292 psMetadata* md, ///< Metadata collection to insert metadata item. 291 int location,///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL293 long location, ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL 292 294 const char *name, ///< Name of metadata item. 293 295 int format, ///< Type of metadata item (psMetadataType) and options (psMetadataFlags) … … 298 300 299 301 /** 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. 302 304 */ 303 305 bool psMetadataAddS32( 304 306 psMetadata* md, ///< Metadata collection to insert metadata item 305 psS32 location,///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL307 long location, ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL 306 308 const char* name, ///< Name of metadata item 307 309 const char* comment, ///< Comment for metadata item … … 310 312 311 313 /** Add a psF32 value to metadata collection. 312 * 314 * 313 315 * @return bool: True for success, False for failure. 314 316 */ 315 317 bool psMetadataAddF32( 316 318 psMetadata* md, ///< Metadata collection to insert metadata item 317 psS32location, ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL319 long location, ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL 318 320 const char* name, ///< Name of metadata item 319 321 const char* comment, ///< Comment for metadata item … … 322 324 323 325 /** Add a psF64 value to metadata collection. 324 * 326 * 325 327 * @return bool: True for success, False for failure. 326 328 */ 327 329 bool psMetadataAddF64( 328 330 psMetadata* md, ///< Metadata collection to insert metadata item 329 psS32location, ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL331 long location, ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL 330 332 const char* name, ///< Name of metadata item 331 333 const char* comment, ///< Comment for metadata item … … 334 336 335 337 /** Add a psList to metadata collection. 336 * 338 * 337 339 * @return psBool: True for success, False for failure. 338 340 */ 339 341 psBool psMetadataAddList( 340 342 psMetadata* md, ///< Metadata collection to insert metadata item 341 psS32 location,///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL343 long location, ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL 342 344 const char* name, ///< Name of metadata item 343 345 const char* comment, ///< Comment for metadata item … … 346 348 347 349 /** Add a string to metadata collection. 348 * 350 * 349 351 * @return bool: True for success, False for failure. 350 352 */ 351 353 bool psMetadataAddStr( 352 354 psMetadata* md, ///< Metadata collection to insert metadata item 353 psS32 location,///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL355 long location, ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL 354 356 const char* name, ///< Name of metadata item 355 357 const char* comment, ///< Comment for metadata item … … 358 360 359 361 /** Add a vector to metadata collection. 360 * 362 * 361 363 * @return psBool: True for success, False for failure. 362 364 */ 363 365 psBool psMetadataAddVector( 364 366 psMetadata* md, ///< Metadata collection to insert metadata item 365 psS32 location,///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL367 long location, ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL 366 368 const char* name, ///< Name of metadata item 367 369 const char* comment, ///< Comment for metadata item … … 370 372 371 373 /** Add a array to metadata collection. 372 * 374 * 373 375 * @return psBool: True for success, False for failure. 374 376 */ 375 377 psBool psMetadataAddArray( 376 378 psMetadata* md, ///< Metadata collection to insert metadata item 377 psS32 location,///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL379 long location, ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL 378 380 const char* name, ///< Name of metadata item 379 381 const char* comment, ///< Comment for metadata item … … 382 384 383 385 /** Add an Image to metadata collection. 384 * 386 * 385 387 * @return psBool: True for success, False for failure. 386 388 */ 387 389 psBool psMetadataAddImage( 388 390 psMetadata* md, ///< Metadata collection to insert metadata item 389 psS32 location,///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL391 long location, ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL 390 392 const char* name, ///< Name of metadata item 391 393 const char* comment, ///< Comment for metadata item … … 394 396 395 397 /** Add a Hash to metadata collection. 396 * 398 * 397 399 * @return psBool: True for success, False for failure. 398 400 */ 399 401 psBool psMetadataAddHash( 400 402 psMetadata* md, ///< Metadata collection to insert metadata item 401 psS32location, ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL403 long location, ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL 402 404 const char* name, ///< Name of metadata item 403 405 const char* comment, ///< Comment for metadata item … … 406 408 407 409 /** Add a LookupTable to metadata collection. 408 * 410 * 409 411 * @return psBool: True for success, False for failure. 410 412 */ 411 413 psBool psMetadataAddLookupTable( 412 414 psMetadata* md, ///< Metadata collection to insert metadata item 413 psS32 location,///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL415 long location, ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL 414 416 const char* name, ///< Name of metadata item 415 417 const char* comment, ///< Comment for metadata item … … 418 420 419 421 /** Add an Unknown (psPtr) to metadata collection. 420 * 422 * 421 423 * @return psBool: True for success, False for failure. 422 424 */ 423 425 psBool psMetadataAddUnknown( 424 426 psMetadata* md, ///< Metadata collection to insert metadata item 425 psS32 location,///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL427 long location, ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL 426 428 const char* name, ///< Name of metadata item 427 429 const char* comment, ///< Comment for metadata item … … 430 432 431 433 /** Add Metadata to metadata collection. 432 * 434 * 433 435 * @return psBool: True for success, False for failure. 434 436 */ 435 437 psBool psMetadataAddMetadata( 436 438 psMetadata* md, ///< Metadata collection to insert metadata item 437 psS32 location,///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL439 long location, ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL 438 440 const char* name, ///< Name of metadata item 439 441 const char* comment, ///< Comment for metadata item … … 453 455 bool psMetadataRemove( 454 456 psMetadata* md, ///< Metadata collection to remove metadata item. 455 int location,///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL457 long location, ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL 456 458 const char * key ///< Name of metadata key. 457 459 ); … … 549 551 psMetadataItem* psMetadataGet( 550 552 const psMetadata* md, ///< Metadata collection to retrieve metadata item. 551 int location///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL553 long location ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL 552 554 ); 553 555 … … 562 564 psMetadataIterator* psMetadataIteratorAlloc( 563 565 psMetadata* md, ///< the psMetadata to iterate with 564 int location,///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL566 long location, ///< Index number, PS_LIST_HEAD, or PS_LIST_TAIL 565 567 const char* regex 566 568 ///< A regular expression for subsetting the psMetadata. If NULL, no … … 575 577 bool psMetadataIteratorSet( 576 578 psMetadataIterator* iterator, ///< psMetadata iterator 577 int location///< index number, PS_LIST_HEAD, or PS_LIST_TAIL579 long location ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL 578 580 ); 579 581 -
trunk/psLib/src/types/psMetadataConfig.c
r4540 r4556 1 /** @file psMetadata Config.c1 /** @file psMetadataIO.c 2 2 * 3 3 * @brief Contains metadata input/output functions. … … 10 10 * @author Eric Van Alst, MHPCC 11 11 * 12 * @version $Revision: 1.3 5$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-07-1 2 19:12:01$12 * @version $Revision: 1.36 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-07-15 02:33:54 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 16 16 */ 17 17 18 #include <libxml/parser.h> 18 19 #include <fitsio.h> 19 20 #include <string.h> … … 33 34 #include "psConstants.h" 34 35 #include "psErrorText.h" 36 37 /******************************************************************************/ 38 /* DEFINE STATEMENTS */ 39 /******************************************************************************/ 35 40 36 41 /** Check for FITS errors */ … … 54 59 #define MAX_STRING_LENGTH 256 55 60 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 56 84 static psMetadata* getMetadataType(char *linePtr); 57 58 85 static psMetadata* setMetadataItem(psMetadata* template, char* linePtr) 59 86 ; 60 61 87 static void parseLevelInfoFree(p_psParseLevelInfo* info); 62 63 88 static 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); 90 static psBool parseMetadataItem(char* keyName, psS32* level, psArray* levelArray, 91 char* linePtr, psS32 lineCount, char* fileName, psMetadataFlags flags); 71 92 72 93 static void parseLevelInfoFree(p_psParseLevelInfo* info) … … 594 615 595 616 // Determine the number of items in template 596 items = template->list-> size;617 items = template->list->n; 597 618 if(items > 0 ) { 598 619 -
trunk/psLib/src/types/psMetadataConfig.h
r4540 r4556 10 10 * @author Robert DeSonia, MHPCC 11 11 * 12 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-07-1 2 19:12:01$12 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-07-15 02:33:54 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 17 17 #ifndef PS_METADATACONFIG_H 18 18 #define PS_METADATACONFIG_H 19 20 #include "psMetadata.h"21 19 22 20 /// @addtogroup Metadata -
trunk/psLib/src/types/psPixels.c
r4540 r4556 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-07-1 2 19:12:01$9 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-07-15 02:33:54 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 55 55 } 56 56 57 psPixels* psPixelsAlloc( psU32nalloc)57 psPixels* psPixelsAlloc(long nalloc) 58 58 { 59 59 psPixels* out = psAlloc(sizeof(psPixels)); … … 72 72 } 73 73 74 psPixels* psPixelsRealloc(psPixels* pixels, psU32nalloc)74 psPixels* psPixelsRealloc(psPixels* pixels, long nalloc) 75 75 { 76 76 if (pixels == NULL) { … … 94 94 } 95 95 96 psPixels* p_psPixelsAppend(psPixels* pixels, int growth, psS32 x, psS32y)96 psPixels* p_psPixelsAppend(psPixels* pixels, long growth, int x, int y) 97 97 { 98 98 if (growth < 1) { -
trunk/psLib/src/types/psPixels.h
r4401 r4556 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-0 6-27 20:38:12$9 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-07-15 02:33:54 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 24 24 typedef struct 25 25 { 26 psS32 x;///< x coordinate27 psS32 y;///< y coordinate26 int x; ///< x coordinate 27 int y; ///< y coordinate 28 28 } 29 29 psPixelCoord; … … 41 41 typedef struct 42 42 { 43 int n;///< Number in usa44 int nalloc;///< Number allocated43 long n; ///< Number in usa 44 long nalloc; ///< Number allocated 45 45 psPixelCoord* data; ///< The pixel coordinates 46 void *lock; ///< Option lock for thread safety 46 47 } 47 48 psPixels; … … 53 54 */ 54 55 psPixels* psPixelsAlloc( 55 psU32 nalloc ///< the size of the coordinate vectors 56 ); 56 long nalloc ///< the size of the coordinate vectors 57 ) 58 ; 57 59 58 60 /** resizes a psPixels structure … … 62 64 psPixels* psPixelsRealloc( 63 65 psPixels* pixels, ///< psPixels to resize, or NULL to create new psPixels 64 psU32nalloc ///< the size of the coordinate vectors66 long nalloc ///< the size of the coordinate vectors 65 67 ); 66 68 … … 71 73 psPixels* p_psPixelsAppend( 72 74 psPixels* pixels, ///< psPixels to append new coordinate to. NULL creates a new one. 73 intgrowth, ///< number of elements to grow the psPixels list, if necessary. if growth < 1, 10 is used.74 psS32 x,///< x coordinate to append75 psS32 y///< y coordinate to append75 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 76 78 ); 77 79 … … 138 140 139 141 /** Prints a psPixels to specified destination. 140 * 142 * 141 143 * @return bool: True if successful. 142 144 */
Note:
See TracChangeset
for help on using the changeset viewer.
