Changeset 4409
- Timestamp:
- Jun 28, 2005, 10:17:52 AM (21 years ago)
- Location:
- trunk/psLib
- Files:
-
- 41 edited
-
pslib.kdevses (modified) (1 diff)
-
src/astro/psTime.c (modified) (7 diffs)
-
src/astro/psTime.h (modified) (14 diffs)
-
src/astronomy/psTime.c (modified) (7 diffs)
-
src/astronomy/psTime.h (modified) (14 diffs)
-
src/collections/psMetadataIO.c (modified) (2 diffs)
-
src/collections/psMetadataIO.h (modified) (2 diffs)
-
src/collections/psScalar.c (modified) (4 diffs)
-
src/collections/psScalar.h (modified) (2 diffs)
-
src/collections/psVector.c (modified) (5 diffs)
-
src/collections/psVector.h (modified) (6 diffs)
-
src/dataManip/psStats.c (modified) (5 diffs)
-
src/dataManip/psStats.h (modified) (3 diffs)
-
src/dataManip/psUnaryOp.c (modified) (2 diffs)
-
src/dataManip/psUnaryOp.h (modified) (2 diffs)
-
src/image/psImage.c (modified) (2 diffs)
-
src/image/psImage.h (modified) (2 diffs)
-
src/math/psStats.c (modified) (5 diffs)
-
src/math/psStats.h (modified) (3 diffs)
-
src/math/psUnaryOp.c (modified) (2 diffs)
-
src/math/psUnaryOp.h (modified) (2 diffs)
-
src/mathtypes/psImage.c (modified) (2 diffs)
-
src/mathtypes/psImage.h (modified) (2 diffs)
-
src/mathtypes/psScalar.c (modified) (4 diffs)
-
src/mathtypes/psScalar.h (modified) (2 diffs)
-
src/mathtypes/psVector.c (modified) (5 diffs)
-
src/mathtypes/psVector.h (modified) (6 diffs)
-
src/sys/psString.c (modified) (3 diffs)
-
src/sys/psString.h (modified) (4 diffs)
-
src/sys/psTrace.c (modified) (4 diffs)
-
src/sys/psTrace.h (modified) (4 diffs)
-
src/sysUtils/psString.c (modified) (3 diffs)
-
src/sysUtils/psString.h (modified) (4 diffs)
-
src/sysUtils/psTrace.c (modified) (4 diffs)
-
src/sysUtils/psTrace.h (modified) (4 diffs)
-
src/types/psMetadataConfig.c (modified) (2 diffs)
-
src/types/psMetadataConfig.h (modified) (2 diffs)
-
src/xml/psXML.c (modified) (2 diffs)
-
src/xml/psXML.h (modified) (2 diffs)
-
test/astronomy/verified/tst_psTime_01.stderr (modified) (2 diffs)
-
test/dataManip/verified/tst_psHist02.stderr (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/pslib.kdevses
r4401 r4409 2 2 <!DOCTYPE KDevPrjSession> 3 3 <KDevPrjSession> 4 <DocsAndViews NumberOfDocuments="0" /> 4 <DocsAndViews NumberOfDocuments="1" > 5 <Doc0 NumberOfViews="1" URL="file:/home/drobbin/panstarrs/psLib/src/dataManip/psFunctions.h" > 6 <View0 line="80" Type="Source" /> 7 </Doc0> 8 </DocsAndViews> 5 9 <pluginList> 6 10 <kdevbookmarks> -
trunk/psLib/src/astro/psTime.c
r4330 r4409 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.6 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-06-2 1 03:01:37$12 * @version $Revision: 1.65 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-06-28 20:17:52 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1166 1166 } 1167 1167 1168 char*psTimeToISO(const psTime *time)1168 psString psTimeToISO(const psTime *time) 1169 1169 { 1170 1170 psS32 ds = 0; … … 1353 1353 } 1354 1354 1355 psTime* psTimeFromISO(const char * time)1355 psTime* psTimeFromISO(const char *input) 1356 1356 { 1357 1357 psS32 millisecond; … … 1360 1360 1361 1361 // Check for NULL string 1362 PS_ASSERT_PTR_NON_NULL( time,NULL);1362 PS_ASSERT_PTR_NON_NULL(input,NULL); 1363 1363 1364 1364 // Convert YYYY-MM-DDThh:mm:ss.sss in string form to tm time 1365 if (sscanf( time, "%d-%d-%dT%d:%d:%d,%d", &tmTime.tm_year, &tmTime.tm_mon, &tmTime.tm_mday,1365 if (sscanf(input, "%d-%d-%dT%d:%d:%d,%d", &tmTime.tm_year, &tmTime.tm_mon, &tmTime.tm_mday, 1366 1366 &tmTime.tm_hour, &tmTime.tm_min, &tmTime.tm_sec,&millisecond) < 7) { 1367 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_ISOTIME_MALFORMED, time);1367 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_ISOTIME_MALFORMED, input); 1368 1368 return NULL; 1369 1369 } … … 1426 1426 } 1427 1427 1428 psTime* psTimeFromTimeval(const struct timeval * time)1428 psTime* psTimeFromTimeval(const struct timeval *input) 1429 1429 { 1430 1430 psTime *outTime = NULL; … … 1432 1432 1433 1433 // Error check 1434 PS_ASSERT_PTR_NON_NULL( time,NULL);1434 PS_ASSERT_PTR_NON_NULL(input,NULL); 1435 1435 1436 1436 // Allocate psTime struct … … 1438 1438 1439 1439 // Convert to psTime 1440 outTime->sec = time->tv_sec;1441 outTime->nsec = time->tv_usec * 1000;1440 outTime->sec = input->tv_sec; 1441 outTime->nsec = input->tv_usec * 1000; 1442 1442 1443 1443 // Error check -
trunk/psLib/src/astro/psTime.h
r4330 r4409 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.3 2$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-06-2 1 03:01:37$13 * @version $Revision: 1.33 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-06-28 20:17:52 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 38 38 */ 39 39 typedef enum { 40 PS_TIME_TAI, ///< Temps Atomique International (TAI) time (time with leapseconds).41 PS_TIME_UTC, ///< Universal Time Coordinated (UTC) time (time without leapseconds).42 PS_TIME_UT1, ///< Universal Time corrected for polar motion43 PS_TIME_TT, ///< Terrestrial Time40 PS_TIME_TAI, ///< Temps Atomique International (TAI) time (time with leapseconds) 41 PS_TIME_UTC, ///< Universal Time Coordinated (UTC) time (time without leapseconds) 42 PS_TIME_UT1, ///< Universal Time corrected for polar motion 43 PS_TIME_TT, ///< Terrestrial Time 44 44 } psTimeType; 45 45 … … 49 49 */ 50 50 typedef enum { 51 PS_IERS_A, ///< IERS Bulletin A52 PS_IERS_B, ///< IERS Bulletin B51 PS_IERS_A, ///< IERS Bulletin A 52 PS_IERS_B, ///< IERS Bulletin B 53 53 } psTimeBulletin; 54 54 … … 62 62 typedef struct psTime 63 63 { 64 psS64 sec; ///< Seconds since epoch, Jan 1, 1970.65 psU32 nsec; ///< Nanoseconds since last second.66 psBool leapsecond; ///< if time falls on UTC leapsecond67 psTimeType type; ///< Type of time.64 psS64 sec; ///< Seconds since epoch, Jan 1, 1970. 65 psU32 nsec; ///< Nanoseconds since last second. 66 psBool leapsecond; ///< if time falls on UTC leapsecond 67 psTimeType type; ///< Type of time. 68 68 } 69 69 psTime; … … 97 97 */ 98 98 psTime* psTimeAlloc( 99 psTimeType type ///< Type of time to create (UTC or TAI).99 psTimeType type ///< Type of time to create (UTC or TAI). 100 100 ); 101 101 … … 108 108 */ 109 109 psTime* psTimeGetNow( 110 psTimeType type ///< Type of time to get (UTC or TAI).110 psTimeType type ///< Type of time to get (UTC or TAI). 111 111 ); 112 112 … … 118 118 */ 119 119 psTime* psTimeConvert( 120 psTime *time, ///< Time to be converted.121 psTimeType type ///< Type to be converted to.120 psTime *time, ///< Time to be converted. 121 psTimeType type ///< Type to be converted to. 122 122 ); 123 123 … … 131 131 double psTimeToLMST( 132 132 psTime *time, ///< psTime to be converted. 133 double longitude ///< Longitude.133 double longitude ///< Longitude. 134 134 ); 135 135 … … 141 141 */ 142 142 double psTimeGetUT1Delta( 143 const psTime *time, ///< psTime to be looked up.144 psTimeBulletin bulletin ///< IERS bulletin to use143 const psTime *time, ///< psTime to be looked up. 144 psTimeBulletin bulletin ///< IERS bulletin to use 145 145 ); 146 146 … … 152 152 */ 153 153 psF64 p_psTimeGetTAIDelta( 154 const psTime *time ///< psTime to be looked up.154 const psTime *time ///< psTime to be looked up. 155 155 ); 156 156 … … 212 212 * This function does not add or subtract leapseconds. 213 213 * 214 * @return char*:Pointer null terminated array of chars in ISO time.215 */ 216 char*psTimeToISO(214 * @return psString: Pointer null terminated array of chars in ISO time. 215 */ 216 psString psTimeToISO( 217 217 const psTime* time ///< Input time to be converted. 218 218 ); … … 268 268 */ 269 269 psTime* psTimeFromISO( 270 const char* time///< Input time to be converted.270 const char* input ///< Input time to be converted. 271 271 ); 272 272 … … 278 278 */ 279 279 psTime* psTimeFromTimeval( 280 const struct timeval * time///< Input time to be converted.280 const struct timeval *input ///< Input time to be converted. 281 281 ); 282 282 … … 296 296 * Converts UTC time to psTime. It will verify if time specified is a leapsecond. 297 297 * 298 * @return psTime*: time (UTC) 298 * @return psTime*: time (UTC)time 299 299 */ 300 300 psTime* psTimeFromUTC( -
trunk/psLib/src/astronomy/psTime.c
r4330 r4409 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.6 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-06-2 1 03:01:37$12 * @version $Revision: 1.65 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-06-28 20:17:52 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1166 1166 } 1167 1167 1168 char*psTimeToISO(const psTime *time)1168 psString psTimeToISO(const psTime *time) 1169 1169 { 1170 1170 psS32 ds = 0; … … 1353 1353 } 1354 1354 1355 psTime* psTimeFromISO(const char * time)1355 psTime* psTimeFromISO(const char *input) 1356 1356 { 1357 1357 psS32 millisecond; … … 1360 1360 1361 1361 // Check for NULL string 1362 PS_ASSERT_PTR_NON_NULL( time,NULL);1362 PS_ASSERT_PTR_NON_NULL(input,NULL); 1363 1363 1364 1364 // Convert YYYY-MM-DDThh:mm:ss.sss in string form to tm time 1365 if (sscanf( time, "%d-%d-%dT%d:%d:%d,%d", &tmTime.tm_year, &tmTime.tm_mon, &tmTime.tm_mday,1365 if (sscanf(input, "%d-%d-%dT%d:%d:%d,%d", &tmTime.tm_year, &tmTime.tm_mon, &tmTime.tm_mday, 1366 1366 &tmTime.tm_hour, &tmTime.tm_min, &tmTime.tm_sec,&millisecond) < 7) { 1367 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_ISOTIME_MALFORMED, time);1367 psError(PS_ERR_BAD_PARAMETER_VALUE, true, PS_ERRORTEXT_psTime_ISOTIME_MALFORMED, input); 1368 1368 return NULL; 1369 1369 } … … 1426 1426 } 1427 1427 1428 psTime* psTimeFromTimeval(const struct timeval * time)1428 psTime* psTimeFromTimeval(const struct timeval *input) 1429 1429 { 1430 1430 psTime *outTime = NULL; … … 1432 1432 1433 1433 // Error check 1434 PS_ASSERT_PTR_NON_NULL( time,NULL);1434 PS_ASSERT_PTR_NON_NULL(input,NULL); 1435 1435 1436 1436 // Allocate psTime struct … … 1438 1438 1439 1439 // Convert to psTime 1440 outTime->sec = time->tv_sec;1441 outTime->nsec = time->tv_usec * 1000;1440 outTime->sec = input->tv_sec; 1441 outTime->nsec = input->tv_usec * 1000; 1442 1442 1443 1443 // Error check -
trunk/psLib/src/astronomy/psTime.h
r4330 r4409 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.3 2$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-06-2 1 03:01:37$13 * @version $Revision: 1.33 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-06-28 20:17:52 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 38 38 */ 39 39 typedef enum { 40 PS_TIME_TAI, ///< Temps Atomique International (TAI) time (time with leapseconds).41 PS_TIME_UTC, ///< Universal Time Coordinated (UTC) time (time without leapseconds).42 PS_TIME_UT1, ///< Universal Time corrected for polar motion43 PS_TIME_TT, ///< Terrestrial Time40 PS_TIME_TAI, ///< Temps Atomique International (TAI) time (time with leapseconds) 41 PS_TIME_UTC, ///< Universal Time Coordinated (UTC) time (time without leapseconds) 42 PS_TIME_UT1, ///< Universal Time corrected for polar motion 43 PS_TIME_TT, ///< Terrestrial Time 44 44 } psTimeType; 45 45 … … 49 49 */ 50 50 typedef enum { 51 PS_IERS_A, ///< IERS Bulletin A52 PS_IERS_B, ///< IERS Bulletin B51 PS_IERS_A, ///< IERS Bulletin A 52 PS_IERS_B, ///< IERS Bulletin B 53 53 } psTimeBulletin; 54 54 … … 62 62 typedef struct psTime 63 63 { 64 psS64 sec; ///< Seconds since epoch, Jan 1, 1970.65 psU32 nsec; ///< Nanoseconds since last second.66 psBool leapsecond; ///< if time falls on UTC leapsecond67 psTimeType type; ///< Type of time.64 psS64 sec; ///< Seconds since epoch, Jan 1, 1970. 65 psU32 nsec; ///< Nanoseconds since last second. 66 psBool leapsecond; ///< if time falls on UTC leapsecond 67 psTimeType type; ///< Type of time. 68 68 } 69 69 psTime; … … 97 97 */ 98 98 psTime* psTimeAlloc( 99 psTimeType type ///< Type of time to create (UTC or TAI).99 psTimeType type ///< Type of time to create (UTC or TAI). 100 100 ); 101 101 … … 108 108 */ 109 109 psTime* psTimeGetNow( 110 psTimeType type ///< Type of time to get (UTC or TAI).110 psTimeType type ///< Type of time to get (UTC or TAI). 111 111 ); 112 112 … … 118 118 */ 119 119 psTime* psTimeConvert( 120 psTime *time, ///< Time to be converted.121 psTimeType type ///< Type to be converted to.120 psTime *time, ///< Time to be converted. 121 psTimeType type ///< Type to be converted to. 122 122 ); 123 123 … … 131 131 double psTimeToLMST( 132 132 psTime *time, ///< psTime to be converted. 133 double longitude ///< Longitude.133 double longitude ///< Longitude. 134 134 ); 135 135 … … 141 141 */ 142 142 double psTimeGetUT1Delta( 143 const psTime *time, ///< psTime to be looked up.144 psTimeBulletin bulletin ///< IERS bulletin to use143 const psTime *time, ///< psTime to be looked up. 144 psTimeBulletin bulletin ///< IERS bulletin to use 145 145 ); 146 146 … … 152 152 */ 153 153 psF64 p_psTimeGetTAIDelta( 154 const psTime *time ///< psTime to be looked up.154 const psTime *time ///< psTime to be looked up. 155 155 ); 156 156 … … 212 212 * This function does not add or subtract leapseconds. 213 213 * 214 * @return char*:Pointer null terminated array of chars in ISO time.215 */ 216 char*psTimeToISO(214 * @return psString: Pointer null terminated array of chars in ISO time. 215 */ 216 psString psTimeToISO( 217 217 const psTime* time ///< Input time to be converted. 218 218 ); … … 268 268 */ 269 269 psTime* psTimeFromISO( 270 const char* time///< Input time to be converted.270 const char* input ///< Input time to be converted. 271 271 ); 272 272 … … 278 278 */ 279 279 psTime* psTimeFromTimeval( 280 const struct timeval * time///< Input time to be converted.280 const struct timeval *input ///< Input time to be converted. 281 281 ); 282 282 … … 296 296 * Converts UTC time to psTime. It will verify if time specified is a leapsecond. 297 297 * 298 * @return psTime*: time (UTC) 298 * @return psTime*: time (UTC)time 299 299 */ 300 300 psTime* psTimeFromUTC( -
trunk/psLib/src/collections/psMetadataIO.c
r4401 r4409 10 10 * @author Eric Van Alst, MHPCC 11 11 * 12 * @version $Revision: 1.3 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-06-2 7 20:38:12 $12 * @version $Revision: 1.33 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-06-28 20:17:52 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1075 1075 } 1076 1076 1077 psMetadata* psMetadataConfigParse(psMetadata* md, int *nFail, const char *fileName, bool overwrite)1077 psMetadata* psMetadataConfigParse(psMetadata* md, unsigned int *nFail, const char *fileName, bool overwrite) 1078 1078 { 1079 1079 FILE* fp = NULL; -
trunk/psLib/src/collections/psMetadataIO.h
r4401 r4409 10 10 * @author Robert DeSonia, MHPCC 11 11 * 12 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-06-2 7 20:38:12 $12 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-06-28 20:17:52 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 81 81 psMetadata* psMetadataConfigParse( 82 82 psMetadata* md, ///< Resulting metadata from read. 83 int *nFail,///< Number of failed lines.83 unsigned int *nFail, ///< Number of failed lines. 84 84 const char *fileName, ///< Name of file to read. 85 85 bool overwrite ///< Allow overwrite of duplicate specifications. -
trunk/psLib/src/collections/psScalar.c
r4330 r4409 8 8 * @author Ross Harman, MHPCC 9 9 * 10 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $11 * @date $Date: 2005-06-2 1 03:01:37$10 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-06-28 20:17:52 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 22 22 #include "psCollectionsErrors.h" 23 23 24 psScalar* psScalarAlloc( psC64 value, psElemType dataType)24 psScalar* psScalarAlloc(complex value, psElemType type) 25 25 { 26 26 psScalar* scalar = NULL; … … 30 30 31 31 scalar->type.dimen = PS_DIMEN_SCALAR; 32 scalar->type.type = dataType;32 scalar->type.type = type; 33 33 34 switch ( dataType) {34 switch (type) { 35 35 case PS_TYPE_S8: 36 36 scalar->data.S8 = (psS8) value; … … 72 72 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 73 73 PS_ERRORTEXT_psScalar_UNSUPPORTED_TYPE, 74 dataType);74 type); 75 75 psFree(scalar); 76 76 return NULL; -
trunk/psLib/src/collections/psScalar.h
r4330 r4409 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-06-2 1 03:01:37$13 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-06-28 20:17:52 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 66 66 */ 67 67 psScalar* psScalarAlloc( 68 psC64 value,///< Data to be put into psScalar.69 psElemType dataType///< Type of data to be held by psScalar.68 complex value, ///< Data to be put into psScalar. 69 psElemType type ///< Type of data to be held by psScalar. 70 70 ); 71 71 -
trunk/psLib/src/collections/psVector.c
r4392 r4409 9 9 * @author Robert DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1.4 4$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-06-2 5 02:02:05$11 * @version $Revision: 1.45 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-06-28 20:17:52 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 48 48 // FUNCTION IMPLEMENTATION - PUBLIC 49 49 50 psVector* psVectorAlloc( psU32 nalloc, psElemType elemType)50 psVector* psVectorAlloc(unsigned long nalloc, psElemType type) 51 51 { 52 52 psVector* psVec = NULL; 53 53 psS32 elementSize = 0; 54 54 55 elementSize = PSELEMTYPE_SIZEOF( elemType);55 elementSize = PSELEMTYPE_SIZEOF(type); 56 56 if (elementSize < 1) { 57 57 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 58 PS_ERRORTEXT_psVector_UNSUPPORTED_TYPE, elemType);58 PS_ERRORTEXT_psVector_UNSUPPORTED_TYPE, type); 59 59 return NULL; 60 60 } … … 66 66 67 67 psVec->type.dimen = PS_DIMEN_VECTOR; 68 psVec->type.type = elemType;68 psVec->type.type = type; 69 69 *(int*)&psVec->nalloc = nalloc; 70 70 psVec->n = nalloc; … … 76 76 } 77 77 78 psVector* psVectorRealloc(psVector* in, psU32nalloc)78 psVector* psVectorRealloc(psVector* vector, unsigned long nalloc) 79 79 { 80 80 psS32 elementSize = 0; 81 81 psElemType elemType; 82 82 83 if ( in== NULL) {83 if (vector == NULL) { 84 84 psError(PS_ERR_BAD_PARAMETER_NULL, true, 85 85 PS_ERRORTEXT_psVector_REALLOC_NULL); 86 86 return NULL; 87 } else if ( in->nalloc != nalloc) { // No need to realloc to same size88 elemType = in->type.type;87 } else if (vector->nalloc != nalloc) { // No need to realloc to same size 88 elemType = vector->type.type; 89 89 elementSize = PSELEMTYPE_SIZEOF(elemType); 90 if (nalloc < in->n) {91 in->n = nalloc;90 if (nalloc < vector->n) { 91 vector->n = nalloc; 92 92 } 93 93 // Realloc after decrementation to avoid accessing freed array elements 94 in->data.U8 = psRealloc(in->data.U8, nalloc * elementSize);95 *(int*)& in->nalloc = nalloc;96 } 97 98 return in;99 } 100 101 psVector* psVectorRecycle(psVector* in, psU32 n, psElemType type)94 vector->data.U8 = psRealloc(vector->data.U8, nalloc * elementSize); 95 *(int*)&vector->nalloc = nalloc; 96 } 97 98 return vector; 99 } 100 101 psVector* psVectorRecycle(psVector* vector, unsigned long nalloc, psElemType type) 102 102 { 103 103 psS32 byteSize; 104 104 105 if ( in== NULL) {106 return psVectorAlloc(n , type);107 } 108 109 if ( in->type.dimen != PS_DIMEN_VECTOR &&110 in->type.dimen != PS_DIMEN_TRANSV) {111 psFree( in);105 if (vector == NULL) { 106 return psVectorAlloc(nalloc, type); 107 } 108 109 if (vector->type.dimen != PS_DIMEN_VECTOR && 110 vector->type.dimen != PS_DIMEN_TRANSV) { 111 psFree(vector); 112 112 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 113 113 PS_ERRORTEXT_psVector_NOT_A_VECTOR); … … 115 115 } 116 116 117 byteSize = n * PSELEMTYPE_SIZEOF(type);117 byteSize = nalloc * PSELEMTYPE_SIZEOF(type); 118 118 119 119 // need to increase data buffer? 120 if (byteSize > in->nalloc*PSELEMTYPE_SIZEOF(in->type.type)) {121 in->data.U8 = psRealloc(in->data.U8, byteSize);122 *(int*)& in->nalloc = n;123 } 124 125 in->type.dimen = PS_DIMEN_VECTOR;126 in->type.type = type;127 in->n = n;128 return in;120 if (byteSize > vector->nalloc*PSELEMTYPE_SIZEOF(vector->type.type)) { 121 vector->data.U8 = psRealloc(vector->data.U8, byteSize); 122 *(int*)&vector->nalloc = nalloc; 123 } 124 125 vector->type.dimen = PS_DIMEN_VECTOR; 126 vector->type.type = type; 127 vector->n = nalloc; 128 return vector; 129 129 } 130 130 -
trunk/psLib/src/collections/psVector.h
r4330 r4409 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.3 6$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-06-2 1 03:01:37$13 * @version $Revision: 1.37 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-06-28 20:17:52 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 29 29 ///< Union of psVector data types. 30 30 typedef union { 31 psU8* U8; ///< Unsigned 8-bit integer data. 32 psU16* U16; ///< Unsigned 16-bit integer data. 33 psU32* U32; ///< Unsigned 32-bit integer data. 34 psU64* U64; ///< Unsigned 64-bit integer data. 35 psS8* S8; ///< Signed 8-bit integer data. 36 psS16* S16; ///< Signed 16-bit integer data. 37 psS32* S32; ///< Signed 32-bit integer data. 38 psS64* S64; ///< Signed 64-bit integer data. 39 psF32* F32; ///< Single-precision float data. 40 psF64* F64; ///< Double-precision float data. 41 psC32* C32; ///< Single-precision complex data. 42 psC64* C64; ///< Double-precision complex data. 43 } p_psVectorData; 31 psU8* U8; ///< Unsigned 8-bit integer data. 32 psU16* U16; ///< Unsigned 16-bit integer data. 33 psU32* U32; ///< Unsigned 32-bit integer data. 34 psU64* U64; ///< Unsigned 64-bit integer data. 35 psS8* S8; ///< Signed 8-bit integer data. 36 psS16* S16; ///< Signed 16-bit integer data. 37 psS32* S32; ///< Signed 32-bit integer data. 38 psS64* S64; ///< Signed 64-bit integer data. 39 psF32* F32; ///< Single-precision float data. 40 psF64* F64; ///< Double-precision float data. 41 psC32* C32; ///< Single-precision complex data. 42 psC64* C64; ///< Double-precision complex data. 43 } 44 p_psVectorData; 44 45 45 46 /** An vector to support primitive types. … … 50 51 typedef struct 51 52 { 52 psType type; ///< Type of data.53 int n; ///< Number of elements in use.54 const int nalloc; ///< Total number of elements available.55 p_psVectorData data; ///< Union for data types.53 psType type; ///< Type of data. 54 int n; ///< Number of elements in use. 55 const int nalloc; ///< Total number of elements available. 56 p_psVectorData data; ///< Union for data types. 56 57 } 57 58 psVector; … … 72 73 */ 73 74 psVector* psVectorAlloc( 74 psU32 nalloc,///< Total number of elements to make available.75 psElemType dataType///< Type of data to be held by vector.75 unsigned long nalloc, ///< Total number of elements to make available. 76 psElemType type ///< Type of data to be held by vector. 76 77 ); 77 78 … … 86 87 */ 87 88 psVector* psVectorRealloc( 88 psVector* psVec,///< Vector to reallocate.89 psU32 nalloc///< Total number of elements to make available.89 psVector* vector, ///< Vector to reallocate. 90 unsigned long nalloc ///< Total number of elements to make available. 90 91 ); 91 92 … … 115 116 */ 116 117 psVector* psVectorRecycle( 117 psVector* psVec,118 psVector* vector, 118 119 ///< Vector to recycle. If NULL, a new vector is created. No effort 119 120 ///< taken to preserve the values. 120 121 121 psU32 nalloc,///< Total number of elements to make available.122 unsigned long nalloc, ///< Total number of elements to make available. 122 123 psElemType type ///< the datatype of the returned vector 123 124 ); -
trunk/psLib/src/dataManip/psStats.c
r4392 r4409 14 14 * stats->binsize 15 15 * 16 * @version $Revision: 1.13 5$ $Name: not supported by cvs2svn $17 * @date $Date: 2005-06-2 5 02:02:05$16 * @version $Revision: 1.136 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2005-06-28 20:17:52 $ 18 18 * 19 19 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 1987 1987 *****************************************************************************/ 1988 1988 psHistogram* psVectorHistogram(psHistogram* out, 1989 const psVector* in,1989 const psVector* values, 1990 1990 const psVector* errors, 1991 1991 const psVector* mask, 1992 ps U32maskVal)1992 psMaskType maskVal) 1993 1993 { 1994 1994 PS_ASSERT_PTR_NON_NULL(out, NULL); … … 1999 1999 PS_ASSERT_VECTOR_TYPE(out->nums, PS_TYPE_F32, NULL); 2000 2000 PS_ASSERT_INT_NONNEGATIVE(out->nums->n, NULL); 2001 PS_ASSERT_VECTOR_NON_NULL( in, out);2001 PS_ASSERT_VECTOR_NON_NULL(values, out); 2002 2002 if (mask != NULL) { 2003 PS_ASSERT_VECTORS_SIZE_EQUAL( in, mask, NULL);2003 PS_ASSERT_VECTORS_SIZE_EQUAL(values, mask, NULL); 2004 2004 PS_ASSERT_VECTOR_TYPE(mask, PS_TYPE_U8, NULL); 2005 2005 } 2006 2006 if (errors != NULL) { 2007 PS_ASSERT_VECTORS_SIZE_EQUAL( in, errors, NULL);2008 PS_ASSERT_VECTOR_TYPE(errors, in->type.type, NULL);2007 PS_ASSERT_VECTORS_SIZE_EQUAL(values, errors, NULL); 2008 PS_ASSERT_VECTOR_TYPE(errors, values->type.type, NULL); 2009 2009 } 2010 2010 … … 2021 2021 2022 2022 // Convert input and errors vectors to F32 if necessary. 2023 inF32 = p_psConvertToF32((psVector *) in);2023 inF32 = p_psConvertToF32((psVector *) values); 2024 2024 if (inF32 == NULL) { 2025 inF32 = (psVector *) in;2025 inF32 = (psVector *) values; 2026 2026 mustFreeVectorIn = 0; 2027 2027 } … … 2187 2187 const psVector* errors, 2188 2188 const psVector* mask, 2189 ps U32maskVal)2189 psMaskType maskVal) 2190 2190 { 2191 2191 PS_ASSERT_PTR_NON_NULL(stats, NULL); -
trunk/psLib/src/dataManip/psStats.h
r4315 r4409 14 14 * @author GLG, MHPCC 15 15 * 16 * @version $Revision: 1.4 4$ $Name: not supported by cvs2svn $17 * @date $Date: 2005-06- 18 02:30:49$16 * @version $Revision: 1.45 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2005-06-28 20:17:52 $ 18 18 * 19 19 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 94 94 const psVector* errors, ///< Errors. 95 95 const psVector* mask, ///< Ignore elements where (maskVector & maskVal) != 0: must be INT or NULL 96 ps U32 maskVal///< Only mask elements with one of these bits set in maskVector96 psMaskType maskVal ///< Only mask elements with one of these bits set in maskVector 97 97 ); 98 98 … … 160 160 psHistogram* psVectorHistogram( 161 161 psHistogram* out, ///< Histogram data 162 const psVector* in,///< Vector to analyse162 const psVector* values, ///< Vector to analyse 163 163 const psVector* errors, ///< Errors 164 164 const psVector* mask, ///< Mask dat for input vector 165 ps U32 maskVal///< Mask value165 psMaskType maskVal ///< Mask value 166 166 ); 167 167 -
trunk/psLib/src/dataManip/psUnaryOp.c
r4029 r4409 30 30 * @author Robert DeSonia, MHPCC 31 31 * 32 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $33 * @date $Date: 2005-0 5-25 20:26:55$32 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 33 * @date $Date: 2005-06-28 20:17:52 $ 34 34 * 35 35 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 304 304 } 305 305 306 psPtr psUnaryOp(psPtr out, psPtr in,char *op)306 psPtr psUnaryOp(psPtr out, const psPtr in, const char *op) 307 307 { 308 308 #define psUnaryOp_EXIT { \ -
trunk/psLib/src/dataManip/psUnaryOp.h
r4162 r4409 30 30 * @author Robert DeSonia, MHPCC 31 31 * 32 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $33 * @date $Date: 2005-06- 08 23:40:45$32 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 33 * @date $Date: 2005-06-28 20:17:52 $ 34 34 * 35 35 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 61 61 psType* psUnaryOp( 62 62 psPtr out, ///< Output type, either psImage or psVector. 63 psPtr in,///< Input, either psImage or psVector.64 c har *op///< Operator.63 const psPtr in, ///< Input, either psImage or psVector. 64 const char *op ///< Operator. 65 65 ); 66 66 -
trunk/psLib/src/image/psImage.c
r4392 r4409 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.7 1$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-06-2 5 02:02:05$11 * @version $Revision: 1.72 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-06-28 20:17:52 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 137 137 } 138 138 139 char* psRegionToString(psRegion region)139 psString psRegionToString(const psRegion region) 140 140 { 141 141 char tmpText[256]; // big enough to store any region as text -
trunk/psLib/src/image/psImage.h
r4330 r4409 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.5 8$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-06-2 1 03:01:37$13 * @version $Revision: 1.59 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-06-28 20:17:52 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 132 132 /** Create a string of the standard IRAF form '[x0:x1,y0:y1]' from a psRegion. 133 133 * 134 * @return char*: A new string representing the psRegion as text, or NULL134 * @return psString: A new string representing the psRegion as text, or NULL 135 135 * is not successful. 136 136 */ 137 char*psRegionToString(138 psRegion region///< the psRegion to convert to a string137 psString psRegionToString( 138 const psRegion region ///< the psRegion to convert to a string 139 139 ); 140 140 -
trunk/psLib/src/math/psStats.c
r4392 r4409 14 14 * stats->binsize 15 15 * 16 * @version $Revision: 1.13 5$ $Name: not supported by cvs2svn $17 * @date $Date: 2005-06-2 5 02:02:05$16 * @version $Revision: 1.136 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2005-06-28 20:17:52 $ 18 18 * 19 19 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 1987 1987 *****************************************************************************/ 1988 1988 psHistogram* psVectorHistogram(psHistogram* out, 1989 const psVector* in,1989 const psVector* values, 1990 1990 const psVector* errors, 1991 1991 const psVector* mask, 1992 ps U32maskVal)1992 psMaskType maskVal) 1993 1993 { 1994 1994 PS_ASSERT_PTR_NON_NULL(out, NULL); … … 1999 1999 PS_ASSERT_VECTOR_TYPE(out->nums, PS_TYPE_F32, NULL); 2000 2000 PS_ASSERT_INT_NONNEGATIVE(out->nums->n, NULL); 2001 PS_ASSERT_VECTOR_NON_NULL( in, out);2001 PS_ASSERT_VECTOR_NON_NULL(values, out); 2002 2002 if (mask != NULL) { 2003 PS_ASSERT_VECTORS_SIZE_EQUAL( in, mask, NULL);2003 PS_ASSERT_VECTORS_SIZE_EQUAL(values, mask, NULL); 2004 2004 PS_ASSERT_VECTOR_TYPE(mask, PS_TYPE_U8, NULL); 2005 2005 } 2006 2006 if (errors != NULL) { 2007 PS_ASSERT_VECTORS_SIZE_EQUAL( in, errors, NULL);2008 PS_ASSERT_VECTOR_TYPE(errors, in->type.type, NULL);2007 PS_ASSERT_VECTORS_SIZE_EQUAL(values, errors, NULL); 2008 PS_ASSERT_VECTOR_TYPE(errors, values->type.type, NULL); 2009 2009 } 2010 2010 … … 2021 2021 2022 2022 // Convert input and errors vectors to F32 if necessary. 2023 inF32 = p_psConvertToF32((psVector *) in);2023 inF32 = p_psConvertToF32((psVector *) values); 2024 2024 if (inF32 == NULL) { 2025 inF32 = (psVector *) in;2025 inF32 = (psVector *) values; 2026 2026 mustFreeVectorIn = 0; 2027 2027 } … … 2187 2187 const psVector* errors, 2188 2188 const psVector* mask, 2189 ps U32maskVal)2189 psMaskType maskVal) 2190 2190 { 2191 2191 PS_ASSERT_PTR_NON_NULL(stats, NULL); -
trunk/psLib/src/math/psStats.h
r4315 r4409 14 14 * @author GLG, MHPCC 15 15 * 16 * @version $Revision: 1.4 4$ $Name: not supported by cvs2svn $17 * @date $Date: 2005-06- 18 02:30:49$16 * @version $Revision: 1.45 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2005-06-28 20:17:52 $ 18 18 * 19 19 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 94 94 const psVector* errors, ///< Errors. 95 95 const psVector* mask, ///< Ignore elements where (maskVector & maskVal) != 0: must be INT or NULL 96 ps U32 maskVal///< Only mask elements with one of these bits set in maskVector96 psMaskType maskVal ///< Only mask elements with one of these bits set in maskVector 97 97 ); 98 98 … … 160 160 psHistogram* psVectorHistogram( 161 161 psHistogram* out, ///< Histogram data 162 const psVector* in,///< Vector to analyse162 const psVector* values, ///< Vector to analyse 163 163 const psVector* errors, ///< Errors 164 164 const psVector* mask, ///< Mask dat for input vector 165 ps U32 maskVal///< Mask value165 psMaskType maskVal ///< Mask value 166 166 ); 167 167 -
trunk/psLib/src/math/psUnaryOp.c
r4029 r4409 30 30 * @author Robert DeSonia, MHPCC 31 31 * 32 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $33 * @date $Date: 2005-0 5-25 20:26:55$32 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 33 * @date $Date: 2005-06-28 20:17:52 $ 34 34 * 35 35 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 304 304 } 305 305 306 psPtr psUnaryOp(psPtr out, psPtr in,char *op)306 psPtr psUnaryOp(psPtr out, const psPtr in, const char *op) 307 307 { 308 308 #define psUnaryOp_EXIT { \ -
trunk/psLib/src/math/psUnaryOp.h
r4162 r4409 30 30 * @author Robert DeSonia, MHPCC 31 31 * 32 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $33 * @date $Date: 2005-06- 08 23:40:45$32 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 33 * @date $Date: 2005-06-28 20:17:52 $ 34 34 * 35 35 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 61 61 psType* psUnaryOp( 62 62 psPtr out, ///< Output type, either psImage or psVector. 63 psPtr in,///< Input, either psImage or psVector.64 c har *op///< Operator.63 const psPtr in, ///< Input, either psImage or psVector. 64 const char *op ///< Operator. 65 65 ); 66 66 -
trunk/psLib/src/mathtypes/psImage.c
r4392 r4409 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.7 1$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-06-2 5 02:02:05$11 * @version $Revision: 1.72 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-06-28 20:17:52 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 137 137 } 138 138 139 char* psRegionToString(psRegion region)139 psString psRegionToString(const psRegion region) 140 140 { 141 141 char tmpText[256]; // big enough to store any region as text -
trunk/psLib/src/mathtypes/psImage.h
r4330 r4409 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.5 8$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-06-2 1 03:01:37$13 * @version $Revision: 1.59 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-06-28 20:17:52 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 132 132 /** Create a string of the standard IRAF form '[x0:x1,y0:y1]' from a psRegion. 133 133 * 134 * @return char*: A new string representing the psRegion as text, or NULL134 * @return psString: A new string representing the psRegion as text, or NULL 135 135 * is not successful. 136 136 */ 137 char*psRegionToString(138 psRegion region///< the psRegion to convert to a string137 psString psRegionToString( 138 const psRegion region ///< the psRegion to convert to a string 139 139 ); 140 140 -
trunk/psLib/src/mathtypes/psScalar.c
r4330 r4409 8 8 * @author Ross Harman, MHPCC 9 9 * 10 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $11 * @date $Date: 2005-06-2 1 03:01:37$10 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-06-28 20:17:52 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 22 22 #include "psCollectionsErrors.h" 23 23 24 psScalar* psScalarAlloc( psC64 value, psElemType dataType)24 psScalar* psScalarAlloc(complex value, psElemType type) 25 25 { 26 26 psScalar* scalar = NULL; … … 30 30 31 31 scalar->type.dimen = PS_DIMEN_SCALAR; 32 scalar->type.type = dataType;32 scalar->type.type = type; 33 33 34 switch ( dataType) {34 switch (type) { 35 35 case PS_TYPE_S8: 36 36 scalar->data.S8 = (psS8) value; … … 72 72 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 73 73 PS_ERRORTEXT_psScalar_UNSUPPORTED_TYPE, 74 dataType);74 type); 75 75 psFree(scalar); 76 76 return NULL; -
trunk/psLib/src/mathtypes/psScalar.h
r4330 r4409 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-06-2 1 03:01:37$13 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-06-28 20:17:52 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 66 66 */ 67 67 psScalar* psScalarAlloc( 68 psC64 value,///< Data to be put into psScalar.69 psElemType dataType///< Type of data to be held by psScalar.68 complex value, ///< Data to be put into psScalar. 69 psElemType type ///< Type of data to be held by psScalar. 70 70 ); 71 71 -
trunk/psLib/src/mathtypes/psVector.c
r4392 r4409 9 9 * @author Robert DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1.4 4$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-06-2 5 02:02:05$11 * @version $Revision: 1.45 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-06-28 20:17:52 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 48 48 // FUNCTION IMPLEMENTATION - PUBLIC 49 49 50 psVector* psVectorAlloc( psU32 nalloc, psElemType elemType)50 psVector* psVectorAlloc(unsigned long nalloc, psElemType type) 51 51 { 52 52 psVector* psVec = NULL; 53 53 psS32 elementSize = 0; 54 54 55 elementSize = PSELEMTYPE_SIZEOF( elemType);55 elementSize = PSELEMTYPE_SIZEOF(type); 56 56 if (elementSize < 1) { 57 57 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 58 PS_ERRORTEXT_psVector_UNSUPPORTED_TYPE, elemType);58 PS_ERRORTEXT_psVector_UNSUPPORTED_TYPE, type); 59 59 return NULL; 60 60 } … … 66 66 67 67 psVec->type.dimen = PS_DIMEN_VECTOR; 68 psVec->type.type = elemType;68 psVec->type.type = type; 69 69 *(int*)&psVec->nalloc = nalloc; 70 70 psVec->n = nalloc; … … 76 76 } 77 77 78 psVector* psVectorRealloc(psVector* in, psU32nalloc)78 psVector* psVectorRealloc(psVector* vector, unsigned long nalloc) 79 79 { 80 80 psS32 elementSize = 0; 81 81 psElemType elemType; 82 82 83 if ( in== NULL) {83 if (vector == NULL) { 84 84 psError(PS_ERR_BAD_PARAMETER_NULL, true, 85 85 PS_ERRORTEXT_psVector_REALLOC_NULL); 86 86 return NULL; 87 } else if ( in->nalloc != nalloc) { // No need to realloc to same size88 elemType = in->type.type;87 } else if (vector->nalloc != nalloc) { // No need to realloc to same size 88 elemType = vector->type.type; 89 89 elementSize = PSELEMTYPE_SIZEOF(elemType); 90 if (nalloc < in->n) {91 in->n = nalloc;90 if (nalloc < vector->n) { 91 vector->n = nalloc; 92 92 } 93 93 // Realloc after decrementation to avoid accessing freed array elements 94 in->data.U8 = psRealloc(in->data.U8, nalloc * elementSize);95 *(int*)& in->nalloc = nalloc;96 } 97 98 return in;99 } 100 101 psVector* psVectorRecycle(psVector* in, psU32 n, psElemType type)94 vector->data.U8 = psRealloc(vector->data.U8, nalloc * elementSize); 95 *(int*)&vector->nalloc = nalloc; 96 } 97 98 return vector; 99 } 100 101 psVector* psVectorRecycle(psVector* vector, unsigned long nalloc, psElemType type) 102 102 { 103 103 psS32 byteSize; 104 104 105 if ( in== NULL) {106 return psVectorAlloc(n , type);107 } 108 109 if ( in->type.dimen != PS_DIMEN_VECTOR &&110 in->type.dimen != PS_DIMEN_TRANSV) {111 psFree( in);105 if (vector == NULL) { 106 return psVectorAlloc(nalloc, type); 107 } 108 109 if (vector->type.dimen != PS_DIMEN_VECTOR && 110 vector->type.dimen != PS_DIMEN_TRANSV) { 111 psFree(vector); 112 112 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 113 113 PS_ERRORTEXT_psVector_NOT_A_VECTOR); … … 115 115 } 116 116 117 byteSize = n * PSELEMTYPE_SIZEOF(type);117 byteSize = nalloc * PSELEMTYPE_SIZEOF(type); 118 118 119 119 // need to increase data buffer? 120 if (byteSize > in->nalloc*PSELEMTYPE_SIZEOF(in->type.type)) {121 in->data.U8 = psRealloc(in->data.U8, byteSize);122 *(int*)& in->nalloc = n;123 } 124 125 in->type.dimen = PS_DIMEN_VECTOR;126 in->type.type = type;127 in->n = n;128 return in;120 if (byteSize > vector->nalloc*PSELEMTYPE_SIZEOF(vector->type.type)) { 121 vector->data.U8 = psRealloc(vector->data.U8, byteSize); 122 *(int*)&vector->nalloc = nalloc; 123 } 124 125 vector->type.dimen = PS_DIMEN_VECTOR; 126 vector->type.type = type; 127 vector->n = nalloc; 128 return vector; 129 129 } 130 130 -
trunk/psLib/src/mathtypes/psVector.h
r4330 r4409 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.3 6$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-06-2 1 03:01:37$13 * @version $Revision: 1.37 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-06-28 20:17:52 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 29 29 ///< Union of psVector data types. 30 30 typedef union { 31 psU8* U8; ///< Unsigned 8-bit integer data. 32 psU16* U16; ///< Unsigned 16-bit integer data. 33 psU32* U32; ///< Unsigned 32-bit integer data. 34 psU64* U64; ///< Unsigned 64-bit integer data. 35 psS8* S8; ///< Signed 8-bit integer data. 36 psS16* S16; ///< Signed 16-bit integer data. 37 psS32* S32; ///< Signed 32-bit integer data. 38 psS64* S64; ///< Signed 64-bit integer data. 39 psF32* F32; ///< Single-precision float data. 40 psF64* F64; ///< Double-precision float data. 41 psC32* C32; ///< Single-precision complex data. 42 psC64* C64; ///< Double-precision complex data. 43 } p_psVectorData; 31 psU8* U8; ///< Unsigned 8-bit integer data. 32 psU16* U16; ///< Unsigned 16-bit integer data. 33 psU32* U32; ///< Unsigned 32-bit integer data. 34 psU64* U64; ///< Unsigned 64-bit integer data. 35 psS8* S8; ///< Signed 8-bit integer data. 36 psS16* S16; ///< Signed 16-bit integer data. 37 psS32* S32; ///< Signed 32-bit integer data. 38 psS64* S64; ///< Signed 64-bit integer data. 39 psF32* F32; ///< Single-precision float data. 40 psF64* F64; ///< Double-precision float data. 41 psC32* C32; ///< Single-precision complex data. 42 psC64* C64; ///< Double-precision complex data. 43 } 44 p_psVectorData; 44 45 45 46 /** An vector to support primitive types. … … 50 51 typedef struct 51 52 { 52 psType type; ///< Type of data.53 int n; ///< Number of elements in use.54 const int nalloc; ///< Total number of elements available.55 p_psVectorData data; ///< Union for data types.53 psType type; ///< Type of data. 54 int n; ///< Number of elements in use. 55 const int nalloc; ///< Total number of elements available. 56 p_psVectorData data; ///< Union for data types. 56 57 } 57 58 psVector; … … 72 73 */ 73 74 psVector* psVectorAlloc( 74 psU32 nalloc,///< Total number of elements to make available.75 psElemType dataType///< Type of data to be held by vector.75 unsigned long nalloc, ///< Total number of elements to make available. 76 psElemType type ///< Type of data to be held by vector. 76 77 ); 77 78 … … 86 87 */ 87 88 psVector* psVectorRealloc( 88 psVector* psVec,///< Vector to reallocate.89 psU32 nalloc///< Total number of elements to make available.89 psVector* vector, ///< Vector to reallocate. 90 unsigned long nalloc ///< Total number of elements to make available. 90 91 ); 91 92 … … 115 116 */ 116 117 psVector* psVectorRecycle( 117 psVector* psVec,118 psVector* vector, 118 119 ///< Vector to recycle. If NULL, a new vector is created. No effort 119 120 ///< taken to preserve the values. 120 121 121 psU32 nalloc,///< Total number of elements to make available.122 unsigned long nalloc, ///< Total number of elements to make available. 122 123 psElemType type ///< the datatype of the returned vector 123 124 ); -
trunk/psLib/src/sys/psString.c
r3997 r4409 12 12 * @author Eric Van Alst, MHPCC 13 13 * 14 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-0 5-20 01:41:17$14 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-06-28 20:17:52 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 26 26 #include "psSysUtilsErrors.h" 27 27 28 char *psStringCopy(const char *str)28 psString psStringCopy(const char *string) 29 29 { 30 30 // Allocate memory using psAlloc function 31 31 // Copy input string to memory just allocated 32 32 // Return the copy 33 return strcpy(psAlloc(strlen(str ) + 1), str);33 return strcpy(psAlloc(strlen(string) + 1), string); 34 34 } 35 35 36 char *psStringNCopy(const char *str, psS32nChar)36 psString psStringNCopy(const char *string, int nChar) 37 37 { 38 38 char *returnValue = NULL; … … 49 49 // Copy input string to memory allocated up to nChar characters 50 50 // Return the copy 51 returnValue = strncpy(psAlloc((size_t) nChar + 1), str , (size_t) nChar);51 returnValue = strncpy(psAlloc((size_t) nChar + 1), string, (size_t) nChar); 52 52 53 53 // Ensure the last byte is NULL character -
trunk/psLib/src/sys/psString.h
r4162 r4409 13 13 * @author Eric Van Alst, MHPCC 14 14 * 15 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $16 * @date $Date: 2005-06- 08 23:40:45$15 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2005-06-28 20:17:52 $ 17 17 * 18 18 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 39 39 * plus one and copy the input string to the newly allocated memory. 40 40 * 41 * @return char*Copy of input string41 * @return psString: Copy of input string 42 42 * 43 43 */ 44 char *psStringCopy( 45 const char *str 46 /**< Input string of characters to copy */ 44 psString psStringCopy( 45 const char *string ///< Input string of characters to copy 47 46 ); 48 47 … … 57 56 * be set to NULL. 58 57 * 59 * @return char*Copy of input string58 * @return psString: Copy of input string 60 59 * 61 60 */ … … 63 62 /*@null@*/ 64 63 65 char *psStringNCopy( 66 const char *str, 67 /**< Input string of characters to copy */ 68 69 psS32 nChar 70 /**< Number of bytes to allocate for string copy */ 64 psString psStringNCopy( 65 const char *string, ///< Input string of characters to copy 66 int nChar ///< Number of bytes to allocate for string copy 71 67 ); 72 68 -
trunk/psLib/src/sys/psTrace.c
r4392 r4409 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.5 2$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-06-2 5 02:02:05$11 * @version $Revision: 1.53 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-06-28 20:17:52 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 57 57 58 58 static void componentFree(p_psComponent* comp); 59 static p_psComponent* componentAlloc(const char *name, psS32level);59 static p_psComponent* componentAlloc(const char *name, int level); 60 60 61 61 /***************************************************************************** 62 62 componentAlloc(): allocate memory for a new node, and initialize members. 63 63 *****************************************************************************/ 64 static p_psComponent* componentAlloc(const char *name, psS32level)64 static p_psComponent* componentAlloc(const char *name, int level) 65 65 { 66 66 p_psComponent* comp = psAlloc(sizeof(p_psComponent)); … … 245 245 *****************************************************************************/ 246 246 psBool psTraceSetLevel(const char *comp, // component of interest 247 psS32level) // desired trace level247 int level) // desired trace level 248 248 { 249 249 char *compName = NULL; … … 487 487 *****************************************************************************/ 488 488 void p_psTrace(const char *comp, // component being traced 489 psS32 level,// desired trace level490 ...) // arguments489 int level, // desired trace level 490 ...) // arguments 491 491 { 492 492 char *fmt = NULL; -
trunk/psLib/src/sys/psTrace.h
r4330 r4409 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.3 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-06-2 1 03:01:37$11 * @version $Revision: 1.34 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-06-28 20:17:52 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 60 60 61 61 #ifdef DOXYGEN 62 void psTrace(const char *facil, ///< facilty of interest 63 psS32 myLevel, ///< desired trace level 64 ...) ///< trace message arguments 65 ; 62 void psTrace( 63 const char *facil, ///< facilty of interest 64 int level, ///< desired trace level 65 ... ///< trace message arguments 66 ); 67 66 68 #else 67 69 /// Send a trace message 68 void p_psTrace(const char *facil, ///< facilty of interest 69 psS32 myLevel, ///< desired trace level 70 ...) ///< trace message arguments 71 ; 70 void p_psTrace( 71 const char *facil, ///< facilty of interest 72 psS32 myLevel, ///< desired trace level 73 ... ///< trace message arguments 74 ); 72 75 73 76 #ifndef SWIG … … 78 81 79 82 /// Set trace level 80 psBool psTraceSetLevel(const char *facil, ///< facilty of interest 81 psS32 level) ///< desired trace level 82 ; 83 psBool psTraceSetLevel( 84 const char *facil, ///< facilty of interest 85 int level ///< desired trace level 86 ); 83 87 84 88 /// Get the trace level … … 94 98 95 99 /// Set the destination of future trace messages. 96 void psTraceSetDestination(FILE * fp); 100 void psTraceSetDestination( 101 FILE * fp ///< 102 ); 97 103 98 104 /// Get the current destination for trace messages. -
trunk/psLib/src/sysUtils/psString.c
r3997 r4409 12 12 * @author Eric Van Alst, MHPCC 13 13 * 14 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-0 5-20 01:41:17$14 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-06-28 20:17:52 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 26 26 #include "psSysUtilsErrors.h" 27 27 28 char *psStringCopy(const char *str)28 psString psStringCopy(const char *string) 29 29 { 30 30 // Allocate memory using psAlloc function 31 31 // Copy input string to memory just allocated 32 32 // Return the copy 33 return strcpy(psAlloc(strlen(str ) + 1), str);33 return strcpy(psAlloc(strlen(string) + 1), string); 34 34 } 35 35 36 char *psStringNCopy(const char *str, psS32nChar)36 psString psStringNCopy(const char *string, int nChar) 37 37 { 38 38 char *returnValue = NULL; … … 49 49 // Copy input string to memory allocated up to nChar characters 50 50 // Return the copy 51 returnValue = strncpy(psAlloc((size_t) nChar + 1), str , (size_t) nChar);51 returnValue = strncpy(psAlloc((size_t) nChar + 1), string, (size_t) nChar); 52 52 53 53 // Ensure the last byte is NULL character -
trunk/psLib/src/sysUtils/psString.h
r4162 r4409 13 13 * @author Eric Van Alst, MHPCC 14 14 * 15 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $16 * @date $Date: 2005-06- 08 23:40:45$15 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2005-06-28 20:17:52 $ 17 17 * 18 18 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 39 39 * plus one and copy the input string to the newly allocated memory. 40 40 * 41 * @return char*Copy of input string41 * @return psString: Copy of input string 42 42 * 43 43 */ 44 char *psStringCopy( 45 const char *str 46 /**< Input string of characters to copy */ 44 psString psStringCopy( 45 const char *string ///< Input string of characters to copy 47 46 ); 48 47 … … 57 56 * be set to NULL. 58 57 * 59 * @return char*Copy of input string58 * @return psString: Copy of input string 60 59 * 61 60 */ … … 63 62 /*@null@*/ 64 63 65 char *psStringNCopy( 66 const char *str, 67 /**< Input string of characters to copy */ 68 69 psS32 nChar 70 /**< Number of bytes to allocate for string copy */ 64 psString psStringNCopy( 65 const char *string, ///< Input string of characters to copy 66 int nChar ///< Number of bytes to allocate for string copy 71 67 ); 72 68 -
trunk/psLib/src/sysUtils/psTrace.c
r4392 r4409 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.5 2$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-06-2 5 02:02:05$11 * @version $Revision: 1.53 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-06-28 20:17:52 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 57 57 58 58 static void componentFree(p_psComponent* comp); 59 static p_psComponent* componentAlloc(const char *name, psS32level);59 static p_psComponent* componentAlloc(const char *name, int level); 60 60 61 61 /***************************************************************************** 62 62 componentAlloc(): allocate memory for a new node, and initialize members. 63 63 *****************************************************************************/ 64 static p_psComponent* componentAlloc(const char *name, psS32level)64 static p_psComponent* componentAlloc(const char *name, int level) 65 65 { 66 66 p_psComponent* comp = psAlloc(sizeof(p_psComponent)); … … 245 245 *****************************************************************************/ 246 246 psBool psTraceSetLevel(const char *comp, // component of interest 247 psS32level) // desired trace level247 int level) // desired trace level 248 248 { 249 249 char *compName = NULL; … … 487 487 *****************************************************************************/ 488 488 void p_psTrace(const char *comp, // component being traced 489 psS32 level,// desired trace level490 ...) // arguments489 int level, // desired trace level 490 ...) // arguments 491 491 { 492 492 char *fmt = NULL; -
trunk/psLib/src/sysUtils/psTrace.h
r4330 r4409 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.3 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-06-2 1 03:01:37$11 * @version $Revision: 1.34 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-06-28 20:17:52 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 60 60 61 61 #ifdef DOXYGEN 62 void psTrace(const char *facil, ///< facilty of interest 63 psS32 myLevel, ///< desired trace level 64 ...) ///< trace message arguments 65 ; 62 void psTrace( 63 const char *facil, ///< facilty of interest 64 int level, ///< desired trace level 65 ... ///< trace message arguments 66 ); 67 66 68 #else 67 69 /// Send a trace message 68 void p_psTrace(const char *facil, ///< facilty of interest 69 psS32 myLevel, ///< desired trace level 70 ...) ///< trace message arguments 71 ; 70 void p_psTrace( 71 const char *facil, ///< facilty of interest 72 psS32 myLevel, ///< desired trace level 73 ... ///< trace message arguments 74 ); 72 75 73 76 #ifndef SWIG … … 78 81 79 82 /// Set trace level 80 psBool psTraceSetLevel(const char *facil, ///< facilty of interest 81 psS32 level) ///< desired trace level 82 ; 83 psBool psTraceSetLevel( 84 const char *facil, ///< facilty of interest 85 int level ///< desired trace level 86 ); 83 87 84 88 /// Get the trace level … … 94 98 95 99 /// Set the destination of future trace messages. 96 void psTraceSetDestination(FILE * fp); 100 void psTraceSetDestination( 101 FILE * fp ///< 102 ); 97 103 98 104 /// Get the current destination for trace messages. -
trunk/psLib/src/types/psMetadataConfig.c
r4401 r4409 10 10 * @author Eric Van Alst, MHPCC 11 11 * 12 * @version $Revision: 1.3 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-06-2 7 20:38:12 $12 * @version $Revision: 1.33 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-06-28 20:17:52 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1075 1075 } 1076 1076 1077 psMetadata* psMetadataConfigParse(psMetadata* md, int *nFail, const char *fileName, bool overwrite)1077 psMetadata* psMetadataConfigParse(psMetadata* md, unsigned int *nFail, const char *fileName, bool overwrite) 1078 1078 { 1079 1079 FILE* fp = NULL; -
trunk/psLib/src/types/psMetadataConfig.h
r4401 r4409 10 10 * @author Robert DeSonia, MHPCC 11 11 * 12 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-06-2 7 20:38:12 $12 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-06-28 20:17:52 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 81 81 psMetadata* psMetadataConfigParse( 82 82 psMetadata* md, ///< Resulting metadata from read. 83 int *nFail,///< Number of failed lines.83 unsigned int *nFail, ///< Number of failed lines. 84 84 const char *fileName, ///< Name of file to read. 85 85 bool overwrite ///< Allow overwrite of duplicate specifications. -
trunk/psLib/src/xml/psXML.c
r4401 r4409 10 10 * @author Eric Van Alst, MHPCC 11 11 * 12 * @version $Revision: 1.3 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-06-2 7 20:38:12 $12 * @version $Revision: 1.33 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-06-28 20:17:52 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1075 1075 } 1076 1076 1077 psMetadata* psMetadataConfigParse(psMetadata* md, int *nFail, const char *fileName, bool overwrite)1077 psMetadata* psMetadataConfigParse(psMetadata* md, unsigned int *nFail, const char *fileName, bool overwrite) 1078 1078 { 1079 1079 FILE* fp = NULL; -
trunk/psLib/src/xml/psXML.h
r4401 r4409 10 10 * @author Robert DeSonia, MHPCC 11 11 * 12 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-06-2 7 20:38:12 $12 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-06-28 20:17:52 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 81 81 psMetadata* psMetadataConfigParse( 82 82 psMetadata* md, ///< Resulting metadata from read. 83 int *nFail,///< Number of failed lines.83 unsigned int *nFail, ///< Number of failed lines. 84 84 const char *fileName, ///< Name of file to read. 85 85 bool overwrite ///< Allow overwrite of duplicate specifications. -
trunk/psLib/test/astronomy/verified/tst_psTime_01.stderr
r4059 r4409 169 169 Following should generate error message for NULL ISO string 170 170 <DATE><TIME>|<HOST>|E|psTimeFromISO (FILE:LINENO) 171 Unallowable operation: timeis NULL.171 Unallowable operation: input is NULL. 172 172 <DATE><TIME>|<HOST>|I|testTimeFromISO 173 173 Following should generate an error for invalid ISO string … … 186 186 Following should generate error message for NULL timeval 187 187 <DATE><TIME>|<HOST>|E|psTimeFromTimeval (FILE:LINENO) 188 Unallowable operation: timeis NULL.188 Unallowable operation: input is NULL. 189 189 190 190 ---> TESTPOINT PASSED (psTime{psTimeFromTimeval} | tst_psTime_01.c) -
trunk/psLib/test/dataManip/verified/tst_psHist02.stderr
r3127 r4409 6 6 Following should generate an error message. 7 7 <DATE><TIME>|<HOST>|E|psVectorHistogram (FILE:LINENO) 8 Unallowable operation: psVector inor its data is NULL.8 Unallowable operation: psVector values or its data is NULL.
Note:
See TracChangeset
for help on using the changeset viewer.
