Changeset 2204
- Timestamp:
- Oct 26, 2004, 2:57:34 PM (22 years ago)
- Location:
- trunk/psLib
- Files:
-
- 217 edited
-
src/astro/psCoord.c (modified) (3 diffs)
-
src/astro/psCoord.h (modified) (3 diffs)
-
src/astro/psTime.c (modified) (24 diffs)
-
src/astro/psTime.h (modified) (2 diffs)
-
src/astronomy/psAstrometry.c (modified) (18 diffs)
-
src/astronomy/psAstrometry.h (modified) (8 diffs)
-
src/astronomy/psCoord.c (modified) (3 diffs)
-
src/astronomy/psCoord.h (modified) (3 diffs)
-
src/astronomy/psMetadata.c (modified) (11 diffs)
-
src/astronomy/psMetadata.h (modified) (10 diffs)
-
src/astronomy/psMetadataIO.c (modified) (12 diffs)
-
src/astronomy/psMetadataIO.h (modified) (3 diffs)
-
src/astronomy/psPhotometry.h (modified) (2 diffs)
-
src/astronomy/psTime.c (modified) (24 diffs)
-
src/astronomy/psTime.h (modified) (2 diffs)
-
src/collections/psArray.c (modified) (9 diffs)
-
src/collections/psArray.h (modified) (6 diffs)
-
src/collections/psBitSet.c (modified) (10 diffs)
-
src/collections/psBitSet.h (modified) (7 diffs)
-
src/collections/psCompare.c (modified) (1 diff)
-
src/collections/psCompare.h (modified) (1 diff)
-
src/collections/psHash.c (modified) (13 diffs)
-
src/collections/psHash.h (modified) (5 diffs)
-
src/collections/psList.c (modified) (16 diffs)
-
src/collections/psList.h (modified) (11 diffs)
-
src/collections/psMetadata.c (modified) (11 diffs)
-
src/collections/psMetadata.h (modified) (10 diffs)
-
src/collections/psMetadataIO.c (modified) (12 diffs)
-
src/collections/psMetadataIO.h (modified) (3 diffs)
-
src/collections/psVector.c (modified) (9 diffs)
-
src/collections/psVector.h (modified) (6 diffs)
-
src/dataManip/psConstants.h (modified) (8 diffs)
-
src/dataManip/psFunctions.c (modified) (57 diffs)
-
src/dataManip/psFunctions.h (modified) (22 diffs)
-
src/dataManip/psMatrix.c (modified) (10 diffs)
-
src/dataManip/psMatrixVectorArithmetic.c (modified) (13 diffs)
-
src/dataManip/psMatrixVectorArithmetic.h (modified) (3 diffs)
-
src/dataManip/psMinimize.c (modified) (21 diffs)
-
src/dataManip/psMinimize.h (modified) (5 diffs)
-
src/dataManip/psStats.c (modified) (28 diffs)
-
src/dataManip/psStats.h (modified) (6 diffs)
-
src/dataManip/psVectorFFT.c (modified) (18 diffs)
-
src/fft/psImageFFT.c (modified) (18 diffs)
-
src/fft/psVectorFFT.c (modified) (18 diffs)
-
src/image/psImage.c (modified) (24 diffs)
-
src/image/psImage.h (modified) (11 diffs)
-
src/image/psImageConvolve.c (modified) (17 diffs)
-
src/image/psImageConvolve.h (modified) (6 diffs)
-
src/image/psImageExtraction.c (modified) (30 diffs)
-
src/image/psImageExtraction.h (modified) (6 diffs)
-
src/image/psImageFFT.c (modified) (18 diffs)
-
src/image/psImageIO.c (modified) (5 diffs)
-
src/image/psImageIO.h (modified) (6 diffs)
-
src/image/psImageManip.c (modified) (28 diffs)
-
src/image/psImageManip.h (modified) (8 diffs)
-
src/image/psImageStats.c (modified) (9 diffs)
-
src/image/psImageStats.h (modified) (3 diffs)
-
src/imageops/psImageConvolve.c (modified) (17 diffs)
-
src/imageops/psImageConvolve.h (modified) (6 diffs)
-
src/imageops/psImageStats.c (modified) (9 diffs)
-
src/imageops/psImageStats.h (modified) (3 diffs)
-
src/math/psCompare.c (modified) (1 diff)
-
src/math/psCompare.h (modified) (1 diff)
-
src/math/psConstants.h (modified) (8 diffs)
-
src/math/psMatrix.c (modified) (10 diffs)
-
src/math/psMinimize.c (modified) (21 diffs)
-
src/math/psMinimize.h (modified) (5 diffs)
-
src/math/psPolynomial.c (modified) (57 diffs)
-
src/math/psPolynomial.h (modified) (22 diffs)
-
src/math/psSpline.c (modified) (57 diffs)
-
src/math/psSpline.h (modified) (22 diffs)
-
src/math/psStats.c (modified) (28 diffs)
-
src/math/psStats.h (modified) (6 diffs)
-
src/mathtypes/psImage.c (modified) (24 diffs)
-
src/mathtypes/psImage.h (modified) (11 diffs)
-
src/mathtypes/psVector.c (modified) (9 diffs)
-
src/mathtypes/psVector.h (modified) (6 diffs)
-
src/sys/psError.c (modified) (6 diffs)
-
src/sys/psError.h (modified) (3 diffs)
-
src/sys/psErrorCodes.c (modified) (7 diffs)
-
src/sys/psErrorCodes.h (modified) (3 diffs)
-
src/sys/psLogMsg.c (modified) (10 diffs)
-
src/sys/psLogMsg.h (modified) (6 diffs)
-
src/sys/psMemory.c (modified) (28 diffs)
-
src/sys/psMemory.h (modified) (19 diffs)
-
src/sys/psString.c (modified) (2 diffs)
-
src/sys/psString.h (modified) (3 diffs)
-
src/sys/psTrace.c (modified) (14 diffs)
-
src/sys/psTrace.h (modified) (4 diffs)
-
src/sys/psType.h (modified) (6 diffs)
-
src/sysUtils/psError.c (modified) (6 diffs)
-
src/sysUtils/psError.h (modified) (3 diffs)
-
src/sysUtils/psErrorCodes.c (modified) (7 diffs)
-
src/sysUtils/psErrorCodes.h (modified) (3 diffs)
-
src/sysUtils/psLogMsg.c (modified) (10 diffs)
-
src/sysUtils/psLogMsg.h (modified) (6 diffs)
-
src/sysUtils/psMemory.c (modified) (28 diffs)
-
src/sysUtils/psMemory.h (modified) (19 diffs)
-
src/sysUtils/psString.c (modified) (2 diffs)
-
src/sysUtils/psString.h (modified) (3 diffs)
-
src/sysUtils/psTrace.c (modified) (14 diffs)
-
src/sysUtils/psTrace.h (modified) (4 diffs)
-
src/sysUtils/psType.h (modified) (6 diffs)
-
src/types/psArray.c (modified) (9 diffs)
-
src/types/psArray.h (modified) (6 diffs)
-
src/types/psBitSet.c (modified) (10 diffs)
-
src/types/psBitSet.h (modified) (7 diffs)
-
src/types/psHash.c (modified) (13 diffs)
-
src/types/psHash.h (modified) (5 diffs)
-
src/types/psList.c (modified) (16 diffs)
-
src/types/psList.h (modified) (11 diffs)
-
src/types/psMetadata.c (modified) (11 diffs)
-
src/types/psMetadata.h (modified) (10 diffs)
-
src/types/psMetadataConfig.c (modified) (12 diffs)
-
src/types/psMetadataConfig.h (modified) (3 diffs)
-
src/xml/psXML.c (modified) (12 diffs)
-
src/xml/psXML.h (modified) (3 diffs)
-
test/FullUnitTest (modified) (2 diffs)
-
test/astronomy/tst_psAstrometry.c (modified) (13 diffs)
-
test/astronomy/tst_psAstrometry01.c (modified) (13 diffs)
-
test/astronomy/tst_psCoord.c (modified) (17 diffs)
-
test/astronomy/tst_psMetadataIO.c (modified) (7 diffs)
-
test/astronomy/tst_psMetadata_01.c (modified) (4 diffs)
-
test/astronomy/tst_psMetadata_02.c (modified) (3 diffs)
-
test/astronomy/tst_psMetadata_03.c (modified) (3 diffs)
-
test/astronomy/tst_psMetadata_04.c (modified) (3 diffs)
-
test/astronomy/tst_psMetadata_05.c (modified) (3 diffs)
-
test/astronomy/tst_psMetadata_06.c (modified) (3 diffs)
-
test/astronomy/tst_psTime_01.c (modified) (12 diffs)
-
test/astronomy/tst_psTime_02.c (modified) (3 diffs)
-
test/astronomy/tst_psTime_03.c (modified) (3 diffs)
-
test/collections/tst_psArray.c (modified) (9 diffs)
-
test/collections/tst_psBitSet.c (modified) (23 diffs)
-
test/collections/tst_psHash00.c (modified) (1 diff)
-
test/collections/tst_psHash01.c (modified) (2 diffs)
-
test/collections/tst_psHash02.c (modified) (3 diffs)
-
test/collections/tst_psHash03.c (modified) (5 diffs)
-
test/collections/tst_psHash04.c (modified) (2 diffs)
-
test/collections/tst_psList.c (modified) (49 diffs)
-
test/collections/tst_psMetadataIO.c (modified) (7 diffs)
-
test/collections/tst_psMetadata_01.c (modified) (4 diffs)
-
test/collections/tst_psMetadata_02.c (modified) (3 diffs)
-
test/collections/tst_psMetadata_03.c (modified) (3 diffs)
-
test/collections/tst_psMetadata_04.c (modified) (3 diffs)
-
test/collections/tst_psMetadata_05.c (modified) (3 diffs)
-
test/collections/tst_psMetadata_06.c (modified) (3 diffs)
-
test/collections/tst_psVector.c (modified) (6 diffs)
-
test/collections/tst_psVectorSort_01.c (modified) (6 diffs)
-
test/collections/tst_psVectorSort_02.c (modified) (5 diffs)
-
test/collections/tst_psVectorSort_03.c (modified) (5 diffs)
-
test/collections/tst_psVectorSort_04.c (modified) (3 diffs)
-
test/dataManip/tst_psFunc00.c (modified) (2 diffs)
-
test/dataManip/tst_psFunc01.c (modified) (2 diffs)
-
test/dataManip/tst_psFunc02.c (modified) (1 diff)
-
test/dataManip/tst_psFunc03.c (modified) (1 diff)
-
test/dataManip/tst_psFunc04.c (modified) (3 diffs)
-
test/dataManip/tst_psFunc05.c (modified) (1 diff)
-
test/dataManip/tst_psFunc07.c (modified) (3 diffs)
-
test/dataManip/tst_psHist00.c (modified) (1 diff)
-
test/dataManip/tst_psHist01.c (modified) (1 diff)
-
test/dataManip/tst_psHist02.c (modified) (2 diffs)
-
test/dataManip/tst_psHist03.c (modified) (1 diff)
-
test/dataManip/tst_psMatrix01.c (modified) (4 diffs)
-
test/dataManip/tst_psMatrix02.c (modified) (2 diffs)
-
test/dataManip/tst_psMatrix03.c (modified) (4 diffs)
-
test/dataManip/tst_psMatrix04.c (modified) (4 diffs)
-
test/dataManip/tst_psMatrix05.c (modified) (4 diffs)
-
test/dataManip/tst_psMatrix06.c (modified) (4 diffs)
-
test/dataManip/tst_psMatrix07.c (modified) (4 diffs)
-
test/dataManip/tst_psMatrixVectorArithmetic01.c (modified) (8 diffs)
-
test/dataManip/tst_psMatrixVectorArithmetic02.c (modified) (9 diffs)
-
test/dataManip/tst_psMatrixVectorArithmetic03.c (modified) (6 diffs)
-
test/dataManip/tst_psMinimize00.c (modified) (3 diffs)
-
test/dataManip/tst_psMinimize01.c (modified) (3 diffs)
-
test/dataManip/tst_psMinimize02.c (modified) (3 diffs)
-
test/dataManip/tst_psMinimize03.c (modified) (3 diffs)
-
test/dataManip/tst_psMinimize04.c (modified) (6 diffs)
-
test/dataManip/tst_psMinimize04_F32.c (modified) (6 diffs)
-
test/dataManip/tst_psMinimize04b.c (modified) (6 diffs)
-
test/dataManip/tst_psMinimize04b_F32.c (modified) (6 diffs)
-
test/dataManip/tst_psMinimize05.c (modified) (9 diffs)
-
test/dataManip/tst_psMinimize06.c (modified) (5 diffs)
-
test/dataManip/tst_psStats00.c (modified) (2 diffs)
-
test/dataManip/tst_psStats01.c (modified) (2 diffs)
-
test/dataManip/tst_psStats02.c (modified) (2 diffs)
-
test/dataManip/tst_psStats03.c (modified) (2 diffs)
-
test/dataManip/tst_psStats04.c (modified) (1 diff)
-
test/dataManip/tst_psStats05.c (modified) (1 diff)
-
test/dataManip/tst_psStats06.c (modified) (2 diffs)
-
test/dataManip/tst_psStats07.c (modified) (7 diffs)
-
test/dataManip/tst_psStats08.c (modified) (2 diffs)
-
test/dataManip/tst_psStats09.c (modified) (2 diffs)
-
test/dataManip/tst_psVectorFFT.c (modified) (19 diffs)
-
test/image/tst_psImage.c (modified) (15 diffs)
-
test/image/tst_psImageConvolve.c (modified) (15 diffs)
-
test/image/tst_psImageExtraction.c (modified) (23 diffs)
-
test/image/tst_psImageFFT.c (modified) (15 diffs)
-
test/image/tst_psImageIO.c (modified) (8 diffs)
-
test/image/tst_psImageManip.c (modified) (46 diffs)
-
test/image/tst_psImageStats00.c (modified) (2 diffs)
-
test/image/tst_psImageStats01.c (modified) (2 diffs)
-
test/image/tst_psImageStats02.c (modified) (2 diffs)
-
test/image/tst_psImageStats03.c (modified) (1 diff)
-
test/image/verified/fOut.fits (modified) ( previous)
-
test/image/verified/sOut.fits (modified) ( previous)
-
test/psTest.c (modified) (10 diffs)
-
test/psTest.h (modified) (6 diffs)
-
test/runTest (modified) (2 diffs)
-
test/sysUtils/tst_psAbort.c (modified) (6 diffs)
-
test/sysUtils/tst_psError.c (modified) (11 diffs)
-
test/sysUtils/tst_psLogMsg.c (modified) (9 diffs)
-
test/sysUtils/tst_psMemory.c (modified) (27 diffs)
-
test/sysUtils/tst_psString.c (modified) (12 diffs)
-
test/sysUtils/tst_psStringCopy.c (modified) (12 diffs)
-
test/sysUtils/tst_psTrace.c (modified) (11 diffs)
-
test/sysUtils/verified/tst_psTrace.stderr (modified) (2 diffs)
-
test/tst_template.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psCoord.c
r2200 r2204 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.2 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-10-2 6 22:32:09$12 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:30 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 67 67 } 68 68 69 psPlaneTransform* psPlaneTransformAlloc( int n1, intn2)69 psPlaneTransform* psPlaneTransformAlloc(psS32 n1, psS32 n2) 70 70 { 71 71 psPlaneTransform *pt = psAlloc(sizeof(psPlaneTransform)); … … 97 97 } 98 98 99 psPlaneDistort* psPlaneDistortAlloc( int n1, int n2, int n3, intn4)99 psPlaneDistort* psPlaneDistortAlloc(psS32 n1, psS32 n2, psS32 n3, psS32 n4) 100 100 { 101 101 psPlaneDistort *pt = psAlloc(sizeof(psPlaneDistort)); -
trunk/psLib/src/astro/psCoord.h
r2200 r2204 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-10-2 6 22:32:09$12 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:30 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 173 173 174 174 psPlaneTransform* psPlaneTransformAlloc( 175 intn1, ///< The order of the x term in the transform.176 intn2 ///< The order of the y term in the transform.175 psS32 n1, ///< The order of the x term in the transform. 176 psS32 n2 ///< The order of the y term in the transform. 177 177 ); 178 178 … … 193 193 194 194 psPlaneDistort* psPlaneDistortAlloc( 195 intn1, ///< The order of the w term in the transform.196 intn2, ///< The order of the x term in the transform.197 intn3, ///< The order of the y term in the transform.198 intn4 ///< The order of the z term in the transform.195 psS32 n1, ///< The order of the w term in the transform. 196 psS32 n2, ///< The order of the x term in the transform. 197 psS32 n3, ///< The order of the y term in the transform. 198 psS32 n4 ///< The order of the z term in the transform. 199 199 ); 200 200 -
trunk/psLib/src/astro/psTime.c
r2196 r2204 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.3 7$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-10-2 6 00:37:44$13 * @version $Revision: 1.38 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:30 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 144 144 static double lookupSer7Table( 145 145 const psTime *time, ///< time to lookup. 146 intcol ///< Column to lookup.146 psS32 col ///< Column to lookup. 147 147 ); 148 148 … … 150 150 { 151 151 char line[LINESIZE]; 152 intj = 0;153 intmaxLines = 100;152 psS32 j = 0; 153 psS32 maxLines = 100; 154 154 psF64 *ptr = NULL; 155 155 psImage *table = NULL; … … 180 180 } 181 181 182 *( unsigned int*)&table->numRows = j;182 *(psU32 *)&table->numRows = j; 183 183 184 184 p_psMemSetPersistent(table,true); … … 191 191 static psImage* readSer7File(const char *fileName) 192 192 { 193 bool beginRecord = false;193 psBool beginRecord = false; 194 194 char line[LINESIZE]; 195 intj = 0;196 intmaxLines = 400;195 psS32 j = 0; 196 psS32 maxLines = 400; 197 197 psImage *table = NULL; 198 198 FILE *fd = NULL; … … 231 231 } 232 232 } 233 *( unsigned int*)&table->numRows = j;233 *(psU32 *)&table->numRows = j; 234 234 235 235 p_psMemSetPersistent(table,true); … … 244 244 { 245 245 char line[LINESIZE]; 246 inti = 0;247 intj = 0;248 intmaxLines = 2500;246 psS32 i = 0; 247 psS32 j = 0; 248 psS32 maxLines = 2500; 249 249 psImage *table = NULL; 250 250 FILE *fd = NULL; … … 276 276 } 277 277 278 *( unsigned int*)&table->numRows = j;278 *(psU32 *)&table->numRows = j; 279 279 280 280 return table; … … 284 284 { 285 285 char line[LINESIZE]; 286 intj = 0;287 intmaxLines = 15000;286 psS32 j = 0; 287 psS32 maxLines = 15000; 288 288 psImage *table = NULL; 289 289 FILE *fd = NULL; … … 346 346 } 347 347 348 *( unsigned int*)&table->numRows = j;348 *(psU32 *)&table->numRows = j; 349 349 350 350 return table; … … 354 354 static double lookupTaiUtcTable(const psTime *time) 355 355 { 356 inthiIdx = 0;357 intloIdx = 0;358 intnumRows = 0;356 psS32 hiIdx = 0; 357 psS32 loIdx = 0; 358 psS32 numRows = 0; 359 359 double jd = 0.0; 360 360 double mjd = 0.0; … … 422 422 } 423 423 424 static double lookupSer7Table(const psTime *time, intcol)425 { 426 inthiIdx = 0;427 intloIdx = 0;428 intnumRows = 0;424 static double lookupSer7Table(const psTime *time, psS32 col) 425 { 426 psS32 hiIdx = 0; 427 psS32 loIdx = 0; 428 psS32 numRows = 0; 429 429 double out = 0.0; 430 430 double denom = 0.0; … … 752 752 } 753 753 754 longpsTimeLeapseconds(const psTime *time1, const psTime *time2)755 { 756 longdiff = 0;754 psS64 psTimeLeapseconds(const psTime *time1, const psTime *time2) 755 { 756 psS64 diff = 0; 757 757 758 758 … … 827 827 char* psTimeToISOTime(const psTime *time) 828 828 { 829 intms = 0;829 psS32 ms = 0; 830 830 char *timeString = NULL; 831 831 char *tempString = NULL; … … 889 889 struct tm* psTimeToTM(const psTime *time) 890 890 { 891 longcent = 0;892 longyear = 0;893 longmonth = 0;894 longday = 0;895 longhour = 0;896 longminute = 0;897 longseconds = 0;898 longtemp = 0;891 psS64 cent = 0; 892 psS64 year = 0; 893 psS64 month = 0; 894 psS64 day = 0; 895 psS64 hour = 0; 896 psS64 minute = 0; 897 psS64 seconds = 0; 898 psS64 temp = 0; 899 899 struct tm* tmTime = NULL; 900 900 … … 975 975 seconds = days * SEC_PER_DAY; 976 976 if(seconds < 0.0) { 977 outTime->usec = (seconds - ( long)seconds) * -1000000.0; // psTime earlier than epoch977 outTime->usec = (seconds - (psS64)seconds) * -1000000.0; // psTime earlier than epoch 978 978 } else { 979 outTime->usec = (seconds - ( long)seconds) * 1000000.0; // psTime greater than epoch979 outTime->usec = (seconds - (psS64)seconds) * 1000000.0; // psTime greater than epoch 980 980 } 981 981 outTime->sec = seconds; … … 1003 1003 seconds = days * SEC_PER_DAY; 1004 1004 if(seconds < 0.0) { 1005 outTime->usec = (seconds - ( long)seconds) * -1000000.0; // psTime earlier than epoch1005 outTime->usec = (seconds - (psS64)seconds) * -1000000.0; // psTime earlier than epoch 1006 1006 } else { 1007 outTime->usec = (seconds - ( long)seconds) * 1000000.0; // psTime greater than epoch1007 outTime->usec = (seconds - (psS64)seconds) * 1000000.0; // psTime greater than epoch 1008 1008 } 1009 1009 outTime->sec = seconds; … … 1020 1020 { 1021 1021 char tempString[MAX_TIME_STRING_LENGTH]; 1022 intmonth;1023 intday;1024 intyear;1025 inthour;1026 intminute;1027 intsecond;1028 intmillisecond;1022 psS32 month; 1023 psS32 day; 1024 psS32 year; 1025 psS32 hour; 1026 psS32 minute; 1027 psS32 second; 1028 psS32 millisecond; 1029 1029 struct tm tmTime; 1030 1030 psTime *outTime = NULL; … … 1127 1127 psTime* psTimeFromTM(const struct tm* time) 1128 1128 { 1129 longyear;1130 longmonth;1131 longday;1132 longhour;1133 longminute;1134 longseconds;1135 longtemp;1129 psS64 year; 1130 psS64 month; 1131 psS64 day; 1132 psS64 hour; 1133 psS64 minute; 1134 psS64 seconds; 1135 psS64 temp; 1136 1136 psTime *outTime = NULL; 1137 1137 … … 1194 1194 { 1195 1195 psF64 deltaSec = 0; 1196 longdeltaUsec = 0;1196 psS64 deltaUsec = 0; 1197 1197 psTime *outTime = NULL; 1198 1198 … … 1243 1243 { 1244 1244 psS64 deltaSec = 0; 1245 longdeltaUsec = 0;1245 psS64 deltaUsec = 0; 1246 1246 psTime *outTime = NULL; 1247 1247 … … 1267 1267 outTime = psTimeAlloc(tai1->type); 1268 1268 deltaSec = tai1->sec - tai2->sec; 1269 deltaUsec = ( long)tai1->usec - (long)tai2->usec;1269 deltaUsec = (psS64)tai1->usec - (psS64)tai2->usec; 1270 1270 1271 1271 // Adjust time in case of microsecond underflow after subtraction … … 1289 1289 { 1290 1290 psS64 deltaSec = 0; 1291 longdeltaUsec = 0;1291 psS64 deltaUsec = 0; 1292 1292 psTime *outTime = NULL; 1293 1293 … … 1313 1313 outTime = psTimeAlloc(tai1->type); 1314 1314 deltaSec = tai1->sec - tai2->sec; 1315 deltaUsec = ( long)tai1->usec - (long)tai2->usec;1315 deltaUsec = (psS64)tai1->usec - (psS64)tai2->usec; 1316 1316 1317 1317 // Adjust time in case of microsecond underflow after subtraction -
trunk/psLib/src/astro/psTime.h
r2179 r2204 54 54 * @author Ross Harman, MHPCC 55 55 * 56 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $57 * @date $Date: 2004-10-2 0 20:05:58$56 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 57 * @date $Date: 2004-10-27 00:57:30 $ 58 58 * 59 59 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 181 181 * @return long: leapseconds added between given times 182 182 */ 183 longpsTimeLeapseconds(183 psS64 psTimeLeapseconds( 184 184 const psTime* time1, ///< First input time. 185 185 const psTime* time2 ///< Second input time. -
trunk/psLib/src/astronomy/psAstrometry.c
r2137 r2204 8 8 * @author George Gusciora, MHPCC 9 9 * 10 * @version $Revision: 1.4 2$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-10- 14 23:45:53$10 * @version $Revision: 1.43 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-10-27 00:57:30 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 33 33 psImage. 34 34 *****************************************************************************/ 35 static intcheckValidImageCoords(double x,36 double y,37 psImage* tmpImage)35 static psS32 checkValidImageCoords(double x, 36 double y, 37 psImage* tmpImage) 38 38 { 39 39 if (tmpImage == NULL) { … … 56 56 cooefficients of order 2 are higher are non-zero, then it is not linear. 57 57 *****************************************************************************/ 58 static intisProjectionLinear(psPlaneTransform *transform)59 { 60 inti = 0;58 static psS32 isProjectionLinear(psPlaneTransform *transform) 59 { 60 psS32 i = 0; 61 61 PS_CHECK_NULL_PTR_RETURN_ZERO(transform); 62 62 … … 178 178 { 179 179 if (obs != NULL) { 180 psFree(( void*)obs->name);180 psFree((psPtr)obs->name); 181 181 } 182 182 } … … 185 185 { 186 186 if (exp != NULL) { 187 psFree(( void*)exp->time);188 psFree(( void*)exp->observatory);189 psFree(( void*)exp->cameraName);190 psFree(( void*)exp->telescopeName);187 psFree((psPtr)exp->time); 188 psFree((psPtr)exp->observatory); 189 psFree((psPtr)exp->cameraName); 190 psFree((psPtr)exp->telescopeName); 191 191 } 192 192 } … … 195 195 { 196 196 if (fp != NULL) { 197 for ( inti = 0; i < fp->p_ps_xRows; i++) {197 for (psS32 i = 0; i < fp->p_ps_xRows; i++) { 198 198 psFree(fp->x[i]); 199 199 } 200 200 201 for ( intj = 0; j < fp->p_ps_yRows; j++) {201 for (psS32 j = 0; j < fp->p_ps_yRows; j++) { 202 202 psFree(fp->y[j]); 203 203 } … … 226 226 { 227 227 psFixedPattern *tmp; 228 inti;229 intj;228 psS32 i; 229 psS32 j; 230 230 231 231 PS_CHECK_NULL_IMAGE_RETURN_NULL(x); … … 301 301 *(float *)&exp->wavelength = wavelength; 302 302 303 exp->time = psMemIncrRefCounter(( void*)time);304 exp->observatory = psMemIncrRefCounter(( void*)observatory);303 exp->time = psMemIncrRefCounter((psPtr)time); 304 exp->observatory = psMemIncrRefCounter((psPtr)observatory); 305 305 306 306 // XXX: how is these value derived? … … 343 343 } 344 344 345 psFPA* psFPAAlloc( intnChips,345 psFPA* psFPAAlloc(psS32 nChips, 346 346 const psExposure* exp) 347 347 { … … 350 350 // create array of NULL chips of the size nChips 351 351 newFPA->chips = psArrayAlloc(nChips); 352 void** chips = newFPA->chips->data;353 for ( inti=0;i<nChips;i++) {352 psPtr* chips = newFPA->chips->data; 353 for (psS32 i=0;i<nChips;i++) { 354 354 chips[i] = NULL; 355 355 } … … 384 384 * psChip constructor 385 385 */ 386 psChip* psChipAlloc( intnCells,386 psChip* psChipAlloc(psS32 nCells, 387 387 psFPA *parentFPA) 388 388 { … … 391 391 // create array of NULL psCells 392 392 chip->cells = psArrayAlloc(nCells); 393 void** cells = chip->cells->data;394 for ( inti=0;i<nCells;i++) {393 psPtr* cells = chip->cells->data; 394 for (psS32 i=0;i<nCells;i++) { 395 395 cells[i] = NULL; 396 396 } … … 412 412 * psCell constructor 413 413 */ 414 psCell* psCellAlloc( intnReadouts,414 psCell* psCellAlloc(psS32 nReadouts, 415 415 psChip* parentChip) 416 416 { … … 419 419 // create array of NULL psReadouts 420 420 cell->readouts = psArrayAlloc(nReadouts); 421 void** readouts = cell->readouts->data;422 for ( inti=0;i<nReadouts;i++) {421 psPtr* readouts = cell->readouts->data; 422 for (psS32 i=0;i<nReadouts;i++) { 423 423 readouts[i] = NULL; 424 424 } … … 440 440 } 441 441 442 psReadout* psReadoutAlloc( intcol0,443 introw0,442 psReadout* psReadoutAlloc(psS32 col0, 443 psS32 row0, 444 444 const psImage* image) 445 445 { 446 446 psReadout* readout = psAlloc(sizeof(psReadout)); 447 447 448 *( unsigned int*)&readout->colBins = 1;449 *( unsigned int*)&readout->rowBins = 1;450 *( int*)&readout->col0 = col0;451 *( int*)&readout->row0 = row0;448 *(psU32*)&readout->colBins = 1; 449 *(psU32*)&readout->rowBins = 1; 450 *(psS32*)&readout->col0 = col0; 451 *(psS32*)&readout->row0 = row0; 452 452 453 453 readout->image = (psImage*)image; … … 521 521 PS_CHECK_NULL_PTR_RETURN_NULL(FPA->chips); 522 522 psArray* chips = FPA->chips; 523 intnChips = chips->n;523 psS32 nChips = chips->n; 524 524 psPlane chipCoord; 525 525 psCell *tmpCell = NULL; … … 529 529 // cells in that chip contain those chip coordinates. 530 530 531 for ( inti = 0; i < nChips; i++) {531 for (psS32 i = 0; i < nChips; i++) { 532 532 psChip* tmpChip = chips->data[i]; 533 533 psPlaneTransformApply(&chipCoord, tmpChip->fromFPA, fpaCoord); … … 560 560 // If so, then we return that cell. 561 561 562 for ( inti = 0; i < cells->n; i++) {562 for (psS32 i = 0; i < cells->n; i++) { 563 563 psCell* tmpCell = (psCell* ) cells->data[i]; 564 564 psArray* readouts = tmpCell->readouts; 565 565 566 566 if (readouts != NULL) { 567 for ( intj = 0; j < readouts->n; j++) {567 for (psS32 j = 0; j < readouts->n; j++) { 568 568 psReadout* tmpReadout = readouts->data[j]; 569 569 -
trunk/psLib/src/astronomy/psAstrometry.h
r2058 r2204 8 8 * @author George Gusciora, MHPCC 9 9 * 10 * @version $Revision: 1. 29$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-10- 12 20:53:02$10 * @version $Revision: 1.30 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-10-27 00:57:30 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 72 72 typedef struct 73 73 { 74 intnX; ///< Number of elements in x direction75 intnY; ///< Number of elements in y direction74 psS32 nX; ///< Number of elements in x direction 75 psS32 nY; ///< Number of elements in y direction 76 76 double x0; ///< X Position of 0,0 corner on focal plane 77 77 double y0; ///< Y Position of 0,0 corner on focal plane … … 79 79 double yScale; ///< Scale of the grid in x direction 80 80 /// XXX: I added the following memvers to facilitate the psFreeing of the x,y data structures. 81 intp_ps_xRows; ///< Number of rows in the x member82 intp_ps_xCols; ///< Number of cols in the x member83 intp_ps_yRows; ///< Number of rows in the y member84 intp_ps_yCols; ///< Number of cols in the y member81 psS32 p_ps_xRows; ///< Number of rows in the x member 82 psS32 p_ps_xCols; ///< Number of cols in the x member 83 psS32 p_ps_yRows; ///< Number of rows in the y member 84 psS32 p_ps_yCols; ///< Number of cols in the y member 85 85 double **x; ///< The grid of offsets in x 86 86 double **y; ///< The grid of offsets in y … … 99 99 typedef struct 100 100 { 101 const unsigned intcolBins; ///< Amount of binning in x-dimension102 const unsigned introwBins; ///< Amount of binning in y-dimension103 const intcol0; ///< Offset from the left of chip.104 const introw0; ///< Offset from the bottom of chip.101 const psU32 colBins; ///< Amount of binning in x-dimension 102 const psU32 rowBins; ///< Amount of binning in y-dimension 103 const psS32 col0; ///< Offset from the left of chip. 104 const psS32 row0; ///< Offset from the bottom of chip. 105 105 106 106 psImage* image; ///< Imaging area of readout … … 304 304 */ 305 305 psFPA* psFPAAlloc( 306 intnChips, ///< number of chips in the FPA306 psS32 nChips, ///< number of chips in the FPA 307 307 const psExposure* exp ///< the exposure information 308 308 ); … … 317 317 */ 318 318 psChip* psChipAlloc( 319 intnCells, ///< number of cells in Chip319 psS32 nCells, ///< number of cells in Chip 320 320 psFPA* parentFPA ///< parent FPA 321 321 ); … … 330 330 */ 331 331 psCell* psCellAlloc( 332 intnReadouts, ///< number of readouts in cell332 psS32 nReadouts, ///< number of readouts in cell 333 333 psChip* parentChip ///< parent Chip 334 334 ); … … 342 342 */ 343 343 psReadout* psReadoutAlloc( 344 intcol0, ///< offset from the left of the cell345 introw0, ///< offset from the bottom of the cell344 psS32 col0, ///< offset from the left of the cell 345 psS32 row0, ///< offset from the bottom of the cell 346 346 const psImage* image ///< image of the readout 347 347 ); -
trunk/psLib/src/astronomy/psCoord.c
r2200 r2204 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.2 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-10-2 6 22:32:09$12 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:30 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 67 67 } 68 68 69 psPlaneTransform* psPlaneTransformAlloc( int n1, intn2)69 psPlaneTransform* psPlaneTransformAlloc(psS32 n1, psS32 n2) 70 70 { 71 71 psPlaneTransform *pt = psAlloc(sizeof(psPlaneTransform)); … … 97 97 } 98 98 99 psPlaneDistort* psPlaneDistortAlloc( int n1, int n2, int n3, intn4)99 psPlaneDistort* psPlaneDistortAlloc(psS32 n1, psS32 n2, psS32 n3, psS32 n4) 100 100 { 101 101 psPlaneDistort *pt = psAlloc(sizeof(psPlaneDistort)); -
trunk/psLib/src/astronomy/psCoord.h
r2200 r2204 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-10-2 6 22:32:09$12 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:30 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 173 173 174 174 psPlaneTransform* psPlaneTransformAlloc( 175 intn1, ///< The order of the x term in the transform.176 intn2 ///< The order of the y term in the transform.175 psS32 n1, ///< The order of the x term in the transform. 176 psS32 n2 ///< The order of the y term in the transform. 177 177 ); 178 178 … … 193 193 194 194 psPlaneDistort* psPlaneDistortAlloc( 195 intn1, ///< The order of the w term in the transform.196 intn2, ///< The order of the x term in the transform.197 intn3, ///< The order of the y term in the transform.198 intn4 ///< The order of the z term in the transform.195 psS32 n1, ///< The order of the w term in the transform. 196 psS32 n2, ///< The order of the x term in the transform. 197 psS32 n3, ///< The order of the y term in the transform. 198 psS32 n4 ///< The order of the z term in the transform. 199 199 ); 200 200 -
trunk/psLib/src/astronomy/psMetadata.c
r2040 r2204 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.3 4$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-10- 09 03:05:53$14 * @version $Revision: 1.35 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-10-27 00:57:30 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 59 59 /*****************************************************************************/ 60 60 61 static intmetadataId = 0;61 static psS32 metadataId = 0; 62 62 63 63 /*****************************************************************************/ … … 143 143 144 144 // Set metadata item unique id 145 *( int*)(&metadataItem->id) = ++metadataId;145 *(psS32 *)(&metadataItem->id) = ++metadataId; 146 146 147 147 // Set metadata item type … … 154 154 break; 155 155 case PS_META_BOOL: 156 metadataItem->data.B = ( bool)va_arg(argPtr, int);156 metadataItem->data.B = (psBool)va_arg(argPtr, psS32); 157 157 break; 158 158 case PS_META_S32: … … 215 215 } 216 216 217 bool psMetadataAddItem( psMetadata *restrict md, psMetadataItem *restrict metadataItem, intlocation )217 psBool psMetadataAddItem( psMetadata *restrict md, psMetadataItem *restrict metadataItem, psS32 location ) 218 218 { 219 219 char * key = NULL; … … 337 337 } 338 338 339 bool psMetadataAdd(psMetadata* restrict md, intwhere, const char *name, psMetadataType type,340 const char *comment, ...)339 psBool psMetadataAdd(psMetadata* restrict md, psS32 where, const char *name, psMetadataType type, 340 const char *comment, ...) 341 341 { 342 342 va_list argPtr; … … 359 359 } 360 360 361 bool psMetadataRemove(psMetadata* restrict md, intwhere, const char *restrict key)362 { 363 intnumChildren = 0;361 psBool psMetadataRemove(psMetadata* restrict md, psS32 where, const char *restrict key) 362 { 363 psS32 numChildren = 0; 364 364 psList* mdList = NULL; 365 365 psHash* mdTable = NULL; … … 471 471 } 472 472 473 psMetadataItem* psMetadataGet(psMetadata* restrict md, intwhere)473 psMetadataItem* psMetadataGet(psMetadata* restrict md, psS32 where) 474 474 { 475 475 psList* mdList = NULL; … … 497 497 } 498 498 499 bool psMetadataSetIterator(psMetadata* restrict md, intwhere)499 psBool psMetadataSetIterator(psMetadata* restrict md, psS32 where) 500 500 { 501 501 psList* mdList = NULL; … … 517 517 } 518 518 519 psMetadataItem* psMetadataGetNext(psMetadata* restrict md, const char *restrict match, intwhich)519 psMetadataItem* psMetadataGetNext(psMetadata* restrict md, const char *restrict match, psS32 which) 520 520 { 521 521 psList* mdList = NULL; … … 553 553 } 554 554 555 psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, intwhich)555 psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, psS32 which) 556 556 { 557 557 psList* mdList = NULL; -
trunk/psLib/src/astronomy/psMetadata.h
r1970 r2204 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.2 3$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-10- 06 01:06:27$13 * @version $Revision: 1.24 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:30 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 38 38 PS_META_F32, ///< Single-precision float data. 39 39 PS_META_F64, ///< Double-precision float data. 40 PS_META_STR, ///< String data (Stored in as void *).41 PS_META_VEC, ///< Vector data (Stored in as void *).42 PS_META_IMG, ///< Image data (Stored in as void *).43 PS_META_JPEG, ///< JPEG data (Stored in as void *).44 PS_META_PNG, ///< PNG data (Stored in as void *).45 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as void *).46 PS_META_UNKNOWN, ///< Other data (Stored in as void *).40 PS_META_STR, ///< String data (Stored in as psPtr ). 41 PS_META_VEC, ///< Vector data (Stored in as psPtr ). 42 PS_META_IMG, ///< Image data (Stored in as psPtr ). 43 PS_META_JPEG, ///< JPEG data (Stored in as psPtr ). 44 PS_META_PNG, ///< PNG data (Stored in as psPtr ). 45 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as psPtr ). 46 PS_META_UNKNOWN, ///< Other data (Stored in as psPtr ). 47 47 PS_META_NTYPE ///< Number of types. Must be last. 48 48 } psMetadataType; … … 55 55 typedef struct psMetadataItem 56 56 { 57 const intid; ///< Unique ID for metadata item.57 const psS32 id; ///< Unique ID for metadata item. 58 58 char *restrict name; ///< Name of metadata item. 59 59 psMetadataType type; ///< Type of metadata item. 60 60 union { 61 bool B; ///< boolean data61 psBool B; ///< boolean data 62 62 psS32 S32; ///< Signed 32-bit integer data. 63 63 psF32 F32; ///< Single-precision float data. 64 64 psF64 F64; ///< Double-precision float data. 65 psP TRV; ///< Pointer to other type of data.65 psPtr V; ///< Pointer to other type of data. 66 66 } data; ///< Union for data types. 67 67 char *comment; ///< Optional comment ("", not NULL). … … 144 144 * @return bool: True for success, false for failure. 145 145 */ 146 bool psMetadataAddItem(146 psBool psMetadataAddItem( 147 147 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 148 148 psMetadataItem* restrict item, ///< Metadata item to be added. 149 intlocation ///< Location to be added.149 psS32 location ///< Location to be added. 150 150 ); 151 151 … … 156 156 * @return bool: True for success, false for failure. 157 157 */ 158 bool psMetadataAdd(159 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 160 intwhere, ///< Location to be added.158 psBool psMetadataAdd( 159 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 160 psS32 where, ///< Location to be added. 161 161 const char *name, ///< Name of metadata item. 162 162 psMetadataType type, ///< Type of metadata item. … … 175 175 * @return bool: True for success, false for failure. 176 176 */ 177 bool psMetadataRemove(178 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 179 intwhere, ///< Location to be removed.177 psBool psMetadataRemove( 178 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 179 psS32 where, ///< Location to be removed. 180 180 const char *restrict key ///< Name of metadata key. 181 181 ); … … 203 203 psMetadataItem* psMetadataGet( 204 204 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 205 intwhere ///< Location to be retrieved.205 psS32 where ///< Location to be retrieved. 206 206 ); 207 207 … … 213 213 * @return void: void. 214 214 */ 215 bool psMetadataSetIterator(215 psBool psMetadataSetIterator( 216 216 psMetadata* restrict md, ///< Metadata collection to iterate. 217 intwhere ///< Location of iterator.217 psS32 where ///< Location of iterator. 218 218 ); 219 219 … … 227 227 psMetadata* restrict md, ///< Metadata collection to iterate. 228 228 const char *restrict match, ///< Beginning of key name. 229 intwhich ///< Iterator to be used.229 psS32 which ///< Iterator to be used. 230 230 ); 231 231 … … 239 239 psMetadata* restrict md, ///< Metadata collection to iterate. 240 240 const char *restrict match, ///< Beginning of key name. 241 intwhich ///< Iterator to be used.241 psS32 which ///< Iterator to be used. 242 242 ); 243 243 -
trunk/psLib/src/astronomy/psMetadataIO.c
r2014 r2204 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10- 08 00:43:12$11 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:30 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 104 104 /** Determines if a line is blank (whitespace only) or a commentline. It returns true if so. The input string 105 105 * must be null terminated. */ 106 bool ignoreLine(char *inString)106 psBool ignoreLine(char *inString) 107 107 { 108 108 while(*inString!='\0' && *inString!='#') { … … 119 119 /** Removes leading and trailing whitespace and # characters from a string. The cleaned string is a new null 120 120 * terminated copy of the original input string. */ 121 char *cleanString(char *inString, intsLen)121 char *cleanString(char *inString, psS32 sLen) 122 122 { 123 123 char *ptrB = NULL; … … 149 149 150 150 /** Count repeat occurances of a single character within a line. The input string must be null terminated. */ 151 intrepeatedChars(char *inString, char ch)152 { 153 intcount = 0;151 psS32 repeatedChars(char *inString, char ch) 152 { 153 psS32 count = 0; 154 154 155 155 … … 166 166 /** Returns cleaned token based on delimiter, but not including delimiter. Also changes the pointer location 167 167 * the beginning of the string. Tokens are newly allocated null terminated strings. */ 168 char* getToken(char **inString, char *delimiter, int*status)168 char* getToken(char **inString, char *delimiter, psS32 *status) 169 169 { 170 170 char *cleanToken = NULL; 171 intsLen = 0;171 psS32 sLen = 0; 172 172 173 173 … … 195 195 /** Returns single parsed value as a double precision number. The input string must be cleaned and null 196 196 * terminated. */ 197 double parseValue(char *inString, int*status)197 double parseValue(char *inString, psS32 *status) 198 198 { 199 199 char *end = NULL; … … 212 212 213 213 /** Returns true or false. 'T', 't', '1', 'F', 'f', and '0' are acceptable, parsable variations. */ 214 bool parseBool(char *inString, int*status)215 { 216 bool value = false;214 psBool parseBool(char *inString, psS32 *status) 215 { 216 psBool value = false; 217 217 218 218 … … 229 229 230 230 /** Returns parsed vector filled with with data. The input string must be null terminated. */ 231 psVector* parseVector(char *inString, psElemType elemType, int*status)231 psVector* parseVector(char *inString, psElemType elemType, psS32 *status) 232 232 { 233 233 char *end = NULL; 234 234 char *saveValue = NULL; 235 inti = 0;236 intnumValues = 0;235 psS32 i = 0; 236 psS32 numValues = 0; 237 237 double value = 0.0; 238 238 psVector *vec = NULL; … … 341 341 342 342 343 psMetadata* psMetadataReadHeader(psMetadata* output, char *extName, intextNum, char *fileName)344 { 345 bool tempBool;346 bool success;343 psMetadata* psMetadataReadHeader(psMetadata* output, char *extName, psS32 extNum, char *fileName) 344 { 345 psBool tempBool; 346 psBool success; 347 347 char keyType; 348 348 char keyName[FITS_LINE_SIZE]; … … 350 350 char keyComment[FITS_LINE_SIZE]; 351 351 char fitsErr[MAX_STRING_LENGTH]; 352 inti;353 inthduType = 0;354 intstatus = 0;355 intnumKeys = 0;356 intkeyNum = 0;352 psS32 i; 353 psS32 hduType = 0; 354 psS32 status = 0; 355 psS32 numKeys = 0; 356 psS32 keyNum = 0; 357 357 psMetadataType metadataItemType; 358 358 fitsfile *fd = NULL; … … 449 449 450 450 451 int psMetadataParseConfig(psMetadata** md, char *fileName, bool overwrite)452 { 453 bool tempBool;451 psS32 psMetadataParseConfig(psMetadata** md, char *fileName, psBool overwrite) 452 { 453 psBool tempBool; 454 454 char *line = NULL; 455 455 char *strName = NULL; … … 458 458 char *strComment = NULL; 459 459 char *linePtr = NULL; 460 intstatus = 0;461 intlineCount = 0;462 intfailedLines = 0;460 psS32 status = 0; 461 psS32 lineCount = 0; 462 psS32 failedLines = 0; 463 463 psF64 tempDbl = 0.0; 464 464 psS32 tempInt = 0.0; -
trunk/psLib/src/astronomy/psMetadataIO.h
r1973 r2204 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10- 06 01:17:39$11 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:30 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 50 50 psMetadata* output, ///< Resulting metadata from read. 51 51 char *extName, ///< File name extension string. 52 intextNum, ///< File name extension number. Starts at 1.52 psS32 extNum, ///< File name extension number. Starts at 1. 53 53 char *fileName ///< Name of file to read. 54 54 ); … … 58 58 * Loads pre-defined settings by parsing a configuration file into a psMetadata structure. 59 59 * 60 * @return int: Number of lines that failed to be read.60 * @return psS32 : Number of lines that failed to be read. 61 61 */ 62 intpsMetadataParseConfig(62 psS32 psMetadataParseConfig( 63 63 psMetadata** md, ///< Resulting metadata from read. 64 64 char *fileName, ///< Name of file to read. 65 bool overwrite ///< Allow overwrite of duplicate specifications.65 psBool overwrite ///< Allow overwrite of duplicate specifications. 66 66 ); 67 67 -
trunk/psLib/src/astronomy/psPhotometry.h
r1441 r2204 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $13 * @date $Date: 2004- 08-09 23:40:54$12 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:30 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 43 43 typedef struct 44 44 { 45 const intID; ///< ID number for this photometric system45 const psS32 ID; ///< ID number for this photometric system 46 46 const char *name; ///< Name of photometric system 47 47 const char *camera; ///< Camera for photometric system -
trunk/psLib/src/astronomy/psTime.c
r2196 r2204 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.3 7$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-10-2 6 00:37:44$13 * @version $Revision: 1.38 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:30 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 144 144 static double lookupSer7Table( 145 145 const psTime *time, ///< time to lookup. 146 intcol ///< Column to lookup.146 psS32 col ///< Column to lookup. 147 147 ); 148 148 … … 150 150 { 151 151 char line[LINESIZE]; 152 intj = 0;153 intmaxLines = 100;152 psS32 j = 0; 153 psS32 maxLines = 100; 154 154 psF64 *ptr = NULL; 155 155 psImage *table = NULL; … … 180 180 } 181 181 182 *( unsigned int*)&table->numRows = j;182 *(psU32 *)&table->numRows = j; 183 183 184 184 p_psMemSetPersistent(table,true); … … 191 191 static psImage* readSer7File(const char *fileName) 192 192 { 193 bool beginRecord = false;193 psBool beginRecord = false; 194 194 char line[LINESIZE]; 195 intj = 0;196 intmaxLines = 400;195 psS32 j = 0; 196 psS32 maxLines = 400; 197 197 psImage *table = NULL; 198 198 FILE *fd = NULL; … … 231 231 } 232 232 } 233 *( unsigned int*)&table->numRows = j;233 *(psU32 *)&table->numRows = j; 234 234 235 235 p_psMemSetPersistent(table,true); … … 244 244 { 245 245 char line[LINESIZE]; 246 inti = 0;247 intj = 0;248 intmaxLines = 2500;246 psS32 i = 0; 247 psS32 j = 0; 248 psS32 maxLines = 2500; 249 249 psImage *table = NULL; 250 250 FILE *fd = NULL; … … 276 276 } 277 277 278 *( unsigned int*)&table->numRows = j;278 *(psU32 *)&table->numRows = j; 279 279 280 280 return table; … … 284 284 { 285 285 char line[LINESIZE]; 286 intj = 0;287 intmaxLines = 15000;286 psS32 j = 0; 287 psS32 maxLines = 15000; 288 288 psImage *table = NULL; 289 289 FILE *fd = NULL; … … 346 346 } 347 347 348 *( unsigned int*)&table->numRows = j;348 *(psU32 *)&table->numRows = j; 349 349 350 350 return table; … … 354 354 static double lookupTaiUtcTable(const psTime *time) 355 355 { 356 inthiIdx = 0;357 intloIdx = 0;358 intnumRows = 0;356 psS32 hiIdx = 0; 357 psS32 loIdx = 0; 358 psS32 numRows = 0; 359 359 double jd = 0.0; 360 360 double mjd = 0.0; … … 422 422 } 423 423 424 static double lookupSer7Table(const psTime *time, intcol)425 { 426 inthiIdx = 0;427 intloIdx = 0;428 intnumRows = 0;424 static double lookupSer7Table(const psTime *time, psS32 col) 425 { 426 psS32 hiIdx = 0; 427 psS32 loIdx = 0; 428 psS32 numRows = 0; 429 429 double out = 0.0; 430 430 double denom = 0.0; … … 752 752 } 753 753 754 longpsTimeLeapseconds(const psTime *time1, const psTime *time2)755 { 756 longdiff = 0;754 psS64 psTimeLeapseconds(const psTime *time1, const psTime *time2) 755 { 756 psS64 diff = 0; 757 757 758 758 … … 827 827 char* psTimeToISOTime(const psTime *time) 828 828 { 829 intms = 0;829 psS32 ms = 0; 830 830 char *timeString = NULL; 831 831 char *tempString = NULL; … … 889 889 struct tm* psTimeToTM(const psTime *time) 890 890 { 891 longcent = 0;892 longyear = 0;893 longmonth = 0;894 longday = 0;895 longhour = 0;896 longminute = 0;897 longseconds = 0;898 longtemp = 0;891 psS64 cent = 0; 892 psS64 year = 0; 893 psS64 month = 0; 894 psS64 day = 0; 895 psS64 hour = 0; 896 psS64 minute = 0; 897 psS64 seconds = 0; 898 psS64 temp = 0; 899 899 struct tm* tmTime = NULL; 900 900 … … 975 975 seconds = days * SEC_PER_DAY; 976 976 if(seconds < 0.0) { 977 outTime->usec = (seconds - ( long)seconds) * -1000000.0; // psTime earlier than epoch977 outTime->usec = (seconds - (psS64)seconds) * -1000000.0; // psTime earlier than epoch 978 978 } else { 979 outTime->usec = (seconds - ( long)seconds) * 1000000.0; // psTime greater than epoch979 outTime->usec = (seconds - (psS64)seconds) * 1000000.0; // psTime greater than epoch 980 980 } 981 981 outTime->sec = seconds; … … 1003 1003 seconds = days * SEC_PER_DAY; 1004 1004 if(seconds < 0.0) { 1005 outTime->usec = (seconds - ( long)seconds) * -1000000.0; // psTime earlier than epoch1005 outTime->usec = (seconds - (psS64)seconds) * -1000000.0; // psTime earlier than epoch 1006 1006 } else { 1007 outTime->usec = (seconds - ( long)seconds) * 1000000.0; // psTime greater than epoch1007 outTime->usec = (seconds - (psS64)seconds) * 1000000.0; // psTime greater than epoch 1008 1008 } 1009 1009 outTime->sec = seconds; … … 1020 1020 { 1021 1021 char tempString[MAX_TIME_STRING_LENGTH]; 1022 intmonth;1023 intday;1024 intyear;1025 inthour;1026 intminute;1027 intsecond;1028 intmillisecond;1022 psS32 month; 1023 psS32 day; 1024 psS32 year; 1025 psS32 hour; 1026 psS32 minute; 1027 psS32 second; 1028 psS32 millisecond; 1029 1029 struct tm tmTime; 1030 1030 psTime *outTime = NULL; … … 1127 1127 psTime* psTimeFromTM(const struct tm* time) 1128 1128 { 1129 longyear;1130 longmonth;1131 longday;1132 longhour;1133 longminute;1134 longseconds;1135 longtemp;1129 psS64 year; 1130 psS64 month; 1131 psS64 day; 1132 psS64 hour; 1133 psS64 minute; 1134 psS64 seconds; 1135 psS64 temp; 1136 1136 psTime *outTime = NULL; 1137 1137 … … 1194 1194 { 1195 1195 psF64 deltaSec = 0; 1196 longdeltaUsec = 0;1196 psS64 deltaUsec = 0; 1197 1197 psTime *outTime = NULL; 1198 1198 … … 1243 1243 { 1244 1244 psS64 deltaSec = 0; 1245 longdeltaUsec = 0;1245 psS64 deltaUsec = 0; 1246 1246 psTime *outTime = NULL; 1247 1247 … … 1267 1267 outTime = psTimeAlloc(tai1->type); 1268 1268 deltaSec = tai1->sec - tai2->sec; 1269 deltaUsec = ( long)tai1->usec - (long)tai2->usec;1269 deltaUsec = (psS64)tai1->usec - (psS64)tai2->usec; 1270 1270 1271 1271 // Adjust time in case of microsecond underflow after subtraction … … 1289 1289 { 1290 1290 psS64 deltaSec = 0; 1291 longdeltaUsec = 0;1291 psS64 deltaUsec = 0; 1292 1292 psTime *outTime = NULL; 1293 1293 … … 1313 1313 outTime = psTimeAlloc(tai1->type); 1314 1314 deltaSec = tai1->sec - tai2->sec; 1315 deltaUsec = ( long)tai1->usec - (long)tai2->usec;1315 deltaUsec = (psS64)tai1->usec - (psS64)tai2->usec; 1316 1316 1317 1317 // Adjust time in case of microsecond underflow after subtraction -
trunk/psLib/src/astronomy/psTime.h
r2179 r2204 54 54 * @author Ross Harman, MHPCC 55 55 * 56 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $57 * @date $Date: 2004-10-2 0 20:05:58$56 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 57 * @date $Date: 2004-10-27 00:57:30 $ 58 58 * 59 59 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 181 181 * @return long: leapseconds added between given times 182 182 */ 183 longpsTimeLeapseconds(183 psS64 psTimeLeapseconds( 184 184 const psTime* time1, ///< First input time. 185 185 const psTime* time2 ///< Second input time. -
trunk/psLib/src/collections/psArray.c
r1920 r2204 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $12 * @date $Date: 2004- 09-28 23:26:48$11 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:31 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 42 42 43 43 /*****************************************************************************/ 44 psArray* psArrayAlloc( unsigned intnalloc)44 psArray* psArrayAlloc(psU32 nalloc) 45 45 { 46 46 psArray* psArr = NULL; … … 54 54 55 55 // Create vector data array 56 psArr->data = psAlloc(nalloc * sizeof(psP TR));56 psArr->data = psAlloc(nalloc * sizeof(psPtr)); 57 57 58 58 return psArr; 59 59 } 60 60 61 psArray* psArrayRealloc(psArray* restrict in, unsigned intnalloc)61 psArray* psArrayRealloc(psArray* restrict in, psU32 nalloc) 62 62 { 63 63 if (in == NULL) { … … 65 65 } else if (in->nalloc != nalloc) { // No need to realloc to same size 66 66 if (nalloc < in->n) { 67 for ( inti = nalloc; i < in->n; i++) { // For reduction in vector size67 for (psS32 i = nalloc; i < in->n; i++) { // For reduction in vector size 68 68 psFree(in->data[i]); 69 69 } … … 71 71 } 72 72 // Realloc after decrementation to avoid accessing freed array elements 73 in->data = psRealloc(in->data, nalloc * sizeof(psP TR));73 in->data = psRealloc(in->data, nalloc * sizeof(psPtr)); 74 74 in->nalloc = nalloc; 75 75 } … … 89 89 } 90 90 91 bool psArrayRemove(psArray* psArr,92 psPTRdata)91 psBool psArrayRemove(psArray* psArr, 92 psPtr data) 93 93 { 94 bool success = false;94 psBool success = false; 95 95 96 96 if (psArr == NULL) { … … 98 98 } 99 99 100 intn = psArr->n;101 psP TR* psArrData = psArr->data;102 for ( inti = n-1; i<0; i--) {100 psS32 n = psArr->n; 101 psPtr* psArrData = psArr->data; 102 for (psS32 i = n-1; i<0; i--) { 103 103 if (psArrData[i] == data) { 104 memmove(psArrData[i],psArrData[i+1],(n-i-1)*sizeof(psP TR));104 memmove(psArrData[i],psArrData[i+1],(n-i-1)*sizeof(psPtr)); 105 105 n--; 106 106 success = true; … … 119 119 } 120 120 121 for ( inti = 0; i < psArr->n; i++) {121 for (psS32 i = 0; i < psArr->n; i++) { 122 122 psFree(psArr->data[i]); 123 123 psArr->data[i] = NULL; … … 131 131 } 132 132 133 qsort(in->data, in->n, sizeof(psP TR), (int (*)(const void *, const void*))compare);133 qsort(in->data, in->n, sizeof(psPtr), (int (*)(const void* , const void*))compare); 134 134 135 135 return in; -
trunk/psLib/src/collections/psArray.h
r1920 r2204 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $15 * @date $Date: 2004- 09-28 23:26:48$14 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-10-27 00:57:31 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 20 20 #ifndef PS_ARRAY_H 21 21 #define PS_ARRAY_H 22 23 #include<stdbool.h>24 22 25 23 #include "psType.h" … … 36 34 typedef struct 37 35 { 38 unsigned intnalloc; ///< Total number of elements available.39 unsigned intn; ///< Number of elements in use.40 psP TR* data; ///< An Array of pointer elements36 psU32 nalloc; ///< Total number of elements available. 37 psU32 n; ///< Number of elements in use. 38 psPtr* data; ///< An Array of pointer elements 41 39 } 42 40 psArray; … … 57 55 */ 58 56 psArray* psArrayAlloc( 59 unsigned intnalloc ///< Total number of elements to make available.57 psU32 nalloc ///< Total number of elements to make available. 60 58 ); 61 59 … … 70 68 psArray* psArrayRealloc( 71 69 psArray* restrict psArr, ///< array to reallocate. 72 unsigned intnalloc ///< Total number of elements to make available.70 psU32 nalloc ///< Total number of elements to make available. 73 71 ); 74 72 … … 81 79 * 82 80 */ 83 bool psArrayRemove(81 psBool psArrayRemove( 84 82 psArray* psArr, ///< array to operate on 85 psP TRdata ///< the data pointer to remove from psArray83 psPtr data ///< the data pointer to remove from psArray 86 84 ); 87 85 -
trunk/psLib/src/collections/psBitSet.c
r1842 r2204 11 11 * @author Robert DeSonia, MHPCC 12 12 * 13 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $14 * @date $Date: 2004- 09-21 23:17:52$13 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:31 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 21 21 #include <ctype.h> 22 22 #include <math.h> 23 #include <stdbool.h>24 23 25 24 #include "psBitSet.h" … … 48 47 * @return char*: Pointer to byte in which bit is contained. 49 48 */ 50 static char mask( intbit)49 static char mask(psS32 bit) 51 50 { 52 51 char mask = (char)0x01; … … 67 66 } 68 67 69 psBitSet* psBitSetAlloc( intn)70 { 71 intnumBytes = 0;68 psBitSet* psBitSetAlloc(psS32 n) 69 { 70 psS32 numBytes = 0; 72 71 psBitSet* newObj = NULL; 73 72 … … 95 94 96 95 psBitSet* psBitSetSet(psBitSet* inBitSet, 97 intbit)96 psS32 bit) 98 97 { 99 98 char *byte = NULL; … … 120 119 121 120 psBitSet* psBitSetClear(psBitSet* inBitSet, 122 intbit)121 psS32 bit) 123 122 { 124 123 char *byte = NULL; … … 144 143 } 145 144 146 bool psBitSetTest(const psBitSet* inBitSet,147 intbit)145 psBool psBitSetTest(const psBitSet* inBitSet, 146 psS32 bit) 148 147 { 149 148 char *byte = NULL; … … 173 172 const psBitSet* restrict inBitSet2) 174 173 { 175 inti = 0;176 intn = 0;174 psS32 i = 0; 175 psS32 n = 0; 177 176 char* outBits = NULL; 178 177 char* inBits1 = NULL; 179 178 char* inBits2 = NULL; 180 intop = UNKNOWN_OP;179 psS32 op = UNKNOWN_OP; 181 180 182 181 if (inBitSet1 == NULL) { … … 198 197 199 198 // make operator all caps 200 inttempStrLen = strlen(operator);199 psS32 tempStrLen = strlen(operator); 201 200 char* tempStr = psAlloc(tempStrLen+1); 202 201 203 for ( intlcv=0;lcv<tempStrLen;lcv++) {202 for (psS32 lcv=0;lcv<tempStrLen;lcv++) { 204 203 tempStr[lcv] = (char)toupper(operator[lcv]); 205 204 } … … 308 307 char *psBitSetToString(const psBitSet* restrict inBitSet) 309 308 { 310 inti = 0;311 intnumBits = inBitSet->n * 8;309 psS32 i = 0; 310 psS32 numBits = inBitSet->n * 8; 312 311 char *outString = psAlloc((size_t) numBits + 1); 313 312 -
trunk/psLib/src/collections/psBitSet.h
r1807 r2204 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $15 * @date $Date: 2004- 09-14 20:01:52$14 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-10-27 00:57:31 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 20 20 #ifndef PSBITSET_H 21 21 #define PSBITSET_H 22 23 #include "psType.h" 22 24 23 25 /// @addtogroup BitSet … … 35 37 typedef struct 36 38 { 37 intn; ///< Number of bytes in the array39 psS32 n; ///< Number of bytes in the array 38 40 char *bits; ///< Aray of bytes holding bits 39 41 } … … 54 56 /*@null@*/ 55 57 psBitSet* psBitSetAlloc( 56 intn ///< Number of bits in psBitSet array58 psS32 n ///< Number of bits in psBitSet array 57 59 ); 58 60 … … 68 70 /* @returned@ */ 69 71 psBitSet* restrict inMask, ///< Pointer to psBitSet to be set. 70 intbit ///< Bit to be set.72 psS32 bit ///< Bit to be set. 71 73 ); 72 74 … … 82 84 /* @returned@ */ 83 85 psBitSet* restrict inMask, ///< Pointer to psBitSet to be cleared. 84 intbit ///< Bit to be cleared.86 psS32 bit ///< Bit to be cleared. 85 87 ); 86 88 … … 95 97 */ 96 98 97 bool psBitSetTest(99 psBool psBitSetTest( 98 100 const psBitSet* restrict inMask, ///< Pointer psBitSet to be tested. 99 intbit ///< Bit to be tested.101 psS32 bit ///< Bit to be tested. 100 102 ); 101 103 -
trunk/psLib/src/collections/psCompare.c
r1407 r2204 7 7 * @author Robert Daniel DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $10 * @date $Date: 2004- 08-07 00:06:06$9 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-10-27 00:57:31 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 13 13 */ 14 14 15 #include "psType.h"16 15 #include "psCompare.h" 17 16 -
trunk/psLib/src/collections/psCompare.h
r1473 r2204 1 /** @file psCompare.h 2 * @brief Comparison functions for sorting routines 3 * 4 * @author Robert Daniel DeSonia, MHPCC 5 * 6 * @ingroup Compare 7 * 8 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-10-27 00:57:31 $ 10 * 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 12 */ 13 1 14 #if !defined(PS_COMPARE_H) 2 15 #define PS_COMPARE_H 3 16 4 /** @file psCompare.h 5 * @brief Comparison functions for sorting routines 6 * 7 * @author Robert Daniel DeSonia, MHPCC 8 * 9 * @ingroup Compare 10 * 11 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-08-11 19:58:11 $ 13 * 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 15 */ 17 #include "psType.h" 16 18 17 19 /** @addtogroup Compare -
trunk/psLib/src/collections/psHash.c
r1842 r2204 11 11 * @author George Gusciora, MHPCC 12 12 * 13 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $14 * @date $Date: 2004- 09-21 23:17:53$13 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:31 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 19 19 #include <stdio.h> 20 20 #include <string.h> 21 #include <stdbool.h>22 21 #include "psHash.h" 23 22 #include "psMemory.h" … … 29 28 #include "psCollectionsErrors.h" 30 29 31 static psHashBucket* hashBucketAlloc(const char *key, void *data, psHashBucket* next);30 static psHashBucket* hashBucketAlloc(const char *key, psPtr data, psHashBucket* next); 32 31 static void hashBucketFree(psHashBucket* bucket); 33 static void *doHashWork(psHash* table, const char *key, void *data, bool remove32 static psPtr doHashWork(psHash* table, const char *key, psPtr data, psBool remove 34 33 ); 35 34 static void hashFree(psHash* table); … … 45 44 psList* psHashKeyList(psHash* table) 46 45 { 47 inti = 0; // Loop index variable46 psS32 i = 0; // Loop index variable 48 47 psList* myLinkList = NULL; // The output data structure 49 48 psHashBucket* ptr = NULL; // Used to step thru linked list. … … 85 84 *****************************************************************************/ 86 85 static psHashBucket* hashBucketAlloc(const char *key, 87 void *data,86 psPtr data, 88 87 psHashBucket* next) 89 88 { … … 135 134 The new hash table. 136 135 *****************************************************************************/ 137 psHash* psHashAlloc( intnbucket) // initial number of buckets138 { 139 inti = 0; // loop index variable136 psHash* psHashAlloc(psS32 nbucket) // initial number of buckets 137 { 138 psS32 i = 0; // loop index variable 140 139 141 140 // Create the new hash table. … … 172 171 static void hashFree(psHash* table) 173 172 { 174 inti = 0; // Loop index variable.173 psS32 i = 0; // Loop index variable. 175 174 176 175 if (table == NULL) { … … 212 211 there is little common code between those functions. 213 212 *****************************************************************************/ 214 static void *doHashWork(psHash* table,213 static psPtr doHashWork(psHash* table, 215 214 const char *key, 216 void *data, bool remove215 psPtr data, psBool remove 217 216 ) 218 217 { 219 long inthash = 1; // This will contain an integer value218 psS64 hash = 1; // This will contain an integer value 220 219 221 220 // "hashed" from the key. … … 236 235 } 237 236 // NOTE: This is the originally supplied hash function. 238 // for ( inti = 0, len = strlen(key); i < len; i++) {237 // for (psS32 i = 0, len = strlen(key); i < len; i++) { 239 238 // hash = (hash << 1) ^ key[i]; 240 239 // } … … 273 272 // of removing an item from a single-linked list. 274 273 275 void *data = ptr->data;274 psPtr data = ptr->data; 276 275 277 276 optr->next = ptr->next; … … 344 343 boolean value defining success or failure 345 344 *****************************************************************************/ 346 bool psHashAdd(psHash* table,347 const char *key,348 void *data)345 psBool psHashAdd(psHash* table, 346 const char *key, 347 psPtr data) 349 348 { 350 349 if (table == NULL) { … … 380 379 The data associated with that key. 381 380 *****************************************************************************/ 382 void *psHashLookup(psHash* table, // table to lookup key in381 psPtr psHashLookup(psHash* table, // table to lookup key in 383 382 const char *key) // key to lookup 384 383 { … … 409 408 boolean value defining success or failure 410 409 *****************************************************************************/ 411 bool psHashRemove(psHash* table,412 const char *key)413 { 414 void *data = NULL;415 bool retVal = false;410 psBool psHashRemove(psHash* table, 411 const char *key) 412 { 413 psPtr data = NULL; 414 psBool retVal = false; 416 415 417 416 if (table == NULL) { -
trunk/psLib/src/collections/psHash.h
r1441 r2204 11 11 * @author George Gusciora, MHPCC 12 12 * 13 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $14 * @date $Date: 2004- 08-09 23:40:55$13 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:31 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 22 22 * \{ 23 23 */ 24 #include<stdbool.h>25 24 26 25 #include "psList.h" … … 30 29 { 31 30 char *key; ///< key for this item of data 32 void *data; ///< the data itself31 psPtr data; ///< the data itself 33 32 struct psHashBucket* next; ///< list of other possible keys 34 33 } … … 40 39 typedef struct psHash 41 40 { 42 intnbucket; ///< Number of buckets in hash table.41 psS32 nbucket; ///< Number of buckets in hash table. 43 42 psHashBucket* *buckets; ///< The bucket data. 44 43 } … … 46 45 47 46 /// Allocate hash buckets in table. 48 psHash* psHashAlloc( intnbucket ///< The number of buckets to allocate.47 psHash* psHashAlloc(psS32 nbucket ///< The number of buckets to allocate. 49 48 ); 50 49 51 50 /// Insert entry into table. 52 bool psHashAdd(psHash* table, ///< table to insert in53 const char *key, ///< key to use54 void *data ///< data to insert55 );51 psBool psHashAdd(psHash* table, ///< table to insert in 52 const char *key, ///< key to use 53 psPtr data ///< data to insert 54 ); 56 55 57 56 /// Lookup key in table. 58 void *psHashLookup(psHash* table, ///< table to lookup key in57 psPtr psHashLookup(psHash* table, ///< table to lookup key in 59 58 const char *key ///< key to lookup 60 59 ); 61 60 62 61 /// Remove key from table. 63 bool psHashRemove(psHash* table, ///< table to lookup key in64 const char *key ///< key to lookup65 );62 psBool psHashRemove(psHash* table, ///< table to lookup key in 63 const char *key ///< key to lookup 64 ); 66 65 67 66 /// List all keys in table. -
trunk/psLib/src/collections/psList.c
r1807 r2204 6 6 * @author Robert Daniel DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 19$ $Name: not supported by cvs2svn $9 * @date $Date: 2004- 09-14 20:01:52$8 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-10-27 00:57:31 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 13 13 14 14 #include <stdlib.h> 15 #include <stdbool.h>16 15 #include <stdio.h> 17 16 #include <pthread.h> // we need a mutex to make this stuff thread safe. … … 26 25 #include "psCollectionsErrors.h" 27 26 28 #define ITER_INIT_HEAD (( void *)1) // next iteration should return head29 #define ITER_INIT_TAIL (( void *)2) // next iteration should return tail27 #define ITER_INIT_HEAD ((psPtr )1) // next iteration should return head 28 #define ITER_INIT_TAIL ((psPtr )2) // next iteration should return tail 30 29 31 30 // private functions. 32 31 static psListElem* listGetIterator(psList* list); 33 static intlistGetIteratorIndex(psList* list);34 static void listSetIterator(psList* list, int where, bool lockList);32 static psS32 listGetIteratorIndex(psList* list); 33 static void listSetIterator(psList* list, psS32 where, psBool lockList); 35 34 static void listFree(psList* list); 36 35 37 psList* psListAlloc( void *data)36 psList* psListAlloc(psPtr data) 38 37 { 39 38 psList* list = psAlloc(sizeof(psList)); … … 82 81 } 83 82 84 bool psListAdd(psList* list, int location, void *data)83 psBool psListAdd(psList* list, psS32 location, psPtr data) 85 84 { 86 85 psListElem* position; 87 86 psListElem* elem; 88 intcursorIndex = 0;87 psS32 cursorIndex = 0; 89 88 90 89 if (list == NULL) { … … 168 167 * Remove an element from a list 169 168 */ 170 bool psListRemove(psList* list, int location, void *data)169 psBool psListRemove(psList* list, psS32 location, psPtr data) 171 170 { 172 171 psListElem* elem = NULL; // element to remove 173 intcursorIndex = 0;172 psS32 cursorIndex = 0; 174 173 175 174 if (list == NULL) { … … 184 183 // search list for the data item. 185 184 186 inti = 0; // index185 psS32 i = 0; // index 187 186 188 187 for (psListElem* ptr = list->head; ptr != NULL; ptr = ptr->next) { … … 247 246 } 248 247 249 void psListSetIterator(psList* list, intwhere)248 void psListSetIterator(psList* list, psS32 where) 250 249 { 251 250 listSetIterator(list, where, true); 252 251 } 253 252 254 static void listSetIterator(psList* list, int where, bool lockList)253 static void listSetIterator(psList* list, psS32 where, psBool lockList) 255 254 { 256 255 psListElem* cursor; 257 intposition;256 psS32 position; 258 257 259 258 if (list == NULL) { … … 272 271 } 273 272 274 if (where >= ( int)list->size) {273 if (where >= (psS32)list->size) { 275 274 list->iter = NULL; 276 275 if (lockList) { … … 323 322 } 324 323 325 intposition = listGetIteratorIndex(list);324 psS32 position = listGetIteratorIndex(list); 326 325 327 326 if (where < position) { 328 intdiff = position - where;329 330 for ( intcount = 0; count < diff; count++) {327 psS32 diff = position - where; 328 329 for (psS32 count = 0; count < diff; count++) { 331 330 listSetIterator(list, PS_LIST_PREVIOUS, false); 332 331 } 333 332 } else { 334 intdiff = where - position;335 336 for ( intcount = 0; count < diff; count++) {333 psS32 diff = where - position; 334 335 for (psS32 count = 0; count < diff; count++) { 337 336 listSetIterator(list, PS_LIST_NEXT, false); 338 337 } … … 363 362 } 364 363 365 intlistGetIteratorIndex(psList* list)364 psS32 listGetIteratorIndex(psList* list) 366 365 { 367 366 if (list->iter == ITER_INIT_HEAD) { … … 374 373 } 375 374 376 void *psListGet(psList* list, intlocation)375 psPtr psListGet(psList* list, psS32 location) 377 376 { 378 377 psListElem* element; … … 391 390 * and now return the previous/next element of the list 392 391 */ 393 void *psListGetNext(psList* list)392 psPtr psListGetNext(psList* list) 394 393 { 395 394 return psListGet(list, PS_LIST_NEXT); 396 395 } 397 396 398 void *psListGetPrevious(psList* list)397 psPtr psListGetPrevious(psList* list) 399 398 { 400 399 return psListGet(list, PS_LIST_PREVIOUS); 401 400 } 402 401 403 void *psListGetCurrent(psList* list)402 psPtr psListGetCurrent(psList* list) 404 403 { 405 404 return psListGet(list, PS_LIST_CURRENT); … … 412 411 { 413 412 psListElem* ptr; 414 unsigned intn;413 psU32 n; 415 414 psArray* restrict arr; 416 415 … … 429 428 ptr = list->head; 430 429 n = list->size; 431 for ( inti = 0; i < n; i++) {430 for (psS32 i = 0; i < n; i++) { 432 431 arr->data[i] = psMemIncrRefCounter(ptr->data); 433 432 ptr = ptr->next; … … 439 438 psList* psArrayToList(psArray* arr) 440 439 { 441 unsigned intn;440 psU32 n; 442 441 psList* list; // list of elements 443 442 … … 448 447 list = psListAlloc(NULL); 449 448 n = arr->n; 450 for ( inti = 0; i < n; i++) {449 for (psS32 i = 0; i < n; i++) { 451 450 psListAdd(list, PS_LIST_TAIL, arr->data[i]); 452 451 } -
trunk/psLib/src/collections/psList.h
r1747 r2204 10 10 * @ingroup LinkedList 11 11 * 12 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $13 * @date $Date: 2004- 09-09 02:23:27$12 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:31 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 17 17 18 18 #include <pthread.h> // we need a mutex to make this stuff thread safe. 19 #include <stdbool.h> // we use the bool type.20 19 21 20 #include "psCompare.h" … … 46 45 struct psListElem* prev; ///< previous link in list 47 46 struct psListElem* next; ///< next link in list 48 void *data; ///< real data item47 psPtr data; ///< real data item 49 48 } 50 49 psListElem; … … 57 56 typedef struct 58 57 { 59 unsigned intsize; ///< number of elements on list58 psU32 size; ///< number of elements on list 60 59 psListElem* head; ///< first element on list (may be NULL) 61 60 psListElem* tail; ///< last element on list (may be NULL) 62 61 psListElem* iter; ///< iteration cursor 63 unsigned intiterIndex; ///< the numeric position of the iteration cursor in the list62 psU32 iterIndex; ///< the numeric position of the iteration cursor in the list 64 63 pthread_mutex_t lock; ///< mutex to lock a node during changes 65 64 } … … 71 70 */ 72 71 psList* psListAlloc( 73 void *data72 psPtr data 74 73 ///< initial data item; may be NULL if no an empty psList is desired 75 74 ) … … 81 80 * NULL, the return value will also be NULL. 82 81 */ 83 bool psListAdd(82 psBool psListAdd( 84 83 psList* restrict list, ///< list to add to (if NULL, nothing is done) 85 intlocation, ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location.86 void *data ///< data item to add. If NULL, list is not modified.84 psS32 location, ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location. 85 psPtr data ///< data item to add. If NULL, list is not modified. 87 86 ); 88 87 89 88 /** Remove an item from a list. If location parameter is PS_LIST_UNKNOWN, 90 89 * 91 * @return bool TRUE if element is successfully removed, otherwise FALSE.90 * @return psBool TRUE if element is successfully removed, otherwise FALSE. 92 91 */ 93 bool psListRemove(92 psBool psListRemove( 94 93 psList* restrict list, 95 94 ///< list to remove element from 96 intlocation,95 psS32 location, 97 96 ///< index of item, or PS_LIST_UNKNOWN, PS_LIST_NEXT, PS_LIST_PREV, or numbered location. 98 void *data97 psPtr data 99 98 ///< if location is PS_LIST_UNKNOWN, data item to find and remove, otherwise this is ignored. 100 99 ); … … 102 101 /** Retrieve an item from a list. 103 102 * 104 * @return void*the item corresponding to the location parameter. If103 * @return psPtr the item corresponding to the location parameter. If 105 104 * location is invalid (e.g., a numbered index greater 106 105 * than the list size or if the list is empty), a 107 106 * NULL is returned. 108 107 */ 109 void *psListGet(108 psPtr psListGet( 110 109 psList* restrict list, ///< list to retrieve element from 111 intlocation ///< index number, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN110 psS32 location ///< index number, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN 112 111 ); 113 112 … … 118 117 void psListSetIterator( 119 118 psList* restrict list, ///< list to retrieve element from 120 intlocation ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL119 psS32 location ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL 121 120 ); 122 121 … … 124 123 * the next list position. 125 124 * 126 * @return void*the data item next on the list or NULL if the iterator125 * @return psPtr the data item next on the list or NULL if the iterator 127 126 * is already pointing to the last element or the list 128 127 * parameter was NULL. 129 128 */ 130 void *psListGetNext(129 psPtr psListGetNext( 131 130 psList* restrict list ///< list to retrieve element from 132 131 ); … … 135 134 * not move the iterator location. 136 135 * 137 * @return void*the data item cooresponding to current iterator136 * @return psPtr the data item cooresponding to current iterator 138 137 * cursor position of the list, or NULL if either the 139 138 * iterator is not valid or list parameter was NULL. 140 139 */ 141 void *psListGetCurrent(140 psPtr psListGetCurrent( 142 141 psList* restrict list ///< list to retrieve element from 143 142 ); … … 146 145 * iterator to the previous list position. 147 146 * 148 * @return void*the data item previous on the list or NULL if the iterator147 * @return psPtr the data item previous on the list or NULL if the iterator 149 148 * is already pointing to the first element or the list 150 149 * parameter was NULL. 151 150 */ 152 void *psListGetPrevious(151 psPtr psListGetPrevious( 153 152 psList* restrict list ///< list to retrieve element from 154 153 ); -
trunk/psLib/src/collections/psMetadata.c
r2040 r2204 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.3 4$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-10- 09 03:05:53$14 * @version $Revision: 1.35 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-10-27 00:57:30 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 59 59 /*****************************************************************************/ 60 60 61 static intmetadataId = 0;61 static psS32 metadataId = 0; 62 62 63 63 /*****************************************************************************/ … … 143 143 144 144 // Set metadata item unique id 145 *( int*)(&metadataItem->id) = ++metadataId;145 *(psS32 *)(&metadataItem->id) = ++metadataId; 146 146 147 147 // Set metadata item type … … 154 154 break; 155 155 case PS_META_BOOL: 156 metadataItem->data.B = ( bool)va_arg(argPtr, int);156 metadataItem->data.B = (psBool)va_arg(argPtr, psS32); 157 157 break; 158 158 case PS_META_S32: … … 215 215 } 216 216 217 bool psMetadataAddItem( psMetadata *restrict md, psMetadataItem *restrict metadataItem, intlocation )217 psBool psMetadataAddItem( psMetadata *restrict md, psMetadataItem *restrict metadataItem, psS32 location ) 218 218 { 219 219 char * key = NULL; … … 337 337 } 338 338 339 bool psMetadataAdd(psMetadata* restrict md, intwhere, const char *name, psMetadataType type,340 const char *comment, ...)339 psBool psMetadataAdd(psMetadata* restrict md, psS32 where, const char *name, psMetadataType type, 340 const char *comment, ...) 341 341 { 342 342 va_list argPtr; … … 359 359 } 360 360 361 bool psMetadataRemove(psMetadata* restrict md, intwhere, const char *restrict key)362 { 363 intnumChildren = 0;361 psBool psMetadataRemove(psMetadata* restrict md, psS32 where, const char *restrict key) 362 { 363 psS32 numChildren = 0; 364 364 psList* mdList = NULL; 365 365 psHash* mdTable = NULL; … … 471 471 } 472 472 473 psMetadataItem* psMetadataGet(psMetadata* restrict md, intwhere)473 psMetadataItem* psMetadataGet(psMetadata* restrict md, psS32 where) 474 474 { 475 475 psList* mdList = NULL; … … 497 497 } 498 498 499 bool psMetadataSetIterator(psMetadata* restrict md, intwhere)499 psBool psMetadataSetIterator(psMetadata* restrict md, psS32 where) 500 500 { 501 501 psList* mdList = NULL; … … 517 517 } 518 518 519 psMetadataItem* psMetadataGetNext(psMetadata* restrict md, const char *restrict match, intwhich)519 psMetadataItem* psMetadataGetNext(psMetadata* restrict md, const char *restrict match, psS32 which) 520 520 { 521 521 psList* mdList = NULL; … … 553 553 } 554 554 555 psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, intwhich)555 psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, psS32 which) 556 556 { 557 557 psList* mdList = NULL; -
trunk/psLib/src/collections/psMetadata.h
r1970 r2204 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.2 3$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-10- 06 01:06:27$13 * @version $Revision: 1.24 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:30 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 38 38 PS_META_F32, ///< Single-precision float data. 39 39 PS_META_F64, ///< Double-precision float data. 40 PS_META_STR, ///< String data (Stored in as void *).41 PS_META_VEC, ///< Vector data (Stored in as void *).42 PS_META_IMG, ///< Image data (Stored in as void *).43 PS_META_JPEG, ///< JPEG data (Stored in as void *).44 PS_META_PNG, ///< PNG data (Stored in as void *).45 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as void *).46 PS_META_UNKNOWN, ///< Other data (Stored in as void *).40 PS_META_STR, ///< String data (Stored in as psPtr ). 41 PS_META_VEC, ///< Vector data (Stored in as psPtr ). 42 PS_META_IMG, ///< Image data (Stored in as psPtr ). 43 PS_META_JPEG, ///< JPEG data (Stored in as psPtr ). 44 PS_META_PNG, ///< PNG data (Stored in as psPtr ). 45 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as psPtr ). 46 PS_META_UNKNOWN, ///< Other data (Stored in as psPtr ). 47 47 PS_META_NTYPE ///< Number of types. Must be last. 48 48 } psMetadataType; … … 55 55 typedef struct psMetadataItem 56 56 { 57 const intid; ///< Unique ID for metadata item.57 const psS32 id; ///< Unique ID for metadata item. 58 58 char *restrict name; ///< Name of metadata item. 59 59 psMetadataType type; ///< Type of metadata item. 60 60 union { 61 bool B; ///< boolean data61 psBool B; ///< boolean data 62 62 psS32 S32; ///< Signed 32-bit integer data. 63 63 psF32 F32; ///< Single-precision float data. 64 64 psF64 F64; ///< Double-precision float data. 65 psP TRV; ///< Pointer to other type of data.65 psPtr V; ///< Pointer to other type of data. 66 66 } data; ///< Union for data types. 67 67 char *comment; ///< Optional comment ("", not NULL). … … 144 144 * @return bool: True for success, false for failure. 145 145 */ 146 bool psMetadataAddItem(146 psBool psMetadataAddItem( 147 147 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 148 148 psMetadataItem* restrict item, ///< Metadata item to be added. 149 intlocation ///< Location to be added.149 psS32 location ///< Location to be added. 150 150 ); 151 151 … … 156 156 * @return bool: True for success, false for failure. 157 157 */ 158 bool psMetadataAdd(159 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 160 intwhere, ///< Location to be added.158 psBool psMetadataAdd( 159 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 160 psS32 where, ///< Location to be added. 161 161 const char *name, ///< Name of metadata item. 162 162 psMetadataType type, ///< Type of metadata item. … … 175 175 * @return bool: True for success, false for failure. 176 176 */ 177 bool psMetadataRemove(178 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 179 intwhere, ///< Location to be removed.177 psBool psMetadataRemove( 178 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 179 psS32 where, ///< Location to be removed. 180 180 const char *restrict key ///< Name of metadata key. 181 181 ); … … 203 203 psMetadataItem* psMetadataGet( 204 204 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 205 intwhere ///< Location to be retrieved.205 psS32 where ///< Location to be retrieved. 206 206 ); 207 207 … … 213 213 * @return void: void. 214 214 */ 215 bool psMetadataSetIterator(215 psBool psMetadataSetIterator( 216 216 psMetadata* restrict md, ///< Metadata collection to iterate. 217 intwhere ///< Location of iterator.217 psS32 where ///< Location of iterator. 218 218 ); 219 219 … … 227 227 psMetadata* restrict md, ///< Metadata collection to iterate. 228 228 const char *restrict match, ///< Beginning of key name. 229 intwhich ///< Iterator to be used.229 psS32 which ///< Iterator to be used. 230 230 ); 231 231 … … 239 239 psMetadata* restrict md, ///< Metadata collection to iterate. 240 240 const char *restrict match, ///< Beginning of key name. 241 intwhich ///< Iterator to be used.241 psS32 which ///< Iterator to be used. 242 242 ); 243 243 -
trunk/psLib/src/collections/psMetadataIO.c
r2014 r2204 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10- 08 00:43:12$11 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:30 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 104 104 /** Determines if a line is blank (whitespace only) or a commentline. It returns true if so. The input string 105 105 * must be null terminated. */ 106 bool ignoreLine(char *inString)106 psBool ignoreLine(char *inString) 107 107 { 108 108 while(*inString!='\0' && *inString!='#') { … … 119 119 /** Removes leading and trailing whitespace and # characters from a string. The cleaned string is a new null 120 120 * terminated copy of the original input string. */ 121 char *cleanString(char *inString, intsLen)121 char *cleanString(char *inString, psS32 sLen) 122 122 { 123 123 char *ptrB = NULL; … … 149 149 150 150 /** Count repeat occurances of a single character within a line. The input string must be null terminated. */ 151 intrepeatedChars(char *inString, char ch)152 { 153 intcount = 0;151 psS32 repeatedChars(char *inString, char ch) 152 { 153 psS32 count = 0; 154 154 155 155 … … 166 166 /** Returns cleaned token based on delimiter, but not including delimiter. Also changes the pointer location 167 167 * the beginning of the string. Tokens are newly allocated null terminated strings. */ 168 char* getToken(char **inString, char *delimiter, int*status)168 char* getToken(char **inString, char *delimiter, psS32 *status) 169 169 { 170 170 char *cleanToken = NULL; 171 intsLen = 0;171 psS32 sLen = 0; 172 172 173 173 … … 195 195 /** Returns single parsed value as a double precision number. The input string must be cleaned and null 196 196 * terminated. */ 197 double parseValue(char *inString, int*status)197 double parseValue(char *inString, psS32 *status) 198 198 { 199 199 char *end = NULL; … … 212 212 213 213 /** Returns true or false. 'T', 't', '1', 'F', 'f', and '0' are acceptable, parsable variations. */ 214 bool parseBool(char *inString, int*status)215 { 216 bool value = false;214 psBool parseBool(char *inString, psS32 *status) 215 { 216 psBool value = false; 217 217 218 218 … … 229 229 230 230 /** Returns parsed vector filled with with data. The input string must be null terminated. */ 231 psVector* parseVector(char *inString, psElemType elemType, int*status)231 psVector* parseVector(char *inString, psElemType elemType, psS32 *status) 232 232 { 233 233 char *end = NULL; 234 234 char *saveValue = NULL; 235 inti = 0;236 intnumValues = 0;235 psS32 i = 0; 236 psS32 numValues = 0; 237 237 double value = 0.0; 238 238 psVector *vec = NULL; … … 341 341 342 342 343 psMetadata* psMetadataReadHeader(psMetadata* output, char *extName, intextNum, char *fileName)344 { 345 bool tempBool;346 bool success;343 psMetadata* psMetadataReadHeader(psMetadata* output, char *extName, psS32 extNum, char *fileName) 344 { 345 psBool tempBool; 346 psBool success; 347 347 char keyType; 348 348 char keyName[FITS_LINE_SIZE]; … … 350 350 char keyComment[FITS_LINE_SIZE]; 351 351 char fitsErr[MAX_STRING_LENGTH]; 352 inti;353 inthduType = 0;354 intstatus = 0;355 intnumKeys = 0;356 intkeyNum = 0;352 psS32 i; 353 psS32 hduType = 0; 354 psS32 status = 0; 355 psS32 numKeys = 0; 356 psS32 keyNum = 0; 357 357 psMetadataType metadataItemType; 358 358 fitsfile *fd = NULL; … … 449 449 450 450 451 int psMetadataParseConfig(psMetadata** md, char *fileName, bool overwrite)452 { 453 bool tempBool;451 psS32 psMetadataParseConfig(psMetadata** md, char *fileName, psBool overwrite) 452 { 453 psBool tempBool; 454 454 char *line = NULL; 455 455 char *strName = NULL; … … 458 458 char *strComment = NULL; 459 459 char *linePtr = NULL; 460 intstatus = 0;461 intlineCount = 0;462 intfailedLines = 0;460 psS32 status = 0; 461 psS32 lineCount = 0; 462 psS32 failedLines = 0; 463 463 psF64 tempDbl = 0.0; 464 464 psS32 tempInt = 0.0; -
trunk/psLib/src/collections/psMetadataIO.h
r1973 r2204 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10- 06 01:17:39$11 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:30 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 50 50 psMetadata* output, ///< Resulting metadata from read. 51 51 char *extName, ///< File name extension string. 52 intextNum, ///< File name extension number. Starts at 1.52 psS32 extNum, ///< File name extension number. Starts at 1. 53 53 char *fileName ///< Name of file to read. 54 54 ); … … 58 58 * Loads pre-defined settings by parsing a configuration file into a psMetadata structure. 59 59 * 60 * @return int: Number of lines that failed to be read.60 * @return psS32 : Number of lines that failed to be read. 61 61 */ 62 intpsMetadataParseConfig(62 psS32 psMetadataParseConfig( 63 63 psMetadata** md, ///< Resulting metadata from read. 64 64 char *fileName, ///< Name of file to read. 65 bool overwrite ///< Allow overwrite of duplicate specifications.65 psBool overwrite ///< Allow overwrite of duplicate specifications. 66 66 ); 67 67 -
trunk/psLib/src/collections/psVector.c
r2006 r2204 10 10 * @author Robert DeSonia, MHPCC 11 11 * 12 * @version $Revision: 1.2 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-10- 07 19:51:30$12 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:31 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 42 42 // FUNCTION IMPLEMENTATION - PUBLIC 43 43 44 psVector* psVectorAlloc( unsigned intnalloc, psElemType elemType)44 psVector* psVectorAlloc(psU32 nalloc, psElemType elemType) 45 45 { 46 46 psVector* psVec = NULL; 47 intelementSize = 0;47 psS32 elementSize = 0; 48 48 49 49 elementSize = PSELEMTYPE_SIZEOF(elemType); … … 64 64 } 65 65 66 psVector* psVectorRealloc(psVector* restrict in, unsigned intnalloc)67 { 68 intelementSize = 0;66 psVector* psVectorRealloc(psVector* restrict in, psU32 nalloc) 67 { 68 psS32 elementSize = 0; 69 69 psElemType elemType; 70 70 … … 88 88 } 89 89 90 psVector* psVectorRecycle(psVector* restrict in, unsigned intn, psElemType type)91 { 92 intbyteSize;90 psVector* psVectorRecycle(psVector* restrict in, psU32 n, psElemType type) 91 { 92 psS32 byteSize; 93 93 94 94 if (in == NULL) { … … 129 129 } 130 130 131 intnElements = in->n;131 psS32 nElements = in->n; 132 132 133 133 out = psVectorRecycle(out, nElements, type); … … 136 136 ps##INTYPE *inVec = in->data.INTYPE; \ 137 137 ps##OUTTYPE *outVec = out->data.OUTTYPE; \ 138 for ( intcol=0;col<nElements;col++) { \138 for (psS32 col=0;col<nElements;col++) { \ 139 139 *(outVec++) = *(inVec++); \ 140 140 } \ … … 225 225 psVector* psVectorSort(psVector* restrict outVector, const psVector* restrict inVector) 226 226 { 227 intN = 0;228 intelSize = 0;229 void *inVec = NULL;230 void *outVec = NULL;227 psS32 N = 0; 228 psS32 elSize = 0; 229 psPtr inVec = NULL; 230 psPtr outVec = NULL; 231 231 psElemType inType = 0; 232 232 … … 311 311 psVector* psVectorSortIndex(psVector* restrict outVector, const psVector* restrict inVector) 312 312 { 313 intN = 0;313 psS32 N = 0; 314 314 psVector* tmpVector = NULL; 315 315 psElemType inType = 0; … … 350 350 ps##TYPE* tmpVec = tmpVector->data.TYPE; \ 351 351 ps##TYPE diff; \ 352 for( inti=0; i<N; i++) { \353 for( intj=0; j<N; j++) { \352 for(psS32 i=0; i<N; i++) { \ 353 for(psS32 j=0; j<N; j++) { \ 354 354 diff = absfcn(tmpVec[i] - inVec[j]); \ 355 355 if(diff < maxError) { \ -
trunk/psLib/src/collections/psVector.h
r1982 r2204 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-10- 06 21:30:52$13 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:31 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 33 33 { 34 34 psType type; ///< Type of data. 35 unsigned intnalloc; ///< Total number of elements available.36 unsigned intn; ///< Number of elements in use.35 psU32 nalloc; ///< Total number of elements available. 36 psU32 n; ///< Number of elements in use. 37 37 38 38 union { … … 49 49 psC32* C32; ///< Single-precision complex data. 50 50 psC64* C64; ///< Double-precision complex data. 51 psP TRV; ///< Pointer to data.51 psPtr V; ///< Pointer to data. 52 52 } data; ///< Union for data types. 53 53 } … … 69 69 */ 70 70 psVector* psVectorAlloc( 71 unsigned intnalloc, ///< Total number of elements to make available.71 psU32 nalloc, ///< Total number of elements to make available. 72 72 psElemType dataType ///< Type of data to be held by vector. 73 73 ); … … 84 84 psVector* psVectorRealloc( 85 85 psVector* restrict psVec, ///< Vector to reallocate. 86 unsigned intnalloc ///< Total number of elements to make available.86 psU32 nalloc ///< Total number of elements to make available. 87 87 ); 88 88 … … 101 101 ///< taken to preserve the values. 102 102 103 unsigned intnalloc, ///< Total number of elements to make available.103 psU32 nalloc, ///< Total number of elements to make available. 104 104 psElemType type ///< the datatype of the returned vector 105 105 ); -
trunk/psLib/src/dataManip/psConstants.h
r2197 r2204 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-10-2 6 21:24:42$8 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-10-27 00:57:31 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 54 54 p_psMemSetPersistent(VEC, true); \ 55 55 p_psMemSetPersistent(VEC->data.V, true); \ 56 for ( inti=0;i<N;i++) { \56 for (psS32 i=0;i<N;i++) { \ 57 57 VEC->data.F32[i] = 1.0; \ 58 58 } \ … … 62 62 p_psMemSetPersistent(VEC, true); \ 63 63 p_psMemSetPersistent(VEC->data.V, true); \ 64 for ( inti=0;i<N;i++) { \64 for (psS32 i=0;i<N;i++) { \ 65 65 VEC->data.F64[i] = 1.0; \ 66 66 } \ … … 70 70 p_psMemSetPersistent(VEC, true); \ 71 71 p_psMemSetPersistent(VEC->data.V, true); \ 72 for ( inti=0;i<N;i++) { \72 for (psS32 i=0;i<N;i++) { \ 73 73 VEC->data.F32[i] = (float) i; \ 74 74 } \ … … 78 78 p_psMemSetPersistent(VEC, true); \ 79 79 p_psMemSetPersistent(VEC->data.V, true); \ 80 for ( inti=0;i<N;i++) { \80 for (psS32 i=0;i<N;i++) { \ 81 81 VEC->data.F64[i] = (float) i; \ 82 82 } \ … … 209 209 210 210 #define PS_PRINT_VECTOR(NAME) \ 211 for ( intmy_i=0;my_i<NAME->n;my_i++) { \211 for (psS32 my_i=0;my_i<NAME->n;my_i++) { \ 212 212 printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \ 213 213 } \ … … 216 216 #define PS_VECTOR_F64_TO_F32(X64, X32) \ 217 217 psVector *X32 = psVectorAlloc(X64->n, PS_TYPE_F32); \ 218 for ( inti=0;i<X64->n;i++) { \218 for (psS32 i=0;i<X64->n;i++) { \ 219 219 X32->data.F32[i] = (float) X64->data.F64[i]; \ 220 220 } \ … … 222 222 #define PS_VECTOR_F32_TO_F64(X32, X64) \ 223 223 psVector *X64 = psVectorAlloc(X32->n, PS_TYPE_F64); \ 224 for ( inti=0;i<X32->n;i++) { \224 for (psS32 i=0;i<X32->n;i++) { \ 225 225 X64->data.F64[i] = (float) X32->data.F32[i]; \ 226 226 } \ -
trunk/psLib/src/dataManip/psFunctions.c
r2197 r2204 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.5 3$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-10-2 6 21:24:42$9 * @version $Revision: 1.54 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-10-27 00:57:31 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 50 50 \ 51 51 if (IN->type.type == PS_TYPE_F64) { \ 52 for ( inti=0;i<IN->n;i++) { \52 for (psS32 i=0;i<IN->n;i++) { \ 53 53 OUT->data.F32[i] = (float) (IN->data.F64[i]); \ 54 54 } \ … … 69 69 \ 70 70 if (IN->type.type == PS_TYPE_F32) { \ 71 for ( inti=0;i<IN->n;i++) { \71 for (psS32 i=0;i<IN->n;i++) { \ 72 72 OUT->data.F64[i] = (float) (IN->data.F32[i]); \ 73 73 } \ … … 117 117 outer coefficients of the Chebyshev polynomials. 118 118 *****************************************************************************/ 119 static psPolynomial1D **CreateChebyshevPolys( intmaxChebyPoly)119 static psPolynomial1D **CreateChebyshevPolys(psS32 maxChebyPoly) 120 120 { 121 121 psPolynomial1D **chebPolys = NULL; 122 inti = 0;123 intj = 0;122 psS32 i = 0; 123 psS32 j = 0; 124 124 125 125 chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *)); … … 153 153 evaluated Gaussian is: \f[ exp(-\frac{(x-mean)^2}{2\sigma^2}) \f] 154 154 *****************************************************************************/ 155 float psGaussian(float x, float mean, float sigma, bool normal)155 float psGaussian(float x, float mean, float sigma, psBool normal) 156 156 { 157 157 float tmp = 1.0; … … 185 185 NOTE: XXX: There is no way to seed the random generator. 186 186 *****************************************************************************/ 187 psVector* psGaussianDev(float mean, float sigma, intNpts)187 psVector* psGaussianDev(float mean, float sigma, psS32 Npts) 188 188 { 189 189 psVector* gauss = NULL; 190 190 const gsl_rng_type *T = NULL; 191 191 gsl_rng *r = NULL; 192 inti = 0;192 psS32 i = 0; 193 193 194 194 gauss = psVectorAlloc(Npts, PS_TYPE_F32); … … 209 209 This routine must allocate memory for the polynomial structures. 210 210 *****************************************************************************/ 211 psPolynomial1D* psPolynomial1DAlloc( intn,211 psPolynomial1D* psPolynomial1DAlloc(psS32 n, 212 212 psPolynomialType type) 213 213 { 214 inti = 0;214 psS32 i = 0; 215 215 psPolynomial1D* newPoly = NULL; 216 216 … … 232 232 } 233 233 234 psPolynomial2D* psPolynomial2DAlloc( int nX, intnY,234 psPolynomial2D* psPolynomial2DAlloc(psS32 nX, psS32 nY, 235 235 psPolynomialType type) 236 236 { 237 intx = 0;238 inty = 0;237 psS32 x = 0; 238 psS32 y = 0; 239 239 psPolynomial2D* newPoly = NULL; 240 240 … … 265 265 } 266 266 267 psPolynomial3D* psPolynomial3DAlloc( int nX, int nY, intnZ,267 psPolynomial3D* psPolynomial3DAlloc(psS32 nX, psS32 nY, psS32 nZ, 268 268 psPolynomialType type) 269 269 { 270 intx = 0;271 inty = 0;272 intz = 0;270 psS32 x = 0; 271 psS32 y = 0; 272 psS32 z = 0; 273 273 psPolynomial3D* newPoly = NULL; 274 274 … … 307 307 } 308 308 309 psPolynomial4D* psPolynomial4DAlloc( int nW, int nX, int nY, intnZ,309 psPolynomial4D* psPolynomial4DAlloc(psS32 nW, psS32 nX, psS32 nY, psS32 nZ, 310 310 psPolynomialType type) 311 311 { 312 intw = 0;313 intx = 0;314 inty = 0;315 intz = 0;312 psS32 w = 0; 313 psS32 x = 0; 314 psS32 y = 0; 315 psS32 z = 0; 316 316 psPolynomial4D* newPoly = NULL; 317 317 … … 367 367 static void polynomial2DFree(psPolynomial2D* myPoly) 368 368 { 369 intx = 0;369 psS32 x = 0; 370 370 371 371 for (x = 0; x < myPoly->nX; x++) { … … 381 381 static void polynomial3DFree(psPolynomial3D* myPoly) 382 382 { 383 intx = 0;384 inty = 0;383 psS32 x = 0; 384 psS32 y = 0; 385 385 386 386 for (x = 0; x < myPoly->nX; x++) { … … 402 402 static void polynomial4DFree(psPolynomial4D* myPoly) 403 403 { 404 intw = 0;405 intx = 0;406 inty = 0;404 psS32 w = 0; 405 psS32 x = 0; 406 psS32 y = 0; 407 407 408 408 for (w = 0; w < myPoly->nW; w++) { … … 434 434 float p_psOrdPolynomial1DEval(float x, const psPolynomial1D* myPoly) 435 435 { 436 intloop_x = 0;436 psS32 loop_x = 0; 437 437 float polySum = 0.0; 438 438 float xSum = 1.0; … … 478 478 { 479 479 psVector *d; 480 intn;481 inti;480 psS32 n; 481 psS32 i; 482 482 float tmp; 483 483 … … 500 500 /* 501 501 502 intn;503 inti;502 psS32 n; 503 psS32 i; 504 504 float tmp; 505 505 psPolynomial1D **chebPolys = NULL; … … 537 537 psVector *tmp; 538 538 psVector *myX; 539 inti;539 psS32 i; 540 540 541 541 PS_CONVERT_VECTOR_F32(x, myX); … … 555 555 float p_psOrdPolynomial2DEval(float x, float y, const psPolynomial2D* myPoly) 556 556 { 557 intloop_x = 0;558 intloop_y = 0;557 psS32 loop_x = 0; 558 psS32 loop_y = 0; 559 559 float polySum = 0.0; 560 560 float xSum = 1.0; … … 577 577 float p_psChebPolynomial2DEval(float x, float y, const psPolynomial2D* myPoly) 578 578 { 579 intloop_x = 0;580 intloop_y = 0;581 inti = 0;579 psS32 loop_x = 0; 580 psS32 loop_y = 0; 581 psS32 i = 0; 582 582 float polySum = 0.0; 583 583 psPolynomial1D* *chebPolys = NULL; 584 intmaxChebyPoly = 0;584 psS32 maxChebyPoly = 0; 585 585 586 586 // Determine how many Chebyshev polynomials … … 628 628 psVector *myX; 629 629 psVector *myY; 630 inti;631 intvecLen=x->n;630 psS32 i; 631 psS32 vecLen=x->n; 632 632 633 633 PS_CONVERT_VECTOR_F32(x, myX); … … 658 658 float p_psOrdPolynomial3DEval(float x, float y, float z, const psPolynomial3D* myPoly) 659 659 { 660 intloop_x = 0;661 intloop_y = 0;662 intloop_z = 0;660 psS32 loop_x = 0; 661 psS32 loop_y = 0; 662 psS32 loop_z = 0; 663 663 float polySum = 0.0; 664 664 float xSum = 1.0; … … 686 686 float p_psChebPolynomial3DEval(float x, float y, float z, const psPolynomial3D* myPoly) 687 687 { 688 intloop_x = 0;689 intloop_y = 0;690 intloop_z = 0;691 inti = 0;688 psS32 loop_x = 0; 689 psS32 loop_y = 0; 690 psS32 loop_z = 0; 691 psS32 i = 0; 692 692 float polySum = 0.0; 693 693 psPolynomial1D* *chebPolys = NULL; 694 intmaxChebyPoly = 0;694 psS32 maxChebyPoly = 0; 695 695 696 696 // Determine how many Chebyshev polynomials … … 746 746 psVector *myY; 747 747 psVector *myZ; 748 inti;749 intvecLen=x->n;748 psS32 i; 749 psS32 vecLen=x->n; 750 750 751 751 PS_CONVERT_VECTOR_F32(x, myX); … … 787 787 float p_psOrdPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D* myPoly) 788 788 { 789 intloop_w = 0;790 intloop_x = 0;791 intloop_y = 0;792 intloop_z = 0;789 psS32 loop_w = 0; 790 psS32 loop_x = 0; 791 psS32 loop_y = 0; 792 psS32 loop_z = 0; 793 793 float polySum = 0.0; 794 794 float wSum = 1.0; … … 821 821 float p_psChebPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D* myPoly) 822 822 { 823 intloop_w = 0;824 intloop_x = 0;825 intloop_y = 0;826 intloop_z = 0;827 inti = 0;823 psS32 loop_w = 0; 824 psS32 loop_x = 0; 825 psS32 loop_y = 0; 826 psS32 loop_z = 0; 827 psS32 i = 0; 828 828 float polySum = 0.0; 829 829 psPolynomial1D* *chebPolys = NULL; 830 intmaxChebyPoly = 0;830 psS32 maxChebyPoly = 0; 831 831 832 832 // Determine how many Chebyshev polynomials … … 890 890 psVector *myY; 891 891 psVector *myZ; 892 inti;893 intvecLen=x->n;892 psS32 i; 893 psS32 vecLen=x->n; 894 894 895 895 PS_CONVERT_VECTOR_F32(w, myW); … … 936 936 937 937 938 psDPolynomial1D* psDPolynomial1DAlloc( intn,938 psDPolynomial1D* psDPolynomial1DAlloc(psS32 n, 939 939 psPolynomialType type) 940 940 { 941 inti = 0;941 psS32 i = 0; 942 942 psDPolynomial1D* newPoly = NULL; 943 943 … … 959 959 } 960 960 961 psDPolynomial2D* psDPolynomial2DAlloc( int nX, intnY,961 psDPolynomial2D* psDPolynomial2DAlloc(psS32 nX, psS32 nY, 962 962 psPolynomialType type) 963 963 { 964 intx = 0;965 inty = 0;964 psS32 x = 0; 965 psS32 y = 0; 966 966 psDPolynomial2D* newPoly = NULL; 967 967 … … 992 992 } 993 993 994 psDPolynomial3D* psDPolynomial3DAlloc( int nX, int nY, intnZ,994 psDPolynomial3D* psDPolynomial3DAlloc(psS32 nX, psS32 nY, psS32 nZ, 995 995 psPolynomialType type) 996 996 { 997 intx = 0;998 inty = 0;999 intz = 0;997 psS32 x = 0; 998 psS32 y = 0; 999 psS32 z = 0; 1000 1000 psDPolynomial3D* newPoly = NULL; 1001 1001 … … 1034 1034 } 1035 1035 1036 psDPolynomial4D* psDPolynomial4DAlloc( int nW, int nX, int nY, intnZ,1036 psDPolynomial4D* psDPolynomial4DAlloc(psS32 nW, psS32 nX, psS32 nY, psS32 nZ, 1037 1037 psPolynomialType type) 1038 1038 { 1039 intw = 0;1040 intx = 0;1041 inty = 0;1042 intz = 0;1039 psS32 w = 0; 1040 psS32 x = 0; 1041 psS32 y = 0; 1042 psS32 z = 0; 1043 1043 psDPolynomial4D* newPoly = NULL; 1044 1044 … … 1094 1094 static void dPolynomial2DFree(psDPolynomial2D* myPoly) 1095 1095 { 1096 intx = 0;1096 psS32 x = 0; 1097 1097 1098 1098 for (x = 0; x < myPoly->nX; x++) { … … 1108 1108 static void dPolynomial3DFree(psDPolynomial3D* myPoly) 1109 1109 { 1110 intx = 0;1111 inty = 0;1110 psS32 x = 0; 1111 psS32 y = 0; 1112 1112 1113 1113 for (x = 0; x < myPoly->nX; x++) { … … 1129 1129 static void dPolynomial4DFree(psDPolynomial4D* myPoly) 1130 1130 { 1131 intw = 0;1132 intx = 0;1133 inty = 0;1131 psS32 w = 0; 1132 psS32 x = 0; 1133 psS32 y = 0; 1134 1134 1135 1135 for (w = 0; w < myPoly->nW; w++) { … … 1159 1159 double p_psDOrdPolynomial1DEval(double x, const psDPolynomial1D* myPoly) 1160 1160 { 1161 intloop_x = 0;1161 psS32 loop_x = 0; 1162 1162 double polySum = 0.0; 1163 1163 double xSum = 1.0; … … 1183 1183 { 1184 1184 psVector *d; 1185 intn;1186 inti;1185 psS32 n; 1186 psS32 i; 1187 1187 double tmp; 1188 1188 … … 1222 1222 psVector *tmp; 1223 1223 psVector *myX; 1224 inti;1224 psS32 i; 1225 1225 1226 1226 PS_CONVERT_VECTOR_F64(x, myX); … … 1241 1241 double p_psDOrdPolynomial2DEval(double x, double y, const psDPolynomial2D* myPoly) 1242 1242 { 1243 intloop_x = 0;1244 intloop_y = 0;1243 psS32 loop_x = 0; 1244 psS32 loop_y = 0; 1245 1245 double polySum = 0.0; 1246 1246 double xSum = 1.0; … … 1263 1263 double p_psDChebPolynomial2DEval(double x, double y, const psDPolynomial2D* myPoly) 1264 1264 { 1265 intloop_x = 0;1266 intloop_y = 0;1267 inti = 0;1265 psS32 loop_x = 0; 1266 psS32 loop_y = 0; 1267 psS32 i = 0; 1268 1268 double polySum = 0.0; 1269 1269 psPolynomial1D* *chebPolys = NULL; 1270 intmaxChebyPoly = 0;1270 psS32 maxChebyPoly = 0; 1271 1271 1272 1272 // Determine how many Chebyshev polynomials … … 1314 1314 psVector *myX; 1315 1315 psVector *myY; 1316 inti;1317 intvecLen=x->n;1316 psS32 i; 1317 psS32 vecLen=x->n; 1318 1318 1319 1319 PS_CONVERT_VECTOR_F64(x, myX); … … 1344 1344 double p_psDOrdPolynomial3DEval(double x, double y, double z, const psDPolynomial3D* myPoly) 1345 1345 { 1346 intloop_x = 0;1347 intloop_y = 0;1348 intloop_z = 0;1346 psS32 loop_x = 0; 1347 psS32 loop_y = 0; 1348 psS32 loop_z = 0; 1349 1349 double polySum = 0.0; 1350 1350 double xSum = 1.0; … … 1372 1372 double p_psDChebPolynomial3DEval(double x, double y, double z, const psDPolynomial3D* myPoly) 1373 1373 { 1374 intloop_x = 0;1375 intloop_y = 0;1376 intloop_z = 0;1377 inti = 0;1374 psS32 loop_x = 0; 1375 psS32 loop_y = 0; 1376 psS32 loop_z = 0; 1377 psS32 i = 0; 1378 1378 double polySum = 0.0; 1379 1379 psPolynomial1D* *chebPolys = NULL; 1380 intmaxChebyPoly = 0;1380 psS32 maxChebyPoly = 0; 1381 1381 1382 1382 // Determine how many Chebyshev polynomials … … 1432 1432 psVector *myY; 1433 1433 psVector *myZ; 1434 inti;1435 intvecLen=x->n;1434 psS32 i; 1435 psS32 vecLen=x->n; 1436 1436 1437 1437 PS_CONVERT_VECTOR_F64(x, myX); … … 1475 1475 double p_psDOrdPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D* myPoly) 1476 1476 { 1477 intloop_w = 0;1478 intloop_x = 0;1479 intloop_y = 0;1480 intloop_z = 0;1477 psS32 loop_w = 0; 1478 psS32 loop_x = 0; 1479 psS32 loop_y = 0; 1480 psS32 loop_z = 0; 1481 1481 double polySum = 0.0; 1482 1482 double wSum = 1.0; … … 1509 1509 double p_psDChebPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D* myPoly) 1510 1510 { 1511 intloop_w = 0;1512 intloop_x = 0;1513 intloop_y = 0;1514 intloop_z = 0;1515 inti = 0;1511 psS32 loop_w = 0; 1512 psS32 loop_x = 0; 1513 psS32 loop_y = 0; 1514 psS32 loop_z = 0; 1515 psS32 i = 0; 1516 1516 double polySum = 0.0; 1517 1517 psPolynomial1D* *chebPolys = NULL; 1518 intmaxChebyPoly = 0;1518 psS32 maxChebyPoly = 0; 1519 1519 1520 1520 // Determine how many Chebyshev polynomials … … 1578 1578 psVector *myY; 1579 1579 psVector *myZ; 1580 inti;1581 intvecLen=x->n;1580 psS32 i; 1581 psS32 vecLen=x->n; 1582 1582 1583 1583 PS_CONVERT_VECTOR_F64(w, myW); … … 1624 1624 1625 1625 //typedef struct { 1626 // intn;1626 // psS32 n; 1627 1627 // psPolynomial1D **spline; 1628 1628 // float *p_psDeriv2; … … 1636 1636 XXX: Ensure that domain[i+1] != domain[i] 1637 1637 *****************************************************************************/ 1638 psSpline1D *psSpline1DAlloc( intnumSplines,1639 intorder,1638 psSpline1D *psSpline1DAlloc(psS32 numSplines, 1639 psS32 order, 1640 1640 float min, 1641 1641 float max) 1642 1642 { 1643 1643 psSpline1D *tmp = NULL; 1644 inti;1644 psS32 i; 1645 1645 float tmpDomain; 1646 1646 float width; … … 1677 1677 1678 1678 // XXX: Have Robert put the dealocator in the memory file. 1679 intp_psSpline1DFree(psSpline1D *tmpSpline)1680 { 1681 inti;1679 psS32 p_psSpline1DFree(psSpline1D *tmpSpline) 1680 { 1681 psS32 i; 1682 1682 1683 1683 if (tmpSpline == NULL) { … … 1704 1704 *****************************************************************************/ 1705 1705 psSpline1D *psSpline1DAllocGeneric(const psVector *bounds, 1706 intorder)1706 psS32 order) 1707 1707 { 1708 1708 psSpline1D *tmp = NULL; 1709 inti;1710 intnumSplines;1709 psS32 i; 1710 psS32 numSplines; 1711 1711 1712 1712 tmp = (psSpline1D *) psAlloc(sizeof(psSpline1D)); … … 1746 1746 XXX: name since we don't take psVectors as input. 1747 1747 *****************************************************************************/ 1748 intp_psVectorBinDisectF32(float *bins,1749 intnumBins,1750 float x)1751 { 1752 intmin;1753 intmax;1754 intmid;1748 psS32 p_psVectorBinDisectF32(float *bins, 1749 psS32 numBins, 1750 float x) 1751 { 1752 psS32 min; 1753 psS32 max; 1754 psS32 mid; 1755 1755 1756 1756 psTrace(".psLib.dataManip.psFunctions.p_psVectorBinDisectF32", 4, … … 1800 1800 p_psVectorBinDisectS32(): integer version of above. 1801 1801 *****************************************************************************/ 1802 int p_psVectorBinDisectS32(int*bins,1803 intnumBins,1804 intx)1805 { 1806 intmin;1807 intmax;1808 intmid;1802 psS32 p_psVectorBinDisectS32(psS32 *bins, 1803 psS32 numBins, 1804 psS32 x) 1805 { 1806 psS32 min; 1807 psS32 max; 1808 psS32 mid; 1809 1809 1810 1810 psTrace(".psLib.dataManip.psFunctions.p_psVectorBinDisectS32", 4, … … 1848 1848 p_psVectorBinDisect(): A wrapper to the above p_psVectorBinDisect(). 1849 1849 *****************************************************************************/ 1850 intp_psVectorBinDisect(psVector *bins,1851 psScalar *x)1850 psS32 p_psVectorBinDisect(psVector *bins, 1851 psScalar *x) 1852 1852 { 1853 1853 if (x->type.type != bins->type.type) { … … 1877 1877 float p_ps1DFullInterpolateF32(float *domain, 1878 1878 float *range, 1879 intn,1879 psS32 n, 1880 1880 float x) 1881 1881 { 1882 inti;1883 intm;1882 psS32 i; 1883 psS32 m; 1884 1884 static psVector *p = NULL; 1885 1885 p = psVectorRecycle(p, n, PS_TYPE_F32); … … 1937 1937 float p_ps1DInterpolateF32(float *domain, 1938 1938 float *range, 1939 intn,1940 intorder,1939 psS32 n, 1940 psS32 order, 1941 1941 float x) 1942 1942 { 1943 intbinNum;1944 intnumIntPoints = order+1;1945 intorigin;1943 psS32 binNum; 1944 psS32 numIntPoints = order+1; 1945 psS32 origin; 1946 1946 1947 1947 psTrace(".psLib.dataManip.psFunctions.p_ps1DInterpolateF32", 4, … … 1987 1987 psScalar *p_psVectorInterpolate(psVector *domain, 1988 1988 psVector *range, 1989 intorder,1989 psS32 order, 1990 1990 psScalar *x) 1991 1991 { … … 2065 2065 float x) 2066 2066 { 2067 intbinNum;2068 intn;2067 psS32 binNum; 2068 psS32 n; 2069 2069 2070 2070 n = spline->n; … … 2091 2091 const psSpline1D *spline) 2092 2092 { 2093 inti;2093 psS32 i; 2094 2094 psVector *tmpVector; 2095 2095 -
trunk/psLib/src/dataManip/psFunctions.h
r1968 r2204 12 12 * @author George Gusciora, MHPCC 13 13 * 14 * @version $Revision: 1.3 0$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-10- 06 00:48:15$14 * @version $Revision: 1.31 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-10-27 00:57:31 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 45 45 float mean, ///< Mean for the Gaussian 46 46 float stddev, ///< Standard deviation for the Gaussian 47 bool normal ///< Indicates whether result should be normalized47 psBool normal ///< Indicates whether result should be normalized 48 48 ); 49 49 … … 57 57 float mean, ///< The mean of the Gaussian 58 58 float sigma, ///< The sigma of the Gaussian 59 intNpts ///< The size of the vector59 psS32 Npts ///< The size of the vector 60 60 ); 61 61 … … 69 69 { 70 70 psPolynomialType type; ///< Polynomial type 71 intn; ///< Number of terms71 psS32 n; ///< Number of terms 72 72 float *coeff; ///< Coefficients 73 73 float *coeffErr; ///< Error in coefficients … … 80 80 { 81 81 psPolynomialType type; ///< Polynomial type 82 intnX; ///< Number of terms in x83 intnY; ///< Number of terms in y82 psS32 nX; ///< Number of terms in x 83 psS32 nY; ///< Number of terms in y 84 84 float **coeff; ///< Coefficients 85 85 float **coeffErr; ///< Error in coefficients … … 92 92 { 93 93 psPolynomialType type; ///< Polynomial type 94 intnX; ///< Number of terms in x95 intnY; ///< Number of terms in y96 intnZ; ///< Number of terms in z94 psS32 nX; ///< Number of terms in x 95 psS32 nY; ///< Number of terms in y 96 psS32 nZ; ///< Number of terms in z 97 97 float ***coeff; ///< Coefficients 98 98 float ***coeffErr; ///< Error in coefficients … … 105 105 { 106 106 psPolynomialType type; ///< Polynomial type 107 intnW; ///< Number of terms in w108 intnX; ///< Number of terms in x109 intnY; ///< Number of terms in y110 intnZ; ///< Number of terms in z107 psS32 nW; ///< Number of terms in w 108 psS32 nX; ///< Number of terms in x 109 psS32 nY; ///< Number of terms in y 110 psS32 nZ; ///< Number of terms in z 111 111 float ****coeff; ///< Coefficients 112 112 float ****coeffErr; ///< Error in coefficients … … 121 121 */ 122 122 psPolynomial1D* psPolynomial1DAlloc( 123 intn, ///< Number of terms123 psS32 n, ///< Number of terms 124 124 psPolynomialType type ///< Polynomial Type 125 125 ); … … 130 130 */ 131 131 psPolynomial2D* psPolynomial2DAlloc( 132 intnX, ///< Number of terms in x133 intnY, ///< Number of terms in y132 psS32 nX, ///< Number of terms in x 133 psS32 nY, ///< Number of terms in y 134 134 psPolynomialType type ///< Polynomial Type 135 135 ); … … 140 140 */ 141 141 psPolynomial3D* psPolynomial3DAlloc( 142 intnX, ///< Number of terms in x143 intnY, ///< Number of terms in y144 intnZ, ///< Number of terms in z142 psS32 nX, ///< Number of terms in x 143 psS32 nY, ///< Number of terms in y 144 psS32 nZ, ///< Number of terms in z 145 145 psPolynomialType type ///< Polynomial Type 146 146 ); … … 151 151 */ 152 152 psPolynomial4D* psPolynomial4DAlloc( 153 intnW, ///< Number of terms in w154 intnX, ///< Number of terms in x155 intnY, ///< Number of terms in y156 intnZ, ///< Number of terms in z153 psS32 nW, ///< Number of terms in w 154 psS32 nX, ///< Number of terms in x 155 psS32 nY, ///< Number of terms in y 156 psS32 nZ, ///< Number of terms in z 157 157 psPolynomialType type ///< Polynomial Type 158 158 ); … … 230 230 { 231 231 psPolynomialType type; ///< Polynomial type 232 intn; ///< Number of terms232 psS32 n; ///< Number of terms 233 233 double *coeff; ///< Coefficients 234 234 double *coeffErr; ///< Error in coefficients … … 241 241 { 242 242 psPolynomialType type; ///< Polynomial type 243 intnX; ///< Number of terms in x244 intnY; ///< Number of terms in y243 psS32 nX; ///< Number of terms in x 244 psS32 nY; ///< Number of terms in y 245 245 double **coeff; ///< Coefficients 246 246 double **coeffErr; ///< Error in coefficients … … 253 253 { 254 254 psPolynomialType type; ///< Polynomial type 255 intnX; ///< Number of terms in x256 intnY; ///< Number of terms in y257 intnZ; ///< Number of terms in z255 psS32 nX; ///< Number of terms in x 256 psS32 nY; ///< Number of terms in y 257 psS32 nZ; ///< Number of terms in z 258 258 double ***coeff; ///< Coefficients 259 259 double ***coeffErr; ///< Error in coefficients … … 266 266 { 267 267 psPolynomialType type; ///< Polynomial type 268 intnW; ///< Number of terms in w269 intnX; ///< Number of terms in x270 intnY; ///< Number of terms in y271 intnZ; ///< Number of terms in z268 psS32 nW; ///< Number of terms in w 269 psS32 nX; ///< Number of terms in x 270 psS32 nY; ///< Number of terms in y 271 psS32 nZ; ///< Number of terms in z 272 272 double ****coeff; ///< Coefficients 273 273 double ****coeffErr; ///< Error in coefficients … … 281 281 */ 282 282 psDPolynomial1D* psDPolynomial1DAlloc( 283 intn, ///< Number of terms283 psS32 n, ///< Number of terms 284 284 psPolynomialType type ///< Polynomial Type 285 285 ); … … 290 290 */ 291 291 psDPolynomial2D* psDPolynomial2DAlloc( 292 intnX, ///< Number of terms in x293 intnY, ///< Number of terms in y292 psS32 nX, ///< Number of terms in x 293 psS32 nY, ///< Number of terms in y 294 294 psPolynomialType type ///< Polynomial Type 295 295 ); … … 300 300 */ 301 301 psDPolynomial3D* psDPolynomial3DAlloc( 302 intnX, ///< Number of terms in x303 intnY, ///< Number of terms in y304 intnZ, ///< Number of terms in z302 psS32 nX, ///< Number of terms in x 303 psS32 nY, ///< Number of terms in y 304 psS32 nZ, ///< Number of terms in z 305 305 psPolynomialType type ///< Polynomial Type 306 306 ); … … 311 311 */ 312 312 psDPolynomial4D* psDPolynomial4DAlloc( 313 intnW, ///< Number of terms in w314 intnX, ///< Number of terms in x315 intnY, ///< Number of terms in y316 intnZ, ///< Number of terms in z313 psS32 nW, ///< Number of terms in w 314 psS32 nX, ///< Number of terms in x 315 psS32 nY, ///< Number of terms in y 316 psS32 nZ, ///< Number of terms in z 317 317 psPolynomialType type ///< Polynomial Type 318 318 ); … … 386 386 typedef struct 387 387 { 388 intn; ///< The number of spline polynomials388 psS32 n; ///< The number of spline polynomials 389 389 psPolynomial1D **spline; ///< An array of n pointers to the spline polynomials 390 390 float *p_psDeriv2; ///< For cubic splines, the second derivative at each domain point. Size is n+1. … … 393 393 psSpline1D; 394 394 395 psSpline1D *psSpline1DAlloc( intn,396 intorder,395 psSpline1D *psSpline1DAlloc(psS32 n, 396 psS32 order, 397 397 float min, 398 398 float max); 399 399 400 intp_psSpline1DFree(psSpline1D *tmpSpline);400 psS32 p_psSpline1DFree(psSpline1D *tmpSpline); 401 401 402 402 psSpline1D *psSpline1DAllocGeneric(const psVector *bounds, 403 intorder);403 psS32 order); 404 404 405 405 float psSpline1DEval(const psSpline1D *spline, … … 409 409 const psSpline1D *spline); 410 410 411 intp_psVectorBinDisectF32(float *bins,412 intnumBins,413 float x);414 415 int p_psVectorBinDisectS32(int*bins,416 intnumBins,417 intx);418 419 intp_psVectorBinDisect(psVector *bins,420 psScalar *x);411 psS32 p_psVectorBinDisectF32(float *bins, 412 psS32 numBins, 413 float x); 414 415 psS32 p_psVectorBinDisectS32(psS32 *bins, 416 psS32 numBins, 417 psS32 x); 418 419 psS32 p_psVectorBinDisect(psVector *bins, 420 psScalar *x); 421 421 422 422 psScalar *p_psVectorInterpolate(psVector *domain, 423 423 psVector *range, 424 intorder,424 psS32 order, 425 425 psScalar *x); 426 426 -
trunk/psLib/src/dataManip/psMatrix.c
r2021 r2204 20 20 * @author Ross Harman, MHPCC 21 21 * 22 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $23 * @date $Date: 2004-10- 08 02:48:01 $22 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 23 * @date $Date: 2004-10-27 00:57:31 $ 24 24 * 25 25 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 119 119 psImage* psMatrixLUD(psImage* outImage, psVector* outPerm, psImage* inImage) 120 120 { 121 intsignum = 0;122 intarraySize = 0;123 intnumRows = 0;124 intnumCols = 0;121 psS32 signum = 0; 122 psS32 arraySize = 0; 123 psS32 numRows = 0; 124 psS32 numCols = 0; 125 125 gsl_matrix lu; 126 126 gsl_permutation perm; … … 165 165 const psVector* inVector, const psVector* inPerm) 166 166 { 167 intarraySize = 0;168 intnumRows = 0;169 intnumCols = 0;167 psS32 arraySize = 0; 168 psS32 numRows = 0; 169 psS32 numCols = 0; 170 170 gsl_matrix lu; 171 171 gsl_permutation perm; … … 217 217 psImage* psMatrixInvert(psImage* outImage, const psImage* inImage, float *restrict det) 218 218 { 219 intsignum = 0;220 intarraySize = 0;221 intnumRows = 0;222 intnumCols = 0;219 psS32 signum = 0; 220 psS32 arraySize = 0; 221 psS32 numRows = 0; 222 psS32 numCols = 0; 223 223 gsl_matrix inv; 224 224 gsl_matrix *lu; … … 271 271 float *psMatrixDeterminant(const psImage* restrict inImage) 272 272 { 273 intsignum = 0;274 intarraySize = 0;275 intnumRows = 0;276 intnumCols = 0;273 psS32 signum = 0; 274 psS32 arraySize = 0; 275 psS32 numRows = 0; 276 psS32 numCols = 0; 277 277 float *det = NULL; 278 278 gsl_matrix *lu = NULL; … … 313 313 psImage* psMatrixMultiply(psImage* outImage, psImage* inImage1, psImage* inImage2) 314 314 { 315 intarraySize = 0;316 intnumRows = 0;317 intnumCols = 0;315 psS32 arraySize = 0; 316 psS32 numRows = 0; 317 psS32 numCols = 0; 318 318 gsl_matrix m1; 319 319 gsl_matrix m2; … … 355 355 psImage* psMatrixTranspose(psImage* outImage, const psImage* inImage) 356 356 { 357 intarraySize = 0;358 intnumRows = 0;359 intnumCols = 0;357 psS32 arraySize = 0; 358 psS32 numRows = 0; 359 psS32 numCols = 0; 360 360 gsl_matrix trans; 361 361 … … 392 392 psImage* psMatrixEigenvectors(psImage* outImage, psImage* inImage) 393 393 { 394 intnumRows = 0;395 intnumCols = 0;394 psS32 numRows = 0; 395 psS32 numCols = 0; 396 396 gsl_vector *eVals = NULL; 397 397 gsl_eigen_symmv_workspace *w = NULL; … … 436 436 psVector* psMatrixToVector(psVector* outVector, const psImage* inImage) 437 437 { 438 intsize = 0;438 psS32 size = 0; 439 439 440 440 // Error checks … … 495 495 psImage* psVectorToMatrix(psImage* outImage, const psVector* inVector) 496 496 { 497 intsize = 0;497 psS32 size = 0; 498 498 499 499 // Error checks -
trunk/psLib/src/dataManip/psMatrixVectorArithmetic.c
r2021 r2204 29 29 * @author Ross Harman, MHPCC 30 30 * 31 * @version $Revision: 1.2 8$ $Name: not supported by cvs2svn $32 * @date $Date: 2004-10- 08 02:48:01 $31 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 32 * @date $Date: 2004-10-27 00:57:31 $ 33 33 * 34 34 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 88 88 #define SCALAR_VECTOR(OUT,IN1,OP,IN2,TYPE) \ 89 89 { \ 90 inti = 0; \91 intnpt = 0; \90 psS32 i = 0; \ 91 psS32 npt = 0; \ 92 92 ps##TYPE *o = NULL; \ 93 93 ps##TYPE *i1 = NULL; \ … … 104 104 #define SCALAR_IMAGE(OUT,IN1,OP,IN2,TYPE) \ 105 105 { \ 106 inti = 0; \107 intj = 0; \108 intnumRows = 0; \109 intnumCols = 0; \106 psS32 i = 0; \ 107 psS32 j = 0; \ 108 psS32 numRows = 0; \ 109 psS32 numCols = 0; \ 110 110 ps##TYPE *o = NULL; \ 111 111 ps##TYPE *i1 = NULL; \ … … 126 126 #define VECTOR_SCALAR(OUT,IN1,OP,IN2,TYPE) \ 127 127 { \ 128 inti = 0; \129 intn1 = 0; \128 psS32 i = 0; \ 129 psS32 n1 = 0; \ 130 130 ps##TYPE *o = NULL; \ 131 131 ps##TYPE *i1 = NULL; \ … … 142 142 #define VECTOR_VECTOR(OUT,IN1,OP,IN2,TYPE) \ 143 143 { \ 144 inti = 0; \145 intn1 = 0; \146 intn2 = 0; \144 psS32 i = 0; \ 145 psS32 n1 = 0; \ 146 psS32 n2 = 0; \ 147 147 ps##TYPE *o = NULL; \ 148 148 ps##TYPE *i1 = NULL; \ … … 167 167 #define VECTOR_IMAGE(OUT,IN1,OP,IN2,TYPE) \ 168 168 { \ 169 inti = 0; \170 intj = 0; \171 intn1 = 0; \172 intnumRows2 = 0; \173 intnumCols2 = 0; \169 psS32 i = 0; \ 170 psS32 j = 0; \ 171 psS32 n1 = 0; \ 172 psS32 numRows2 = 0; \ 173 psS32 numCols2 = 0; \ 174 174 psDimen dim1 = 0; \ 175 175 ps##TYPE *o = NULL; \ … … 221 221 #define IMAGE_SCALAR(OUT,IN1,OP,IN2,TYPE) \ 222 222 { \ 223 inti = 0; \224 intj = 0; \225 intnumRows = 0; \226 intnumCols = 0; \223 psS32 i = 0; \ 224 psS32 j = 0; \ 225 psS32 numRows = 0; \ 226 psS32 numCols = 0; \ 227 227 ps##TYPE *o = NULL; \ 228 228 ps##TYPE *i1 = NULL; \ … … 242 242 #define IMAGE_VECTOR(OUT,IN1,OP,IN2,TYPE) \ 243 243 { \ 244 inti = 0; \245 intj = 0; \246 intn2 = 0; \247 intnumRows1 = 0; \248 intnumCols1 = 0; \244 psS32 i = 0; \ 245 psS32 j = 0; \ 246 psS32 n2 = 0; \ 247 psS32 numRows1 = 0; \ 248 psS32 numCols1 = 0; \ 249 249 psDimen dim2 = 0; \ 250 250 ps##TYPE *o = NULL; \ … … 295 295 #define IMAGE_IMAGE(OUT,IN1,OP,IN2,TYPE) \ 296 296 { \ 297 inti = 0; \298 intj = 0; \299 intnumRows1 = 0; \300 intnumCols1 = 0; \301 intnumRows2 = 0; \302 intnumCols2 = 0; \297 psS32 i = 0; \ 298 psS32 j = 0; \ 299 psS32 numRows1 = 0; \ 300 psS32 numCols1 = 0; \ 301 psS32 numRows2 = 0; \ 302 psS32 numCols2 = 0; \ 303 303 ps##TYPE *o = NULL; \ 304 304 ps##TYPE *i1 = NULL; \ … … 417 417 } 418 418 419 void *psBinaryOp(void *out, void *in1, char *op, void *in2)419 psPtr psBinaryOp(psPtr out, psPtr in1, char *op, psPtr in2) 420 420 { 421 421 psDimen dim1 = 0; … … 605 605 #define VECTOR(OUT,IN,OP,TYPE) \ 606 606 { \ 607 inti = 0; \608 intnIn = 0; \609 intnOut = 0; \607 psS32 i = 0; \ 608 psS32 nIn = 0; \ 609 psS32 nOut = 0; \ 610 610 ps##TYPE *o = NULL; \ 611 611 ps##TYPE *i1 = NULL; \ … … 629 629 #define IMAGE(OUT,IN,OP,TYPE) \ 630 630 { \ 631 inti = 0; \632 intj = 0; \633 intnumRowsIn = 0; \634 intnumColsIn = 0; \635 intnumRowsOut = 0; \636 intnumColsOut = 0; \631 psS32 i = 0; \ 632 psS32 j = 0; \ 633 psS32 numRowsIn = 0; \ 634 psS32 numColsIn = 0; \ 635 psS32 numRowsOut = 0; \ 636 psS32 numColsOut = 0; \ 637 637 ps##TYPE *o = NULL; \ 638 638 ps##TYPE *i1 = NULL; \ … … 818 818 } 819 819 820 void *psUnaryOp(void *out, void *in, char *op)820 psPtr psUnaryOp(psPtr out, psPtr in, char *op) 821 821 { 822 822 psDimen dimIn = 0; -
trunk/psLib/src/dataManip/psMatrixVectorArithmetic.h
r1464 r2204 30 30 * @author Ross Harman, MHPCC 31 31 * 32 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $33 * @date $Date: 2004- 08-11 02:37:55$32 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 33 * @date $Date: 2004-10-27 00:57:31 $ 34 34 * 35 35 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 56 56 */ 57 57 psType* psBinaryOp( 58 void *out, ///< Output type, either psImage or psVector.59 void *in1, ///< First input, either psImage or psVector.58 psPtr out, ///< Output type, either psImage or psVector. 59 psPtr in1, ///< First input, either psImage or psVector. 60 60 char *op, ///< Operator. 61 void *in2 ///< Second input, either psImage or psVector.61 psPtr in2 ///< Second input, either psImage or psVector. 62 62 ); 63 63 … … 79 79 */ 80 80 psType* psUnaryOp( 81 void *out, ///< Output type, either psImage or psVector.82 void *in, ///< Input, either psImage or psVector.81 psPtr out, ///< Output type, either psImage or psVector. 82 psPtr in, ///< Input, either psImage or psVector. 83 83 char *op ///< Operator. 84 84 ); -
trunk/psLib/src/dataManip/psMinimize.c
r2202 r2204 9 9 * @author GLF, MHPCC 10 10 * 11 * @version $Revision: 1.6 0$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10-2 6 23:14:04$11 * @version $Revision: 1.61 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:31 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 59 59 *****************************************************************************/ 60 60 void p_psBuildSums1D(double x, 61 intpolyOrder,61 psS32 polyOrder, 62 62 psVector* sums) 63 63 { 64 inti = 0;64 psS32 i = 0; 65 65 double xSum = 0.0; 66 66 … … 101 101 "---- CalculateSecondDerivs() begin ----\n"); 102 102 103 inti;104 intk;105 bool mustFreeX = false;103 psS32 i; 104 psS32 k; 105 psBool mustFreeX = false; 106 106 float sig; 107 107 float p; 108 intn = y->n;108 psS32 n = y->n; 109 109 float *u = (float *) psAlloc(n * sizeof(float)); 110 110 float *derivs2 = (float *) psAlloc(n * sizeof(float)); … … 173 173 float X) 174 174 { 175 intn;176 intklo;177 intkhi;175 psS32 n; 176 psS32 klo; 177 psS32 khi; 178 178 float H; 179 179 float A; … … 240 240 psTrace(".psLib.dataManip.psVectorFitSpline1D", 4, 241 241 "---- psVectorFitSpline1D() begin ----\n"); 242 intnumSplines = (y->n)-1;242 psS32 numSplines = (y->n)-1; 243 243 float tmp; 244 244 float H; 245 inti;245 psS32 i; 246 246 float slope; 247 247 psVector *x32 = NULL; … … 416 416 the F64 port might be. 417 417 *****************************************************************************/ 418 bool psMinimizeLMChi2(psMinimization *min,419 psImage *covar,420 psVector *params,421 const psVector *paramMask,422 const psArray *x,423 const psVector *y,424 const psVector *yErr,425 psMinimizeLMChi2Func func)418 psBool psMinimizeLMChi2(psMinimization *min, 419 psImage *covar, 420 psVector *params, 421 const psVector *paramMask, 422 const psArray *x, 423 const psVector *y, 424 const psVector *yErr, 425 psMinimizeLMChi2Func func) 426 426 { 427 427 PS_CHECK_NULL_PTR_RETURN_NULL(min); … … 441 441 psTrace(".psLib.dataManip.psMinimizeLMChi2", 4, 442 442 "---- psMinimizeLMChi2() begin ----\n"); 443 intnumData = y->n;444 intnumParams = params->n;445 inti;446 intj;447 intk;448 intl;449 intn;450 intp;443 psS32 numData = y->n; 444 psS32 numParams = params->n; 445 psS32 i; 446 psS32 j; 447 psS32 k; 448 psS32 l; 449 psS32 n; 450 psS32 p; 451 451 psVector *beta = psVectorAlloc(numParams, PS_TYPE_F64); 452 452 psVector *perm = psVectorAlloc(numParams, PS_TYPE_F64); … … 663 663 const psVector* restrict yErr) 664 664 { 665 intj;666 intk;667 intn = x->n;665 psS32 j; 666 psS32 k; 667 psS32 n = x->n; 668 668 double fac; 669 669 double sum; … … 689 689 // are fitting this ChebyShev polynomial to. 690 690 691 for ( inti=0;i<n;i++) {691 for (psS32 i=0;i<n;i++) { 692 692 // NR 5.8.4 693 693 double Y = cos(M_PI * (0.5 + ((float) i)) / ((float) n)); … … 741 741 const psVector* restrict yErr) 742 742 { 743 intpolyOrder = myPoly->n;743 psS32 polyOrder = myPoly->n; 744 744 psImage* A = NULL; 745 745 psImage* ALUD = NULL; … … 748 748 psVector* X = NULL; // NOTE: do we need this? 749 749 psVector* coeffs = NULL; 750 inti = 0;751 intj = 0;752 intk = 0;750 psS32 i = 0; 751 psS32 j = 0; 752 psS32 k = 0; 753 753 psVector* xSums = NULL; 754 754 … … 853 853 const psVector* restrict yErr) 854 854 { 855 inti;855 psS32 i; 856 856 psPolynomial1D *tmpPoly; 857 857 PS_CHECK_NULL_1DPOLY_RETURN_NULL(myPoly); … … 908 908 /****************************************************************************** 909 909 *****************************************************************************/ 910 psMinimization *psMinimizationAlloc( intmaxIter,910 psMinimization *psMinimizationAlloc(psS32 maxIter, 911 911 float tol) 912 912 { … … 952 952 float fb = 0.0; 953 953 float fc = 0.0; 954 intiter = 100;954 psS32 iter = 100; 955 955 float aDir = 0.0; 956 956 float cDir = 0.0; … … 960 960 float stepSize = DETERMINE_BRACKET_STEP_SIZE; 961 961 psVector *tmp = NULL; 962 inti = 0;963 intnull = 0;962 psS32 i = 0; 963 psS32 null = 0; 964 964 965 965 psTrace(".psLib.dataManip.p_psDetermineBracket", 4, … … 1141 1141 psVector *tmpc = NULL; 1142 1142 psVector *tmpn = NULL; 1143 inti = 0;1144 intnull = 0;1143 psS32 i = 0; 1144 psS32 null = 0; 1145 1145 1146 1146 psTrace(".psLib.dataManip.p_psLineMin", 4, … … 1313 1313 XXX: Check for F32 types? 1314 1314 *****************************************************************************/ 1315 bool psMinimizePowell(psMinimization *min,1316 psVector *params,1317 const psVector *paramMask,1318 const psArray *coords,1319 psMinimizePowellFunc func)1315 psBool psMinimizePowell(psMinimization *min, 1316 psVector *params, 1317 const psVector *paramMask, 1318 const psArray *coords, 1319 psMinimizePowellFunc func) 1320 1320 { 1321 1321 PS_CHECK_NULL_VECTOR_RETURN_NULL(params); … … 1325 1325 PS_CHECK_NULL_PTR_RETURN_NULL(func); 1326 1326 1327 intnumDims = params->n;1328 inti = 0;1329 intj = 0;1327 psS32 numDims = params->n; 1328 psS32 i = 0; 1329 psS32 j = 0; 1330 1330 psVector **v = NULL; 1331 1331 psVector *pQP = NULL; … … 1337 1337 float baseFuncVal = 0.0; 1338 1338 float currFuncVal = 0.0; 1339 intbiggestIter = 0;1339 psS32 biggestIter = 0; 1340 1340 float biggestDiff = 0.0; 1341 1341 float term1 = 0.0; … … 1529 1529 float chi2 = 0.0; 1530 1530 float d; 1531 inti;1531 psS32 i; 1532 1532 psVector *tmp; 1533 1533 … … 1552 1552 psMinimizePowell(). 1553 1553 *****************************************************************************/ 1554 bool psMinimizeChi2Powell(psMinimization *min,1555 psVector *params,1556 const psVector *paramMask,1557 const psArray *coords,1558 const psVector *value,1559 const psVector *error,1560 psMinimizeChi2PowellFunc func)1554 psBool psMinimizeChi2Powell(psMinimization *min, 1555 psVector *params, 1556 const psVector *paramMask, 1557 const psArray *coords, 1558 const psVector *value, 1559 const psVector *error, 1560 psMinimizeChi2PowellFunc func) 1561 1561 { 1562 1562 myValue = (psVector *) value; -
trunk/psLib/src/dataManip/psMinimize.h
r2202 r2204 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.3 1$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-10-2 6 23:14:04$10 * @version $Revision: 1.32 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-10-27 00:57:31 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 46 46 typedef struct 47 47 { 48 intmaxIter; ///< Convergence limit48 psS32 maxIter; ///< Convergence limit 49 49 float tol; ///< Error Tolerance 50 50 float value; ///< Value of function at minimum 51 intiter; ///< Number of iterations required51 psS32 iter; ///< Number of iterations required 52 52 float lastDelta; ///< The last difference for the fit 53 53 } 54 54 psMinimization; 55 55 56 psMinimization *psMinimizationAlloc( intmaxIter,56 psMinimization *psMinimizationAlloc(psS32 maxIter, 57 57 float tol); 58 58 … … 88 88 const psArray *x); 89 89 90 bool psMinimizeLMChi2(psMinimization *min,91 psImage *covar,92 psVector *params,93 const psVector *paramMask,94 const psArray *x,95 const psVector *y,96 const psVector *yErr,97 psMinimizeLMChi2Func func);90 psBool psMinimizeLMChi2(psMinimization *min, 91 psImage *covar, 92 psVector *params, 93 const psVector *paramMask, 94 const psArray *x, 95 const psVector *y, 96 const psVector *yErr, 97 psMinimizeLMChi2Func func); 98 98 99 99 typedef … … 101 101 const psArray *coords); 102 102 103 bool psMinimizePowell(psMinimization *min,104 psVector *params,105 const psVector *paramMask,106 const psArray *coords,107 psMinimizePowellFunc func);103 psBool psMinimizePowell(psMinimization *min, 104 psVector *params, 105 const psVector *paramMask, 106 const psArray *coords, 107 psMinimizePowellFunc func); 108 108 109 109 typedef … … 111 111 const psArray *coords); 112 112 113 bool psMinimizeChi2Powell(psMinimization *min,114 psVector *params,115 const psVector *paramMask,116 const psArray *coords,117 const psVector *value,118 const psVector *error,119 psMinimizeChi2PowellFunc func);113 psBool psMinimizeChi2Powell(psMinimization *min, 114 psVector *params, 115 const psVector *paramMask, 116 const psArray *coords, 117 const psVector *value, 118 const psVector *error, 119 psMinimizeChi2PowellFunc func); 120 120 121 121 -
trunk/psLib/src/dataManip/psStats.c
r2197 r2204 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.6 8$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10-2 6 21:24:43$11 * @version $Revision: 1.69 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:31 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 51 51 52 52 void p_psVectorRobustStats(const psVector* restrict myVector, 53 const psVector* restrict maskVector, unsigned intmaskVal, psStats* stats);53 const psVector* restrict maskVector, psU32 maskVal, psStats* stats); 54 54 55 55 … … 75 75 /*****************************************************************************/ 76 76 77 bool p_psGetStatValue(const psStats* stats, double *value)77 psBool p_psGetStatValue(const psStats* stats, double *value) 78 78 { 79 79 … … 134 134 *****************************************************************************/ 135 135 136 void p_psVectorPrint(psVector* myVector, psVector* maskVector, unsigned intmaskVal, psStats* stats)137 { 138 inti = 0; // Loop index variable.136 void p_psVectorPrint(psVector* myVector, psVector* maskVector, psU32 maskVal, psStats* stats) 137 { 138 psS32 i = 0; // Loop index variable. 139 139 140 140 for (i = 0; i < myVector->n; i++) { … … 178 178 179 179 void p_psVectorSampleMean(const psVector* restrict myVector, 180 const psVector* restrict maskVector, unsigned intmaskVal, psStats* stats)181 { 182 inti = 0; // Loop index variable180 const psVector* restrict maskVector, psU32 maskVal, psStats* stats) 181 { 182 psS32 i = 0; // Loop index variable 183 183 float mean = 0.0; // The mean 184 intcount = 0; // # of points in this mean?184 psS32 count = 0; // # of points in this mean? 185 185 float rangeMin = 0.0; // Exclude data below this 186 186 float rangeMax = 0.0; // Exclude date above this … … 242 242 *****************************************************************************/ 243 243 void p_psVectorMax(const psVector* restrict myVector, 244 const psVector* restrict maskVector, unsigned intmaskVal, psStats* stats)245 { 246 inti = 0; // Loop index variable244 const psVector* restrict maskVector, psU32 maskVal, psStats* stats) 245 { 246 psS32 i = 0; // Loop index variable 247 247 float max = -MY_MAX_FLOAT; // The calculated maximum 248 248 float rangeMin = 0.0; // Exclude data below this … … 303 303 *****************************************************************************/ 304 304 void p_psVectorMin(const psVector* restrict myVector, 305 const psVector* restrict maskVector, unsigned intmaskVal, psStats* stats)306 { 307 inti = 0; // Loop index variable305 const psVector* restrict maskVector, psU32 maskVal, psStats* stats) 306 { 307 psS32 i = 0; // Loop index variable 308 308 float min = MY_MAX_FLOAT; // The calculated maximum 309 309 float rangeMin = 0.0; // Exclude data below this … … 363 363 NULL 364 364 *****************************************************************************/ 365 intp_psVectorNValues(const psVector* restrict myVector,366 const psVector* restrict maskVector, unsigned intmaskVal, psStats* stats)367 { 368 inti = 0; // Loop index variable369 intnumData = 0; // The number of data points365 psS32 p_psVectorNValues(const psVector* restrict myVector, 366 const psVector* restrict maskVector, psU32 maskVal, psStats* stats) 367 { 368 psS32 i = 0; // Loop index variable 369 psS32 numData = 0; // The number of data points 370 370 float rangeMin = 0.0; // Exclude data below this 371 371 float rangeMax = 0.0; // Exclude date above this … … 414 414 *****************************************************************************/ 415 415 void p_psVectorSampleMedian(const psVector* restrict myVector, 416 const psVector* restrict maskVector, unsigned intmaskVal, psStats* stats)416 const psVector* restrict maskVector, psU32 maskVal, psStats* stats) 417 417 { 418 418 psVector* unsortedVector = NULL; // Temporary vector 419 419 psVector* sortedVector = NULL; // Temporary vector 420 inti = 0; // Loop index variable421 intcount = 0; // # of points in this mean?422 intnValues = 0; // # of points in vector420 psS32 i = 0; // Loop index variable 421 psS32 count = 0; // # of points in this mean? 422 psS32 nValues = 0; // # of points in vector 423 423 float rangeMin = 0.0; // Exclude data below this 424 424 float rangeMax = 0.0; // Exclude date above this … … 497 497 float sigma) 498 498 { 499 inti = 0; // Loop index variable500 intj = 0; // Loop index variable499 psS32 i = 0; // Loop index variable 500 psS32 j = 0; // Loop index variable 501 501 float iMid; 502 502 float jMid; 503 intnumBins = robustHistogram->nums->n;504 intnumBounds = robustHistogram->bounds->n;503 psS32 numBins = robustHistogram->nums->n; 504 psS32 numBounds = robustHistogram->bounds->n; 505 505 psVector* smooth = psVectorAlloc(numBins, PS_TYPE_F32); 506 intjMin = 0;507 intjMax = 0;506 psS32 jMin = 0; 507 psS32 jMax = 0; 508 508 float firstBound = robustHistogram->bounds->data.F32[0]; 509 509 float lastBound = robustHistogram->bounds->data.F32[numBounds-1]; … … 566 566 *****************************************************************************/ 567 567 void p_psVectorSampleQuartiles(const psVector* restrict myVector, 568 const psVector* restrict maskVector, unsigned intmaskVal, psStats* stats)568 const psVector* restrict maskVector, psU32 maskVal, psStats* stats) 569 569 { 570 570 psVector* unsortedVector = NULL; // Temporary vector 571 571 psVector* sortedVector = NULL; // Temporary vector 572 inti = 0; // Loop index variable573 intcount = 0; // # of points in this mean?574 intnValues = 0; // # data points572 psS32 i = 0; // Loop index variable 573 psS32 count = 0; // # of points in this mean? 574 psS32 nValues = 0; // # data points 575 575 float rangeMin = 0.0; // Exclude data below this 576 576 float rangeMax = 0.0; // Exclude date above this … … 648 648 *****************************************************************************/ 649 649 void p_psVectorSampleStdev(const psVector* restrict myVector, 650 const psVector* restrict maskVector, unsigned intmaskVal, psStats* stats)651 { 652 inti = 0; // Loop index variable653 intcountInt = 0; // # of data points being used650 const psVector* restrict maskVector, psU32 maskVal, psStats* stats) 651 { 652 psS32 i = 0; // Loop index variable 653 psS32 countInt = 0; // # of data points being used 654 654 float countFloat = 0.0; // # of data points being used 655 655 float mean = 0.0; // The mean … … 733 733 *****************************************************************************/ 734 734 void p_psVectorClippedStats(const psVector* restrict myVector, 735 const psVector* restrict maskVector, unsigned intmaskVal, psStats* stats)736 { 737 inti = 0; // Loop index variable738 intj = 0; // Loop index variable735 const psVector* restrict maskVector, psU32 maskVal, psStats* stats) 736 { 737 psS32 i = 0; // Loop index variable 738 psS32 j = 0; // Loop index variable 739 739 float clippedMean = 0.0; // self-explanatory 740 740 float clippedStdev = 0.0; // self-explanatory … … 825 825 float min = (float)HUGE; 826 826 float max = (float)-HUGE; 827 inti = 0;827 psS32 i = 0; 828 828 829 829 for (i = 0; i < myData->n; i++) { … … 856 856 float max = (double)-HUGE; 857 857 double range = 0.0; 858 inti = 0;858 psS32 i = 0; 859 859 860 860 for (i = 0; i < myData->n; i++) { … … 914 914 *****************************************************************************/ 915 915 float p_psGaussianDeriv(const psVector* restrict myData, 916 const psVector* restrict myParams, intwhichParam)916 const psVector* restrict myParams, psS32 whichParam) 917 917 { 918 918 float x = myData->data.F32[0]; … … 957 957 *****************************************************************************/ 958 958 float p_psQuadraticDeriv(const psVector* restrict myParams, 959 const psVector* restrict myCoords, intwhichParamDeriv)959 const psVector* restrict myCoords, psS32 whichParamDeriv) 960 960 { 961 961 float x = myCoords->data.F32[0]; … … 989 989 float getThisValue) 990 990 { 991 intnumIterations = 0;991 psS32 numIterations = 0; 992 992 float midpoint = 0.0; 993 993 float oldMidpoint = 1.0; … … 1030 1030 float fitQuadraticSearchForYThenReturnX(psVector *xVec, 1031 1031 psVector *yVec, 1032 intbinNum,1032 psS32 binNum, 1033 1033 float yVal) 1034 1034 { … … 1129 1129 void p_psVectorRobustStats(const psVector* restrict myVector, 1130 1130 const psVector* restrict maskVector, 1131 unsigned intmaskVal,1131 psU32 maskVal, 1132 1132 psStats* stats) 1133 1133 { … … 1135 1135 psVector* robustHistogramVector = NULL; 1136 1136 float binSize = 0.0; // Size of the histogram bins 1137 intLQBinNum = -1; // Bin num for lower quartile1138 intUQBinNum = -1; // Bin num for upper quartile1139 intmedianBinNum = -1;1140 inti = 0; // Loop index variable1141 intmodeBinNum = 0;1137 psS32 LQBinNum = -1; // Bin num for lower quartile 1138 psS32 UQBinNum = -1; // Bin num for upper quartile 1139 psS32 medianBinNum = -1; 1140 psS32 i = 0; // Loop index variable 1141 psS32 modeBinNum = 0; 1142 1142 float modeBinCount = 0.0; 1143 1143 float dL = 0.0; 1144 intnumBins = 0;1144 psS32 numBins = 0; 1145 1145 float myMean = 0.0; 1146 1146 float myStdev = 0.0; … … 1200 1200 // bins, not the binSize. Also, if we get here, we know that 1201 1201 // binSize != 0.0. 1202 numBins = ( int)((stats->max - stats->min) / binSize);1202 numBins = (psS32)((stats->max - stats->min) / binSize); 1203 1203 robustHistogram = psHistogramAlloc(stats->min, stats->max, numBins); 1204 1204 … … 1440 1440 The histogram structure 1441 1441 *****************************************************************************/ 1442 psHistogram* psHistogramAlloc(float lower, float upper, intn)1443 { 1444 inti = 0; // Loop index variable1442 psHistogram* psHistogramAlloc(float lower, float upper, psS32 n) 1443 { 1444 psS32 i = 0; // Loop index variable 1445 1445 psHistogram* newHist = NULL; // The new histogram structure 1446 1446 float binSize = 0.0; // The histogram bin size … … 1500 1500 { 1501 1501 psHistogram* newHist = NULL; // The new histogram structure 1502 inti; // Loop index variable1502 psS32 i; // Loop index variable 1503 1503 1504 1504 // NOTE: Verify that this is the correct action. … … 1565 1565 const psVector* restrict in, 1566 1566 const psVector* restrict mask, 1567 unsigned intmaskVal)1568 { 1569 inti = 0; // Loop index variable1567 psU32 maskVal) 1568 { 1569 psS32 i = 0; // Loop index variable 1570 1570 float binSize = 0.0; // Histogram bin size 1571 intbinNum = 0; // A temporary bin number1572 intnumBins = 0; // The total number of bins1573 inttmp = 0;1571 psS32 binNum = 0; // A temporary bin number 1572 psS32 numBins = 0; // The total number of bins 1573 psS32 tmp = 0; 1574 1574 psScalar tmpScalar; 1575 1575 tmpScalar.type.type = PS_TYPE_F32; 1576 1576 psVector* inF32; 1577 intmustFreeTmp = 1;1577 psS32 mustFreeTmp = 1; 1578 1578 1579 1579 // NOTE: Verify that this is the correct action. … … 1629 1629 if (out->uniform == true) { 1630 1630 binSize = out->bounds->data.F32[1] - out->bounds->data.F32[0]; 1631 binNum = ( int)((inF32->data.F32[i] - out->bounds->data.F32[0]) / binSize);1631 binNum = (psS32)((inF32->data.F32[i] - out->bounds->data.F32[0]) / binSize); 1632 1632 1633 1633 // NOTE: This next if-statement really shouldn't be necessary. … … 1673 1673 psVector* p_psConvertToF32(psVector* in) 1674 1674 { 1675 inti = 0;1675 psS32 i = 0; 1676 1676 psVector* tmp = NULL; 1677 1677 … … 1724 1724 psVector* in, 1725 1725 psVector* mask, 1726 unsigned intmaskVal)1726 psU32 maskVal) 1727 1727 { 1728 1728 psVector* inF32; 1729 intmustFreeTmp = 1;1729 psS32 mustFreeTmp = 1; 1730 1730 1731 1731 if (in == NULL) { -
trunk/psLib/src/dataManip/psStats.h
r1980 r2204 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.3 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-10- 06 20:07:04$12 * @version $Revision: 1.32 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:31 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 67 67 double robustUQ; ///< robust upper quartile 68 68 double robustLQ; ///< robust lower quartile 69 introbustN50; ///<70 introbustNfit; ///<69 psS32 robustN50; ///< 70 psS32 robustNfit; ///< 71 71 double clippedMean; ///< Nsigma clipped mean 72 72 double clippedStdev; ///< standard deviation after clipping 73 intclippedNvalues; ///< ???73 psS32 clippedNvalues; ///< ??? 74 74 double clipSigma; ///< Nsigma used for clipping; user input 75 intclipIter; ///< Number of clipping iterations; user input75 psS32 clipIter; ///< Number of clipping iterations; user input 76 76 double min; ///< minimum data value in array 77 77 double max; ///< maximum data value in array … … 89 89 psVector* in, ///< Vector to be analysed: must be F32 90 90 psVector* mask, ///< Ignore elements where (maskVector & maskVal) != 0: must be INT or NULL 91 unsigned intmaskVal ///< Only mask elements with one of these bits set in maskVector91 psU32 maskVal ///< Only mask elements with one of these bits set in maskVector 92 92 ); 93 93 … … 118 118 psVector* bounds; ///< Bounds for the bins (type F32) 119 119 psVector* nums; ///< Number in each of the bins (INT) 120 intminNum; ///< Number below the minimum121 intmaxNum; ///< Number above the maximum122 bool uniform; ///< Is it a uniform distribution?120 psS32 minNum; ///< Number below the minimum 121 psS32 maxNum; ///< Number above the maximum 122 psBool uniform; ///< Is it a uniform distribution? 123 123 } 124 124 psHistogram; … … 133 133 float lower, ///< Lower limit for the bins 134 134 float upper, ///< Upper limit for the bins 135 intn ///< Number of bins135 psS32 n ///< Number of bins 136 136 ); 137 137 … … 157 157 const psVector* restrict in, ///< Vector to analyse 158 158 const psVector* restrict mask, ///< Mask dat for input vector 159 unsigned intmaskVal ///< Mask value159 psU32 maskVal ///< Mask value 160 160 ); 161 161 162 162 /** Extracts the statistic value specified by stats->options. 163 163 * 164 * @return bool If more than one statistic result is set in stats->options,164 * @return psBool If more than one statistic result is set in stats->options, 165 165 * false is returned and the value parameter is not set, 166 166 * otherwise true is returned. 167 167 */ 168 bool p_psGetStatValue(168 psBool p_psGetStatValue( 169 169 const psStats* stats, 170 170 ///< the statistic struct to operate on -
trunk/psLib/src/dataManip/psVectorFFT.c
r2080 r2204 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1.2 6$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-10- 13 20:46:57$7 * @version $Revision: 1.27 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-10-27 00:57:31 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 27 27 #define P_FFTW_PLAN_RIGOR FFTW_ESTIMATE 28 28 29 static bool p_fftwWisdomImported = false;29 static psBool p_fftwWisdomImported = false; 30 30 31 31 psVector* psVectorFFT(psVector* out, const psVector* in, psFftDirection direction) 32 32 { 33 unsigned intnumElements;33 psU32 numElements; 34 34 psElemType type; 35 35 fftwf_plan plan; … … 85 85 86 86 if ((direction & PS_FFT_REAL_RESULT) != 0) { 87 for ( inti = 0; i < numElements; i++) {87 for (psS32 i = 0; i < numElements; i++) { 88 88 out->data.F32[i] = out->data.C32[i]; 89 89 } … … 98 98 { 99 99 psElemType type; 100 unsigned intnumElements;100 psU32 numElements; 101 101 102 102 if (in == NULL) { … … 127 127 outVec = out->data.F32; 128 128 129 for ( unsigned inti = 0; i < numElements; i++) {129 for (psU32 i = 0; i < numElements; i++) { 130 130 outVec[i] = crealf(inVec[i]); 131 131 } … … 138 138 outVec = out->data.F64; 139 139 140 for ( unsigned inti = 0; i < numElements; i++) {140 for (psU32 i = 0; i < numElements; i++) { 141 141 outVec[i] = creal(inVec[i]); 142 142 } … … 158 158 { 159 159 psElemType type; 160 unsigned intnumElements;160 psU32 numElements; 161 161 162 162 if (in == NULL) { … … 187 187 outVec = out->data.F32; 188 188 189 for ( unsigned inti = 0; i < numElements; i++) {189 for (psU32 i = 0; i < numElements; i++) { 190 190 outVec[i] = cimagf(inVec[i]); 191 191 } … … 198 198 outVec = out->data.F64; 199 199 200 for ( unsigned inti = 0; i < numElements; i++) {200 for (psU32 i = 0; i < numElements; i++) { 201 201 outVec[i] = cimag(inVec[i]); 202 202 } … … 218 218 { 219 219 psElemType type; 220 unsigned intnumElements;220 psU32 numElements; 221 221 222 222 if (real == NULL || imag == NULL) { … … 254 254 outVec = out->data.C32; 255 255 256 for ( unsigned inti = 0; i < numElements; i++) {256 for (psU32 i = 0; i < numElements; i++) { 257 257 outVec[i] = realVec[i] + I * imagVec[i]; 258 258 } … … 266 266 outVec = out->data.C64; 267 267 268 for ( unsigned inti = 0; i < numElements; i++) {268 for (psU32 i = 0; i < numElements; i++) { 269 269 outVec[i] = realVec[i] + I * imagVec[i]; 270 270 } … … 286 286 { 287 287 psElemType type; 288 unsigned intnumElements;288 psU32 numElements; 289 289 290 290 if (in == NULL) { … … 316 316 outVec = out->data.C32; 317 317 318 for ( unsigned inti = 0; i < numElements; i++) {318 for (psU32 i = 0; i < numElements; i++) { 319 319 outVec[i] = crealf(inVec[i]) - I * cimagf(inVec[i]); 320 320 } … … 327 327 outVec = out->data.C64; 328 328 329 for ( unsigned inti = 0; i < numElements; i++) {329 for (psU32 i = 0; i < numElements; i++) { 330 330 outVec[i] = creal(inVec[i]) - I * cimag(inVec[i]); 331 331 } … … 347 347 { 348 348 psElemType type; 349 unsigned intoutNumElements;350 unsigned intinNumElements;351 unsigned intinHalfNumElements;352 unsigned intinNumElementsSquared;349 psU32 outNumElements; 350 psU32 inNumElements; 351 psU32 inHalfNumElements; 352 psU32 inNumElementsSquared; 353 353 354 354 if (in == NULL) { … … 378 378 379 379 // from ADD: P_j = (|C_j|^2+|C_N-j|^2)/N^2, where j = 1,2,...,(N/2-1) 380 for ( unsigned inti = 1; i < inHalfNumElements; i++) {380 for (psU32 i = 1; i < inHalfNumElements; i++) { 381 381 inAbs1 = cabsf(inVec[i]); 382 382 inAbs2 = cabsf(inVec[inNumElements - i]); … … 402 402 403 403 // from ADD: P_j = (|C_j|^2+|C_N-j|^2)/N^2, where j = 1,2,...,(N/2-1) 404 for ( unsigned inti = 1; i < inHalfNumElements; i++) {404 for (psU32 i = 1; i < inHalfNumElements; i++) { 405 405 inAbs1 = cabs(inVec[i]); 406 406 inAbs2 = cabs(inVec[inNumElements - i]); -
trunk/psLib/src/fft/psImageFFT.c
r1983 r2204 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-10- 06 21:31:30$7 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-10-27 00:57:31 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 11 11 */ 12 12 #include <unistd.h> 13 #include <stdbool.h>14 13 #include <string.h> 15 14 #include <complex.h> … … 27 26 #define PS_FFTW_PLAN_RIGOR FFTW_ESTIMATE 28 27 29 static bool p_fftwWisdomImported = false;28 static psBool p_fftwWisdomImported = false; 30 29 31 30 psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction) 32 31 { 33 unsigned intnumCols;34 unsigned intnumRows;32 psU32 numCols; 33 psU32 numRows; 35 34 psElemType type; 36 35 fftwf_plan plan; … … 77 76 78 77 // n.b. FFTW can perform a in-place transform at the same rate or faster than out-of-place. 79 intsign = ((direction & PS_FFT_FORWARD) != 0) ? FFTW_FORWARD : FFTW_BACKWARD;78 psS32 sign = ((direction & PS_FFT_FORWARD) != 0) ? FFTW_FORWARD : FFTW_BACKWARD; 80 79 out = psImageCopy(out, in, PS_TYPE_C32); 81 80 plan = fftwf_plan_dft_2d(numCols, numRows, … … 118 117 { 119 118 psElemType type; 120 unsigned intnumCols;121 unsigned intnumRows;119 psU32 numCols; 120 psU32 numRows; 122 121 123 122 if (in == NULL) { … … 140 139 141 140 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32); 142 for ( unsigned introw = 0; row < numRows; row++) {141 for (psU32 row = 0; row < numRows; row++) { 143 142 outRow = out->data.F32[row]; 144 143 inRow = in->data.C32[row]; 145 144 146 for ( unsigned intcol = 0; col < numCols; col++) {145 for (psU32 col = 0; col < numCols; col++) { 147 146 outRow[col] = crealf(inRow[col]); 148 147 } … … 153 152 154 153 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64); 155 for ( unsigned introw = 0; row < numRows; row++) {154 for (psU32 row = 0; row < numRows; row++) { 156 155 outRow = out->data.F64[row]; 157 156 inRow = in->data.C64[row]; 158 157 159 for ( unsigned intcol = 0; col < numCols; col++) {158 for (psU32 col = 0; col < numCols; col++) { 160 159 outRow[col] = creal(inRow[col]); 161 160 } … … 179 178 { 180 179 psElemType type; 181 unsigned intnumCols;182 unsigned intnumRows;180 psU32 numCols; 181 psU32 numRows; 183 182 184 183 if (in == NULL) { … … 203 202 204 203 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32); 205 for ( unsigned introw = 0; row < numRows; row++) {204 for (psU32 row = 0; row < numRows; row++) { 206 205 outRow = out->data.F32[row]; 207 206 inRow = in->data.C32[row]; 208 207 209 for ( unsigned intcol = 0; col < numCols; col++) {208 for (psU32 col = 0; col < numCols; col++) { 210 209 outRow[col] = cimagf(inRow[col]); 211 210 } … … 216 215 217 216 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64); 218 for ( unsigned introw = 0; row < numRows; row++) {217 for (psU32 row = 0; row < numRows; row++) { 219 218 outRow = out->data.F64[row]; 220 219 inRow = in->data.C64[row]; 221 220 222 for ( unsigned intcol = 0; col < numCols; col++) {221 for (psU32 col = 0; col < numCols; col++) { 223 222 outRow[col] = cimag(inRow[col]); 224 223 } … … 241 240 { 242 241 psElemType type; 243 unsigned intnumCols;244 unsigned intnumRows;242 psU32 numCols; 243 psU32 numRows; 245 244 246 245 if (real == NULL || imag == NULL) { … … 282 281 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32); 283 282 284 for ( unsigned introw = 0; row < numRows; row++) {283 for (psU32 row = 0; row < numRows; row++) { 285 284 outRow = out->data.C32[row]; 286 285 realRow = real->data.F32[row]; 287 286 imagRow = imag->data.F32[row]; 288 287 289 for ( unsigned intcol = 0; col < numCols; col++) {288 for (psU32 col = 0; col < numCols; col++) { 290 289 outRow[col] = realRow[col] + I * imagRow[col]; 291 290 } … … 297 296 298 297 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64); 299 for ( unsigned introw = 0; row < numRows; row++) {298 for (psU32 row = 0; row < numRows; row++) { 300 299 outRow = out->data.C64[row]; 301 300 realRow = real->data.F64[row]; 302 301 imagRow = imag->data.F64[row]; 303 302 304 for ( unsigned intcol = 0; col < numCols; col++) {303 for (psU32 col = 0; col < numCols; col++) { 305 304 outRow[col] = realRow[col] + I * imagRow[col]; 306 305 } … … 324 323 { 325 324 psElemType type; 326 unsigned intnumCols;327 unsigned intnumRows;325 psU32 numCols; 326 psU32 numRows; 328 327 329 328 if (in == NULL) { … … 346 345 347 346 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32); 348 for ( unsigned introw = 0; row < numRows; row++) {347 for (psU32 row = 0; row < numRows; row++) { 349 348 outRow = out->data.C32[row]; 350 349 inRow = in->data.C32[row]; 351 350 352 for ( unsigned intcol = 0; col < numCols; col++) {351 for (psU32 col = 0; col < numCols; col++) { 353 352 outRow[col] = crealf(inRow[col]) - I * cimagf(inRow[col]); 354 353 } … … 359 358 360 359 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64); 361 for ( unsigned introw = 0; row < numRows; row++) {360 for (psU32 row = 0; row < numRows; row++) { 362 361 outRow = out->data.C64[row]; 363 362 inRow = in->data.C64[row]; 364 363 365 for ( unsigned intcol = 0; col < numCols; col++) {364 for (psU32 col = 0; col < numCols; col++) { 366 365 outRow[col] = creal(inRow[col]) - I * cimag(inRow[col]); 367 366 } … … 384 383 { 385 384 psElemType type; 386 unsigned intnumCols;387 unsigned intnumRows;388 intnumElementsSquared;385 psU32 numCols; 386 psU32 numRows; 387 psS32 numElementsSquared; 389 388 390 389 if (in == NULL) { … … 405 404 406 405 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32); 407 for ( unsigned introw = 0; row < numRows; row++) {406 for (psU32 row = 0; row < numRows; row++) { 408 407 outRow = out->data.F32[row]; 409 408 inRow = in->data.C32[row]; 410 409 411 for ( unsigned intcol = 0; col < numCols; col++) {410 for (psU32 col = 0; col < numCols; col++) { 412 411 real = crealf(inRow[col]); 413 412 imag = cimagf(inRow[col]); … … 422 421 423 422 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64); 424 for ( unsigned introw = 0; row < numRows; row++) {423 for (psU32 row = 0; row < numRows; row++) { 425 424 outRow = out->data.F64[row]; 426 425 inRow = in->data.C64[row]; 427 426 428 for ( unsigned intcol = 0; col < numCols; col++) {427 for (psU32 col = 0; col < numCols; col++) { 429 428 real = creal(inRow[col]); 430 429 imag = cimag(inRow[col]); -
trunk/psLib/src/fft/psVectorFFT.c
r2080 r2204 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1.2 6$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-10- 13 20:46:57$7 * @version $Revision: 1.27 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-10-27 00:57:31 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 27 27 #define P_FFTW_PLAN_RIGOR FFTW_ESTIMATE 28 28 29 static bool p_fftwWisdomImported = false;29 static psBool p_fftwWisdomImported = false; 30 30 31 31 psVector* psVectorFFT(psVector* out, const psVector* in, psFftDirection direction) 32 32 { 33 unsigned intnumElements;33 psU32 numElements; 34 34 psElemType type; 35 35 fftwf_plan plan; … … 85 85 86 86 if ((direction & PS_FFT_REAL_RESULT) != 0) { 87 for ( inti = 0; i < numElements; i++) {87 for (psS32 i = 0; i < numElements; i++) { 88 88 out->data.F32[i] = out->data.C32[i]; 89 89 } … … 98 98 { 99 99 psElemType type; 100 unsigned intnumElements;100 psU32 numElements; 101 101 102 102 if (in == NULL) { … … 127 127 outVec = out->data.F32; 128 128 129 for ( unsigned inti = 0; i < numElements; i++) {129 for (psU32 i = 0; i < numElements; i++) { 130 130 outVec[i] = crealf(inVec[i]); 131 131 } … … 138 138 outVec = out->data.F64; 139 139 140 for ( unsigned inti = 0; i < numElements; i++) {140 for (psU32 i = 0; i < numElements; i++) { 141 141 outVec[i] = creal(inVec[i]); 142 142 } … … 158 158 { 159 159 psElemType type; 160 unsigned intnumElements;160 psU32 numElements; 161 161 162 162 if (in == NULL) { … … 187 187 outVec = out->data.F32; 188 188 189 for ( unsigned inti = 0; i < numElements; i++) {189 for (psU32 i = 0; i < numElements; i++) { 190 190 outVec[i] = cimagf(inVec[i]); 191 191 } … … 198 198 outVec = out->data.F64; 199 199 200 for ( unsigned inti = 0; i < numElements; i++) {200 for (psU32 i = 0; i < numElements; i++) { 201 201 outVec[i] = cimag(inVec[i]); 202 202 } … … 218 218 { 219 219 psElemType type; 220 unsigned intnumElements;220 psU32 numElements; 221 221 222 222 if (real == NULL || imag == NULL) { … … 254 254 outVec = out->data.C32; 255 255 256 for ( unsigned inti = 0; i < numElements; i++) {256 for (psU32 i = 0; i < numElements; i++) { 257 257 outVec[i] = realVec[i] + I * imagVec[i]; 258 258 } … … 266 266 outVec = out->data.C64; 267 267 268 for ( unsigned inti = 0; i < numElements; i++) {268 for (psU32 i = 0; i < numElements; i++) { 269 269 outVec[i] = realVec[i] + I * imagVec[i]; 270 270 } … … 286 286 { 287 287 psElemType type; 288 unsigned intnumElements;288 psU32 numElements; 289 289 290 290 if (in == NULL) { … … 316 316 outVec = out->data.C32; 317 317 318 for ( unsigned inti = 0; i < numElements; i++) {318 for (psU32 i = 0; i < numElements; i++) { 319 319 outVec[i] = crealf(inVec[i]) - I * cimagf(inVec[i]); 320 320 } … … 327 327 outVec = out->data.C64; 328 328 329 for ( unsigned inti = 0; i < numElements; i++) {329 for (psU32 i = 0; i < numElements; i++) { 330 330 outVec[i] = creal(inVec[i]) - I * cimag(inVec[i]); 331 331 } … … 347 347 { 348 348 psElemType type; 349 unsigned intoutNumElements;350 unsigned intinNumElements;351 unsigned intinHalfNumElements;352 unsigned intinNumElementsSquared;349 psU32 outNumElements; 350 psU32 inNumElements; 351 psU32 inHalfNumElements; 352 psU32 inNumElementsSquared; 353 353 354 354 if (in == NULL) { … … 378 378 379 379 // from ADD: P_j = (|C_j|^2+|C_N-j|^2)/N^2, where j = 1,2,...,(N/2-1) 380 for ( unsigned inti = 1; i < inHalfNumElements; i++) {380 for (psU32 i = 1; i < inHalfNumElements; i++) { 381 381 inAbs1 = cabsf(inVec[i]); 382 382 inAbs2 = cabsf(inVec[inNumElements - i]); … … 402 402 403 403 // from ADD: P_j = (|C_j|^2+|C_N-j|^2)/N^2, where j = 1,2,...,(N/2-1) 404 for ( unsigned inti = 1; i < inHalfNumElements; i++) {404 for (psU32 i = 1; i < inHalfNumElements; i++) { 405 405 inAbs1 = cabs(inVec[i]); 406 406 inAbs2 = cabs(inVec[inNumElements - i]); -
trunk/psLib/src/image/psImage.c
r2105 r2204 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.5 0$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-10- 14 01:22:59$12 * @version $Revision: 1.51 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:31 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 29 29 static void imageFree(psImage* image); 30 30 31 psImage* psImageAlloc( unsigned intnumCols,32 unsigned intnumRows,31 psImage* psImageAlloc(psU32 numCols, 32 psU32 numRows, 33 33 const psElemType type) 34 34 { 35 intarea = 0;36 intelementSize = PSELEMTYPE_SIZEOF(type); // element size in bytes37 introwSize = numCols * elementSize; // row size in bytes.35 psS32 area = 0; 36 psS32 elementSize = PSELEMTYPE_SIZEOF(type); // element size in bytes 37 psS32 rowSize = numCols * elementSize; // row size in bytes. 38 38 39 39 area = numCols * numRows; … … 51 51 p_psMemSetDeallocator(image, (psFreeFcn) imageFree); 52 52 53 image->data.V = psAlloc(sizeof( void *) * numRows);53 image->data.V = psAlloc(sizeof(psPtr ) * numRows); 54 54 55 55 image->rawDataBuffer = psAlloc(area * elementSize); … … 57 57 // set the row pointers. 58 58 image->data.V[0] = image->rawDataBuffer; 59 for ( inti = 1; i < numRows; i++) {60 image->data.V[i] = ( void *)((int8_t *) image->data.V[i - 1] + rowSize);61 } 62 63 *( int*)&image->col0 = 0;64 *( int*)&image->row0 = 0;65 *( unsigned int*)&image->numCols = numCols;66 *( unsigned int*)&image->numRows = numRows;59 for (psS32 i = 1; i < numRows; i++) { 60 image->data.V[i] = (psPtr )((int8_t *) image->data.V[i - 1] + rowSize); 61 } 62 63 *(psS32 *)&image->col0 = 0; 64 *(psS32 *)&image->row0 = 0; 65 *(psU32 *)&image->numCols = numCols; 66 *(psU32 *)&image->numRows = numRows; 67 67 *(psDimen* ) & image->type.dimen = PS_DIMEN_IMAGE; 68 68 *(psElemType* ) & image->type.type = type; … … 81 81 if (image->type.type == PS_TYPE_PTR) { 82 82 // 2-D array of pointers -- must dereference elements 83 unsigned intoldNumRows = image->numRows;84 unsigned intoldNumCols = image->numCols;85 psP TR* rowPtr;86 87 for ( unsigned introw = 0; row < oldNumRows; row++) {83 psU32 oldNumRows = image->numRows; 84 psU32 oldNumCols = image->numCols; 85 psPtr* rowPtr; 86 87 for (psU32 row = 0; row < oldNumRows; row++) { 88 88 rowPtr = image->data.PTR[row]; 89 for ( unsigned intcol = 0; col < oldNumCols; col++) {89 for (psU32 col = 0; col < oldNumCols; col++) { 90 90 psMemDecrRefCounter(rowPtr[col]); 91 91 } … … 105 105 106 106 psImage* psImageRecycle(psImage* old, 107 unsigned intnumCols,108 unsigned intnumRows,107 psU32 numCols, 108 psU32 numRows, 109 109 const psElemType type) 110 110 { 111 intelementSize = PSELEMTYPE_SIZEOF(type); // element size in bytes112 introwSize = numCols * elementSize; // row size in bytes.111 psS32 elementSize = PSELEMTYPE_SIZEOF(type); // element size in bytes 112 psS32 rowSize = numCols * elementSize; // row size in bytes. 113 113 114 114 if (old == NULL) { … … 128 128 // 2-D array of pointers -- must 129 129 // dereference 130 unsigned intoldNumRows = old->numRows;131 unsigned intoldNumCols = old->numCols;132 psP TR* rowPtr;133 134 for ( unsigned introw = 0; row < oldNumRows; row++) {130 psU32 oldNumRows = old->numRows; 131 psU32 oldNumCols = old->numCols; 132 psPtr* rowPtr; 133 134 for (psU32 row = 0; row < oldNumRows; row++) { 135 135 rowPtr = old->data.PTR[row]; 136 for ( unsigned intcol = 0; col < oldNumCols; col++) {136 for (psU32 col = 0; col < oldNumCols; col++) { 137 137 psMemDecrRefCounter(rowPtr[col]); 138 138 rowPtr[col] = NULL; … … 149 149 old->rawDataBuffer = psRealloc(old->data.V[0], 150 150 numCols * numRows * elementSize); 151 old->data.V = ( void **)psRealloc(old->data.V, numRows * sizeof(void *));151 old->data.V = (psPtr *)psRealloc(old->data.V, numRows * sizeof(psPtr )); 152 152 153 153 // recreate the row pointers 154 154 old->data.V[0] = old->rawDataBuffer; 155 for ( inti = 1; i < numRows; i++) {156 old->data.V[i] = ( void *)((int8_t *) old->data.V[i - 1] + rowSize);157 } 158 159 *( unsigned int*)&old->numCols = numCols;160 *( unsigned int*)&old->numRows = numRows;155 for (psS32 i = 1; i < numRows; i++) { 156 old->data.V[i] = (psPtr )((int8_t *) old->data.V[i - 1] + rowSize); 157 } 158 159 *(psU32 *)&old->numCols = numCols; 160 *(psU32 *)&old->numRows = numRows; 161 161 *(psElemType* ) & old->type.type = type; 162 162 … … 169 169 { 170 170 psElemType inDatatype; 171 intelementSize;172 intelements;173 intnumRows;174 intnumCols;171 psS32 elementSize; 172 psS32 elements; 173 psS32 numRows; 174 psS32 numCols; 175 175 176 176 if (input == NULL || input->data.V == NULL) { … … 218 218 // datatype. 219 219 if (type == inDatatype) { 220 for ( introw=0;row<numRows;row++) {220 for (psS32 row=0;row<numRows;row++) { 221 221 memcpy(output->data.V[row], input->data.V[row], elementSize * numCols); 222 222 } … … 227 227 ps##INTYPE *in; \ 228 228 ps##OUTTYPE *out; \ 229 for( introw=0;row<numRows;row++) { \229 for(psS32 row=0;row<numRows;row++) { \ 230 230 in = IN->data.INTYPE[row]; \ 231 231 out = OUT->data.OUTTYPE[row]; \ 232 for ( intcol=0;col<numCols;col++) { \232 for (psS32 col=0;col<numCols;col++) { \ 233 233 *(out++) = *(in++); \ 234 234 } \ … … 331 331 } 332 332 333 intpsImageFreeChildren(psImage* image)333 psS32 psImageFreeChildren(psImage* image) 334 334 { 335 intnumFreed = 0;335 psS32 numFreed = 0; 336 336 337 337 if (image == NULL) { … … 345 345 // orphan the children first 346 346 // (so psFree doesn't try to modify the parent's children array while I'm using it) 347 for ( inti=0;i<numFreed;i++) {347 for (psS32 i=0;i<numFreed;i++) { 348 348 children[i]->parent = NULL; 349 349 } … … 366 366 float y, 367 367 const psImage* mask, 368 unsigned intmaskVal,368 psU32 maskVal, 369 369 psC64 unexposedValue, 370 370 psImageInterpolateMode mode) … … 438 438 float y, \ 439 439 const psImage* mask, \ 440 unsigned intmaskVal, \440 psU32 maskVal, \ 441 441 psF64 unexposedValue) \ 442 442 { \ 443 int intX = (int) round((psF64)(x) - 0.5 + FLT_EPSILON); \444 int intY = (int) round((psF64)(y) - 0.5 + FLT_EPSILON); \445 intlastX = input->numCols - 1; \446 intlastY = input->numRows - 1; \443 psS32 intX = (psS32) round((psF64)(x) - 0.5 + FLT_EPSILON); \ 444 psS32 intY = (psS32) round((psF64)(y) - 0.5 + FLT_EPSILON); \ 445 psS32 lastX = input->numCols - 1; \ 446 psS32 lastY = input->numRows - 1; \ 447 447 \ 448 448 if ((intX < 0) || \ … … 463 463 float y, \ 464 464 const psImage* mask, \ 465 unsigned intmaskVal, \465 psU32 maskVal, \ 466 466 psC64 unexposedValue) \ 467 467 { \ 468 int intX = (int) round((psF64)(x) - 0.5); \469 int intY = (int) round((psF64)(y) - 0.5); \470 intlastX = input->numCols - 1; \471 intlastY = input->numRows - 1; \468 psS32 intX = (psS32) round((psF64)(x) - 0.5); \ 469 psS32 intY = (psS32) round((psF64)(y) - 0.5); \ 470 psS32 lastX = input->numCols - 1; \ 471 psS32 lastY = input->numRows - 1; \ 472 472 \ 473 473 if ((intX < 0) || \ … … 501 501 float y, \ 502 502 const psImage* mask, \ 503 unsigned intmaskVal, \503 psU32 maskVal, \ 504 504 psF64 unexposedValue) \ 505 505 { \ … … 508 508 psF64 fracX = x - 0.5 - floorX; \ 509 509 psF64 fracY = y - 0.5 - floorY; \ 510 int intFloorX = (int) floorX; \511 int intFloorY = (int) floorY; \512 intlastX = input->numCols - 1; \513 intlastY = input->numRows - 1; \510 psS32 intFloorX = (psS32) floorX; \ 511 psS32 intFloorY = (psS32) floorY; \ 512 psS32 lastX = input->numCols - 1; \ 513 psS32 lastY = input->numRows - 1; \ 514 514 ps##TYPE V00; \ 515 515 ps##TYPE V01; \ 516 516 ps##TYPE V10; \ 517 517 ps##TYPE V11; \ 518 bool valid00 = false; \519 bool valid01 = false; \520 bool valid10 = false; \521 bool valid11 = false; \518 psBool valid00 = false; \ 519 psBool valid01 = false; \ 520 psBool valid10 = false; \ 521 psBool valid11 = false; \ 522 522 \ 523 523 if (intFloorY >= 0 && intFloorY <= lastY) { \ … … 556 556 \ 557 557 psF64 V0; \ 558 bool valid0 = true; \558 psBool valid0 = true; \ 559 559 if (valid00 && valid10) { \ 560 560 V0 = V00*(1-fracX)+V10*fracX; \ … … 568 568 \ 569 569 psF64 V1; \ 570 bool valid1 = true; \570 psBool valid1 = true; \ 571 571 if (valid01 && valid11) { \ 572 572 V1 = V01*(1-fracX)+V11*fracX; \ … … 595 595 float y, \ 596 596 const psImage* mask, \ 597 unsigned intmaskVal, \597 psU32 maskVal, \ 598 598 psC64 unexposedValue) \ 599 599 { \ … … 602 602 psF64 fracX = x - 0.5 - floorX; \ 603 603 psF64 fracY = y - 0.5 - floorY; \ 604 int intFloorX = (int) floorX; \605 int intFloorY = (int) floorY; \606 intlastX = input->numCols - 1; \607 intlastY = input->numRows - 1; \604 psS32 intFloorX = (psS32) floorX; \ 605 psS32 intFloorY = (psS32) floorY; \ 606 psS32 lastX = input->numCols - 1; \ 607 psS32 lastY = input->numRows - 1; \ 608 608 ps##TYPE V00; \ 609 609 ps##TYPE V01; \ 610 610 ps##TYPE V10; \ 611 611 ps##TYPE V11; \ 612 bool valid00 = false; \613 bool valid01 = false; \614 bool valid10 = false; \615 bool valid11 = false; \612 psBool valid00 = false; \ 613 psBool valid01 = false; \ 614 psBool valid10 = false; \ 615 psBool valid11 = false; \ 616 616 \ 617 617 if (intFloorY >= 0 && intFloorY <= lastY) { \ … … 650 650 \ 651 651 psC64 V0; \ 652 bool valid0 = true; \652 psBool valid0 = true; \ 653 653 if (valid00 && valid10) { \ 654 654 V0 = V00*(1-fracX)+V10*fracX; \ … … 662 662 \ 663 663 psC64 V1; \ 664 bool valid1 = true; \664 psBool valid1 = true; \ 665 665 if (valid01 && valid11) { \ 666 666 V0 = V01*(1-fracX)+V11*fracX; \ -
trunk/psLib/src/image/psImage.h
r2105 r2204 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.4 1$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-10- 14 01:22:59$13 * @version $Revision: 1.42 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:31 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 47 47 { 48 48 const psType type; ///< Image data type and dimension. 49 const unsigned intnumCols; ///< Number of columns in image50 const unsigned intnumRows; ///< Number of rows in image.51 const intcol0; ///< Column position relative to parent.52 const introw0; ///< Row position relative to parent.49 const psU32 numCols; ///< Number of columns in image 50 const psU32 numRows; ///< Number of rows in image. 51 const psS32 col0; ///< Column position relative to parent. 52 const psS32 row0; ///< Row position relative to parent. 53 53 54 54 union { … … 65 65 psC32** C32; ///< Single-precision complex data. 66 66 psC64** C64; ///< Double-precision complex data. 67 psP TR** PTR; ///< Void pointers.68 psP TR* V; ///< Pointer to data.67 psPtr** PTR; ///< Void pointers. 68 psPtr* V; ///< Pointer to data. 69 69 } data; ///< Union for data types. 70 70 const struct psImage* parent; ///< Parent, if a subimage. 71 71 psArray* children; ///< Children of this region. 72 72 73 void*rawDataBuffer;73 psPtr rawDataBuffer; 74 74 } 75 75 psImage; … … 84 84 */ 85 85 psImage* psImageAlloc( 86 unsigned intnumCols, ///< Number of rows in image.87 unsigned intnumRows, ///< Number of columns in image.86 psU32 numCols, ///< Number of rows in image. 87 psU32 numRows, ///< Number of columns in image. 88 88 const psElemType type ///< Type of data for image. 89 89 ); … … 96 96 psImage* psImageRecycle( 97 97 psImage* old, ///< the psImage to recycle by resizing image buffer 98 unsigned intnumCols, ///< the desired number of columns in image99 unsigned intnumRows, ///< the desired number of rows in image98 psU32 numCols, ///< the desired number of columns in image 99 psU32 numRows, ///< the desired number of rows in image 100 100 const psElemType type ///< the desired datatype of the image 101 101 ); … … 115 115 /** Frees all children of a psImage. 116 116 * 117 * @return intNumber of children freed.117 * @return psS32 Number of children freed. 118 118 * 119 119 */ 120 intpsImageFreeChildren(120 psS32 psImageFreeChildren( 121 121 psImage* image ///< psImage in which all children shall be deallocated 122 122 ); … … 132 132 float y, ///< row location ot derive value of 133 133 const psImage* mask, ///< if not NULL, the mask of the input image 134 unsigned intmaskVal, ///< the mask value134 psU32 maskVal, ///< the mask value 135 135 psC64 unexposedValue, ///< return value if x,y location is not in image. 136 136 psImageInterpolateMode mode ///< interpolation mode … … 143 143 float y, /**< row location ot derive value of */ \ 144 144 const psImage* mask, /**< if not NULL, the mask of the input image */ \ 145 unsigned intmaskVal, /**< the mask value */ \145 psU32 maskVal, /**< the mask value */ \ 146 146 psF64 unexposedValue /**< return value if x,y location is not in image. */ \ 147 147 ); \ … … 151 151 float y, /**< row location ot derive value of */ \ 152 152 const psImage* mask, /**< if not NULL, the mask of the input image */ \ 153 unsigned intmaskVal, /**< the mask value */ \153 psU32 maskVal, /**< the mask value */ \ 154 154 psF64 unexposedValue /**< return value if x,y location is not in image. */ \ 155 155 ); … … 161 161 float y, /**< row location ot derive value of */ \ 162 162 const psImage* mask, /**< if not NULL, the mask of the input image */ \ 163 unsigned intmaskVal, /**< the mask value */ \163 psU32 maskVal, /**< the mask value */ \ 164 164 psC64 unexposedValue /**< return value if x,y location is not in image. */ \ 165 165 ); \ … … 169 169 float y, /**< row location ot derive value of */ \ 170 170 const psImage* mask, /**< if not NULL, the mask of the input image */ \ 171 unsigned intmaskVal, /**< the mask value */ \171 psU32 maskVal, /**< the mask value */ \ 172 172 psC64 unexposedValue /**< return value if x,y location is not in image. */ \ 173 173 ); -
trunk/psLib/src/image/psImageConvolve.c
r1983 r2204 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-10- 06 21:31:30$7 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-10-27 00:57:31 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 static void freeKernel(psKernel* ptr); 29 29 30 psKernel* psKernelAlloc( int xMin, int xMax, int yMin, intyMax)30 psKernel* psKernelAlloc(psS32 xMin, psS32 xMax, psS32 yMin, psS32 yMax) 31 31 { 32 32 psKernel* result; 33 intnumRows;34 intnumCols;33 psS32 numRows; 34 psS32 numCols; 35 35 36 36 // following is explicitly spelled out in the SDRS as a requirement … … 40 40 yMin, yMax); 41 41 42 inttemp = yMin;42 psS32 temp = yMin; 43 43 yMin = yMax; 44 44 yMax = temp; … … 51 51 xMin, xMax); 52 52 53 inttemp = xMin;53 psS32 temp = xMin; 54 54 xMin = xMax; 55 55 xMax = temp; … … 70 70 psKernelType** kernelRows = result->p_kernelRows; 71 71 psKernelType** imageRows = result->image->data.PS_TYPE_KERNEL_DATA; 72 for ( inti = 0; i < numRows; i++) {72 for (psS32 i = 0; i < numRows; i++) { 73 73 kernelRows[i] = imageRows[i] - xMin; 74 74 } … … 91 91 const psVector* xShifts, 92 92 const psVector* yShifts, 93 bool relative)93 psBool relative) 94 94 { 95 intx = 0;96 inty = 0;97 intt = 0;98 intdeltaT;99 intoldX;100 intoldY;101 intxMin = 0;102 intxMax = 0;103 intyMin = 0;104 intyMax = 0;105 intlength = 0;95 psS32 x = 0; 96 psS32 y = 0; 97 psS32 t = 0; 98 psS32 deltaT; 99 psS32 oldX; 100 psS32 oldY; 101 psS32 xMin = 0; 102 psS32 xMax = 0; 103 psS32 yMin = 0; 104 psS32 yMax = 0; 105 psS32 length = 0; 106 106 psKernelType normalizeTime = 1.0; // fraction of total time for each shift clock 107 107 psKernel* result = NULL; … … 153 153 y = 0; \ 154 154 t = 0; \ 155 for ( intlcv = 0; lcv < length; lcv++) { \155 for (psS32 lcv = 0; lcv < length; lcv++) { \ 156 156 if (relative) { \ 157 157 x += xShiftData[lcv]; \ … … 181 181 y = 0; \ 182 182 t = 0; \ 183 for ( inti = 0; i < length; i++) { \183 for (psS32 i = 0; i < length; i++) { \ 184 184 deltaT = t; \ 185 185 oldX = x; \ … … 228 228 } 229 229 230 psImage* psImageConvolve(psImage* out, const psImage* in, const psKernel* kernel, bool direct)230 psImage* psImageConvolve(psImage* out, const psImage* in, const psKernel* kernel, psBool direct) 231 231 { 232 232 if (in == NULL) { … … 242 242 return NULL; 243 243 } 244 intxMin = kernel->xMin;245 intxMax = kernel->xMax;246 intyMin = kernel->yMin;247 intyMax = kernel->yMax;244 psS32 xMin = kernel->xMin; 245 psS32 xMax = kernel->xMax; 246 psS32 yMin = kernel->yMin; 247 psS32 yMax = kernel->yMax; 248 248 psKernelType** kData = kernel->kernel; 249 249 250 250 // make the output image to the proper size and type 251 intnumRows = in->numRows;252 intnumCols = in->numCols;251 psS32 numRows = in->numRows; 252 psS32 numCols = in->numCols; 253 253 254 254 … … 261 261 ps##TYPE** inData = in->data.TYPE; \ 262 262 out = psImageRecycle(out, numCols, numRows, PS_TYPE_##TYPE); \ 263 for ( introw=0;row<numRows;row++) { \263 for (psS32 row=0;row<numRows;row++) { \ 264 264 ps##TYPE* outRow = out->data.TYPE[row]; \ 265 for ( intcol=0;col<numCols;col++) { \265 for (psS32 col=0;col<numCols;col++) { \ 266 266 ps##TYPE pixel = 0.0; \ 267 for ( intkRow = yMin; kRow < yMax; kRow++) { \267 for (psS32 kRow = yMin; kRow < yMax; kRow++) { \ 268 268 if (row-kRow >= 0 && row-kRow < numRows) { \ 269 for ( intkCol = xMin; kCol < xMax; kCol++) { \269 for (psS32 kCol = xMin; kCol < xMax; kCol++) { \ 270 270 if (col-kCol >= 0 && col-kCol < numCols) { \ 271 271 pixel += kData[kRow][kCol] * inData[row-kRow][col-kCol]; \ … … 310 310 } else { 311 311 // fourier convolution 312 intpaddedCols = numCols+2*FOURIER_PADDING;313 intpaddedRows = numRows+2*FOURIER_PADDING;312 psS32 paddedCols = numCols+2*FOURIER_PADDING; 313 psS32 paddedRows = numRows+2*FOURIER_PADDING; 314 314 315 315 // check to see if kernel is smaller, otherwise padding it up will fail. 316 intkRows = kernel->image->numRows;317 intkCols = kernel->image->numCols;316 psS32 kRows = kernel->image->numRows; 317 psS32 kCols = kernel->image->numCols; 318 318 if (kRows >= numRows || kCols >= numCols) { 319 319 psErrorMsg(PS_ERRORNAME_DOMAIN "psImageConvolve", … … 328 328 // pad the image 329 329 psImage* paddedImage = psImageAlloc(paddedCols,paddedRows,in->type.type); 330 intelementSize = PSELEMTYPE_SIZEOF(in->type.type);330 psS32 elementSize = PSELEMTYPE_SIZEOF(in->type.type); 331 331 332 332 // zero out padded area on top and bottom … … 335 335 336 336 // fill in the image-containing rows. 337 intsidePaddingSize = FOURIER_PADDING*elementSize;338 intimageRowSize = numCols*elementSize;337 psS32 sidePaddingSize = FOURIER_PADDING*elementSize; 338 psS32 imageRowSize = numCols*elementSize; 339 339 psU8* paddedData = paddedImage->data.U8[FOURIER_PADDING]; 340 for ( introw=0;row<numRows;row++) {340 for (psS32 row=0;row<numRows;row++) { 341 341 // zero out padded area on left edge. 342 342 memset(paddedData,0,sidePaddingSize); … … 354 354 psImage* paddedKernel = psImageAlloc(paddedCols,paddedRows,PS_TYPE_KERNEL); 355 355 memset(paddedKernel->data.U8[0],0,sizeof(psKernelType)*numCols*numRows); // zero-out image 356 intyMax = kernel->yMax;357 intxMax = kernel->xMax;358 for ( introw = kernel->yMin; row <= yMax;row++) {359 intpadRow = row;356 psS32 yMax = kernel->yMax; 357 psS32 xMax = kernel->xMax; 358 for (psS32 row = kernel->yMin; row <= yMax;row++) { 359 psS32 padRow = row; 360 360 if (padRow < 0) { 361 361 padRow += paddedRows; … … 363 363 psKernelType* padData = paddedKernel->data.PS_TYPE_KERNEL_DATA[padRow]; 364 364 psKernelType* kernelRow = kernel->kernel[row]; 365 for ( intcol = kernel->xMin; col <= xMax; col++) {365 for (psS32 col = kernel->xMin; col <= xMax; col++) { 366 366 if (col < 0) { 367 367 padData[col+paddedCols] = kernelRow[col]; … … 418 418 out = psImageRecycle(out,numCols,numRows,PS_TYPE_F32); 419 419 float factor = 1.0f/numCols/numRows; 420 for ( introw = 0; row < numRows; row++) {420 for (psS32 row = 0; row < numRows; row++) { 421 421 psF32* outRow = out->data.F32[row]; 422 422 psC32* resultRow = complexOutSansPad->data.C32[row]; 423 for ( intcol = 0; col < numCols; col++) {423 for (psS32 col = 0; col < numCols; col++) { 424 424 outRow[col] = crealf(resultRow[col])*factor; 425 425 } -
trunk/psLib/src/image/psImageConvolve.h
r1863 r2204 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $10 * @date $Date: 2004- 09-23 18:30:57$9 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-10-27 00:57:31 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 15 15 #ifndef PS_IMAGE_CONVOLVE_H 16 16 #define PS_IMAGE_CONVOLVE_H 17 18 #include<stdbool.h>19 17 20 18 #include "psImage.h" … … 32 30 { 33 31 psImage* image; ///< Kernel data, in the form of an image 34 intxMin; ///< Most negative x index35 intyMin; ///< Most negative y index36 intxMax; ///< Most positive x index37 intyMax; ///< Most positive y index32 psS32 xMin; ///< Most negative x index 33 psS32 yMin; ///< Most negative y index 34 psS32 xMax; ///< Most positive x index 35 psS32 yMax; ///< Most positive y index 38 36 psKernelType** kernel; ///< Pointer to the kernel data 39 37 psKernelType** p_kernelRows; ///< Pointer to the rows of the kernel data; not intended for user use. … … 68 66 */ 69 67 psKernel* psKernelAlloc( 70 intxMin, ///< Most negative x index71 intxMax, ///< Most positive x index72 intyMin, ///< Most negative y index73 intyMax ///< Most positive y index68 psS32 xMin, ///< Most negative x index 69 psS32 xMax, ///< Most positive x index 70 psS32 yMin, ///< Most negative y index 71 psS32 yMax ///< Most positive y index 74 72 ); 75 73 … … 94 92 const psVector* xShifts, ///< list of x-axis shifts 95 93 const psVector* yShifts, ///< list of y-axis shifts 96 bool relative94 psBool relative 97 95 ); 98 96 … … 118 116 const psImage* in, ///< the psImage to convolve 119 117 const psKernel* kernel, ///< kernel to colvolve with 120 bool direct ///< specifies method, true=direct convolution, false=fourier118 psBool direct ///< specifies method, true=direct convolution, false=fourier 121 119 ); 122 120 -
trunk/psLib/src/image/psImageExtraction.c
r2105 r2204 9 9 * @author Robert DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1.2 6$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10- 14 01:22:59$11 * @version $Revision: 1.27 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:31 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 26 26 psImage* imageSubset(psImage* out, 27 27 psImage* image, 28 intcol0,29 introw0,30 intcol1,31 introw1)28 psS32 col0, 29 psS32 row0, 30 psS32 col1, 31 psS32 row1) 32 32 { 33 unsigned intelementSize; // size of image element in bytes34 unsigned intinputColOffset; // offset in bytes to first subset pixel in input row33 psU32 elementSize; // size of image element in bytes 34 psU32 inputColOffset; // offset in bytes to first subset pixel in input row 35 35 36 36 if (image == NULL || image->data.V == NULL) { … … 68 68 return NULL; 69 69 } 70 intnumRows = row1-row0;71 intnumCols = col1-col0;70 psS32 numRows = row1-row0; 71 psS32 numCols = col1-col0; 72 72 73 73 elementSize = PSELEMTYPE_SIZEOF(image->type.type); … … 82 82 83 83 // increment the raw data buffer before freeing anything in the 'out' 84 void*rawData = psMemIncrRefCounter(image->rawDataBuffer);84 psPtr rawData = psMemIncrRefCounter(image->rawDataBuffer); 85 85 86 86 if (out != NULL) { … … 97 97 } 98 98 99 out->data.V = psRealloc(out->data.V,sizeof( void*)*numRows); // resize row pointer array99 out->data.V = psRealloc(out->data.V,sizeof(psPtr)*numRows); // resize row pointer array 100 100 *(psType*)&out->type = image->type; 101 *( unsigned int*)&out->numCols = numCols;102 *( unsigned int*)&out->numRows = numRows;103 *( int*)&out->row0 = row0;104 *( int*)&out->col0 = col0;101 *(psU32*)&out->numCols = numCols; 102 *(psU32*)&out->numRows = numRows; 103 *(psS32*)&out->row0 = row0; 104 *(psS32*)&out->col0 = col0; 105 105 out->parent = image; 106 106 out->children = NULL; … … 111 111 112 112 inputColOffset = elementSize * col0; 113 for ( introw = 0; row < numRows; row++) {113 for (psS32 row = 0; row < numRows; row++) { 114 114 out->data.V[row] = image->data.U8[row0 + row] + inputColOffset; 115 115 } 116 116 117 117 // add output image as a child of the input image. 118 intn = 0;118 psS32 n = 0; 119 119 psArray* children = image->children; 120 120 if (children == NULL) { … … 134 134 135 135 psImage* psImageSubset(psImage* image, 136 intcol0,137 introw0,138 intcol1,139 introw1)136 psS32 col0, 137 psS32 row0, 138 psS32 col1, 139 psS32 row1) 140 140 { 141 141 return imageSubset(NULL,image,col0,row0,col1,row1); … … 145 145 const char* section) 146 146 { 147 intcol0;148 intcol1;149 introw0;150 introw1;147 psS32 col0; 148 psS32 col1; 149 psS32 row0; 150 psS32 row1; 151 151 152 152 // section should be of the form '[col0:col1,row0:row1]' … … 177 177 } 178 178 179 psImage* psImageTrim(psImage* image, int col0, int row0, int col1, introw1)179 psImage* psImageTrim(psImage* image, psS32 col0, psS32 row0, psS32 col1, psS32 row1) 180 180 { 181 181 if (image == NULL || image->data.V == NULL) { … … 220 220 psImageFreeChildren(image); 221 221 222 unsigned intelementSize = PSELEMTYPE_SIZEOF(image->type.type);223 unsigned intnumCols = col1-col0;224 unsigned intnumRows = row1-row0;225 unsigned introwSize = elementSize*numCols;226 unsigned intcolOffset = elementSize * col0;222 psU32 elementSize = PSELEMTYPE_SIZEOF(image->type.type); 223 psU32 numCols = col1-col0; 224 psU32 numRows = row1-row0; 225 psU32 rowSize = elementSize*numCols; 226 psU32 colOffset = elementSize * col0; 227 227 psU8* imageData = image->rawDataBuffer; 228 for ( introw = row0; row < row1; row++) {228 for (psS32 row = row0; row < row1; row++) { 229 229 memmove(imageData,image->data.U8[row] + colOffset,rowSize); 230 230 imageData += rowSize; 231 231 } 232 232 233 *( unsigned int*)&image->numRows = numRows;234 *( unsigned int*)&image->numCols = numCols;233 *(psU32*)&image->numRows = numRows; 234 *(psU32*)&image->numCols = numCols; 235 235 236 236 // XXX: should I really resize the buffers? 237 image->data.V = psRealloc(image->data.V,sizeof( void*)*numRows);237 image->data.V = psRealloc(image->data.V,sizeof(psPtr)*numRows); 238 238 image->rawDataBuffer = psRealloc(image->rawDataBuffer,rowSize*numRows); 239 239 240 240 image->data.V[0] = image->rawDataBuffer; 241 for ( intr = 1; r < numRows; r++) {241 for (psS32 r = 1; r < numRows; r++) { 242 242 image->data.U8[r] = image->data.U8[r-1] + rowSize; 243 243 } … … 250 250 const psImage* restrict in, 251 251 const psImage* restrict mask, 252 unsigned intmaskVal,253 intcol0,254 introw0,255 intcol1,256 introw1,252 psU32 maskVal, 253 psS32 col0, 254 psS32 row0, 255 psS32 col1, 256 psS32 row1, 257 257 psImageCutDirection direction, 258 258 const psStats* stats) … … 261 261 psStats* myStats; 262 262 psElemType type; 263 intinRows;264 intinCols;265 intdelta = 1;263 psS32 inRows; 264 psS32 inCols; 265 psS32 delta = 1; 266 266 psF64* outData; 267 267 … … 349 349 *myStats = *stats; 350 350 351 intnumCols = col1-col0;352 intnumRows = row1-row0;351 psS32 numCols = col1-col0; 352 psS32 numRows = row1-row0; 353 353 354 354 if (direction == PS_CUT_X_POS || direction == PS_CUT_X_NEG) { … … 380 380 case PS_TYPE_##TYPE: { \ 381 381 psMaskType* maskVecData = NULL; \ 382 for ( intc=col0;c<col1;c++) { \382 for (psS32 c=col0;c<col1;c++) { \ 383 383 ps##TYPE *imgData = in->data.TYPE[row0] + c; \ 384 384 ps##TYPE *imgVecData = imgVec->data.TYPE; \ … … 387 387 maskData = (psMaskType* )(mask->data.V[row0]) + c; \ 388 388 } \ 389 for ( intr=row0;r<row1;r++) { \389 for (psS32 r=row0;r<row1;r++) { \ 390 390 *(imgVecData++) = *imgData; \ 391 391 imgData += inCols; \ … … 437 437 psVector* imgVec = NULL; 438 438 psVector* maskVec = NULL; 439 intelementSize = PSELEMTYPE_SIZEOF(type);439 psS32 elementSize = PSELEMTYPE_SIZEOF(type); 440 440 psU32* outPosition = NULL; 441 441 … … 465 465 } 466 466 467 for ( intr = row0; r < row1; r++) {467 for (psS32 r = row0; r < row1; r++) { 468 468 // point the vector struct to the 469 469 // data to calculate the stats 470 imgVec->data.V = ( void *)(in->data.U8[r] + col0 * elementSize);470 imgVec->data.V = (psPtr )(in->data.U8[r] + col0 * elementSize); 471 471 if (maskVec != NULL) { 472 maskVec->data.V = ( void *)(mask->data.U8[r] + col0 * sizeof(psMaskType));472 maskVec->data.V = (psPtr )(mask->data.U8[r] + col0 * sizeof(psMaskType)); 473 473 } 474 474 myStats = psVectorStats(myStats, imgVec, maskVec, maskVal); … … 503 503 const psImage* in, 504 504 const psImage* restrict mask, 505 unsigned intmaskVal,505 psU32 maskVal, 506 506 float startCol, 507 507 float startRow, 508 508 float endCol, 509 509 float endRow, 510 unsigned intnSamples,510 psU32 nSamples, 511 511 psImageInterpolateMode mode) 512 512 { … … 518 518 return NULL; 519 519 } 520 intnumCols = in->numCols;521 intnumRows = in->numRows;520 psS32 numCols = in->numCols; 521 psS32 numRows = in->numRows; 522 522 523 523 if (nSamples < 2) { … … 594 594 case PS_TYPE_##TYPE: { \ 595 595 ps##TYPE* outData = out->data.TYPE; \ 596 for ( inti = 0; i < nSamples; i++) { \596 for (psS32 i = 0; i < nSamples; i++) { \ 597 597 float x = startCol + (float)i*dX; \ 598 598 float y = startRow + (float)i*dY; \ … … 642 642 const psImage* in, 643 643 const psImage* restrict mask, 644 unsigned intmaskVal,644 psU32 maskVal, 645 645 float centerCol, 646 646 float centerRow, … … 659 659 return NULL; 660 660 } 661 intnumCols = in->numCols;662 intnumRows = in->numRows;661 psS32 numCols = in->numCols; 662 psS32 numRows = in->numRows; 663 663 664 664 if (mask != NULL) { … … 734 734 735 735 // size the output vector to proper size. 736 intnumOut = radii->n - 1;736 psS32 numOut = radii->n - 1; 737 737 out = psVectorRecycle(out, numOut, PS_TYPE_F64); 738 738 psF64* outData = out->data.F64; … … 741 741 psF32* rSq = rSqVec->data.F32; 742 742 743 intstartRow = centerRow - rSq[numOut];744 intendRow = centerRow + rSq[numOut];745 intstartCol = centerCol - rSq[numOut];746 intendCol = centerCol + rSq[numOut];743 psS32 startRow = centerRow - rSq[numOut]; 744 psS32 endRow = centerRow + rSq[numOut]; 745 psS32 startCol = centerCol - rSq[numOut]; 746 psS32 endCol = centerCol + rSq[numOut]; 747 747 748 748 if (startRow < 0) { … … 763 763 764 764 // Square the radii data 765 for ( intd = 0; d <= numOut; d++) {765 for (psS32 d = 0; d <= numOut; d++) { 766 766 rSq[d] *= rSq[d]; 767 767 } … … 770 770 psVector** buffer = psAlloc(sizeof(psVector*)*numOut); 771 771 psVector** bufferMask = psAlloc(sizeof(psVector*)*numOut); 772 for ( intlcv = 0; lcv < numOut; lcv++) {772 for (psS32 lcv = 0; lcv < numOut; lcv++) { 773 773 // n.b. alloc enough for the data by making the vectors slightly larger 774 774 // than the area of the region of interest. … … 788 788 float dY; 789 789 float dist; 790 for ( introw=startRow; row <= endRow; row++) {790 for (psS32 row=startRow; row <= endRow; row++) { 791 791 psF32* inRow = in->data.F32[row]; 792 792 psMaskType* maskRow = NULL; … … 794 794 maskRow = mask->data.PS_TYPE_MASK_DATA[row]; 795 795 } 796 for ( intcol=startCol; col <= endCol; col++) {796 for (psS32 col=startCol; col <= endCol; col++) { 797 797 dX = centerCol - (float)col - 0.5f; 798 798 dY = centerRow - (float)row - 0.5f; 799 799 dist = dX*dX+dY*dY; 800 for ( intr = 0; r < numOut; r++) {800 for (psS32 r = 0; r < numOut; r++) { 801 801 if (rSq[r] < dist && dist < rSq[r+1]) { 802 intn = buffer[r]->n;802 psS32 n = buffer[r]->n; 803 803 if (n == buffer[r]->nalloc) { // in case buffers already full, expand 804 804 buffer[r] = psVectorRealloc(buffer[r], n*2); … … 825 825 *myStats = *stats; 826 826 827 for ( intr = 0; r < numOut; r++) {827 for (psS32 r = 0; r < numOut; r++) { 828 828 myStats = psVectorStats(myStats,buffer[r], bufferMask[r],maskVal); 829 829 (void)p_psGetStatValue(myStats,&statVal); … … 833 833 psFree(myStats); 834 834 835 for ( intlcv = 0; lcv < numOut; lcv++) {835 for (psS32 lcv = 0; lcv < numOut; lcv++) { 836 836 psFree(buffer[lcv]); 837 837 psFree(bufferMask[lcv]); -
trunk/psLib/src/image/psImageExtraction.h
r2088 r2204 10 10 * @author Robert DeSonia, MHPCC 11 11 * 12 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-10- 13 22:05:03$12 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:31 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 54 54 psImage* psImageSubset( 55 55 psImage* image, ///< Parent image. 56 intcol0, ///< starting column of subimage57 introw0, ///< starting row of subimage58 intcol1, ///< exclusive end column of subimage.59 introw1 ///< exclusive end row of subimage56 psS32 col0, ///< starting column of subimage 57 psS32 row0, ///< starting row of subimage 58 psS32 col1, ///< exclusive end column of subimage. 59 psS32 row1 ///< exclusive end row of subimage 60 60 ); 61 61 … … 93 93 psImage* psImageTrim( 94 94 psImage* image, ///< image to trim 95 intcol0, ///< column of trim region's left boundary96 introw0, ///< row of trim region's lower boundary97 intcol1, ///< column of trim region's right boundary98 introw1 ///< row of trim region's upper boundary95 psS32 col0, ///< column of trim region's left boundary 96 psS32 row0, ///< row of trim region's lower boundary 97 psS32 col1, ///< column of trim region's right boundary 98 psS32 row1 ///< row of trim region's upper boundary 99 99 ); 100 100 … … 130 130 const psImage* restrict input, ///< the input image in which to perform the slice 131 131 const psImage* restrict mask, ///< the mask for the input image. 132 unsigned intmaskVal, ///< the mask value to apply to the mask133 intcol0, ///< the leftmost column of the slice region134 introw0, ///< the bottommost row of the slice region135 intcol1, ///< exclusive end column of the slice region136 introw1, ///< exclusive end row of the slice region132 psU32 maskVal, ///< the mask value to apply to the mask 133 psS32 col0, ///< the leftmost column of the slice region 134 psS32 row0, ///< the bottommost row of the slice region 135 psS32 col1, ///< exclusive end column of the slice region 136 psS32 row1, ///< exclusive end row of the slice region 137 137 psImageCutDirection direction, ///< the slice dimension and direction 138 138 const psStats* stats ///< the statistic to perform in slice operation … … 161 161 const psImage* input, ///< the input image in which to perform the cut 162 162 const psImage* restrict mask, ///< the mask for the input image. 163 unsigned intmaskVal, ///< the mask value to apply to the mask163 psU32 maskVal, ///< the mask value to apply to the mask 164 164 float startCol, ///< the column of the start of the cut line 165 165 float startRow, ///< the row of the start of the cut line 166 166 float endCol, ///< the column of the end of the cut line 167 167 float endRow, ///< the row of the end of the cut line 168 unsigned intnSamples, ///< the number of samples along the cut168 psU32 nSamples, ///< the number of samples along the cut 169 169 psImageInterpolateMode mode ///< the interpolation method to use 170 170 ); … … 187 187 const psImage* input, ///< the input image in which to perform the cut 188 188 const psImage* restrict mask, ///< the mask for the input image. 189 unsigned intmaskVal, ///< the mask value to apply to the mask189 psU32 maskVal, ///< the mask value to apply to the mask 190 190 float centerCol, ///< the column of the center of the cut circle 191 191 float centerRow, ///< the row of the center of the cut circle -
trunk/psLib/src/image/psImageFFT.c
r1983 r2204 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-10- 06 21:31:30$7 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-10-27 00:57:31 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 11 11 */ 12 12 #include <unistd.h> 13 #include <stdbool.h>14 13 #include <string.h> 15 14 #include <complex.h> … … 27 26 #define PS_FFTW_PLAN_RIGOR FFTW_ESTIMATE 28 27 29 static bool p_fftwWisdomImported = false;28 static psBool p_fftwWisdomImported = false; 30 29 31 30 psImage* psImageFFT(psImage* out, const psImage* in, psFftDirection direction) 32 31 { 33 unsigned intnumCols;34 unsigned intnumRows;32 psU32 numCols; 33 psU32 numRows; 35 34 psElemType type; 36 35 fftwf_plan plan; … … 77 76 78 77 // n.b. FFTW can perform a in-place transform at the same rate or faster than out-of-place. 79 intsign = ((direction & PS_FFT_FORWARD) != 0) ? FFTW_FORWARD : FFTW_BACKWARD;78 psS32 sign = ((direction & PS_FFT_FORWARD) != 0) ? FFTW_FORWARD : FFTW_BACKWARD; 80 79 out = psImageCopy(out, in, PS_TYPE_C32); 81 80 plan = fftwf_plan_dft_2d(numCols, numRows, … … 118 117 { 119 118 psElemType type; 120 unsigned intnumCols;121 unsigned intnumRows;119 psU32 numCols; 120 psU32 numRows; 122 121 123 122 if (in == NULL) { … … 140 139 141 140 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32); 142 for ( unsigned introw = 0; row < numRows; row++) {141 for (psU32 row = 0; row < numRows; row++) { 143 142 outRow = out->data.F32[row]; 144 143 inRow = in->data.C32[row]; 145 144 146 for ( unsigned intcol = 0; col < numCols; col++) {145 for (psU32 col = 0; col < numCols; col++) { 147 146 outRow[col] = crealf(inRow[col]); 148 147 } … … 153 152 154 153 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64); 155 for ( unsigned introw = 0; row < numRows; row++) {154 for (psU32 row = 0; row < numRows; row++) { 156 155 outRow = out->data.F64[row]; 157 156 inRow = in->data.C64[row]; 158 157 159 for ( unsigned intcol = 0; col < numCols; col++) {158 for (psU32 col = 0; col < numCols; col++) { 160 159 outRow[col] = creal(inRow[col]); 161 160 } … … 179 178 { 180 179 psElemType type; 181 unsigned intnumCols;182 unsigned intnumRows;180 psU32 numCols; 181 psU32 numRows; 183 182 184 183 if (in == NULL) { … … 203 202 204 203 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32); 205 for ( unsigned introw = 0; row < numRows; row++) {204 for (psU32 row = 0; row < numRows; row++) { 206 205 outRow = out->data.F32[row]; 207 206 inRow = in->data.C32[row]; 208 207 209 for ( unsigned intcol = 0; col < numCols; col++) {208 for (psU32 col = 0; col < numCols; col++) { 210 209 outRow[col] = cimagf(inRow[col]); 211 210 } … … 216 215 217 216 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64); 218 for ( unsigned introw = 0; row < numRows; row++) {217 for (psU32 row = 0; row < numRows; row++) { 219 218 outRow = out->data.F64[row]; 220 219 inRow = in->data.C64[row]; 221 220 222 for ( unsigned intcol = 0; col < numCols; col++) {221 for (psU32 col = 0; col < numCols; col++) { 223 222 outRow[col] = cimag(inRow[col]); 224 223 } … … 241 240 { 242 241 psElemType type; 243 unsigned intnumCols;244 unsigned intnumRows;242 psU32 numCols; 243 psU32 numRows; 245 244 246 245 if (real == NULL || imag == NULL) { … … 282 281 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32); 283 282 284 for ( unsigned introw = 0; row < numRows; row++) {283 for (psU32 row = 0; row < numRows; row++) { 285 284 outRow = out->data.C32[row]; 286 285 realRow = real->data.F32[row]; 287 286 imagRow = imag->data.F32[row]; 288 287 289 for ( unsigned intcol = 0; col < numCols; col++) {288 for (psU32 col = 0; col < numCols; col++) { 290 289 outRow[col] = realRow[col] + I * imagRow[col]; 291 290 } … … 297 296 298 297 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64); 299 for ( unsigned introw = 0; row < numRows; row++) {298 for (psU32 row = 0; row < numRows; row++) { 300 299 outRow = out->data.C64[row]; 301 300 realRow = real->data.F64[row]; 302 301 imagRow = imag->data.F64[row]; 303 302 304 for ( unsigned intcol = 0; col < numCols; col++) {303 for (psU32 col = 0; col < numCols; col++) { 305 304 outRow[col] = realRow[col] + I * imagRow[col]; 306 305 } … … 324 323 { 325 324 psElemType type; 326 unsigned intnumCols;327 unsigned intnumRows;325 psU32 numCols; 326 psU32 numRows; 328 327 329 328 if (in == NULL) { … … 346 345 347 346 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C32); 348 for ( unsigned introw = 0; row < numRows; row++) {347 for (psU32 row = 0; row < numRows; row++) { 349 348 outRow = out->data.C32[row]; 350 349 inRow = in->data.C32[row]; 351 350 352 for ( unsigned intcol = 0; col < numCols; col++) {351 for (psU32 col = 0; col < numCols; col++) { 353 352 outRow[col] = crealf(inRow[col]) - I * cimagf(inRow[col]); 354 353 } … … 359 358 360 359 out = psImageRecycle(out, numCols, numRows, PS_TYPE_C64); 361 for ( unsigned introw = 0; row < numRows; row++) {360 for (psU32 row = 0; row < numRows; row++) { 362 361 outRow = out->data.C64[row]; 363 362 inRow = in->data.C64[row]; 364 363 365 for ( unsigned intcol = 0; col < numCols; col++) {364 for (psU32 col = 0; col < numCols; col++) { 366 365 outRow[col] = creal(inRow[col]) - I * cimag(inRow[col]); 367 366 } … … 384 383 { 385 384 psElemType type; 386 unsigned intnumCols;387 unsigned intnumRows;388 intnumElementsSquared;385 psU32 numCols; 386 psU32 numRows; 387 psS32 numElementsSquared; 389 388 390 389 if (in == NULL) { … … 405 404 406 405 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F32); 407 for ( unsigned introw = 0; row < numRows; row++) {406 for (psU32 row = 0; row < numRows; row++) { 408 407 outRow = out->data.F32[row]; 409 408 inRow = in->data.C32[row]; 410 409 411 for ( unsigned intcol = 0; col < numCols; col++) {410 for (psU32 col = 0; col < numCols; col++) { 412 411 real = crealf(inRow[col]); 413 412 imag = cimagf(inRow[col]); … … 422 421 423 422 out = psImageRecycle(out, numCols, numRows, PS_TYPE_F64); 424 for ( unsigned introw = 0; row < numRows; row++) {423 for (psU32 row = 0; row < numRows; row++) { 425 424 outRow = out->data.F64[row]; 426 425 inRow = in->data.C64[row]; 427 426 428 for ( unsigned intcol = 0; col < numCols; col++) {427 for (psU32 col = 0; col < numCols; col++) { 429 428 real = creal(inRow[col]); 430 429 imag = cimag(inRow[col]); -
trunk/psLib/src/image/psImageIO.c
r1941 r2204 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-10- 02 02:08:00$9 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-10-27 00:57:31 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 15 15 #include <fitsio.h> 16 16 #include <unistd.h> 17 #include <stdbool.h>18 17 19 18 #include "psImageIO.h" … … 24 23 25 24 psImage* psImageReadSection(psImage* output, 26 intcol,27 introw,28 intnumCols,29 intnumRows,30 intz,25 psS32 col, 26 psS32 row, 27 psS32 numCols, 28 psS32 numRows, 29 psS32 z, 31 30 char *extname, 32 intextnum,31 psS32 extnum, 33 32 char *filename) 34 33 { 35 34 fitsfile *fptr = NULL; /* Pointer to the FITS file */ 36 intstatus = 0; /* CFITSIO file vars */37 intnAxis = 0;38 intanynull = 0;39 intbitPix = 0; /* Pixel type */40 longnAxes[3];41 longfirstPixel[3]; /* lower-left corner of image subset */42 longlastPixel[3]; /* upper-right corner of image subset */43 longincrement[3]; /* increment for image subset */35 psS32 status = 0; /* CFITSIO file vars */ 36 psS32 nAxis = 0; 37 psS32 anynull = 0; 38 psS32 bitPix = 0; /* Pixel type */ 39 psS64 nAxes[3]; 40 psS64 firstPixel[3]; /* lower-left corner of image subset */ 41 psS64 lastPixel[3]; /* upper-right corner of image subset */ 42 psS64 increment[3]; /* increment for image subset */ 44 43 char fitsErr[80] = ""; /* CFITSIO error message string */ 45 inthduType = IMAGE_HDU;46 intfitsDatatype = 0;47 intdatatype = 0;44 psS32 hduType = IMAGE_HDU; 45 psS32 fitsDatatype = 0; 46 psS32 datatype = 0; 48 47 49 48 if (filename == NULL) { … … 228 227 } 229 228 230 bool psImageWriteSection(psImage* input,231 intcol0,232 introw0,233 intz,234 char *extname,235 intextnum,236 char *filename)229 psBool psImageWriteSection(psImage* input, 230 psS32 col0, 231 psS32 row0, 232 psS32 z, 233 char *extname, 234 psS32 extnum, 235 char *filename) 237 236 { 238 intnumCols = 0;239 intnumRows = 0;240 241 intstatus = 0; /* CFITSIO status */237 psS32 numCols = 0; 238 psS32 numRows = 0; 239 240 psS32 status = 0; /* CFITSIO status */ 242 241 fitsfile *fptr = NULL; /* pointer to the FITS file */ 243 longnAxes[3]; /* Image axis vars */244 longfirstPixel[3]; /* First Pixel to read */245 longlastPixel[3]; /* Last Pixel to read */242 psS64 nAxes[3]; /* Image axis vars */ 243 psS64 firstPixel[3]; /* First Pixel to read */ 244 psS64 lastPixel[3]; /* Last Pixel to read */ 246 245 char fitsErr[80]; /* FITSIO message string */ 247 intdatatype = 0; /* the datatype of the image */248 intbitPix = 0; /* FITS bitPix value */249 inthduType = IMAGE_HDU; /* the HDU type (image,table, etc.) */246 psS32 datatype = 0; /* the datatype of the image */ 247 psS32 bitPix = 0; /* FITS bitPix value */ 248 psS32 hduType = IMAGE_HDU; /* the HDU type (image,table, etc.) */ 250 249 double bscale = 1.0; 251 250 double bzero = 0.0; 252 bool createNewHDU = false;251 psBool createNewHDU = false; 253 252 254 253 /* need a valid image to write */ … … 336 335 } 337 336 } else { 338 intnumHDUs = 0;337 psS32 numHDUs = 0; 339 338 340 339 fits_get_num_hdus(fptr, &numHDUs, &status); -
trunk/psLib/src/image/psImageIO.h
r1442 r2204 10 10 * @author Robert DeSonia, MHPCC 11 11 * 12 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $13 * @date $Date: 2004- 08-10 01:05:53$12 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:31 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 17 17 #ifndef PS_IMAGEIO_H 18 18 #define PS_IMAGEIO_H 19 20 #include <stdbool.h>21 19 22 20 #include "psImage.h" … … 34 32 /**< the output psImage to recycle, or NULL if new psImage desired */ 35 33 36 intcol0,34 psS32 col0, 37 35 /**< the column index of the origin to start reading */ 38 36 39 introw0,37 psS32 row0, 40 38 /**< the row index of the origin to start reading */ 41 39 42 intnumCols,40 psS32 numCols, 43 41 /**< the number of desired columns to read */ 44 42 45 intnumRows,43 psS32 numRows, 46 44 /**< the number of desired rows to read */ 47 45 48 intz,46 psS32 z, 49 47 /**< the z index to read if file is organized as a 3D image cube. */ 50 48 … … 54 52 */ 55 53 56 intextnum,54 psS32 extnum, 57 55 /**< the image extension to read (0=PHU, 1=first extension, etc.) This is 58 56 * only used if extname is NULL … … 65 63 /** Read an image or subimage from a FITS file specified by a filename. 66 64 * 67 * return bool TRUE is successful, otherwise FALSE.65 * return psBool TRUE is successful, otherwise FALSE. 68 66 */ 69 bool psImageWriteSection(67 psBool psImageWriteSection( 70 68 psImage* input, 71 69 /**< the psImage to write */ 72 70 73 intcol0,71 psS32 col0, 74 72 /**< the column index of the origin to start writing */ 75 73 76 introw0,74 psS32 row0, 77 75 /**< the row index of the origin to start writing */ 78 76 79 intz,77 psS32 z, 80 78 /**< the z index to start writing */ 81 79 … … 85 83 */ 86 84 87 intextnum,85 psS32 extnum, 88 86 /**< the image extension to write (0=PHU, 1=first extension, etc.) This is 89 87 * only used if extname is NULL. -
trunk/psLib/src/image/psImageManip.c
r2105 r2204 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.2 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-10- 14 01:22:59$12 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:31 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 #include <math.h> // for isfinite(), etc. 19 19 #include <stdlib.h> 20 #include <stdbool.h>21 20 #include <string.h> // for memcpy, etc. 22 21 … … 29 28 #include "psImageErrors.h" 30 29 31 intpsImageClip(psImage* input,32 psF64 min,33 psF64 vmin,34 psF64 max,35 psF64 vmax)30 psS32 psImageClip(psImage* input, 31 psF64 min, 32 psF64 vmin, 33 psF64 max, 34 psF64 vmax) 36 35 { 37 intnumClipped = 0;38 unsigned intnumRows;39 unsigned intnumCols;36 psS32 numClipped = 0; 37 psU32 numRows; 38 psU32 numCols; 40 39 41 40 if (input == NULL) { … … 72 71 (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \ 73 72 } \ 74 for ( unsigned introw = 0;row<numRows;row++) { \73 for (psU32 row = 0;row<numRows;row++) { \ 75 74 ps##type* inputRow = input->data.type[row]; \ 76 for ( unsigned intcol = 0; col < numCols; col++) { \75 for (psU32 col = 0; col < numCols; col++) { \ 77 76 if ((psF64)inputRow[col] < min) { \ 78 77 inputRow[col] = (ps##type)vmin; \ … … 103 102 (psF64)PS_MIN_##type,(psF64)PS_MAX_##type); \ 104 103 } \ 105 for ( unsigned introw = 0;row<numRows;row++) { \104 for (psU32 row = 0;row<numRows;row++) { \ 106 105 ps##type* inputRow = input->data.type[row]; \ 107 for ( unsigned intcol = 0; col < numCols; col++) { \106 for (psU32 col = 0; col < numCols; col++) { \ 108 107 if (absfcn(inputRow[col]) < min) { \ 109 108 inputRow[col] = (ps##type)vmin; \ … … 144 143 } 145 144 146 intpsImageClipNaN(psImage* input,147 psF64 value)145 psS32 psImageClipNaN(psImage* input, 146 psF64 value) 148 147 { 149 intnumClipped = 0;150 unsigned intnumRows;151 unsigned intnumCols;148 psS32 numClipped = 0; 149 psU32 numRows; 150 psU32 numCols; 152 151 153 152 if (input == NULL) { … … 161 160 #define psImageClipNaNCase(type) \ 162 161 case PS_TYPE_##type: \ 163 for ( unsigned introw = 0;row<numRows;row++) { \162 for (psU32 row = 0;row<numRows;row++) { \ 164 163 ps##type* inputRow = input->data.type[row]; \ 165 for ( unsigned intcol = 0; col < numCols; col++) { \164 for (psU32 col = 0; col < numCols; col++) { \ 166 165 if (! isfinite(inputRow[col])) { \ 167 166 inputRow[col] = (ps##type)value; \ … … 190 189 } 191 190 192 intpsImageOverlaySection(psImage* image,193 const psImage* overlay,194 intcol0,195 introw0,196 const char *op)191 psS32 psImageOverlaySection(psImage* image, 192 const psImage* overlay, 193 psS32 col0, 194 psS32 row0, 195 const char *op) 197 196 { 198 unsigned intimageNumRows;199 unsigned intimageNumCols;200 unsigned intoverlayNumRows;201 unsigned intoverlayNumCols;202 unsigned intimageRowLimit;203 unsigned intimageColLimit;197 psU32 imageNumRows; 198 psU32 imageNumCols; 199 psU32 overlayNumRows; 200 psU32 overlayNumCols; 201 psU32 imageRowLimit; 202 psU32 imageColLimit; 204 203 psElemType type; 205 204 … … 257 256 #define psImageOverlayCase(DATATYPE) \ 258 257 case PS_TYPE_##DATATYPE: \ 259 for ( unsigned introw=row0;row<imageRowLimit;row++) { \258 for (psU32 row=row0;row<imageRowLimit;row++) { \ 260 259 ps##DATATYPE* imageRow = image->data.DATATYPE[row]; \ 261 260 ps##DATATYPE* overlayRow = overlay->data.DATATYPE[row-row0]; \ 262 for ( unsigned intcol=col0;col<imageColLimit;col++) { \261 for (psU32 col=col0;col<imageColLimit;col++) { \ 263 262 switch (*op) { \ 264 263 case '+': \ … … 315 314 } 316 315 317 intpsImageClipComplexRegion(psImage* input,318 psC64 min,319 psC64 vmin,320 psC64 max,321 psC64 vmax)316 psS32 psImageClipComplexRegion(psImage* input, 317 psC64 min, 318 psC64 vmin, 319 psC64 max, 320 psC64 vmax) 322 321 { 323 intnumClipped = 0;324 unsigned intnumRows;325 unsigned intnumCols;322 psS32 numClipped = 0; 323 psU32 numRows; 324 psU32 numCols; 326 325 psF64 realMin = creal(min); 327 326 psF64 imagMin = cimag(min); … … 374 373 break; \ 375 374 } \ 376 for ( unsigned introw = 0;row<numRows;row++) { \375 for (psU32 row = 0;row<numRows;row++) { \ 377 376 ps##type* inputRow = input->data.type[row]; \ 378 for ( unsigned intcol = 0; col < numCols; col++) { \377 for (psU32 col = 0; col < numCols; col++) { \ 379 378 if ( (realfcn(inputRow[col]) > realMax) || (imagfcn(inputRow[col]) > imagMax) ) { \ 380 379 inputRow[col] = (ps##type)vmax; \ … … 411 410 const psImage* restrict mask, 412 411 psMaskType maskVal, 413 unsigned intscale,412 psU32 scale, 414 413 const psStats* stats) 415 414 { 416 intinRows;417 intinCols;418 intoutRows;419 intoutCols;415 psS32 inRows; 416 psS32 inCols; 417 psS32 outRows; 418 psS32 outCols; 420 419 psVector* vec; // vector to hold the values of a single bin. 421 420 psVector* maskVec = NULL; // vector to hold the mask of a single bin. … … 491 490 ps##type* vecData = vec->data.type; \ 492 491 psMaskType* inRowMask = NULL; \ 493 for ( introw = 0; row < outRows; row++) { \492 for (psS32 row = 0; row < outRows; row++) { \ 494 493 outRowData = out->data.type[row]; \ 495 intinCurrentRow = row*scale; \496 intinNextRow = (row+1)*scale; \497 for ( intcol = 0; col < outCols; col++) { \498 intinCurrentCol = col*scale; \499 intinNextCol = (col+1)*scale; \500 intn = 0; \501 for ( intinRow = inCurrentRow; inRow < inNextRow && inRow < inRows; inRow++) { \494 psS32 inCurrentRow = row*scale; \ 495 psS32 inNextRow = (row+1)*scale; \ 496 for (psS32 col = 0; col < outCols; col++) { \ 497 psS32 inCurrentCol = col*scale; \ 498 psS32 inNextCol = (col+1)*scale; \ 499 psS32 n = 0; \ 500 for (psS32 inRow = inCurrentRow; inRow < inNextRow && inRow < inRows; inRow++) { \ 502 501 ps##type* inRowData = in->data.type[inRow]; \ 503 502 if (mask != NULL) { \ 504 503 inRowMask = mask->data.PS_TYPE_MASK_DATA[inRow]; \ 505 504 } \ 506 for ( intinCol = inCurrentCol; inCol < inNextCol && inCol < inCols; inCol++) { \505 for (psS32 inCol = inCurrentCol; inCol < inNextCol && inCol < inCols; inCol++) { \ 507 506 if (maskData != NULL) { \ 508 507 maskData[n] = inRowMask[inCol]; \ … … 555 554 psImage* psImageResample(psImage* out, 556 555 const psImage* in, 557 intscale,556 psS32 scale, 558 557 psImageInterpolateMode mode) 559 558 { 560 intoutRows;561 intoutCols;559 psS32 outRows; 560 psS32 outCols; 562 561 float invScale; 563 562 … … 597 596 case PS_TYPE_##TYPE: { \ 598 597 out = psImageRecycle(out,outCols, outRows, PS_TYPE_##TYPE); \ 599 for ( introw=0;row<outRows;row++) { \598 for (psS32 row=0;row<outRows;row++) { \ 600 599 ps##TYPE* rowData = out->data.TYPE[row]; \ 601 600 float inRow = (float)row * invScale; \ 602 for ( intcol=0;col<outCols;col++) { \601 for (psS32 col=0;col<outCols;col++) { \ 603 602 rowData[col] = psImagePixelInterpolate(in,(float)col*invScale,inRow,NULL,0,0,mode); \ 604 603 } \ … … 637 636 psImage* psImageRoll(psImage* out, 638 637 const psImage* in, 639 intdx,640 intdy)638 psS32 dx, 639 psS32 dy) 641 640 { 642 intoutRows;643 intoutCols;644 intelementSize;641 psS32 outRows; 642 psS32 outCols; 643 psS32 elementSize; 645 644 646 645 if (in == NULL) { … … 669 668 } 670 669 671 intsegment1Size = elementSize * (outCols - dx);672 intsegment2Size = elementSize * dx;673 674 for ( introw = 0; row < outRows; row++) {675 intinRowNumber = row + dy;670 psS32 segment1Size = elementSize * (outCols - dx); 671 psS32 segment2Size = elementSize * dx; 672 673 for (psS32 row = 0; row < outRows; row++) { 674 psS32 inRowNumber = row + dy; 676 675 677 676 if (inRowNumber >= outRows) { … … 706 705 if (fabsf(angle - 90.0f) < FLT_EPSILON) { 707 706 // perform 1/4 rotate counter-clockwise 708 intnumRows = in->numCols;709 intnumCols = in->numRows;710 intlastCol = numCols - 1;707 psS32 numRows = in->numCols; 708 psS32 numCols = in->numRows; 709 psS32 lastCol = numCols - 1; 711 710 psElemType type = in->type.type; 712 711 … … 716 715 case PS_TYPE_##TYPE: { \ 717 716 ps##TYPE** inData = in->data.TYPE; \ 718 for ( introw=0;row<numRows;row++) { \717 for (psS32 row=0;row<numRows;row++) { \ 719 718 ps##TYPE* outRow = out->data.TYPE[row]; \ 720 for ( intcol=0;col<numCols;col++) { \719 for (psS32 col=0;col<numCols;col++) { \ 721 720 outRow[col] = inData[lastCol-col][row]; \ 722 721 } \ … … 752 751 } else if (fabsf(angle - 180.0f) < FLT_EPSILON) { 753 752 // perform 1/2 rotate 754 intnumRows = in->numRows;755 intlastRow = numRows - 1;756 intnumCols = in->numCols;757 intlastCol = numCols - 1;753 psS32 numRows = in->numRows; 754 psS32 lastRow = numRows - 1; 755 psS32 numCols = in->numCols; 756 psS32 lastCol = numCols - 1; 758 757 psElemType type = in->type.type; 759 758 … … 762 761 #define PSIMAGE_ROTATE_180_CASE(TYPE) \ 763 762 case PS_TYPE_##TYPE: { \ 764 for ( introw=0;row<numRows;row++) { \763 for (psS32 row=0;row<numRows;row++) { \ 765 764 ps##TYPE* outRow = out->data.TYPE[row]; \ 766 765 ps##TYPE* inRow = in->data.TYPE[lastRow-row]; \ 767 for ( intcol=0;col<numCols;col++) { \766 for (psS32 col=0;col<numCols;col++) { \ 768 767 outRow[col] = inRow[lastCol - col]; \ 769 768 } \ … … 799 798 } else if (fabsf(angle - 270.0f) < FLT_EPSILON) { 800 799 // perform 1/4 rotate clockwise 801 intnumRows = in->numCols;802 intlastRow = numRows - 1;803 intnumCols = in->numRows;800 psS32 numRows = in->numCols; 801 psS32 lastRow = numRows - 1; 802 psS32 numCols = in->numRows; 804 803 psElemType type = in->type.type; 805 804 … … 809 808 case PS_TYPE_##TYPE: { \ 810 809 ps##TYPE** inData = in->data.TYPE; \ 811 for ( introw=0;row<numRows;row++) { \810 for (psS32 row=0;row<numRows;row++) { \ 812 811 ps##TYPE* outRow = out->data.TYPE[row]; \ 813 for ( intcol=0;col<numCols;col++) { \812 for (psS32 col=0;col<numCols;col++) { \ 814 813 outRow[col] = inData[col][lastRow-row]; \ 815 814 } \ … … 847 846 } else { 848 847 psElemType type = in->type.type; 849 intnumRows = in->numRows;850 intnumCols = in->numCols;848 psS32 numRows = in->numRows; 849 psS32 numCols = in->numCols; 851 850 float centerX = (float)(numCols) / 2.0f; 852 851 float centerY = (float)(numRows) / 2.0f; … … 859 858 // y' = y cos(t) - x sin(t); i.e. y' = (y-centerY)*cosT - (x-centerX)*sinT; 860 859 861 intoutCols = ceil(abs(numCols * cosT) + abs(numRows * sinT)) + 1;862 intoutRows = ceil(abs(numCols * sinT) + abs(numRows * cosT)) + 1;860 psS32 outCols = ceil(abs(numCols * cosT) + abs(numRows * sinT)) + 1; 861 psS32 outRows = ceil(abs(numCols * sinT) + abs(numRows * cosT)) + 1; 863 862 float minX = (float)outCols / -2.0f; 864 intintMinY = outRows / -2;863 psS32 intMinY = outRows / -2; 865 864 866 865 out = psImageRecycle(out, outCols, outRows, type); … … 906 905 float inY; \ 907 906 ps##TYPE* outRow; \ 908 for ( inty = 0; y < outRows; y++) { \907 for (psS32 y = 0; y < outRows; y++) { \ 909 908 inX = minXTimesCosTPlusCenterX + (y+intMinY) * sinT; \ 910 909 inY = CenterYMinusminXTimesSinT + (y+intMinY) * cosT; \ 911 910 outRow = out->data.TYPE[y]; \ 912 for ( intx = 0; x < outCols; x++) { \911 for (psS32 x = 0; x < outCols; x++) { \ 913 912 outRow[x] = p_psImagePixelInterpolate##MODE##_##TYPE(in,inX,inY,NULL,0,unexposedValue); \ 914 913 inX += cosT; \ … … 993 992 psImageInterpolateMode mode) 994 993 { 995 intoutRows;996 intoutCols;997 intelementSize;994 psS32 outRows; 995 psS32 outCols; 996 psS32 elementSize; 998 997 psElemType type; 999 998 … … 1030 1029 break; \ 1031 1030 } \ 1032 for ( introw=0;row<outRows;row++) { \1031 for (psS32 row=0;row<outRows;row++) { \ 1033 1032 ps##TYPE* outRow = out->data.TYPE[row]; \ 1034 1033 float y = dy+(float)row; \ 1035 for ( intcol=0;col<outCols;col++) { \1034 for (psS32 col=0;col<outCols;col++) { \ 1036 1035 outRow[col] = p_psImagePixelInterpolate##MODE##_##TYPE( \ 1037 1036 in,dx+(float)col,y,NULL,0,unexposedValue); \ -
trunk/psLib/src/image/psImageManip.h
r1635 r2204 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $14 * @date $Date: 2004- 08-27 19:49:54$13 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:31 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 30 30 * defined for psU8, psU16, psS8, psS16, psF32, psF64, psC32, and psC64. 31 31 * 32 * @return intThe number of clipped pixels32 * @return psS32 The number of clipped pixels 33 33 */ 34 intpsImageClip(34 psS32 psImageClip( 35 35 psImage* input, ///< the image to clip 36 36 psF64 min, ///< the minimum image value allowed … … 47 47 * This function is defined for psC32, and psC64 imagery only. 48 48 * 49 * @return intThe number of clipped pixels49 * @return psS32 The number of clipped pixels 50 50 */ 51 intpsImageClipComplexRegion(51 psS32 psImageClipComplexRegion( 52 52 psImage* input, ///< the image to clip 53 53 psC64 min, ///< the minimum image value allowed … … 62 62 * function is defined for psF32, psF64, psC32, and psC64. 63 63 * 64 * @return intThe number of clipped pixels64 * @return psS32 The number of clipped pixels 65 65 */ 66 intpsImageClipNaN(66 psS32 psImageClipNaN( 67 67 psImage* input, ///< the image to clip 68 68 psF64 value ///< the value to set all NaN/Inf values to … … 78 78 * function is defined for psU8, psS8, psS16, psF32, psF64, psC32, and psC64. 79 79 * 80 * @return int0 if success, non-zero if failed.80 * @return psS32 0 if success, non-zero if failed. 81 81 */ 82 intpsImageOverlaySection(82 psS32 psImageOverlaySection( 83 83 psImage* image, ///< target image 84 84 const psImage* overlay, ///< the overlay image 85 intcol0, ///< the column to start overlay86 introw0, ///< the row to start overlay85 psS32 col0, ///< the column to start overlay 86 psS32 row0, ///< the row to start overlay 87 87 const char *op ///< the operation to perform for overlay 88 88 ); … … 103 103 const psImage* restrict mask, ///< mask for input image. If NULL, no masking is done. 104 104 psMaskType maskVal, ///< the bits to check in mask. 105 unsigned intscale, ///< the scale to rebin for each dimension105 psU32 scale, ///< the scale to rebin for each dimension 106 106 const psStats* stats 107 107 ///< the statistic to perform when rebinning. Only one method should be set. … … 121 121 psImage* out, ///< an psImage to recycle. If NULL, a new image is created 122 122 const psImage* in, ///< input image 123 intscale, ///< resample scaling factor123 psS32 scale, ///< resample scaling factor 124 124 psImageInterpolateMode mode ///< the interpolation mode used in resampling 125 125 ); … … 176 176 psImage* out, ///< an psImage to recycle. If NULL, a new image is created 177 177 const psImage* in, ///< input image 178 intdx, ///< number of pixels to roll in the x-dimension179 intdy ///< number of pixels to roll in the y-dimension178 psS32 dx, ///< number of pixels to roll in the x-dimension 179 psS32 dy ///< number of pixels to roll in the y-dimension 180 180 ); 181 181 -
trunk/psLib/src/image/psImageStats.c
r2102 r2204 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.4 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10- 14 01:06:44$11 * @version $Revision: 1.44 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:31 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 40 40 psImage* in, 41 41 psImage* mask, 42 intmaskVal)42 psS32 maskVal) 43 43 { 44 44 psVector* junkData = NULL; … … 106 106 psImage* in, 107 107 psImage* mask, 108 unsigned intmaskVal)108 psU32 maskVal) 109 109 { 110 110 psVector* junkData = NULL; … … 150 150 151 151 // XXX: Why do we have this function? 152 float *p_psCalcScaleFactorsFit( intn)153 { 154 inti = 0;152 float *p_psCalcScaleFactorsFit(psS32 n) 153 { 154 psS32 i = 0; 155 155 float tmp = 0.0; 156 156 float *scalingFactors = (float *)psAlloc(n * sizeof(float)); … … 175 175 output a vector of evenly spaced floating point values between -1.0:1.0. 176 176 *****************************************************************************/ 177 float *p_psCalcScaleFactorsEval( intn)178 { 179 inti = 0;177 float *p_psCalcScaleFactorsEval(psS32 n) 178 { 179 psS32 i = 0; 180 180 float tmp = 0.0; 181 181 … … 196 196 197 197 // XXX: Use a static array of CHebyshev polynomials. 198 psPolynomial1D **p_psCreateChebyshevPolys( intmaxChebyPoly)198 psPolynomial1D **p_psCreateChebyshevPolys(psS32 maxChebyPoly) 199 199 { 200 200 if (maxChebyPoly < 1) { … … 202 202 } 203 203 psPolynomial1D **chebPolys = NULL; 204 inti = 0;205 intj = 0;204 psS32 i = 0; 205 psS32 j = 0; 206 206 207 207 chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *)); … … 245 245 const psImage* input) 246 246 { 247 intx = 0;248 inty = 0;249 inti = 0;250 intj = 0;247 psS32 x = 0; 248 psS32 y = 0; 249 psS32 i = 0; 250 psS32 j = 0; 251 251 float **sums = NULL; 252 252 psPolynomial1D* *chebPolys = NULL; 253 intmaxChebyPoly = 0;253 psS32 maxChebyPoly = 0; 254 254 float *cScalingFactors = NULL; 255 255 float *rScalingFactors = NULL; … … 365 365 psImage* psImageEvalPolynomial(psImage* input, const psPolynomial2D* coeffs) 366 366 { 367 intx = 0;368 inty = 0;369 inti = 0;370 intj = 0;367 psS32 x = 0; 368 psS32 y = 0; 369 psS32 i = 0; 370 psS32 j = 0; 371 371 // float **sums = NULL; 372 372 psPolynomial1D* *chebPolys = NULL; 373 intmaxChebyPoly = 0;373 psS32 maxChebyPoly = 0; 374 374 float *cScalingFactors = NULL; 375 375 float *rScalingFactors = NULL; -
trunk/psLib/src/image/psImageStats.h
r1951 r2204 9 9 * @author George Gusciora, MHPCC 10 10 * 11 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10- 05 01:03:11 $11 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:31 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 40 40 psImage* in, ///< image (or subimage) to calculate stats 41 41 psImage* mask, ///< mask data for image (NULL ok) 42 intmaskVal ///< mask Mask for mask42 psS32 maskVal ///< mask Mask for mask 43 43 ); 44 44 … … 55 55 psImage* in, ///< Image data to be histogramed. 56 56 psImage* mask, ///< mask data for image (NULL ok) 57 unsigned intmaskVal ///< mask Mask for mask57 psU32 maskVal ///< mask Mask for mask 58 58 ); 59 59 -
trunk/psLib/src/imageops/psImageConvolve.c
r1983 r2204 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-10- 06 21:31:30$7 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-10-27 00:57:31 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 static void freeKernel(psKernel* ptr); 29 29 30 psKernel* psKernelAlloc( int xMin, int xMax, int yMin, intyMax)30 psKernel* psKernelAlloc(psS32 xMin, psS32 xMax, psS32 yMin, psS32 yMax) 31 31 { 32 32 psKernel* result; 33 intnumRows;34 intnumCols;33 psS32 numRows; 34 psS32 numCols; 35 35 36 36 // following is explicitly spelled out in the SDRS as a requirement … … 40 40 yMin, yMax); 41 41 42 inttemp = yMin;42 psS32 temp = yMin; 43 43 yMin = yMax; 44 44 yMax = temp; … … 51 51 xMin, xMax); 52 52 53 inttemp = xMin;53 psS32 temp = xMin; 54 54 xMin = xMax; 55 55 xMax = temp; … … 70 70 psKernelType** kernelRows = result->p_kernelRows; 71 71 psKernelType** imageRows = result->image->data.PS_TYPE_KERNEL_DATA; 72 for ( inti = 0; i < numRows; i++) {72 for (psS32 i = 0; i < numRows; i++) { 73 73 kernelRows[i] = imageRows[i] - xMin; 74 74 } … … 91 91 const psVector* xShifts, 92 92 const psVector* yShifts, 93 bool relative)93 psBool relative) 94 94 { 95 intx = 0;96 inty = 0;97 intt = 0;98 intdeltaT;99 intoldX;100 intoldY;101 intxMin = 0;102 intxMax = 0;103 intyMin = 0;104 intyMax = 0;105 intlength = 0;95 psS32 x = 0; 96 psS32 y = 0; 97 psS32 t = 0; 98 psS32 deltaT; 99 psS32 oldX; 100 psS32 oldY; 101 psS32 xMin = 0; 102 psS32 xMax = 0; 103 psS32 yMin = 0; 104 psS32 yMax = 0; 105 psS32 length = 0; 106 106 psKernelType normalizeTime = 1.0; // fraction of total time for each shift clock 107 107 psKernel* result = NULL; … … 153 153 y = 0; \ 154 154 t = 0; \ 155 for ( intlcv = 0; lcv < length; lcv++) { \155 for (psS32 lcv = 0; lcv < length; lcv++) { \ 156 156 if (relative) { \ 157 157 x += xShiftData[lcv]; \ … … 181 181 y = 0; \ 182 182 t = 0; \ 183 for ( inti = 0; i < length; i++) { \183 for (psS32 i = 0; i < length; i++) { \ 184 184 deltaT = t; \ 185 185 oldX = x; \ … … 228 228 } 229 229 230 psImage* psImageConvolve(psImage* out, const psImage* in, const psKernel* kernel, bool direct)230 psImage* psImageConvolve(psImage* out, const psImage* in, const psKernel* kernel, psBool direct) 231 231 { 232 232 if (in == NULL) { … … 242 242 return NULL; 243 243 } 244 intxMin = kernel->xMin;245 intxMax = kernel->xMax;246 intyMin = kernel->yMin;247 intyMax = kernel->yMax;244 psS32 xMin = kernel->xMin; 245 psS32 xMax = kernel->xMax; 246 psS32 yMin = kernel->yMin; 247 psS32 yMax = kernel->yMax; 248 248 psKernelType** kData = kernel->kernel; 249 249 250 250 // make the output image to the proper size and type 251 intnumRows = in->numRows;252 intnumCols = in->numCols;251 psS32 numRows = in->numRows; 252 psS32 numCols = in->numCols; 253 253 254 254 … … 261 261 ps##TYPE** inData = in->data.TYPE; \ 262 262 out = psImageRecycle(out, numCols, numRows, PS_TYPE_##TYPE); \ 263 for ( introw=0;row<numRows;row++) { \263 for (psS32 row=0;row<numRows;row++) { \ 264 264 ps##TYPE* outRow = out->data.TYPE[row]; \ 265 for ( intcol=0;col<numCols;col++) { \265 for (psS32 col=0;col<numCols;col++) { \ 266 266 ps##TYPE pixel = 0.0; \ 267 for ( intkRow = yMin; kRow < yMax; kRow++) { \267 for (psS32 kRow = yMin; kRow < yMax; kRow++) { \ 268 268 if (row-kRow >= 0 && row-kRow < numRows) { \ 269 for ( intkCol = xMin; kCol < xMax; kCol++) { \269 for (psS32 kCol = xMin; kCol < xMax; kCol++) { \ 270 270 if (col-kCol >= 0 && col-kCol < numCols) { \ 271 271 pixel += kData[kRow][kCol] * inData[row-kRow][col-kCol]; \ … … 310 310 } else { 311 311 // fourier convolution 312 intpaddedCols = numCols+2*FOURIER_PADDING;313 intpaddedRows = numRows+2*FOURIER_PADDING;312 psS32 paddedCols = numCols+2*FOURIER_PADDING; 313 psS32 paddedRows = numRows+2*FOURIER_PADDING; 314 314 315 315 // check to see if kernel is smaller, otherwise padding it up will fail. 316 intkRows = kernel->image->numRows;317 intkCols = kernel->image->numCols;316 psS32 kRows = kernel->image->numRows; 317 psS32 kCols = kernel->image->numCols; 318 318 if (kRows >= numRows || kCols >= numCols) { 319 319 psErrorMsg(PS_ERRORNAME_DOMAIN "psImageConvolve", … … 328 328 // pad the image 329 329 psImage* paddedImage = psImageAlloc(paddedCols,paddedRows,in->type.type); 330 intelementSize = PSELEMTYPE_SIZEOF(in->type.type);330 psS32 elementSize = PSELEMTYPE_SIZEOF(in->type.type); 331 331 332 332 // zero out padded area on top and bottom … … 335 335 336 336 // fill in the image-containing rows. 337 intsidePaddingSize = FOURIER_PADDING*elementSize;338 intimageRowSize = numCols*elementSize;337 psS32 sidePaddingSize = FOURIER_PADDING*elementSize; 338 psS32 imageRowSize = numCols*elementSize; 339 339 psU8* paddedData = paddedImage->data.U8[FOURIER_PADDING]; 340 for ( introw=0;row<numRows;row++) {340 for (psS32 row=0;row<numRows;row++) { 341 341 // zero out padded area on left edge. 342 342 memset(paddedData,0,sidePaddingSize); … … 354 354 psImage* paddedKernel = psImageAlloc(paddedCols,paddedRows,PS_TYPE_KERNEL); 355 355 memset(paddedKernel->data.U8[0],0,sizeof(psKernelType)*numCols*numRows); // zero-out image 356 intyMax = kernel->yMax;357 intxMax = kernel->xMax;358 for ( introw = kernel->yMin; row <= yMax;row++) {359 intpadRow = row;356 psS32 yMax = kernel->yMax; 357 psS32 xMax = kernel->xMax; 358 for (psS32 row = kernel->yMin; row <= yMax;row++) { 359 psS32 padRow = row; 360 360 if (padRow < 0) { 361 361 padRow += paddedRows; … … 363 363 psKernelType* padData = paddedKernel->data.PS_TYPE_KERNEL_DATA[padRow]; 364 364 psKernelType* kernelRow = kernel->kernel[row]; 365 for ( intcol = kernel->xMin; col <= xMax; col++) {365 for (psS32 col = kernel->xMin; col <= xMax; col++) { 366 366 if (col < 0) { 367 367 padData[col+paddedCols] = kernelRow[col]; … … 418 418 out = psImageRecycle(out,numCols,numRows,PS_TYPE_F32); 419 419 float factor = 1.0f/numCols/numRows; 420 for ( introw = 0; row < numRows; row++) {420 for (psS32 row = 0; row < numRows; row++) { 421 421 psF32* outRow = out->data.F32[row]; 422 422 psC32* resultRow = complexOutSansPad->data.C32[row]; 423 for ( intcol = 0; col < numCols; col++) {423 for (psS32 col = 0; col < numCols; col++) { 424 424 outRow[col] = crealf(resultRow[col])*factor; 425 425 } -
trunk/psLib/src/imageops/psImageConvolve.h
r1863 r2204 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $10 * @date $Date: 2004- 09-23 18:30:57$9 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-10-27 00:57:31 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 15 15 #ifndef PS_IMAGE_CONVOLVE_H 16 16 #define PS_IMAGE_CONVOLVE_H 17 18 #include<stdbool.h>19 17 20 18 #include "psImage.h" … … 32 30 { 33 31 psImage* image; ///< Kernel data, in the form of an image 34 intxMin; ///< Most negative x index35 intyMin; ///< Most negative y index36 intxMax; ///< Most positive x index37 intyMax; ///< Most positive y index32 psS32 xMin; ///< Most negative x index 33 psS32 yMin; ///< Most negative y index 34 psS32 xMax; ///< Most positive x index 35 psS32 yMax; ///< Most positive y index 38 36 psKernelType** kernel; ///< Pointer to the kernel data 39 37 psKernelType** p_kernelRows; ///< Pointer to the rows of the kernel data; not intended for user use. … … 68 66 */ 69 67 psKernel* psKernelAlloc( 70 intxMin, ///< Most negative x index71 intxMax, ///< Most positive x index72 intyMin, ///< Most negative y index73 intyMax ///< Most positive y index68 psS32 xMin, ///< Most negative x index 69 psS32 xMax, ///< Most positive x index 70 psS32 yMin, ///< Most negative y index 71 psS32 yMax ///< Most positive y index 74 72 ); 75 73 … … 94 92 const psVector* xShifts, ///< list of x-axis shifts 95 93 const psVector* yShifts, ///< list of y-axis shifts 96 bool relative94 psBool relative 97 95 ); 98 96 … … 118 116 const psImage* in, ///< the psImage to convolve 119 117 const psKernel* kernel, ///< kernel to colvolve with 120 bool direct ///< specifies method, true=direct convolution, false=fourier118 psBool direct ///< specifies method, true=direct convolution, false=fourier 121 119 ); 122 120 -
trunk/psLib/src/imageops/psImageStats.c
r2102 r2204 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.4 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10- 14 01:06:44$11 * @version $Revision: 1.44 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:31 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 40 40 psImage* in, 41 41 psImage* mask, 42 intmaskVal)42 psS32 maskVal) 43 43 { 44 44 psVector* junkData = NULL; … … 106 106 psImage* in, 107 107 psImage* mask, 108 unsigned intmaskVal)108 psU32 maskVal) 109 109 { 110 110 psVector* junkData = NULL; … … 150 150 151 151 // XXX: Why do we have this function? 152 float *p_psCalcScaleFactorsFit( intn)153 { 154 inti = 0;152 float *p_psCalcScaleFactorsFit(psS32 n) 153 { 154 psS32 i = 0; 155 155 float tmp = 0.0; 156 156 float *scalingFactors = (float *)psAlloc(n * sizeof(float)); … … 175 175 output a vector of evenly spaced floating point values between -1.0:1.0. 176 176 *****************************************************************************/ 177 float *p_psCalcScaleFactorsEval( intn)178 { 179 inti = 0;177 float *p_psCalcScaleFactorsEval(psS32 n) 178 { 179 psS32 i = 0; 180 180 float tmp = 0.0; 181 181 … … 196 196 197 197 // XXX: Use a static array of CHebyshev polynomials. 198 psPolynomial1D **p_psCreateChebyshevPolys( intmaxChebyPoly)198 psPolynomial1D **p_psCreateChebyshevPolys(psS32 maxChebyPoly) 199 199 { 200 200 if (maxChebyPoly < 1) { … … 202 202 } 203 203 psPolynomial1D **chebPolys = NULL; 204 inti = 0;205 intj = 0;204 psS32 i = 0; 205 psS32 j = 0; 206 206 207 207 chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *)); … … 245 245 const psImage* input) 246 246 { 247 intx = 0;248 inty = 0;249 inti = 0;250 intj = 0;247 psS32 x = 0; 248 psS32 y = 0; 249 psS32 i = 0; 250 psS32 j = 0; 251 251 float **sums = NULL; 252 252 psPolynomial1D* *chebPolys = NULL; 253 intmaxChebyPoly = 0;253 psS32 maxChebyPoly = 0; 254 254 float *cScalingFactors = NULL; 255 255 float *rScalingFactors = NULL; … … 365 365 psImage* psImageEvalPolynomial(psImage* input, const psPolynomial2D* coeffs) 366 366 { 367 intx = 0;368 inty = 0;369 inti = 0;370 intj = 0;367 psS32 x = 0; 368 psS32 y = 0; 369 psS32 i = 0; 370 psS32 j = 0; 371 371 // float **sums = NULL; 372 372 psPolynomial1D* *chebPolys = NULL; 373 intmaxChebyPoly = 0;373 psS32 maxChebyPoly = 0; 374 374 float *cScalingFactors = NULL; 375 375 float *rScalingFactors = NULL; -
trunk/psLib/src/imageops/psImageStats.h
r1951 r2204 9 9 * @author George Gusciora, MHPCC 10 10 * 11 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10- 05 01:03:11 $11 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:31 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 40 40 psImage* in, ///< image (or subimage) to calculate stats 41 41 psImage* mask, ///< mask data for image (NULL ok) 42 intmaskVal ///< mask Mask for mask42 psS32 maskVal ///< mask Mask for mask 43 43 ); 44 44 … … 55 55 psImage* in, ///< Image data to be histogramed. 56 56 psImage* mask, ///< mask data for image (NULL ok) 57 unsigned intmaskVal ///< mask Mask for mask57 psU32 maskVal ///< mask Mask for mask 58 58 ); 59 59 -
trunk/psLib/src/math/psCompare.c
r1407 r2204 7 7 * @author Robert Daniel DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $10 * @date $Date: 2004- 08-07 00:06:06$9 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-10-27 00:57:31 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 13 13 */ 14 14 15 #include "psType.h"16 15 #include "psCompare.h" 17 16 -
trunk/psLib/src/math/psCompare.h
r1473 r2204 1 /** @file psCompare.h 2 * @brief Comparison functions for sorting routines 3 * 4 * @author Robert Daniel DeSonia, MHPCC 5 * 6 * @ingroup Compare 7 * 8 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-10-27 00:57:31 $ 10 * 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 12 */ 13 1 14 #if !defined(PS_COMPARE_H) 2 15 #define PS_COMPARE_H 3 16 4 /** @file psCompare.h 5 * @brief Comparison functions for sorting routines 6 * 7 * @author Robert Daniel DeSonia, MHPCC 8 * 9 * @ingroup Compare 10 * 11 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-08-11 19:58:11 $ 13 * 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 15 */ 17 #include "psType.h" 16 18 17 19 /** @addtogroup Compare -
trunk/psLib/src/math/psConstants.h
r2197 r2204 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-10-2 6 21:24:42$8 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-10-27 00:57:31 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 54 54 p_psMemSetPersistent(VEC, true); \ 55 55 p_psMemSetPersistent(VEC->data.V, true); \ 56 for ( inti=0;i<N;i++) { \56 for (psS32 i=0;i<N;i++) { \ 57 57 VEC->data.F32[i] = 1.0; \ 58 58 } \ … … 62 62 p_psMemSetPersistent(VEC, true); \ 63 63 p_psMemSetPersistent(VEC->data.V, true); \ 64 for ( inti=0;i<N;i++) { \64 for (psS32 i=0;i<N;i++) { \ 65 65 VEC->data.F64[i] = 1.0; \ 66 66 } \ … … 70 70 p_psMemSetPersistent(VEC, true); \ 71 71 p_psMemSetPersistent(VEC->data.V, true); \ 72 for ( inti=0;i<N;i++) { \72 for (psS32 i=0;i<N;i++) { \ 73 73 VEC->data.F32[i] = (float) i; \ 74 74 } \ … … 78 78 p_psMemSetPersistent(VEC, true); \ 79 79 p_psMemSetPersistent(VEC->data.V, true); \ 80 for ( inti=0;i<N;i++) { \80 for (psS32 i=0;i<N;i++) { \ 81 81 VEC->data.F64[i] = (float) i; \ 82 82 } \ … … 209 209 210 210 #define PS_PRINT_VECTOR(NAME) \ 211 for ( intmy_i=0;my_i<NAME->n;my_i++) { \211 for (psS32 my_i=0;my_i<NAME->n;my_i++) { \ 212 212 printf("%s->data.F32[%d] is %f\n", #NAME, my_i, NAME->data.F32[my_i]); \ 213 213 } \ … … 216 216 #define PS_VECTOR_F64_TO_F32(X64, X32) \ 217 217 psVector *X32 = psVectorAlloc(X64->n, PS_TYPE_F32); \ 218 for ( inti=0;i<X64->n;i++) { \218 for (psS32 i=0;i<X64->n;i++) { \ 219 219 X32->data.F32[i] = (float) X64->data.F64[i]; \ 220 220 } \ … … 222 222 #define PS_VECTOR_F32_TO_F64(X32, X64) \ 223 223 psVector *X64 = psVectorAlloc(X32->n, PS_TYPE_F64); \ 224 for ( inti=0;i<X32->n;i++) { \224 for (psS32 i=0;i<X32->n;i++) { \ 225 225 X64->data.F64[i] = (float) X32->data.F32[i]; \ 226 226 } \ -
trunk/psLib/src/math/psMatrix.c
r2021 r2204 20 20 * @author Ross Harman, MHPCC 21 21 * 22 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $23 * @date $Date: 2004-10- 08 02:48:01 $22 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 23 * @date $Date: 2004-10-27 00:57:31 $ 24 24 * 25 25 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 119 119 psImage* psMatrixLUD(psImage* outImage, psVector* outPerm, psImage* inImage) 120 120 { 121 intsignum = 0;122 intarraySize = 0;123 intnumRows = 0;124 intnumCols = 0;121 psS32 signum = 0; 122 psS32 arraySize = 0; 123 psS32 numRows = 0; 124 psS32 numCols = 0; 125 125 gsl_matrix lu; 126 126 gsl_permutation perm; … … 165 165 const psVector* inVector, const psVector* inPerm) 166 166 { 167 intarraySize = 0;168 intnumRows = 0;169 intnumCols = 0;167 psS32 arraySize = 0; 168 psS32 numRows = 0; 169 psS32 numCols = 0; 170 170 gsl_matrix lu; 171 171 gsl_permutation perm; … … 217 217 psImage* psMatrixInvert(psImage* outImage, const psImage* inImage, float *restrict det) 218 218 { 219 intsignum = 0;220 intarraySize = 0;221 intnumRows = 0;222 intnumCols = 0;219 psS32 signum = 0; 220 psS32 arraySize = 0; 221 psS32 numRows = 0; 222 psS32 numCols = 0; 223 223 gsl_matrix inv; 224 224 gsl_matrix *lu; … … 271 271 float *psMatrixDeterminant(const psImage* restrict inImage) 272 272 { 273 intsignum = 0;274 intarraySize = 0;275 intnumRows = 0;276 intnumCols = 0;273 psS32 signum = 0; 274 psS32 arraySize = 0; 275 psS32 numRows = 0; 276 psS32 numCols = 0; 277 277 float *det = NULL; 278 278 gsl_matrix *lu = NULL; … … 313 313 psImage* psMatrixMultiply(psImage* outImage, psImage* inImage1, psImage* inImage2) 314 314 { 315 intarraySize = 0;316 intnumRows = 0;317 intnumCols = 0;315 psS32 arraySize = 0; 316 psS32 numRows = 0; 317 psS32 numCols = 0; 318 318 gsl_matrix m1; 319 319 gsl_matrix m2; … … 355 355 psImage* psMatrixTranspose(psImage* outImage, const psImage* inImage) 356 356 { 357 intarraySize = 0;358 intnumRows = 0;359 intnumCols = 0;357 psS32 arraySize = 0; 358 psS32 numRows = 0; 359 psS32 numCols = 0; 360 360 gsl_matrix trans; 361 361 … … 392 392 psImage* psMatrixEigenvectors(psImage* outImage, psImage* inImage) 393 393 { 394 intnumRows = 0;395 intnumCols = 0;394 psS32 numRows = 0; 395 psS32 numCols = 0; 396 396 gsl_vector *eVals = NULL; 397 397 gsl_eigen_symmv_workspace *w = NULL; … … 436 436 psVector* psMatrixToVector(psVector* outVector, const psImage* inImage) 437 437 { 438 intsize = 0;438 psS32 size = 0; 439 439 440 440 // Error checks … … 495 495 psImage* psVectorToMatrix(psImage* outImage, const psVector* inVector) 496 496 { 497 intsize = 0;497 psS32 size = 0; 498 498 499 499 // Error checks -
trunk/psLib/src/math/psMinimize.c
r2202 r2204 9 9 * @author GLF, MHPCC 10 10 * 11 * @version $Revision: 1.6 0$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10-2 6 23:14:04$11 * @version $Revision: 1.61 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:31 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 59 59 *****************************************************************************/ 60 60 void p_psBuildSums1D(double x, 61 intpolyOrder,61 psS32 polyOrder, 62 62 psVector* sums) 63 63 { 64 inti = 0;64 psS32 i = 0; 65 65 double xSum = 0.0; 66 66 … … 101 101 "---- CalculateSecondDerivs() begin ----\n"); 102 102 103 inti;104 intk;105 bool mustFreeX = false;103 psS32 i; 104 psS32 k; 105 psBool mustFreeX = false; 106 106 float sig; 107 107 float p; 108 intn = y->n;108 psS32 n = y->n; 109 109 float *u = (float *) psAlloc(n * sizeof(float)); 110 110 float *derivs2 = (float *) psAlloc(n * sizeof(float)); … … 173 173 float X) 174 174 { 175 intn;176 intklo;177 intkhi;175 psS32 n; 176 psS32 klo; 177 psS32 khi; 178 178 float H; 179 179 float A; … … 240 240 psTrace(".psLib.dataManip.psVectorFitSpline1D", 4, 241 241 "---- psVectorFitSpline1D() begin ----\n"); 242 intnumSplines = (y->n)-1;242 psS32 numSplines = (y->n)-1; 243 243 float tmp; 244 244 float H; 245 inti;245 psS32 i; 246 246 float slope; 247 247 psVector *x32 = NULL; … … 416 416 the F64 port might be. 417 417 *****************************************************************************/ 418 bool psMinimizeLMChi2(psMinimization *min,419 psImage *covar,420 psVector *params,421 const psVector *paramMask,422 const psArray *x,423 const psVector *y,424 const psVector *yErr,425 psMinimizeLMChi2Func func)418 psBool psMinimizeLMChi2(psMinimization *min, 419 psImage *covar, 420 psVector *params, 421 const psVector *paramMask, 422 const psArray *x, 423 const psVector *y, 424 const psVector *yErr, 425 psMinimizeLMChi2Func func) 426 426 { 427 427 PS_CHECK_NULL_PTR_RETURN_NULL(min); … … 441 441 psTrace(".psLib.dataManip.psMinimizeLMChi2", 4, 442 442 "---- psMinimizeLMChi2() begin ----\n"); 443 intnumData = y->n;444 intnumParams = params->n;445 inti;446 intj;447 intk;448 intl;449 intn;450 intp;443 psS32 numData = y->n; 444 psS32 numParams = params->n; 445 psS32 i; 446 psS32 j; 447 psS32 k; 448 psS32 l; 449 psS32 n; 450 psS32 p; 451 451 psVector *beta = psVectorAlloc(numParams, PS_TYPE_F64); 452 452 psVector *perm = psVectorAlloc(numParams, PS_TYPE_F64); … … 663 663 const psVector* restrict yErr) 664 664 { 665 intj;666 intk;667 intn = x->n;665 psS32 j; 666 psS32 k; 667 psS32 n = x->n; 668 668 double fac; 669 669 double sum; … … 689 689 // are fitting this ChebyShev polynomial to. 690 690 691 for ( inti=0;i<n;i++) {691 for (psS32 i=0;i<n;i++) { 692 692 // NR 5.8.4 693 693 double Y = cos(M_PI * (0.5 + ((float) i)) / ((float) n)); … … 741 741 const psVector* restrict yErr) 742 742 { 743 intpolyOrder = myPoly->n;743 psS32 polyOrder = myPoly->n; 744 744 psImage* A = NULL; 745 745 psImage* ALUD = NULL; … … 748 748 psVector* X = NULL; // NOTE: do we need this? 749 749 psVector* coeffs = NULL; 750 inti = 0;751 intj = 0;752 intk = 0;750 psS32 i = 0; 751 psS32 j = 0; 752 psS32 k = 0; 753 753 psVector* xSums = NULL; 754 754 … … 853 853 const psVector* restrict yErr) 854 854 { 855 inti;855 psS32 i; 856 856 psPolynomial1D *tmpPoly; 857 857 PS_CHECK_NULL_1DPOLY_RETURN_NULL(myPoly); … … 908 908 /****************************************************************************** 909 909 *****************************************************************************/ 910 psMinimization *psMinimizationAlloc( intmaxIter,910 psMinimization *psMinimizationAlloc(psS32 maxIter, 911 911 float tol) 912 912 { … … 952 952 float fb = 0.0; 953 953 float fc = 0.0; 954 intiter = 100;954 psS32 iter = 100; 955 955 float aDir = 0.0; 956 956 float cDir = 0.0; … … 960 960 float stepSize = DETERMINE_BRACKET_STEP_SIZE; 961 961 psVector *tmp = NULL; 962 inti = 0;963 intnull = 0;962 psS32 i = 0; 963 psS32 null = 0; 964 964 965 965 psTrace(".psLib.dataManip.p_psDetermineBracket", 4, … … 1141 1141 psVector *tmpc = NULL; 1142 1142 psVector *tmpn = NULL; 1143 inti = 0;1144 intnull = 0;1143 psS32 i = 0; 1144 psS32 null = 0; 1145 1145 1146 1146 psTrace(".psLib.dataManip.p_psLineMin", 4, … … 1313 1313 XXX: Check for F32 types? 1314 1314 *****************************************************************************/ 1315 bool psMinimizePowell(psMinimization *min,1316 psVector *params,1317 const psVector *paramMask,1318 const psArray *coords,1319 psMinimizePowellFunc func)1315 psBool psMinimizePowell(psMinimization *min, 1316 psVector *params, 1317 const psVector *paramMask, 1318 const psArray *coords, 1319 psMinimizePowellFunc func) 1320 1320 { 1321 1321 PS_CHECK_NULL_VECTOR_RETURN_NULL(params); … … 1325 1325 PS_CHECK_NULL_PTR_RETURN_NULL(func); 1326 1326 1327 intnumDims = params->n;1328 inti = 0;1329 intj = 0;1327 psS32 numDims = params->n; 1328 psS32 i = 0; 1329 psS32 j = 0; 1330 1330 psVector **v = NULL; 1331 1331 psVector *pQP = NULL; … … 1337 1337 float baseFuncVal = 0.0; 1338 1338 float currFuncVal = 0.0; 1339 intbiggestIter = 0;1339 psS32 biggestIter = 0; 1340 1340 float biggestDiff = 0.0; 1341 1341 float term1 = 0.0; … … 1529 1529 float chi2 = 0.0; 1530 1530 float d; 1531 inti;1531 psS32 i; 1532 1532 psVector *tmp; 1533 1533 … … 1552 1552 psMinimizePowell(). 1553 1553 *****************************************************************************/ 1554 bool psMinimizeChi2Powell(psMinimization *min,1555 psVector *params,1556 const psVector *paramMask,1557 const psArray *coords,1558 const psVector *value,1559 const psVector *error,1560 psMinimizeChi2PowellFunc func)1554 psBool psMinimizeChi2Powell(psMinimization *min, 1555 psVector *params, 1556 const psVector *paramMask, 1557 const psArray *coords, 1558 const psVector *value, 1559 const psVector *error, 1560 psMinimizeChi2PowellFunc func) 1561 1561 { 1562 1562 myValue = (psVector *) value; -
trunk/psLib/src/math/psMinimize.h
r2202 r2204 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.3 1$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-10-2 6 23:14:04$10 * @version $Revision: 1.32 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-10-27 00:57:31 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 46 46 typedef struct 47 47 { 48 intmaxIter; ///< Convergence limit48 psS32 maxIter; ///< Convergence limit 49 49 float tol; ///< Error Tolerance 50 50 float value; ///< Value of function at minimum 51 intiter; ///< Number of iterations required51 psS32 iter; ///< Number of iterations required 52 52 float lastDelta; ///< The last difference for the fit 53 53 } 54 54 psMinimization; 55 55 56 psMinimization *psMinimizationAlloc( intmaxIter,56 psMinimization *psMinimizationAlloc(psS32 maxIter, 57 57 float tol); 58 58 … … 88 88 const psArray *x); 89 89 90 bool psMinimizeLMChi2(psMinimization *min,91 psImage *covar,92 psVector *params,93 const psVector *paramMask,94 const psArray *x,95 const psVector *y,96 const psVector *yErr,97 psMinimizeLMChi2Func func);90 psBool psMinimizeLMChi2(psMinimization *min, 91 psImage *covar, 92 psVector *params, 93 const psVector *paramMask, 94 const psArray *x, 95 const psVector *y, 96 const psVector *yErr, 97 psMinimizeLMChi2Func func); 98 98 99 99 typedef … … 101 101 const psArray *coords); 102 102 103 bool psMinimizePowell(psMinimization *min,104 psVector *params,105 const psVector *paramMask,106 const psArray *coords,107 psMinimizePowellFunc func);103 psBool psMinimizePowell(psMinimization *min, 104 psVector *params, 105 const psVector *paramMask, 106 const psArray *coords, 107 psMinimizePowellFunc func); 108 108 109 109 typedef … … 111 111 const psArray *coords); 112 112 113 bool psMinimizeChi2Powell(psMinimization *min,114 psVector *params,115 const psVector *paramMask,116 const psArray *coords,117 const psVector *value,118 const psVector *error,119 psMinimizeChi2PowellFunc func);113 psBool psMinimizeChi2Powell(psMinimization *min, 114 psVector *params, 115 const psVector *paramMask, 116 const psArray *coords, 117 const psVector *value, 118 const psVector *error, 119 psMinimizeChi2PowellFunc func); 120 120 121 121 -
trunk/psLib/src/math/psPolynomial.c
r2197 r2204 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.5 3$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-10-2 6 21:24:42$9 * @version $Revision: 1.54 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-10-27 00:57:31 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 50 50 \ 51 51 if (IN->type.type == PS_TYPE_F64) { \ 52 for ( inti=0;i<IN->n;i++) { \52 for (psS32 i=0;i<IN->n;i++) { \ 53 53 OUT->data.F32[i] = (float) (IN->data.F64[i]); \ 54 54 } \ … … 69 69 \ 70 70 if (IN->type.type == PS_TYPE_F32) { \ 71 for ( inti=0;i<IN->n;i++) { \71 for (psS32 i=0;i<IN->n;i++) { \ 72 72 OUT->data.F64[i] = (float) (IN->data.F32[i]); \ 73 73 } \ … … 117 117 outer coefficients of the Chebyshev polynomials. 118 118 *****************************************************************************/ 119 static psPolynomial1D **CreateChebyshevPolys( intmaxChebyPoly)119 static psPolynomial1D **CreateChebyshevPolys(psS32 maxChebyPoly) 120 120 { 121 121 psPolynomial1D **chebPolys = NULL; 122 inti = 0;123 intj = 0;122 psS32 i = 0; 123 psS32 j = 0; 124 124 125 125 chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *)); … … 153 153 evaluated Gaussian is: \f[ exp(-\frac{(x-mean)^2}{2\sigma^2}) \f] 154 154 *****************************************************************************/ 155 float psGaussian(float x, float mean, float sigma, bool normal)155 float psGaussian(float x, float mean, float sigma, psBool normal) 156 156 { 157 157 float tmp = 1.0; … … 185 185 NOTE: XXX: There is no way to seed the random generator. 186 186 *****************************************************************************/ 187 psVector* psGaussianDev(float mean, float sigma, intNpts)187 psVector* psGaussianDev(float mean, float sigma, psS32 Npts) 188 188 { 189 189 psVector* gauss = NULL; 190 190 const gsl_rng_type *T = NULL; 191 191 gsl_rng *r = NULL; 192 inti = 0;192 psS32 i = 0; 193 193 194 194 gauss = psVectorAlloc(Npts, PS_TYPE_F32); … … 209 209 This routine must allocate memory for the polynomial structures. 210 210 *****************************************************************************/ 211 psPolynomial1D* psPolynomial1DAlloc( intn,211 psPolynomial1D* psPolynomial1DAlloc(psS32 n, 212 212 psPolynomialType type) 213 213 { 214 inti = 0;214 psS32 i = 0; 215 215 psPolynomial1D* newPoly = NULL; 216 216 … … 232 232 } 233 233 234 psPolynomial2D* psPolynomial2DAlloc( int nX, intnY,234 psPolynomial2D* psPolynomial2DAlloc(psS32 nX, psS32 nY, 235 235 psPolynomialType type) 236 236 { 237 intx = 0;238 inty = 0;237 psS32 x = 0; 238 psS32 y = 0; 239 239 psPolynomial2D* newPoly = NULL; 240 240 … … 265 265 } 266 266 267 psPolynomial3D* psPolynomial3DAlloc( int nX, int nY, intnZ,267 psPolynomial3D* psPolynomial3DAlloc(psS32 nX, psS32 nY, psS32 nZ, 268 268 psPolynomialType type) 269 269 { 270 intx = 0;271 inty = 0;272 intz = 0;270 psS32 x = 0; 271 psS32 y = 0; 272 psS32 z = 0; 273 273 psPolynomial3D* newPoly = NULL; 274 274 … … 307 307 } 308 308 309 psPolynomial4D* psPolynomial4DAlloc( int nW, int nX, int nY, intnZ,309 psPolynomial4D* psPolynomial4DAlloc(psS32 nW, psS32 nX, psS32 nY, psS32 nZ, 310 310 psPolynomialType type) 311 311 { 312 intw = 0;313 intx = 0;314 inty = 0;315 intz = 0;312 psS32 w = 0; 313 psS32 x = 0; 314 psS32 y = 0; 315 psS32 z = 0; 316 316 psPolynomial4D* newPoly = NULL; 317 317 … … 367 367 static void polynomial2DFree(psPolynomial2D* myPoly) 368 368 { 369 intx = 0;369 psS32 x = 0; 370 370 371 371 for (x = 0; x < myPoly->nX; x++) { … … 381 381 static void polynomial3DFree(psPolynomial3D* myPoly) 382 382 { 383 intx = 0;384 inty = 0;383 psS32 x = 0; 384 psS32 y = 0; 385 385 386 386 for (x = 0; x < myPoly->nX; x++) { … … 402 402 static void polynomial4DFree(psPolynomial4D* myPoly) 403 403 { 404 intw = 0;405 intx = 0;406 inty = 0;404 psS32 w = 0; 405 psS32 x = 0; 406 psS32 y = 0; 407 407 408 408 for (w = 0; w < myPoly->nW; w++) { … … 434 434 float p_psOrdPolynomial1DEval(float x, const psPolynomial1D* myPoly) 435 435 { 436 intloop_x = 0;436 psS32 loop_x = 0; 437 437 float polySum = 0.0; 438 438 float xSum = 1.0; … … 478 478 { 479 479 psVector *d; 480 intn;481 inti;480 psS32 n; 481 psS32 i; 482 482 float tmp; 483 483 … … 500 500 /* 501 501 502 intn;503 inti;502 psS32 n; 503 psS32 i; 504 504 float tmp; 505 505 psPolynomial1D **chebPolys = NULL; … … 537 537 psVector *tmp; 538 538 psVector *myX; 539 inti;539 psS32 i; 540 540 541 541 PS_CONVERT_VECTOR_F32(x, myX); … … 555 555 float p_psOrdPolynomial2DEval(float x, float y, const psPolynomial2D* myPoly) 556 556 { 557 intloop_x = 0;558 intloop_y = 0;557 psS32 loop_x = 0; 558 psS32 loop_y = 0; 559 559 float polySum = 0.0; 560 560 float xSum = 1.0; … … 577 577 float p_psChebPolynomial2DEval(float x, float y, const psPolynomial2D* myPoly) 578 578 { 579 intloop_x = 0;580 intloop_y = 0;581 inti = 0;579 psS32 loop_x = 0; 580 psS32 loop_y = 0; 581 psS32 i = 0; 582 582 float polySum = 0.0; 583 583 psPolynomial1D* *chebPolys = NULL; 584 intmaxChebyPoly = 0;584 psS32 maxChebyPoly = 0; 585 585 586 586 // Determine how many Chebyshev polynomials … … 628 628 psVector *myX; 629 629 psVector *myY; 630 inti;631 intvecLen=x->n;630 psS32 i; 631 psS32 vecLen=x->n; 632 632 633 633 PS_CONVERT_VECTOR_F32(x, myX); … … 658 658 float p_psOrdPolynomial3DEval(float x, float y, float z, const psPolynomial3D* myPoly) 659 659 { 660 intloop_x = 0;661 intloop_y = 0;662 intloop_z = 0;660 psS32 loop_x = 0; 661 psS32 loop_y = 0; 662 psS32 loop_z = 0; 663 663 float polySum = 0.0; 664 664 float xSum = 1.0; … … 686 686 float p_psChebPolynomial3DEval(float x, float y, float z, const psPolynomial3D* myPoly) 687 687 { 688 intloop_x = 0;689 intloop_y = 0;690 intloop_z = 0;691 inti = 0;688 psS32 loop_x = 0; 689 psS32 loop_y = 0; 690 psS32 loop_z = 0; 691 psS32 i = 0; 692 692 float polySum = 0.0; 693 693 psPolynomial1D* *chebPolys = NULL; 694 intmaxChebyPoly = 0;694 psS32 maxChebyPoly = 0; 695 695 696 696 // Determine how many Chebyshev polynomials … … 746 746 psVector *myY; 747 747 psVector *myZ; 748 inti;749 intvecLen=x->n;748 psS32 i; 749 psS32 vecLen=x->n; 750 750 751 751 PS_CONVERT_VECTOR_F32(x, myX); … … 787 787 float p_psOrdPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D* myPoly) 788 788 { 789 intloop_w = 0;790 intloop_x = 0;791 intloop_y = 0;792 intloop_z = 0;789 psS32 loop_w = 0; 790 psS32 loop_x = 0; 791 psS32 loop_y = 0; 792 psS32 loop_z = 0; 793 793 float polySum = 0.0; 794 794 float wSum = 1.0; … … 821 821 float p_psChebPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D* myPoly) 822 822 { 823 intloop_w = 0;824 intloop_x = 0;825 intloop_y = 0;826 intloop_z = 0;827 inti = 0;823 psS32 loop_w = 0; 824 psS32 loop_x = 0; 825 psS32 loop_y = 0; 826 psS32 loop_z = 0; 827 psS32 i = 0; 828 828 float polySum = 0.0; 829 829 psPolynomial1D* *chebPolys = NULL; 830 intmaxChebyPoly = 0;830 psS32 maxChebyPoly = 0; 831 831 832 832 // Determine how many Chebyshev polynomials … … 890 890 psVector *myY; 891 891 psVector *myZ; 892 inti;893 intvecLen=x->n;892 psS32 i; 893 psS32 vecLen=x->n; 894 894 895 895 PS_CONVERT_VECTOR_F32(w, myW); … … 936 936 937 937 938 psDPolynomial1D* psDPolynomial1DAlloc( intn,938 psDPolynomial1D* psDPolynomial1DAlloc(psS32 n, 939 939 psPolynomialType type) 940 940 { 941 inti = 0;941 psS32 i = 0; 942 942 psDPolynomial1D* newPoly = NULL; 943 943 … … 959 959 } 960 960 961 psDPolynomial2D* psDPolynomial2DAlloc( int nX, intnY,961 psDPolynomial2D* psDPolynomial2DAlloc(psS32 nX, psS32 nY, 962 962 psPolynomialType type) 963 963 { 964 intx = 0;965 inty = 0;964 psS32 x = 0; 965 psS32 y = 0; 966 966 psDPolynomial2D* newPoly = NULL; 967 967 … … 992 992 } 993 993 994 psDPolynomial3D* psDPolynomial3DAlloc( int nX, int nY, intnZ,994 psDPolynomial3D* psDPolynomial3DAlloc(psS32 nX, psS32 nY, psS32 nZ, 995 995 psPolynomialType type) 996 996 { 997 intx = 0;998 inty = 0;999 intz = 0;997 psS32 x = 0; 998 psS32 y = 0; 999 psS32 z = 0; 1000 1000 psDPolynomial3D* newPoly = NULL; 1001 1001 … … 1034 1034 } 1035 1035 1036 psDPolynomial4D* psDPolynomial4DAlloc( int nW, int nX, int nY, intnZ,1036 psDPolynomial4D* psDPolynomial4DAlloc(psS32 nW, psS32 nX, psS32 nY, psS32 nZ, 1037 1037 psPolynomialType type) 1038 1038 { 1039 intw = 0;1040 intx = 0;1041 inty = 0;1042 intz = 0;1039 psS32 w = 0; 1040 psS32 x = 0; 1041 psS32 y = 0; 1042 psS32 z = 0; 1043 1043 psDPolynomial4D* newPoly = NULL; 1044 1044 … … 1094 1094 static void dPolynomial2DFree(psDPolynomial2D* myPoly) 1095 1095 { 1096 intx = 0;1096 psS32 x = 0; 1097 1097 1098 1098 for (x = 0; x < myPoly->nX; x++) { … … 1108 1108 static void dPolynomial3DFree(psDPolynomial3D* myPoly) 1109 1109 { 1110 intx = 0;1111 inty = 0;1110 psS32 x = 0; 1111 psS32 y = 0; 1112 1112 1113 1113 for (x = 0; x < myPoly->nX; x++) { … … 1129 1129 static void dPolynomial4DFree(psDPolynomial4D* myPoly) 1130 1130 { 1131 intw = 0;1132 intx = 0;1133 inty = 0;1131 psS32 w = 0; 1132 psS32 x = 0; 1133 psS32 y = 0; 1134 1134 1135 1135 for (w = 0; w < myPoly->nW; w++) { … … 1159 1159 double p_psDOrdPolynomial1DEval(double x, const psDPolynomial1D* myPoly) 1160 1160 { 1161 intloop_x = 0;1161 psS32 loop_x = 0; 1162 1162 double polySum = 0.0; 1163 1163 double xSum = 1.0; … … 1183 1183 { 1184 1184 psVector *d; 1185 intn;1186 inti;1185 psS32 n; 1186 psS32 i; 1187 1187 double tmp; 1188 1188 … … 1222 1222 psVector *tmp; 1223 1223 psVector *myX; 1224 inti;1224 psS32 i; 1225 1225 1226 1226 PS_CONVERT_VECTOR_F64(x, myX); … … 1241 1241 double p_psDOrdPolynomial2DEval(double x, double y, const psDPolynomial2D* myPoly) 1242 1242 { 1243 intloop_x = 0;1244 intloop_y = 0;1243 psS32 loop_x = 0; 1244 psS32 loop_y = 0; 1245 1245 double polySum = 0.0; 1246 1246 double xSum = 1.0; … … 1263 1263 double p_psDChebPolynomial2DEval(double x, double y, const psDPolynomial2D* myPoly) 1264 1264 { 1265 intloop_x = 0;1266 intloop_y = 0;1267 inti = 0;1265 psS32 loop_x = 0; 1266 psS32 loop_y = 0; 1267 psS32 i = 0; 1268 1268 double polySum = 0.0; 1269 1269 psPolynomial1D* *chebPolys = NULL; 1270 intmaxChebyPoly = 0;1270 psS32 maxChebyPoly = 0; 1271 1271 1272 1272 // Determine how many Chebyshev polynomials … … 1314 1314 psVector *myX; 1315 1315 psVector *myY; 1316 inti;1317 intvecLen=x->n;1316 psS32 i; 1317 psS32 vecLen=x->n; 1318 1318 1319 1319 PS_CONVERT_VECTOR_F64(x, myX); … … 1344 1344 double p_psDOrdPolynomial3DEval(double x, double y, double z, const psDPolynomial3D* myPoly) 1345 1345 { 1346 intloop_x = 0;1347 intloop_y = 0;1348 intloop_z = 0;1346 psS32 loop_x = 0; 1347 psS32 loop_y = 0; 1348 psS32 loop_z = 0; 1349 1349 double polySum = 0.0; 1350 1350 double xSum = 1.0; … … 1372 1372 double p_psDChebPolynomial3DEval(double x, double y, double z, const psDPolynomial3D* myPoly) 1373 1373 { 1374 intloop_x = 0;1375 intloop_y = 0;1376 intloop_z = 0;1377 inti = 0;1374 psS32 loop_x = 0; 1375 psS32 loop_y = 0; 1376 psS32 loop_z = 0; 1377 psS32 i = 0; 1378 1378 double polySum = 0.0; 1379 1379 psPolynomial1D* *chebPolys = NULL; 1380 intmaxChebyPoly = 0;1380 psS32 maxChebyPoly = 0; 1381 1381 1382 1382 // Determine how many Chebyshev polynomials … … 1432 1432 psVector *myY; 1433 1433 psVector *myZ; 1434 inti;1435 intvecLen=x->n;1434 psS32 i; 1435 psS32 vecLen=x->n; 1436 1436 1437 1437 PS_CONVERT_VECTOR_F64(x, myX); … … 1475 1475 double p_psDOrdPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D* myPoly) 1476 1476 { 1477 intloop_w = 0;1478 intloop_x = 0;1479 intloop_y = 0;1480 intloop_z = 0;1477 psS32 loop_w = 0; 1478 psS32 loop_x = 0; 1479 psS32 loop_y = 0; 1480 psS32 loop_z = 0; 1481 1481 double polySum = 0.0; 1482 1482 double wSum = 1.0; … … 1509 1509 double p_psDChebPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D* myPoly) 1510 1510 { 1511 intloop_w = 0;1512 intloop_x = 0;1513 intloop_y = 0;1514 intloop_z = 0;1515 inti = 0;1511 psS32 loop_w = 0; 1512 psS32 loop_x = 0; 1513 psS32 loop_y = 0; 1514 psS32 loop_z = 0; 1515 psS32 i = 0; 1516 1516 double polySum = 0.0; 1517 1517 psPolynomial1D* *chebPolys = NULL; 1518 intmaxChebyPoly = 0;1518 psS32 maxChebyPoly = 0; 1519 1519 1520 1520 // Determine how many Chebyshev polynomials … … 1578 1578 psVector *myY; 1579 1579 psVector *myZ; 1580 inti;1581 intvecLen=x->n;1580 psS32 i; 1581 psS32 vecLen=x->n; 1582 1582 1583 1583 PS_CONVERT_VECTOR_F64(w, myW); … … 1624 1624 1625 1625 //typedef struct { 1626 // intn;1626 // psS32 n; 1627 1627 // psPolynomial1D **spline; 1628 1628 // float *p_psDeriv2; … … 1636 1636 XXX: Ensure that domain[i+1] != domain[i] 1637 1637 *****************************************************************************/ 1638 psSpline1D *psSpline1DAlloc( intnumSplines,1639 intorder,1638 psSpline1D *psSpline1DAlloc(psS32 numSplines, 1639 psS32 order, 1640 1640 float min, 1641 1641 float max) 1642 1642 { 1643 1643 psSpline1D *tmp = NULL; 1644 inti;1644 psS32 i; 1645 1645 float tmpDomain; 1646 1646 float width; … … 1677 1677 1678 1678 // XXX: Have Robert put the dealocator in the memory file. 1679 intp_psSpline1DFree(psSpline1D *tmpSpline)1680 { 1681 inti;1679 psS32 p_psSpline1DFree(psSpline1D *tmpSpline) 1680 { 1681 psS32 i; 1682 1682 1683 1683 if (tmpSpline == NULL) { … … 1704 1704 *****************************************************************************/ 1705 1705 psSpline1D *psSpline1DAllocGeneric(const psVector *bounds, 1706 intorder)1706 psS32 order) 1707 1707 { 1708 1708 psSpline1D *tmp = NULL; 1709 inti;1710 intnumSplines;1709 psS32 i; 1710 psS32 numSplines; 1711 1711 1712 1712 tmp = (psSpline1D *) psAlloc(sizeof(psSpline1D)); … … 1746 1746 XXX: name since we don't take psVectors as input. 1747 1747 *****************************************************************************/ 1748 intp_psVectorBinDisectF32(float *bins,1749 intnumBins,1750 float x)1751 { 1752 intmin;1753 intmax;1754 intmid;1748 psS32 p_psVectorBinDisectF32(float *bins, 1749 psS32 numBins, 1750 float x) 1751 { 1752 psS32 min; 1753 psS32 max; 1754 psS32 mid; 1755 1755 1756 1756 psTrace(".psLib.dataManip.psFunctions.p_psVectorBinDisectF32", 4, … … 1800 1800 p_psVectorBinDisectS32(): integer version of above. 1801 1801 *****************************************************************************/ 1802 int p_psVectorBinDisectS32(int*bins,1803 intnumBins,1804 intx)1805 { 1806 intmin;1807 intmax;1808 intmid;1802 psS32 p_psVectorBinDisectS32(psS32 *bins, 1803 psS32 numBins, 1804 psS32 x) 1805 { 1806 psS32 min; 1807 psS32 max; 1808 psS32 mid; 1809 1809 1810 1810 psTrace(".psLib.dataManip.psFunctions.p_psVectorBinDisectS32", 4, … … 1848 1848 p_psVectorBinDisect(): A wrapper to the above p_psVectorBinDisect(). 1849 1849 *****************************************************************************/ 1850 intp_psVectorBinDisect(psVector *bins,1851 psScalar *x)1850 psS32 p_psVectorBinDisect(psVector *bins, 1851 psScalar *x) 1852 1852 { 1853 1853 if (x->type.type != bins->type.type) { … … 1877 1877 float p_ps1DFullInterpolateF32(float *domain, 1878 1878 float *range, 1879 intn,1879 psS32 n, 1880 1880 float x) 1881 1881 { 1882 inti;1883 intm;1882 psS32 i; 1883 psS32 m; 1884 1884 static psVector *p = NULL; 1885 1885 p = psVectorRecycle(p, n, PS_TYPE_F32); … … 1937 1937 float p_ps1DInterpolateF32(float *domain, 1938 1938 float *range, 1939 intn,1940 intorder,1939 psS32 n, 1940 psS32 order, 1941 1941 float x) 1942 1942 { 1943 intbinNum;1944 intnumIntPoints = order+1;1945 intorigin;1943 psS32 binNum; 1944 psS32 numIntPoints = order+1; 1945 psS32 origin; 1946 1946 1947 1947 psTrace(".psLib.dataManip.psFunctions.p_ps1DInterpolateF32", 4, … … 1987 1987 psScalar *p_psVectorInterpolate(psVector *domain, 1988 1988 psVector *range, 1989 intorder,1989 psS32 order, 1990 1990 psScalar *x) 1991 1991 { … … 2065 2065 float x) 2066 2066 { 2067 intbinNum;2068 intn;2067 psS32 binNum; 2068 psS32 n; 2069 2069 2070 2070 n = spline->n; … … 2091 2091 const psSpline1D *spline) 2092 2092 { 2093 inti;2093 psS32 i; 2094 2094 psVector *tmpVector; 2095 2095 -
trunk/psLib/src/math/psPolynomial.h
r1968 r2204 12 12 * @author George Gusciora, MHPCC 13 13 * 14 * @version $Revision: 1.3 0$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-10- 06 00:48:15$14 * @version $Revision: 1.31 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-10-27 00:57:31 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 45 45 float mean, ///< Mean for the Gaussian 46 46 float stddev, ///< Standard deviation for the Gaussian 47 bool normal ///< Indicates whether result should be normalized47 psBool normal ///< Indicates whether result should be normalized 48 48 ); 49 49 … … 57 57 float mean, ///< The mean of the Gaussian 58 58 float sigma, ///< The sigma of the Gaussian 59 intNpts ///< The size of the vector59 psS32 Npts ///< The size of the vector 60 60 ); 61 61 … … 69 69 { 70 70 psPolynomialType type; ///< Polynomial type 71 intn; ///< Number of terms71 psS32 n; ///< Number of terms 72 72 float *coeff; ///< Coefficients 73 73 float *coeffErr; ///< Error in coefficients … … 80 80 { 81 81 psPolynomialType type; ///< Polynomial type 82 intnX; ///< Number of terms in x83 intnY; ///< Number of terms in y82 psS32 nX; ///< Number of terms in x 83 psS32 nY; ///< Number of terms in y 84 84 float **coeff; ///< Coefficients 85 85 float **coeffErr; ///< Error in coefficients … … 92 92 { 93 93 psPolynomialType type; ///< Polynomial type 94 intnX; ///< Number of terms in x95 intnY; ///< Number of terms in y96 intnZ; ///< Number of terms in z94 psS32 nX; ///< Number of terms in x 95 psS32 nY; ///< Number of terms in y 96 psS32 nZ; ///< Number of terms in z 97 97 float ***coeff; ///< Coefficients 98 98 float ***coeffErr; ///< Error in coefficients … … 105 105 { 106 106 psPolynomialType type; ///< Polynomial type 107 intnW; ///< Number of terms in w108 intnX; ///< Number of terms in x109 intnY; ///< Number of terms in y110 intnZ; ///< Number of terms in z107 psS32 nW; ///< Number of terms in w 108 psS32 nX; ///< Number of terms in x 109 psS32 nY; ///< Number of terms in y 110 psS32 nZ; ///< Number of terms in z 111 111 float ****coeff; ///< Coefficients 112 112 float ****coeffErr; ///< Error in coefficients … … 121 121 */ 122 122 psPolynomial1D* psPolynomial1DAlloc( 123 intn, ///< Number of terms123 psS32 n, ///< Number of terms 124 124 psPolynomialType type ///< Polynomial Type 125 125 ); … … 130 130 */ 131 131 psPolynomial2D* psPolynomial2DAlloc( 132 intnX, ///< Number of terms in x133 intnY, ///< Number of terms in y132 psS32 nX, ///< Number of terms in x 133 psS32 nY, ///< Number of terms in y 134 134 psPolynomialType type ///< Polynomial Type 135 135 ); … … 140 140 */ 141 141 psPolynomial3D* psPolynomial3DAlloc( 142 intnX, ///< Number of terms in x143 intnY, ///< Number of terms in y144 intnZ, ///< Number of terms in z142 psS32 nX, ///< Number of terms in x 143 psS32 nY, ///< Number of terms in y 144 psS32 nZ, ///< Number of terms in z 145 145 psPolynomialType type ///< Polynomial Type 146 146 ); … … 151 151 */ 152 152 psPolynomial4D* psPolynomial4DAlloc( 153 intnW, ///< Number of terms in w154 intnX, ///< Number of terms in x155 intnY, ///< Number of terms in y156 intnZ, ///< Number of terms in z153 psS32 nW, ///< Number of terms in w 154 psS32 nX, ///< Number of terms in x 155 psS32 nY, ///< Number of terms in y 156 psS32 nZ, ///< Number of terms in z 157 157 psPolynomialType type ///< Polynomial Type 158 158 ); … … 230 230 { 231 231 psPolynomialType type; ///< Polynomial type 232 intn; ///< Number of terms232 psS32 n; ///< Number of terms 233 233 double *coeff; ///< Coefficients 234 234 double *coeffErr; ///< Error in coefficients … … 241 241 { 242 242 psPolynomialType type; ///< Polynomial type 243 intnX; ///< Number of terms in x244 intnY; ///< Number of terms in y243 psS32 nX; ///< Number of terms in x 244 psS32 nY; ///< Number of terms in y 245 245 double **coeff; ///< Coefficients 246 246 double **coeffErr; ///< Error in coefficients … … 253 253 { 254 254 psPolynomialType type; ///< Polynomial type 255 intnX; ///< Number of terms in x256 intnY; ///< Number of terms in y257 intnZ; ///< Number of terms in z255 psS32 nX; ///< Number of terms in x 256 psS32 nY; ///< Number of terms in y 257 psS32 nZ; ///< Number of terms in z 258 258 double ***coeff; ///< Coefficients 259 259 double ***coeffErr; ///< Error in coefficients … … 266 266 { 267 267 psPolynomialType type; ///< Polynomial type 268 intnW; ///< Number of terms in w269 intnX; ///< Number of terms in x270 intnY; ///< Number of terms in y271 intnZ; ///< Number of terms in z268 psS32 nW; ///< Number of terms in w 269 psS32 nX; ///< Number of terms in x 270 psS32 nY; ///< Number of terms in y 271 psS32 nZ; ///< Number of terms in z 272 272 double ****coeff; ///< Coefficients 273 273 double ****coeffErr; ///< Error in coefficients … … 281 281 */ 282 282 psDPolynomial1D* psDPolynomial1DAlloc( 283 intn, ///< Number of terms283 psS32 n, ///< Number of terms 284 284 psPolynomialType type ///< Polynomial Type 285 285 ); … … 290 290 */ 291 291 psDPolynomial2D* psDPolynomial2DAlloc( 292 intnX, ///< Number of terms in x293 intnY, ///< Number of terms in y292 psS32 nX, ///< Number of terms in x 293 psS32 nY, ///< Number of terms in y 294 294 psPolynomialType type ///< Polynomial Type 295 295 ); … … 300 300 */ 301 301 psDPolynomial3D* psDPolynomial3DAlloc( 302 intnX, ///< Number of terms in x303 intnY, ///< Number of terms in y304 intnZ, ///< Number of terms in z302 psS32 nX, ///< Number of terms in x 303 psS32 nY, ///< Number of terms in y 304 psS32 nZ, ///< Number of terms in z 305 305 psPolynomialType type ///< Polynomial Type 306 306 ); … … 311 311 */ 312 312 psDPolynomial4D* psDPolynomial4DAlloc( 313 intnW, ///< Number of terms in w314 intnX, ///< Number of terms in x315 intnY, ///< Number of terms in y316 intnZ, ///< Number of terms in z313 psS32 nW, ///< Number of terms in w 314 psS32 nX, ///< Number of terms in x 315 psS32 nY, ///< Number of terms in y 316 psS32 nZ, ///< Number of terms in z 317 317 psPolynomialType type ///< Polynomial Type 318 318 ); … … 386 386 typedef struct 387 387 { 388 intn; ///< The number of spline polynomials388 psS32 n; ///< The number of spline polynomials 389 389 psPolynomial1D **spline; ///< An array of n pointers to the spline polynomials 390 390 float *p_psDeriv2; ///< For cubic splines, the second derivative at each domain point. Size is n+1. … … 393 393 psSpline1D; 394 394 395 psSpline1D *psSpline1DAlloc( intn,396 intorder,395 psSpline1D *psSpline1DAlloc(psS32 n, 396 psS32 order, 397 397 float min, 398 398 float max); 399 399 400 intp_psSpline1DFree(psSpline1D *tmpSpline);400 psS32 p_psSpline1DFree(psSpline1D *tmpSpline); 401 401 402 402 psSpline1D *psSpline1DAllocGeneric(const psVector *bounds, 403 intorder);403 psS32 order); 404 404 405 405 float psSpline1DEval(const psSpline1D *spline, … … 409 409 const psSpline1D *spline); 410 410 411 intp_psVectorBinDisectF32(float *bins,412 intnumBins,413 float x);414 415 int p_psVectorBinDisectS32(int*bins,416 intnumBins,417 intx);418 419 intp_psVectorBinDisect(psVector *bins,420 psScalar *x);411 psS32 p_psVectorBinDisectF32(float *bins, 412 psS32 numBins, 413 float x); 414 415 psS32 p_psVectorBinDisectS32(psS32 *bins, 416 psS32 numBins, 417 psS32 x); 418 419 psS32 p_psVectorBinDisect(psVector *bins, 420 psScalar *x); 421 421 422 422 psScalar *p_psVectorInterpolate(psVector *domain, 423 423 psVector *range, 424 intorder,424 psS32 order, 425 425 psScalar *x); 426 426 -
trunk/psLib/src/math/psSpline.c
r2197 r2204 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.5 3$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-10-2 6 21:24:42$9 * @version $Revision: 1.54 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-10-27 00:57:31 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 50 50 \ 51 51 if (IN->type.type == PS_TYPE_F64) { \ 52 for ( inti=0;i<IN->n;i++) { \52 for (psS32 i=0;i<IN->n;i++) { \ 53 53 OUT->data.F32[i] = (float) (IN->data.F64[i]); \ 54 54 } \ … … 69 69 \ 70 70 if (IN->type.type == PS_TYPE_F32) { \ 71 for ( inti=0;i<IN->n;i++) { \71 for (psS32 i=0;i<IN->n;i++) { \ 72 72 OUT->data.F64[i] = (float) (IN->data.F32[i]); \ 73 73 } \ … … 117 117 outer coefficients of the Chebyshev polynomials. 118 118 *****************************************************************************/ 119 static psPolynomial1D **CreateChebyshevPolys( intmaxChebyPoly)119 static psPolynomial1D **CreateChebyshevPolys(psS32 maxChebyPoly) 120 120 { 121 121 psPolynomial1D **chebPolys = NULL; 122 inti = 0;123 intj = 0;122 psS32 i = 0; 123 psS32 j = 0; 124 124 125 125 chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *)); … … 153 153 evaluated Gaussian is: \f[ exp(-\frac{(x-mean)^2}{2\sigma^2}) \f] 154 154 *****************************************************************************/ 155 float psGaussian(float x, float mean, float sigma, bool normal)155 float psGaussian(float x, float mean, float sigma, psBool normal) 156 156 { 157 157 float tmp = 1.0; … … 185 185 NOTE: XXX: There is no way to seed the random generator. 186 186 *****************************************************************************/ 187 psVector* psGaussianDev(float mean, float sigma, intNpts)187 psVector* psGaussianDev(float mean, float sigma, psS32 Npts) 188 188 { 189 189 psVector* gauss = NULL; 190 190 const gsl_rng_type *T = NULL; 191 191 gsl_rng *r = NULL; 192 inti = 0;192 psS32 i = 0; 193 193 194 194 gauss = psVectorAlloc(Npts, PS_TYPE_F32); … … 209 209 This routine must allocate memory for the polynomial structures. 210 210 *****************************************************************************/ 211 psPolynomial1D* psPolynomial1DAlloc( intn,211 psPolynomial1D* psPolynomial1DAlloc(psS32 n, 212 212 psPolynomialType type) 213 213 { 214 inti = 0;214 psS32 i = 0; 215 215 psPolynomial1D* newPoly = NULL; 216 216 … … 232 232 } 233 233 234 psPolynomial2D* psPolynomial2DAlloc( int nX, intnY,234 psPolynomial2D* psPolynomial2DAlloc(psS32 nX, psS32 nY, 235 235 psPolynomialType type) 236 236 { 237 intx = 0;238 inty = 0;237 psS32 x = 0; 238 psS32 y = 0; 239 239 psPolynomial2D* newPoly = NULL; 240 240 … … 265 265 } 266 266 267 psPolynomial3D* psPolynomial3DAlloc( int nX, int nY, intnZ,267 psPolynomial3D* psPolynomial3DAlloc(psS32 nX, psS32 nY, psS32 nZ, 268 268 psPolynomialType type) 269 269 { 270 intx = 0;271 inty = 0;272 intz = 0;270 psS32 x = 0; 271 psS32 y = 0; 272 psS32 z = 0; 273 273 psPolynomial3D* newPoly = NULL; 274 274 … … 307 307 } 308 308 309 psPolynomial4D* psPolynomial4DAlloc( int nW, int nX, int nY, intnZ,309 psPolynomial4D* psPolynomial4DAlloc(psS32 nW, psS32 nX, psS32 nY, psS32 nZ, 310 310 psPolynomialType type) 311 311 { 312 intw = 0;313 intx = 0;314 inty = 0;315 intz = 0;312 psS32 w = 0; 313 psS32 x = 0; 314 psS32 y = 0; 315 psS32 z = 0; 316 316 psPolynomial4D* newPoly = NULL; 317 317 … … 367 367 static void polynomial2DFree(psPolynomial2D* myPoly) 368 368 { 369 intx = 0;369 psS32 x = 0; 370 370 371 371 for (x = 0; x < myPoly->nX; x++) { … … 381 381 static void polynomial3DFree(psPolynomial3D* myPoly) 382 382 { 383 intx = 0;384 inty = 0;383 psS32 x = 0; 384 psS32 y = 0; 385 385 386 386 for (x = 0; x < myPoly->nX; x++) { … … 402 402 static void polynomial4DFree(psPolynomial4D* myPoly) 403 403 { 404 intw = 0;405 intx = 0;406 inty = 0;404 psS32 w = 0; 405 psS32 x = 0; 406 psS32 y = 0; 407 407 408 408 for (w = 0; w < myPoly->nW; w++) { … … 434 434 float p_psOrdPolynomial1DEval(float x, const psPolynomial1D* myPoly) 435 435 { 436 intloop_x = 0;436 psS32 loop_x = 0; 437 437 float polySum = 0.0; 438 438 float xSum = 1.0; … … 478 478 { 479 479 psVector *d; 480 intn;481 inti;480 psS32 n; 481 psS32 i; 482 482 float tmp; 483 483 … … 500 500 /* 501 501 502 intn;503 inti;502 psS32 n; 503 psS32 i; 504 504 float tmp; 505 505 psPolynomial1D **chebPolys = NULL; … … 537 537 psVector *tmp; 538 538 psVector *myX; 539 inti;539 psS32 i; 540 540 541 541 PS_CONVERT_VECTOR_F32(x, myX); … … 555 555 float p_psOrdPolynomial2DEval(float x, float y, const psPolynomial2D* myPoly) 556 556 { 557 intloop_x = 0;558 intloop_y = 0;557 psS32 loop_x = 0; 558 psS32 loop_y = 0; 559 559 float polySum = 0.0; 560 560 float xSum = 1.0; … … 577 577 float p_psChebPolynomial2DEval(float x, float y, const psPolynomial2D* myPoly) 578 578 { 579 intloop_x = 0;580 intloop_y = 0;581 inti = 0;579 psS32 loop_x = 0; 580 psS32 loop_y = 0; 581 psS32 i = 0; 582 582 float polySum = 0.0; 583 583 psPolynomial1D* *chebPolys = NULL; 584 intmaxChebyPoly = 0;584 psS32 maxChebyPoly = 0; 585 585 586 586 // Determine how many Chebyshev polynomials … … 628 628 psVector *myX; 629 629 psVector *myY; 630 inti;631 intvecLen=x->n;630 psS32 i; 631 psS32 vecLen=x->n; 632 632 633 633 PS_CONVERT_VECTOR_F32(x, myX); … … 658 658 float p_psOrdPolynomial3DEval(float x, float y, float z, const psPolynomial3D* myPoly) 659 659 { 660 intloop_x = 0;661 intloop_y = 0;662 intloop_z = 0;660 psS32 loop_x = 0; 661 psS32 loop_y = 0; 662 psS32 loop_z = 0; 663 663 float polySum = 0.0; 664 664 float xSum = 1.0; … … 686 686 float p_psChebPolynomial3DEval(float x, float y, float z, const psPolynomial3D* myPoly) 687 687 { 688 intloop_x = 0;689 intloop_y = 0;690 intloop_z = 0;691 inti = 0;688 psS32 loop_x = 0; 689 psS32 loop_y = 0; 690 psS32 loop_z = 0; 691 psS32 i = 0; 692 692 float polySum = 0.0; 693 693 psPolynomial1D* *chebPolys = NULL; 694 intmaxChebyPoly = 0;694 psS32 maxChebyPoly = 0; 695 695 696 696 // Determine how many Chebyshev polynomials … … 746 746 psVector *myY; 747 747 psVector *myZ; 748 inti;749 intvecLen=x->n;748 psS32 i; 749 psS32 vecLen=x->n; 750 750 751 751 PS_CONVERT_VECTOR_F32(x, myX); … … 787 787 float p_psOrdPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D* myPoly) 788 788 { 789 intloop_w = 0;790 intloop_x = 0;791 intloop_y = 0;792 intloop_z = 0;789 psS32 loop_w = 0; 790 psS32 loop_x = 0; 791 psS32 loop_y = 0; 792 psS32 loop_z = 0; 793 793 float polySum = 0.0; 794 794 float wSum = 1.0; … … 821 821 float p_psChebPolynomial4DEval(float w, float x, float y, float z, const psPolynomial4D* myPoly) 822 822 { 823 intloop_w = 0;824 intloop_x = 0;825 intloop_y = 0;826 intloop_z = 0;827 inti = 0;823 psS32 loop_w = 0; 824 psS32 loop_x = 0; 825 psS32 loop_y = 0; 826 psS32 loop_z = 0; 827 psS32 i = 0; 828 828 float polySum = 0.0; 829 829 psPolynomial1D* *chebPolys = NULL; 830 intmaxChebyPoly = 0;830 psS32 maxChebyPoly = 0; 831 831 832 832 // Determine how many Chebyshev polynomials … … 890 890 psVector *myY; 891 891 psVector *myZ; 892 inti;893 intvecLen=x->n;892 psS32 i; 893 psS32 vecLen=x->n; 894 894 895 895 PS_CONVERT_VECTOR_F32(w, myW); … … 936 936 937 937 938 psDPolynomial1D* psDPolynomial1DAlloc( intn,938 psDPolynomial1D* psDPolynomial1DAlloc(psS32 n, 939 939 psPolynomialType type) 940 940 { 941 inti = 0;941 psS32 i = 0; 942 942 psDPolynomial1D* newPoly = NULL; 943 943 … … 959 959 } 960 960 961 psDPolynomial2D* psDPolynomial2DAlloc( int nX, intnY,961 psDPolynomial2D* psDPolynomial2DAlloc(psS32 nX, psS32 nY, 962 962 psPolynomialType type) 963 963 { 964 intx = 0;965 inty = 0;964 psS32 x = 0; 965 psS32 y = 0; 966 966 psDPolynomial2D* newPoly = NULL; 967 967 … … 992 992 } 993 993 994 psDPolynomial3D* psDPolynomial3DAlloc( int nX, int nY, intnZ,994 psDPolynomial3D* psDPolynomial3DAlloc(psS32 nX, psS32 nY, psS32 nZ, 995 995 psPolynomialType type) 996 996 { 997 intx = 0;998 inty = 0;999 intz = 0;997 psS32 x = 0; 998 psS32 y = 0; 999 psS32 z = 0; 1000 1000 psDPolynomial3D* newPoly = NULL; 1001 1001 … … 1034 1034 } 1035 1035 1036 psDPolynomial4D* psDPolynomial4DAlloc( int nW, int nX, int nY, intnZ,1036 psDPolynomial4D* psDPolynomial4DAlloc(psS32 nW, psS32 nX, psS32 nY, psS32 nZ, 1037 1037 psPolynomialType type) 1038 1038 { 1039 intw = 0;1040 intx = 0;1041 inty = 0;1042 intz = 0;1039 psS32 w = 0; 1040 psS32 x = 0; 1041 psS32 y = 0; 1042 psS32 z = 0; 1043 1043 psDPolynomial4D* newPoly = NULL; 1044 1044 … … 1094 1094 static void dPolynomial2DFree(psDPolynomial2D* myPoly) 1095 1095 { 1096 intx = 0;1096 psS32 x = 0; 1097 1097 1098 1098 for (x = 0; x < myPoly->nX; x++) { … … 1108 1108 static void dPolynomial3DFree(psDPolynomial3D* myPoly) 1109 1109 { 1110 intx = 0;1111 inty = 0;1110 psS32 x = 0; 1111 psS32 y = 0; 1112 1112 1113 1113 for (x = 0; x < myPoly->nX; x++) { … … 1129 1129 static void dPolynomial4DFree(psDPolynomial4D* myPoly) 1130 1130 { 1131 intw = 0;1132 intx = 0;1133 inty = 0;1131 psS32 w = 0; 1132 psS32 x = 0; 1133 psS32 y = 0; 1134 1134 1135 1135 for (w = 0; w < myPoly->nW; w++) { … … 1159 1159 double p_psDOrdPolynomial1DEval(double x, const psDPolynomial1D* myPoly) 1160 1160 { 1161 intloop_x = 0;1161 psS32 loop_x = 0; 1162 1162 double polySum = 0.0; 1163 1163 double xSum = 1.0; … … 1183 1183 { 1184 1184 psVector *d; 1185 intn;1186 inti;1185 psS32 n; 1186 psS32 i; 1187 1187 double tmp; 1188 1188 … … 1222 1222 psVector *tmp; 1223 1223 psVector *myX; 1224 inti;1224 psS32 i; 1225 1225 1226 1226 PS_CONVERT_VECTOR_F64(x, myX); … … 1241 1241 double p_psDOrdPolynomial2DEval(double x, double y, const psDPolynomial2D* myPoly) 1242 1242 { 1243 intloop_x = 0;1244 intloop_y = 0;1243 psS32 loop_x = 0; 1244 psS32 loop_y = 0; 1245 1245 double polySum = 0.0; 1246 1246 double xSum = 1.0; … … 1263 1263 double p_psDChebPolynomial2DEval(double x, double y, const psDPolynomial2D* myPoly) 1264 1264 { 1265 intloop_x = 0;1266 intloop_y = 0;1267 inti = 0;1265 psS32 loop_x = 0; 1266 psS32 loop_y = 0; 1267 psS32 i = 0; 1268 1268 double polySum = 0.0; 1269 1269 psPolynomial1D* *chebPolys = NULL; 1270 intmaxChebyPoly = 0;1270 psS32 maxChebyPoly = 0; 1271 1271 1272 1272 // Determine how many Chebyshev polynomials … … 1314 1314 psVector *myX; 1315 1315 psVector *myY; 1316 inti;1317 intvecLen=x->n;1316 psS32 i; 1317 psS32 vecLen=x->n; 1318 1318 1319 1319 PS_CONVERT_VECTOR_F64(x, myX); … … 1344 1344 double p_psDOrdPolynomial3DEval(double x, double y, double z, const psDPolynomial3D* myPoly) 1345 1345 { 1346 intloop_x = 0;1347 intloop_y = 0;1348 intloop_z = 0;1346 psS32 loop_x = 0; 1347 psS32 loop_y = 0; 1348 psS32 loop_z = 0; 1349 1349 double polySum = 0.0; 1350 1350 double xSum = 1.0; … … 1372 1372 double p_psDChebPolynomial3DEval(double x, double y, double z, const psDPolynomial3D* myPoly) 1373 1373 { 1374 intloop_x = 0;1375 intloop_y = 0;1376 intloop_z = 0;1377 inti = 0;1374 psS32 loop_x = 0; 1375 psS32 loop_y = 0; 1376 psS32 loop_z = 0; 1377 psS32 i = 0; 1378 1378 double polySum = 0.0; 1379 1379 psPolynomial1D* *chebPolys = NULL; 1380 intmaxChebyPoly = 0;1380 psS32 maxChebyPoly = 0; 1381 1381 1382 1382 // Determine how many Chebyshev polynomials … … 1432 1432 psVector *myY; 1433 1433 psVector *myZ; 1434 inti;1435 intvecLen=x->n;1434 psS32 i; 1435 psS32 vecLen=x->n; 1436 1436 1437 1437 PS_CONVERT_VECTOR_F64(x, myX); … … 1475 1475 double p_psDOrdPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D* myPoly) 1476 1476 { 1477 intloop_w = 0;1478 intloop_x = 0;1479 intloop_y = 0;1480 intloop_z = 0;1477 psS32 loop_w = 0; 1478 psS32 loop_x = 0; 1479 psS32 loop_y = 0; 1480 psS32 loop_z = 0; 1481 1481 double polySum = 0.0; 1482 1482 double wSum = 1.0; … … 1509 1509 double p_psDChebPolynomial4DEval(double w, double x, double y, double z, const psDPolynomial4D* myPoly) 1510 1510 { 1511 intloop_w = 0;1512 intloop_x = 0;1513 intloop_y = 0;1514 intloop_z = 0;1515 inti = 0;1511 psS32 loop_w = 0; 1512 psS32 loop_x = 0; 1513 psS32 loop_y = 0; 1514 psS32 loop_z = 0; 1515 psS32 i = 0; 1516 1516 double polySum = 0.0; 1517 1517 psPolynomial1D* *chebPolys = NULL; 1518 intmaxChebyPoly = 0;1518 psS32 maxChebyPoly = 0; 1519 1519 1520 1520 // Determine how many Chebyshev polynomials … … 1578 1578 psVector *myY; 1579 1579 psVector *myZ; 1580 inti;1581 intvecLen=x->n;1580 psS32 i; 1581 psS32 vecLen=x->n; 1582 1582 1583 1583 PS_CONVERT_VECTOR_F64(w, myW); … … 1624 1624 1625 1625 //typedef struct { 1626 // intn;1626 // psS32 n; 1627 1627 // psPolynomial1D **spline; 1628 1628 // float *p_psDeriv2; … … 1636 1636 XXX: Ensure that domain[i+1] != domain[i] 1637 1637 *****************************************************************************/ 1638 psSpline1D *psSpline1DAlloc( intnumSplines,1639 intorder,1638 psSpline1D *psSpline1DAlloc(psS32 numSplines, 1639 psS32 order, 1640 1640 float min, 1641 1641 float max) 1642 1642 { 1643 1643 psSpline1D *tmp = NULL; 1644 inti;1644 psS32 i; 1645 1645 float tmpDomain; 1646 1646 float width; … … 1677 1677 1678 1678 // XXX: Have Robert put the dealocator in the memory file. 1679 intp_psSpline1DFree(psSpline1D *tmpSpline)1680 { 1681 inti;1679 psS32 p_psSpline1DFree(psSpline1D *tmpSpline) 1680 { 1681 psS32 i; 1682 1682 1683 1683 if (tmpSpline == NULL) { … … 1704 1704 *****************************************************************************/ 1705 1705 psSpline1D *psSpline1DAllocGeneric(const psVector *bounds, 1706 intorder)1706 psS32 order) 1707 1707 { 1708 1708 psSpline1D *tmp = NULL; 1709 inti;1710 intnumSplines;1709 psS32 i; 1710 psS32 numSplines; 1711 1711 1712 1712 tmp = (psSpline1D *) psAlloc(sizeof(psSpline1D)); … … 1746 1746 XXX: name since we don't take psVectors as input. 1747 1747 *****************************************************************************/ 1748 intp_psVectorBinDisectF32(float *bins,1749 intnumBins,1750 float x)1751 { 1752 intmin;1753 intmax;1754 intmid;1748 psS32 p_psVectorBinDisectF32(float *bins, 1749 psS32 numBins, 1750 float x) 1751 { 1752 psS32 min; 1753 psS32 max; 1754 psS32 mid; 1755 1755 1756 1756 psTrace(".psLib.dataManip.psFunctions.p_psVectorBinDisectF32", 4, … … 1800 1800 p_psVectorBinDisectS32(): integer version of above. 1801 1801 *****************************************************************************/ 1802 int p_psVectorBinDisectS32(int*bins,1803 intnumBins,1804 intx)1805 { 1806 intmin;1807 intmax;1808 intmid;1802 psS32 p_psVectorBinDisectS32(psS32 *bins, 1803 psS32 numBins, 1804 psS32 x) 1805 { 1806 psS32 min; 1807 psS32 max; 1808 psS32 mid; 1809 1809 1810 1810 psTrace(".psLib.dataManip.psFunctions.p_psVectorBinDisectS32", 4, … … 1848 1848 p_psVectorBinDisect(): A wrapper to the above p_psVectorBinDisect(). 1849 1849 *****************************************************************************/ 1850 intp_psVectorBinDisect(psVector *bins,1851 psScalar *x)1850 psS32 p_psVectorBinDisect(psVector *bins, 1851 psScalar *x) 1852 1852 { 1853 1853 if (x->type.type != bins->type.type) { … … 1877 1877 float p_ps1DFullInterpolateF32(float *domain, 1878 1878 float *range, 1879 intn,1879 psS32 n, 1880 1880 float x) 1881 1881 { 1882 inti;1883 intm;1882 psS32 i; 1883 psS32 m; 1884 1884 static psVector *p = NULL; 1885 1885 p = psVectorRecycle(p, n, PS_TYPE_F32); … … 1937 1937 float p_ps1DInterpolateF32(float *domain, 1938 1938 float *range, 1939 intn,1940 intorder,1939 psS32 n, 1940 psS32 order, 1941 1941 float x) 1942 1942 { 1943 intbinNum;1944 intnumIntPoints = order+1;1945 intorigin;1943 psS32 binNum; 1944 psS32 numIntPoints = order+1; 1945 psS32 origin; 1946 1946 1947 1947 psTrace(".psLib.dataManip.psFunctions.p_ps1DInterpolateF32", 4, … … 1987 1987 psScalar *p_psVectorInterpolate(psVector *domain, 1988 1988 psVector *range, 1989 intorder,1989 psS32 order, 1990 1990 psScalar *x) 1991 1991 { … … 2065 2065 float x) 2066 2066 { 2067 intbinNum;2068 intn;2067 psS32 binNum; 2068 psS32 n; 2069 2069 2070 2070 n = spline->n; … … 2091 2091 const psSpline1D *spline) 2092 2092 { 2093 inti;2093 psS32 i; 2094 2094 psVector *tmpVector; 2095 2095 -
trunk/psLib/src/math/psSpline.h
r1968 r2204 12 12 * @author George Gusciora, MHPCC 13 13 * 14 * @version $Revision: 1.3 0$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-10- 06 00:48:15$14 * @version $Revision: 1.31 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-10-27 00:57:31 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 45 45 float mean, ///< Mean for the Gaussian 46 46 float stddev, ///< Standard deviation for the Gaussian 47 bool normal ///< Indicates whether result should be normalized47 psBool normal ///< Indicates whether result should be normalized 48 48 ); 49 49 … … 57 57 float mean, ///< The mean of the Gaussian 58 58 float sigma, ///< The sigma of the Gaussian 59 intNpts ///< The size of the vector59 psS32 Npts ///< The size of the vector 60 60 ); 61 61 … … 69 69 { 70 70 psPolynomialType type; ///< Polynomial type 71 intn; ///< Number of terms71 psS32 n; ///< Number of terms 72 72 float *coeff; ///< Coefficients 73 73 float *coeffErr; ///< Error in coefficients … … 80 80 { 81 81 psPolynomialType type; ///< Polynomial type 82 intnX; ///< Number of terms in x83 intnY; ///< Number of terms in y82 psS32 nX; ///< Number of terms in x 83 psS32 nY; ///< Number of terms in y 84 84 float **coeff; ///< Coefficients 85 85 float **coeffErr; ///< Error in coefficients … … 92 92 { 93 93 psPolynomialType type; ///< Polynomial type 94 intnX; ///< Number of terms in x95 intnY; ///< Number of terms in y96 intnZ; ///< Number of terms in z94 psS32 nX; ///< Number of terms in x 95 psS32 nY; ///< Number of terms in y 96 psS32 nZ; ///< Number of terms in z 97 97 float ***coeff; ///< Coefficients 98 98 float ***coeffErr; ///< Error in coefficients … … 105 105 { 106 106 psPolynomialType type; ///< Polynomial type 107 intnW; ///< Number of terms in w108 intnX; ///< Number of terms in x109 intnY; ///< Number of terms in y110 intnZ; ///< Number of terms in z107 psS32 nW; ///< Number of terms in w 108 psS32 nX; ///< Number of terms in x 109 psS32 nY; ///< Number of terms in y 110 psS32 nZ; ///< Number of terms in z 111 111 float ****coeff; ///< Coefficients 112 112 float ****coeffErr; ///< Error in coefficients … … 121 121 */ 122 122 psPolynomial1D* psPolynomial1DAlloc( 123 intn, ///< Number of terms123 psS32 n, ///< Number of terms 124 124 psPolynomialType type ///< Polynomial Type 125 125 ); … … 130 130 */ 131 131 psPolynomial2D* psPolynomial2DAlloc( 132 intnX, ///< Number of terms in x133 intnY, ///< Number of terms in y132 psS32 nX, ///< Number of terms in x 133 psS32 nY, ///< Number of terms in y 134 134 psPolynomialType type ///< Polynomial Type 135 135 ); … … 140 140 */ 141 141 psPolynomial3D* psPolynomial3DAlloc( 142 intnX, ///< Number of terms in x143 intnY, ///< Number of terms in y144 intnZ, ///< Number of terms in z142 psS32 nX, ///< Number of terms in x 143 psS32 nY, ///< Number of terms in y 144 psS32 nZ, ///< Number of terms in z 145 145 psPolynomialType type ///< Polynomial Type 146 146 ); … … 151 151 */ 152 152 psPolynomial4D* psPolynomial4DAlloc( 153 intnW, ///< Number of terms in w154 intnX, ///< Number of terms in x155 intnY, ///< Number of terms in y156 intnZ, ///< Number of terms in z153 psS32 nW, ///< Number of terms in w 154 psS32 nX, ///< Number of terms in x 155 psS32 nY, ///< Number of terms in y 156 psS32 nZ, ///< Number of terms in z 157 157 psPolynomialType type ///< Polynomial Type 158 158 ); … … 230 230 { 231 231 psPolynomialType type; ///< Polynomial type 232 intn; ///< Number of terms232 psS32 n; ///< Number of terms 233 233 double *coeff; ///< Coefficients 234 234 double *coeffErr; ///< Error in coefficients … … 241 241 { 242 242 psPolynomialType type; ///< Polynomial type 243 intnX; ///< Number of terms in x244 intnY; ///< Number of terms in y243 psS32 nX; ///< Number of terms in x 244 psS32 nY; ///< Number of terms in y 245 245 double **coeff; ///< Coefficients 246 246 double **coeffErr; ///< Error in coefficients … … 253 253 { 254 254 psPolynomialType type; ///< Polynomial type 255 intnX; ///< Number of terms in x256 intnY; ///< Number of terms in y257 intnZ; ///< Number of terms in z255 psS32 nX; ///< Number of terms in x 256 psS32 nY; ///< Number of terms in y 257 psS32 nZ; ///< Number of terms in z 258 258 double ***coeff; ///< Coefficients 259 259 double ***coeffErr; ///< Error in coefficients … … 266 266 { 267 267 psPolynomialType type; ///< Polynomial type 268 intnW; ///< Number of terms in w269 intnX; ///< Number of terms in x270 intnY; ///< Number of terms in y271 intnZ; ///< Number of terms in z268 psS32 nW; ///< Number of terms in w 269 psS32 nX; ///< Number of terms in x 270 psS32 nY; ///< Number of terms in y 271 psS32 nZ; ///< Number of terms in z 272 272 double ****coeff; ///< Coefficients 273 273 double ****coeffErr; ///< Error in coefficients … … 281 281 */ 282 282 psDPolynomial1D* psDPolynomial1DAlloc( 283 intn, ///< Number of terms283 psS32 n, ///< Number of terms 284 284 psPolynomialType type ///< Polynomial Type 285 285 ); … … 290 290 */ 291 291 psDPolynomial2D* psDPolynomial2DAlloc( 292 intnX, ///< Number of terms in x293 intnY, ///< Number of terms in y292 psS32 nX, ///< Number of terms in x 293 psS32 nY, ///< Number of terms in y 294 294 psPolynomialType type ///< Polynomial Type 295 295 ); … … 300 300 */ 301 301 psDPolynomial3D* psDPolynomial3DAlloc( 302 intnX, ///< Number of terms in x303 intnY, ///< Number of terms in y304 intnZ, ///< Number of terms in z302 psS32 nX, ///< Number of terms in x 303 psS32 nY, ///< Number of terms in y 304 psS32 nZ, ///< Number of terms in z 305 305 psPolynomialType type ///< Polynomial Type 306 306 ); … … 311 311 */ 312 312 psDPolynomial4D* psDPolynomial4DAlloc( 313 intnW, ///< Number of terms in w314 intnX, ///< Number of terms in x315 intnY, ///< Number of terms in y316 intnZ, ///< Number of terms in z313 psS32 nW, ///< Number of terms in w 314 psS32 nX, ///< Number of terms in x 315 psS32 nY, ///< Number of terms in y 316 psS32 nZ, ///< Number of terms in z 317 317 psPolynomialType type ///< Polynomial Type 318 318 ); … … 386 386 typedef struct 387 387 { 388 intn; ///< The number of spline polynomials388 psS32 n; ///< The number of spline polynomials 389 389 psPolynomial1D **spline; ///< An array of n pointers to the spline polynomials 390 390 float *p_psDeriv2; ///< For cubic splines, the second derivative at each domain point. Size is n+1. … … 393 393 psSpline1D; 394 394 395 psSpline1D *psSpline1DAlloc( intn,396 intorder,395 psSpline1D *psSpline1DAlloc(psS32 n, 396 psS32 order, 397 397 float min, 398 398 float max); 399 399 400 intp_psSpline1DFree(psSpline1D *tmpSpline);400 psS32 p_psSpline1DFree(psSpline1D *tmpSpline); 401 401 402 402 psSpline1D *psSpline1DAllocGeneric(const psVector *bounds, 403 intorder);403 psS32 order); 404 404 405 405 float psSpline1DEval(const psSpline1D *spline, … … 409 409 const psSpline1D *spline); 410 410 411 intp_psVectorBinDisectF32(float *bins,412 intnumBins,413 float x);414 415 int p_psVectorBinDisectS32(int*bins,416 intnumBins,417 intx);418 419 intp_psVectorBinDisect(psVector *bins,420 psScalar *x);411 psS32 p_psVectorBinDisectF32(float *bins, 412 psS32 numBins, 413 float x); 414 415 psS32 p_psVectorBinDisectS32(psS32 *bins, 416 psS32 numBins, 417 psS32 x); 418 419 psS32 p_psVectorBinDisect(psVector *bins, 420 psScalar *x); 421 421 422 422 psScalar *p_psVectorInterpolate(psVector *domain, 423 423 psVector *range, 424 intorder,424 psS32 order, 425 425 psScalar *x); 426 426 -
trunk/psLib/src/math/psStats.c
r2197 r2204 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.6 8$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10-2 6 21:24:43$11 * @version $Revision: 1.69 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:31 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 51 51 52 52 void p_psVectorRobustStats(const psVector* restrict myVector, 53 const psVector* restrict maskVector, unsigned intmaskVal, psStats* stats);53 const psVector* restrict maskVector, psU32 maskVal, psStats* stats); 54 54 55 55 … … 75 75 /*****************************************************************************/ 76 76 77 bool p_psGetStatValue(const psStats* stats, double *value)77 psBool p_psGetStatValue(const psStats* stats, double *value) 78 78 { 79 79 … … 134 134 *****************************************************************************/ 135 135 136 void p_psVectorPrint(psVector* myVector, psVector* maskVector, unsigned intmaskVal, psStats* stats)137 { 138 inti = 0; // Loop index variable.136 void p_psVectorPrint(psVector* myVector, psVector* maskVector, psU32 maskVal, psStats* stats) 137 { 138 psS32 i = 0; // Loop index variable. 139 139 140 140 for (i = 0; i < myVector->n; i++) { … … 178 178 179 179 void p_psVectorSampleMean(const psVector* restrict myVector, 180 const psVector* restrict maskVector, unsigned intmaskVal, psStats* stats)181 { 182 inti = 0; // Loop index variable180 const psVector* restrict maskVector, psU32 maskVal, psStats* stats) 181 { 182 psS32 i = 0; // Loop index variable 183 183 float mean = 0.0; // The mean 184 intcount = 0; // # of points in this mean?184 psS32 count = 0; // # of points in this mean? 185 185 float rangeMin = 0.0; // Exclude data below this 186 186 float rangeMax = 0.0; // Exclude date above this … … 242 242 *****************************************************************************/ 243 243 void p_psVectorMax(const psVector* restrict myVector, 244 const psVector* restrict maskVector, unsigned intmaskVal, psStats* stats)245 { 246 inti = 0; // Loop index variable244 const psVector* restrict maskVector, psU32 maskVal, psStats* stats) 245 { 246 psS32 i = 0; // Loop index variable 247 247 float max = -MY_MAX_FLOAT; // The calculated maximum 248 248 float rangeMin = 0.0; // Exclude data below this … … 303 303 *****************************************************************************/ 304 304 void p_psVectorMin(const psVector* restrict myVector, 305 const psVector* restrict maskVector, unsigned intmaskVal, psStats* stats)306 { 307 inti = 0; // Loop index variable305 const psVector* restrict maskVector, psU32 maskVal, psStats* stats) 306 { 307 psS32 i = 0; // Loop index variable 308 308 float min = MY_MAX_FLOAT; // The calculated maximum 309 309 float rangeMin = 0.0; // Exclude data below this … … 363 363 NULL 364 364 *****************************************************************************/ 365 intp_psVectorNValues(const psVector* restrict myVector,366 const psVector* restrict maskVector, unsigned intmaskVal, psStats* stats)367 { 368 inti = 0; // Loop index variable369 intnumData = 0; // The number of data points365 psS32 p_psVectorNValues(const psVector* restrict myVector, 366 const psVector* restrict maskVector, psU32 maskVal, psStats* stats) 367 { 368 psS32 i = 0; // Loop index variable 369 psS32 numData = 0; // The number of data points 370 370 float rangeMin = 0.0; // Exclude data below this 371 371 float rangeMax = 0.0; // Exclude date above this … … 414 414 *****************************************************************************/ 415 415 void p_psVectorSampleMedian(const psVector* restrict myVector, 416 const psVector* restrict maskVector, unsigned intmaskVal, psStats* stats)416 const psVector* restrict maskVector, psU32 maskVal, psStats* stats) 417 417 { 418 418 psVector* unsortedVector = NULL; // Temporary vector 419 419 psVector* sortedVector = NULL; // Temporary vector 420 inti = 0; // Loop index variable421 intcount = 0; // # of points in this mean?422 intnValues = 0; // # of points in vector420 psS32 i = 0; // Loop index variable 421 psS32 count = 0; // # of points in this mean? 422 psS32 nValues = 0; // # of points in vector 423 423 float rangeMin = 0.0; // Exclude data below this 424 424 float rangeMax = 0.0; // Exclude date above this … … 497 497 float sigma) 498 498 { 499 inti = 0; // Loop index variable500 intj = 0; // Loop index variable499 psS32 i = 0; // Loop index variable 500 psS32 j = 0; // Loop index variable 501 501 float iMid; 502 502 float jMid; 503 intnumBins = robustHistogram->nums->n;504 intnumBounds = robustHistogram->bounds->n;503 psS32 numBins = robustHistogram->nums->n; 504 psS32 numBounds = robustHistogram->bounds->n; 505 505 psVector* smooth = psVectorAlloc(numBins, PS_TYPE_F32); 506 intjMin = 0;507 intjMax = 0;506 psS32 jMin = 0; 507 psS32 jMax = 0; 508 508 float firstBound = robustHistogram->bounds->data.F32[0]; 509 509 float lastBound = robustHistogram->bounds->data.F32[numBounds-1]; … … 566 566 *****************************************************************************/ 567 567 void p_psVectorSampleQuartiles(const psVector* restrict myVector, 568 const psVector* restrict maskVector, unsigned intmaskVal, psStats* stats)568 const psVector* restrict maskVector, psU32 maskVal, psStats* stats) 569 569 { 570 570 psVector* unsortedVector = NULL; // Temporary vector 571 571 psVector* sortedVector = NULL; // Temporary vector 572 inti = 0; // Loop index variable573 intcount = 0; // # of points in this mean?574 intnValues = 0; // # data points572 psS32 i = 0; // Loop index variable 573 psS32 count = 0; // # of points in this mean? 574 psS32 nValues = 0; // # data points 575 575 float rangeMin = 0.0; // Exclude data below this 576 576 float rangeMax = 0.0; // Exclude date above this … … 648 648 *****************************************************************************/ 649 649 void p_psVectorSampleStdev(const psVector* restrict myVector, 650 const psVector* restrict maskVector, unsigned intmaskVal, psStats* stats)651 { 652 inti = 0; // Loop index variable653 intcountInt = 0; // # of data points being used650 const psVector* restrict maskVector, psU32 maskVal, psStats* stats) 651 { 652 psS32 i = 0; // Loop index variable 653 psS32 countInt = 0; // # of data points being used 654 654 float countFloat = 0.0; // # of data points being used 655 655 float mean = 0.0; // The mean … … 733 733 *****************************************************************************/ 734 734 void p_psVectorClippedStats(const psVector* restrict myVector, 735 const psVector* restrict maskVector, unsigned intmaskVal, psStats* stats)736 { 737 inti = 0; // Loop index variable738 intj = 0; // Loop index variable735 const psVector* restrict maskVector, psU32 maskVal, psStats* stats) 736 { 737 psS32 i = 0; // Loop index variable 738 psS32 j = 0; // Loop index variable 739 739 float clippedMean = 0.0; // self-explanatory 740 740 float clippedStdev = 0.0; // self-explanatory … … 825 825 float min = (float)HUGE; 826 826 float max = (float)-HUGE; 827 inti = 0;827 psS32 i = 0; 828 828 829 829 for (i = 0; i < myData->n; i++) { … … 856 856 float max = (double)-HUGE; 857 857 double range = 0.0; 858 inti = 0;858 psS32 i = 0; 859 859 860 860 for (i = 0; i < myData->n; i++) { … … 914 914 *****************************************************************************/ 915 915 float p_psGaussianDeriv(const psVector* restrict myData, 916 const psVector* restrict myParams, intwhichParam)916 const psVector* restrict myParams, psS32 whichParam) 917 917 { 918 918 float x = myData->data.F32[0]; … … 957 957 *****************************************************************************/ 958 958 float p_psQuadraticDeriv(const psVector* restrict myParams, 959 const psVector* restrict myCoords, intwhichParamDeriv)959 const psVector* restrict myCoords, psS32 whichParamDeriv) 960 960 { 961 961 float x = myCoords->data.F32[0]; … … 989 989 float getThisValue) 990 990 { 991 intnumIterations = 0;991 psS32 numIterations = 0; 992 992 float midpoint = 0.0; 993 993 float oldMidpoint = 1.0; … … 1030 1030 float fitQuadraticSearchForYThenReturnX(psVector *xVec, 1031 1031 psVector *yVec, 1032 intbinNum,1032 psS32 binNum, 1033 1033 float yVal) 1034 1034 { … … 1129 1129 void p_psVectorRobustStats(const psVector* restrict myVector, 1130 1130 const psVector* restrict maskVector, 1131 unsigned intmaskVal,1131 psU32 maskVal, 1132 1132 psStats* stats) 1133 1133 { … … 1135 1135 psVector* robustHistogramVector = NULL; 1136 1136 float binSize = 0.0; // Size of the histogram bins 1137 intLQBinNum = -1; // Bin num for lower quartile1138 intUQBinNum = -1; // Bin num for upper quartile1139 intmedianBinNum = -1;1140 inti = 0; // Loop index variable1141 intmodeBinNum = 0;1137 psS32 LQBinNum = -1; // Bin num for lower quartile 1138 psS32 UQBinNum = -1; // Bin num for upper quartile 1139 psS32 medianBinNum = -1; 1140 psS32 i = 0; // Loop index variable 1141 psS32 modeBinNum = 0; 1142 1142 float modeBinCount = 0.0; 1143 1143 float dL = 0.0; 1144 intnumBins = 0;1144 psS32 numBins = 0; 1145 1145 float myMean = 0.0; 1146 1146 float myStdev = 0.0; … … 1200 1200 // bins, not the binSize. Also, if we get here, we know that 1201 1201 // binSize != 0.0. 1202 numBins = ( int)((stats->max - stats->min) / binSize);1202 numBins = (psS32)((stats->max - stats->min) / binSize); 1203 1203 robustHistogram = psHistogramAlloc(stats->min, stats->max, numBins); 1204 1204 … … 1440 1440 The histogram structure 1441 1441 *****************************************************************************/ 1442 psHistogram* psHistogramAlloc(float lower, float upper, intn)1443 { 1444 inti = 0; // Loop index variable1442 psHistogram* psHistogramAlloc(float lower, float upper, psS32 n) 1443 { 1444 psS32 i = 0; // Loop index variable 1445 1445 psHistogram* newHist = NULL; // The new histogram structure 1446 1446 float binSize = 0.0; // The histogram bin size … … 1500 1500 { 1501 1501 psHistogram* newHist = NULL; // The new histogram structure 1502 inti; // Loop index variable1502 psS32 i; // Loop index variable 1503 1503 1504 1504 // NOTE: Verify that this is the correct action. … … 1565 1565 const psVector* restrict in, 1566 1566 const psVector* restrict mask, 1567 unsigned intmaskVal)1568 { 1569 inti = 0; // Loop index variable1567 psU32 maskVal) 1568 { 1569 psS32 i = 0; // Loop index variable 1570 1570 float binSize = 0.0; // Histogram bin size 1571 intbinNum = 0; // A temporary bin number1572 intnumBins = 0; // The total number of bins1573 inttmp = 0;1571 psS32 binNum = 0; // A temporary bin number 1572 psS32 numBins = 0; // The total number of bins 1573 psS32 tmp = 0; 1574 1574 psScalar tmpScalar; 1575 1575 tmpScalar.type.type = PS_TYPE_F32; 1576 1576 psVector* inF32; 1577 intmustFreeTmp = 1;1577 psS32 mustFreeTmp = 1; 1578 1578 1579 1579 // NOTE: Verify that this is the correct action. … … 1629 1629 if (out->uniform == true) { 1630 1630 binSize = out->bounds->data.F32[1] - out->bounds->data.F32[0]; 1631 binNum = ( int)((inF32->data.F32[i] - out->bounds->data.F32[0]) / binSize);1631 binNum = (psS32)((inF32->data.F32[i] - out->bounds->data.F32[0]) / binSize); 1632 1632 1633 1633 // NOTE: This next if-statement really shouldn't be necessary. … … 1673 1673 psVector* p_psConvertToF32(psVector* in) 1674 1674 { 1675 inti = 0;1675 psS32 i = 0; 1676 1676 psVector* tmp = NULL; 1677 1677 … … 1724 1724 psVector* in, 1725 1725 psVector* mask, 1726 unsigned intmaskVal)1726 psU32 maskVal) 1727 1727 { 1728 1728 psVector* inF32; 1729 intmustFreeTmp = 1;1729 psS32 mustFreeTmp = 1; 1730 1730 1731 1731 if (in == NULL) { -
trunk/psLib/src/math/psStats.h
r1980 r2204 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.3 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-10- 06 20:07:04$12 * @version $Revision: 1.32 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:31 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 67 67 double robustUQ; ///< robust upper quartile 68 68 double robustLQ; ///< robust lower quartile 69 introbustN50; ///<70 introbustNfit; ///<69 psS32 robustN50; ///< 70 psS32 robustNfit; ///< 71 71 double clippedMean; ///< Nsigma clipped mean 72 72 double clippedStdev; ///< standard deviation after clipping 73 intclippedNvalues; ///< ???73 psS32 clippedNvalues; ///< ??? 74 74 double clipSigma; ///< Nsigma used for clipping; user input 75 intclipIter; ///< Number of clipping iterations; user input75 psS32 clipIter; ///< Number of clipping iterations; user input 76 76 double min; ///< minimum data value in array 77 77 double max; ///< maximum data value in array … … 89 89 psVector* in, ///< Vector to be analysed: must be F32 90 90 psVector* mask, ///< Ignore elements where (maskVector & maskVal) != 0: must be INT or NULL 91 unsigned intmaskVal ///< Only mask elements with one of these bits set in maskVector91 psU32 maskVal ///< Only mask elements with one of these bits set in maskVector 92 92 ); 93 93 … … 118 118 psVector* bounds; ///< Bounds for the bins (type F32) 119 119 psVector* nums; ///< Number in each of the bins (INT) 120 intminNum; ///< Number below the minimum121 intmaxNum; ///< Number above the maximum122 bool uniform; ///< Is it a uniform distribution?120 psS32 minNum; ///< Number below the minimum 121 psS32 maxNum; ///< Number above the maximum 122 psBool uniform; ///< Is it a uniform distribution? 123 123 } 124 124 psHistogram; … … 133 133 float lower, ///< Lower limit for the bins 134 134 float upper, ///< Upper limit for the bins 135 intn ///< Number of bins135 psS32 n ///< Number of bins 136 136 ); 137 137 … … 157 157 const psVector* restrict in, ///< Vector to analyse 158 158 const psVector* restrict mask, ///< Mask dat for input vector 159 unsigned intmaskVal ///< Mask value159 psU32 maskVal ///< Mask value 160 160 ); 161 161 162 162 /** Extracts the statistic value specified by stats->options. 163 163 * 164 * @return bool If more than one statistic result is set in stats->options,164 * @return psBool If more than one statistic result is set in stats->options, 165 165 * false is returned and the value parameter is not set, 166 166 * otherwise true is returned. 167 167 */ 168 bool p_psGetStatValue(168 psBool p_psGetStatValue( 169 169 const psStats* stats, 170 170 ///< the statistic struct to operate on -
trunk/psLib/src/mathtypes/psImage.c
r2105 r2204 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.5 0$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-10- 14 01:22:59$12 * @version $Revision: 1.51 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:31 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 29 29 static void imageFree(psImage* image); 30 30 31 psImage* psImageAlloc( unsigned intnumCols,32 unsigned intnumRows,31 psImage* psImageAlloc(psU32 numCols, 32 psU32 numRows, 33 33 const psElemType type) 34 34 { 35 intarea = 0;36 intelementSize = PSELEMTYPE_SIZEOF(type); // element size in bytes37 introwSize = numCols * elementSize; // row size in bytes.35 psS32 area = 0; 36 psS32 elementSize = PSELEMTYPE_SIZEOF(type); // element size in bytes 37 psS32 rowSize = numCols * elementSize; // row size in bytes. 38 38 39 39 area = numCols * numRows; … … 51 51 p_psMemSetDeallocator(image, (psFreeFcn) imageFree); 52 52 53 image->data.V = psAlloc(sizeof( void *) * numRows);53 image->data.V = psAlloc(sizeof(psPtr ) * numRows); 54 54 55 55 image->rawDataBuffer = psAlloc(area * elementSize); … … 57 57 // set the row pointers. 58 58 image->data.V[0] = image->rawDataBuffer; 59 for ( inti = 1; i < numRows; i++) {60 image->data.V[i] = ( void *)((int8_t *) image->data.V[i - 1] + rowSize);61 } 62 63 *( int*)&image->col0 = 0;64 *( int*)&image->row0 = 0;65 *( unsigned int*)&image->numCols = numCols;66 *( unsigned int*)&image->numRows = numRows;59 for (psS32 i = 1; i < numRows; i++) { 60 image->data.V[i] = (psPtr )((int8_t *) image->data.V[i - 1] + rowSize); 61 } 62 63 *(psS32 *)&image->col0 = 0; 64 *(psS32 *)&image->row0 = 0; 65 *(psU32 *)&image->numCols = numCols; 66 *(psU32 *)&image->numRows = numRows; 67 67 *(psDimen* ) & image->type.dimen = PS_DIMEN_IMAGE; 68 68 *(psElemType* ) & image->type.type = type; … … 81 81 if (image->type.type == PS_TYPE_PTR) { 82 82 // 2-D array of pointers -- must dereference elements 83 unsigned intoldNumRows = image->numRows;84 unsigned intoldNumCols = image->numCols;85 psP TR* rowPtr;86 87 for ( unsigned introw = 0; row < oldNumRows; row++) {83 psU32 oldNumRows = image->numRows; 84 psU32 oldNumCols = image->numCols; 85 psPtr* rowPtr; 86 87 for (psU32 row = 0; row < oldNumRows; row++) { 88 88 rowPtr = image->data.PTR[row]; 89 for ( unsigned intcol = 0; col < oldNumCols; col++) {89 for (psU32 col = 0; col < oldNumCols; col++) { 90 90 psMemDecrRefCounter(rowPtr[col]); 91 91 } … … 105 105 106 106 psImage* psImageRecycle(psImage* old, 107 unsigned intnumCols,108 unsigned intnumRows,107 psU32 numCols, 108 psU32 numRows, 109 109 const psElemType type) 110 110 { 111 intelementSize = PSELEMTYPE_SIZEOF(type); // element size in bytes112 introwSize = numCols * elementSize; // row size in bytes.111 psS32 elementSize = PSELEMTYPE_SIZEOF(type); // element size in bytes 112 psS32 rowSize = numCols * elementSize; // row size in bytes. 113 113 114 114 if (old == NULL) { … … 128 128 // 2-D array of pointers -- must 129 129 // dereference 130 unsigned intoldNumRows = old->numRows;131 unsigned intoldNumCols = old->numCols;132 psP TR* rowPtr;133 134 for ( unsigned introw = 0; row < oldNumRows; row++) {130 psU32 oldNumRows = old->numRows; 131 psU32 oldNumCols = old->numCols; 132 psPtr* rowPtr; 133 134 for (psU32 row = 0; row < oldNumRows; row++) { 135 135 rowPtr = old->data.PTR[row]; 136 for ( unsigned intcol = 0; col < oldNumCols; col++) {136 for (psU32 col = 0; col < oldNumCols; col++) { 137 137 psMemDecrRefCounter(rowPtr[col]); 138 138 rowPtr[col] = NULL; … … 149 149 old->rawDataBuffer = psRealloc(old->data.V[0], 150 150 numCols * numRows * elementSize); 151 old->data.V = ( void **)psRealloc(old->data.V, numRows * sizeof(void *));151 old->data.V = (psPtr *)psRealloc(old->data.V, numRows * sizeof(psPtr )); 152 152 153 153 // recreate the row pointers 154 154 old->data.V[0] = old->rawDataBuffer; 155 for ( inti = 1; i < numRows; i++) {156 old->data.V[i] = ( void *)((int8_t *) old->data.V[i - 1] + rowSize);157 } 158 159 *( unsigned int*)&old->numCols = numCols;160 *( unsigned int*)&old->numRows = numRows;155 for (psS32 i = 1; i < numRows; i++) { 156 old->data.V[i] = (psPtr )((int8_t *) old->data.V[i - 1] + rowSize); 157 } 158 159 *(psU32 *)&old->numCols = numCols; 160 *(psU32 *)&old->numRows = numRows; 161 161 *(psElemType* ) & old->type.type = type; 162 162 … … 169 169 { 170 170 psElemType inDatatype; 171 intelementSize;172 intelements;173 intnumRows;174 intnumCols;171 psS32 elementSize; 172 psS32 elements; 173 psS32 numRows; 174 psS32 numCols; 175 175 176 176 if (input == NULL || input->data.V == NULL) { … … 218 218 // datatype. 219 219 if (type == inDatatype) { 220 for ( introw=0;row<numRows;row++) {220 for (psS32 row=0;row<numRows;row++) { 221 221 memcpy(output->data.V[row], input->data.V[row], elementSize * numCols); 222 222 } … … 227 227 ps##INTYPE *in; \ 228 228 ps##OUTTYPE *out; \ 229 for( introw=0;row<numRows;row++) { \229 for(psS32 row=0;row<numRows;row++) { \ 230 230 in = IN->data.INTYPE[row]; \ 231 231 out = OUT->data.OUTTYPE[row]; \ 232 for ( intcol=0;col<numCols;col++) { \232 for (psS32 col=0;col<numCols;col++) { \ 233 233 *(out++) = *(in++); \ 234 234 } \ … … 331 331 } 332 332 333 intpsImageFreeChildren(psImage* image)333 psS32 psImageFreeChildren(psImage* image) 334 334 { 335 intnumFreed = 0;335 psS32 numFreed = 0; 336 336 337 337 if (image == NULL) { … … 345 345 // orphan the children first 346 346 // (so psFree doesn't try to modify the parent's children array while I'm using it) 347 for ( inti=0;i<numFreed;i++) {347 for (psS32 i=0;i<numFreed;i++) { 348 348 children[i]->parent = NULL; 349 349 } … … 366 366 float y, 367 367 const psImage* mask, 368 unsigned intmaskVal,368 psU32 maskVal, 369 369 psC64 unexposedValue, 370 370 psImageInterpolateMode mode) … … 438 438 float y, \ 439 439 const psImage* mask, \ 440 unsigned intmaskVal, \440 psU32 maskVal, \ 441 441 psF64 unexposedValue) \ 442 442 { \ 443 int intX = (int) round((psF64)(x) - 0.5 + FLT_EPSILON); \444 int intY = (int) round((psF64)(y) - 0.5 + FLT_EPSILON); \445 intlastX = input->numCols - 1; \446 intlastY = input->numRows - 1; \443 psS32 intX = (psS32) round((psF64)(x) - 0.5 + FLT_EPSILON); \ 444 psS32 intY = (psS32) round((psF64)(y) - 0.5 + FLT_EPSILON); \ 445 psS32 lastX = input->numCols - 1; \ 446 psS32 lastY = input->numRows - 1; \ 447 447 \ 448 448 if ((intX < 0) || \ … … 463 463 float y, \ 464 464 const psImage* mask, \ 465 unsigned intmaskVal, \465 psU32 maskVal, \ 466 466 psC64 unexposedValue) \ 467 467 { \ 468 int intX = (int) round((psF64)(x) - 0.5); \469 int intY = (int) round((psF64)(y) - 0.5); \470 intlastX = input->numCols - 1; \471 intlastY = input->numRows - 1; \468 psS32 intX = (psS32) round((psF64)(x) - 0.5); \ 469 psS32 intY = (psS32) round((psF64)(y) - 0.5); \ 470 psS32 lastX = input->numCols - 1; \ 471 psS32 lastY = input->numRows - 1; \ 472 472 \ 473 473 if ((intX < 0) || \ … … 501 501 float y, \ 502 502 const psImage* mask, \ 503 unsigned intmaskVal, \503 psU32 maskVal, \ 504 504 psF64 unexposedValue) \ 505 505 { \ … … 508 508 psF64 fracX = x - 0.5 - floorX; \ 509 509 psF64 fracY = y - 0.5 - floorY; \ 510 int intFloorX = (int) floorX; \511 int intFloorY = (int) floorY; \512 intlastX = input->numCols - 1; \513 intlastY = input->numRows - 1; \510 psS32 intFloorX = (psS32) floorX; \ 511 psS32 intFloorY = (psS32) floorY; \ 512 psS32 lastX = input->numCols - 1; \ 513 psS32 lastY = input->numRows - 1; \ 514 514 ps##TYPE V00; \ 515 515 ps##TYPE V01; \ 516 516 ps##TYPE V10; \ 517 517 ps##TYPE V11; \ 518 bool valid00 = false; \519 bool valid01 = false; \520 bool valid10 = false; \521 bool valid11 = false; \518 psBool valid00 = false; \ 519 psBool valid01 = false; \ 520 psBool valid10 = false; \ 521 psBool valid11 = false; \ 522 522 \ 523 523 if (intFloorY >= 0 && intFloorY <= lastY) { \ … … 556 556 \ 557 557 psF64 V0; \ 558 bool valid0 = true; \558 psBool valid0 = true; \ 559 559 if (valid00 && valid10) { \ 560 560 V0 = V00*(1-fracX)+V10*fracX; \ … … 568 568 \ 569 569 psF64 V1; \ 570 bool valid1 = true; \570 psBool valid1 = true; \ 571 571 if (valid01 && valid11) { \ 572 572 V1 = V01*(1-fracX)+V11*fracX; \ … … 595 595 float y, \ 596 596 const psImage* mask, \ 597 unsigned intmaskVal, \597 psU32 maskVal, \ 598 598 psC64 unexposedValue) \ 599 599 { \ … … 602 602 psF64 fracX = x - 0.5 - floorX; \ 603 603 psF64 fracY = y - 0.5 - floorY; \ 604 int intFloorX = (int) floorX; \605 int intFloorY = (int) floorY; \606 intlastX = input->numCols - 1; \607 intlastY = input->numRows - 1; \604 psS32 intFloorX = (psS32) floorX; \ 605 psS32 intFloorY = (psS32) floorY; \ 606 psS32 lastX = input->numCols - 1; \ 607 psS32 lastY = input->numRows - 1; \ 608 608 ps##TYPE V00; \ 609 609 ps##TYPE V01; \ 610 610 ps##TYPE V10; \ 611 611 ps##TYPE V11; \ 612 bool valid00 = false; \613 bool valid01 = false; \614 bool valid10 = false; \615 bool valid11 = false; \612 psBool valid00 = false; \ 613 psBool valid01 = false; \ 614 psBool valid10 = false; \ 615 psBool valid11 = false; \ 616 616 \ 617 617 if (intFloorY >= 0 && intFloorY <= lastY) { \ … … 650 650 \ 651 651 psC64 V0; \ 652 bool valid0 = true; \652 psBool valid0 = true; \ 653 653 if (valid00 && valid10) { \ 654 654 V0 = V00*(1-fracX)+V10*fracX; \ … … 662 662 \ 663 663 psC64 V1; \ 664 bool valid1 = true; \664 psBool valid1 = true; \ 665 665 if (valid01 && valid11) { \ 666 666 V0 = V01*(1-fracX)+V11*fracX; \ -
trunk/psLib/src/mathtypes/psImage.h
r2105 r2204 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.4 1$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-10- 14 01:22:59$13 * @version $Revision: 1.42 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:31 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 47 47 { 48 48 const psType type; ///< Image data type and dimension. 49 const unsigned intnumCols; ///< Number of columns in image50 const unsigned intnumRows; ///< Number of rows in image.51 const intcol0; ///< Column position relative to parent.52 const introw0; ///< Row position relative to parent.49 const psU32 numCols; ///< Number of columns in image 50 const psU32 numRows; ///< Number of rows in image. 51 const psS32 col0; ///< Column position relative to parent. 52 const psS32 row0; ///< Row position relative to parent. 53 53 54 54 union { … … 65 65 psC32** C32; ///< Single-precision complex data. 66 66 psC64** C64; ///< Double-precision complex data. 67 psP TR** PTR; ///< Void pointers.68 psP TR* V; ///< Pointer to data.67 psPtr** PTR; ///< Void pointers. 68 psPtr* V; ///< Pointer to data. 69 69 } data; ///< Union for data types. 70 70 const struct psImage* parent; ///< Parent, if a subimage. 71 71 psArray* children; ///< Children of this region. 72 72 73 void*rawDataBuffer;73 psPtr rawDataBuffer; 74 74 } 75 75 psImage; … … 84 84 */ 85 85 psImage* psImageAlloc( 86 unsigned intnumCols, ///< Number of rows in image.87 unsigned intnumRows, ///< Number of columns in image.86 psU32 numCols, ///< Number of rows in image. 87 psU32 numRows, ///< Number of columns in image. 88 88 const psElemType type ///< Type of data for image. 89 89 ); … … 96 96 psImage* psImageRecycle( 97 97 psImage* old, ///< the psImage to recycle by resizing image buffer 98 unsigned intnumCols, ///< the desired number of columns in image99 unsigned intnumRows, ///< the desired number of rows in image98 psU32 numCols, ///< the desired number of columns in image 99 psU32 numRows, ///< the desired number of rows in image 100 100 const psElemType type ///< the desired datatype of the image 101 101 ); … … 115 115 /** Frees all children of a psImage. 116 116 * 117 * @return intNumber of children freed.117 * @return psS32 Number of children freed. 118 118 * 119 119 */ 120 intpsImageFreeChildren(120 psS32 psImageFreeChildren( 121 121 psImage* image ///< psImage in which all children shall be deallocated 122 122 ); … … 132 132 float y, ///< row location ot derive value of 133 133 const psImage* mask, ///< if not NULL, the mask of the input image 134 unsigned intmaskVal, ///< the mask value134 psU32 maskVal, ///< the mask value 135 135 psC64 unexposedValue, ///< return value if x,y location is not in image. 136 136 psImageInterpolateMode mode ///< interpolation mode … … 143 143 float y, /**< row location ot derive value of */ \ 144 144 const psImage* mask, /**< if not NULL, the mask of the input image */ \ 145 unsigned intmaskVal, /**< the mask value */ \145 psU32 maskVal, /**< the mask value */ \ 146 146 psF64 unexposedValue /**< return value if x,y location is not in image. */ \ 147 147 ); \ … … 151 151 float y, /**< row location ot derive value of */ \ 152 152 const psImage* mask, /**< if not NULL, the mask of the input image */ \ 153 unsigned intmaskVal, /**< the mask value */ \153 psU32 maskVal, /**< the mask value */ \ 154 154 psF64 unexposedValue /**< return value if x,y location is not in image. */ \ 155 155 ); … … 161 161 float y, /**< row location ot derive value of */ \ 162 162 const psImage* mask, /**< if not NULL, the mask of the input image */ \ 163 unsigned intmaskVal, /**< the mask value */ \163 psU32 maskVal, /**< the mask value */ \ 164 164 psC64 unexposedValue /**< return value if x,y location is not in image. */ \ 165 165 ); \ … … 169 169 float y, /**< row location ot derive value of */ \ 170 170 const psImage* mask, /**< if not NULL, the mask of the input image */ \ 171 unsigned intmaskVal, /**< the mask value */ \171 psU32 maskVal, /**< the mask value */ \ 172 172 psC64 unexposedValue /**< return value if x,y location is not in image. */ \ 173 173 ); -
trunk/psLib/src/mathtypes/psVector.c
r2006 r2204 10 10 * @author Robert DeSonia, MHPCC 11 11 * 12 * @version $Revision: 1.2 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-10- 07 19:51:30$12 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:31 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 42 42 // FUNCTION IMPLEMENTATION - PUBLIC 43 43 44 psVector* psVectorAlloc( unsigned intnalloc, psElemType elemType)44 psVector* psVectorAlloc(psU32 nalloc, psElemType elemType) 45 45 { 46 46 psVector* psVec = NULL; 47 intelementSize = 0;47 psS32 elementSize = 0; 48 48 49 49 elementSize = PSELEMTYPE_SIZEOF(elemType); … … 64 64 } 65 65 66 psVector* psVectorRealloc(psVector* restrict in, unsigned intnalloc)67 { 68 intelementSize = 0;66 psVector* psVectorRealloc(psVector* restrict in, psU32 nalloc) 67 { 68 psS32 elementSize = 0; 69 69 psElemType elemType; 70 70 … … 88 88 } 89 89 90 psVector* psVectorRecycle(psVector* restrict in, unsigned intn, psElemType type)91 { 92 intbyteSize;90 psVector* psVectorRecycle(psVector* restrict in, psU32 n, psElemType type) 91 { 92 psS32 byteSize; 93 93 94 94 if (in == NULL) { … … 129 129 } 130 130 131 intnElements = in->n;131 psS32 nElements = in->n; 132 132 133 133 out = psVectorRecycle(out, nElements, type); … … 136 136 ps##INTYPE *inVec = in->data.INTYPE; \ 137 137 ps##OUTTYPE *outVec = out->data.OUTTYPE; \ 138 for ( intcol=0;col<nElements;col++) { \138 for (psS32 col=0;col<nElements;col++) { \ 139 139 *(outVec++) = *(inVec++); \ 140 140 } \ … … 225 225 psVector* psVectorSort(psVector* restrict outVector, const psVector* restrict inVector) 226 226 { 227 intN = 0;228 intelSize = 0;229 void *inVec = NULL;230 void *outVec = NULL;227 psS32 N = 0; 228 psS32 elSize = 0; 229 psPtr inVec = NULL; 230 psPtr outVec = NULL; 231 231 psElemType inType = 0; 232 232 … … 311 311 psVector* psVectorSortIndex(psVector* restrict outVector, const psVector* restrict inVector) 312 312 { 313 intN = 0;313 psS32 N = 0; 314 314 psVector* tmpVector = NULL; 315 315 psElemType inType = 0; … … 350 350 ps##TYPE* tmpVec = tmpVector->data.TYPE; \ 351 351 ps##TYPE diff; \ 352 for( inti=0; i<N; i++) { \353 for( intj=0; j<N; j++) { \352 for(psS32 i=0; i<N; i++) { \ 353 for(psS32 j=0; j<N; j++) { \ 354 354 diff = absfcn(tmpVec[i] - inVec[j]); \ 355 355 if(diff < maxError) { \ -
trunk/psLib/src/mathtypes/psVector.h
r1982 r2204 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-10- 06 21:30:52$13 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:31 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 33 33 { 34 34 psType type; ///< Type of data. 35 unsigned intnalloc; ///< Total number of elements available.36 unsigned intn; ///< Number of elements in use.35 psU32 nalloc; ///< Total number of elements available. 36 psU32 n; ///< Number of elements in use. 37 37 38 38 union { … … 49 49 psC32* C32; ///< Single-precision complex data. 50 50 psC64* C64; ///< Double-precision complex data. 51 psP TRV; ///< Pointer to data.51 psPtr V; ///< Pointer to data. 52 52 } data; ///< Union for data types. 53 53 } … … 69 69 */ 70 70 psVector* psVectorAlloc( 71 unsigned intnalloc, ///< Total number of elements to make available.71 psU32 nalloc, ///< Total number of elements to make available. 72 72 psElemType dataType ///< Type of data to be held by vector. 73 73 ); … … 84 84 psVector* psVectorRealloc( 85 85 psVector* restrict psVec, ///< Vector to reallocate. 86 unsigned intnalloc ///< Total number of elements to make available.86 psU32 nalloc ///< Total number of elements to make available. 87 87 ); 88 88 … … 101 101 ///< taken to preserve the values. 102 102 103 unsigned intnalloc, ///< Total number of elements to make available.103 psU32 nalloc, ///< Total number of elements to make available. 104 104 psElemType type ///< the datatype of the returned vector 105 105 ); -
trunk/psLib/src/sys/psError.c
r1905 r2204 10 10 * @author Eric Van Alst, MHPCC 11 11 * 12 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $13 * @date $Date: 2004- 09-27 20:38:02$12 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:31 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 26 26 #define MAX_ERROR_STACK_SIZE 64 27 27 static psErr* errorStack[MAX_ERROR_STACK_SIZE]; 28 static unsigned interrorStackSize = 0;28 static psU32 errorStackSize = 0; 29 29 pthread_mutex_t lockErrorStack = PTHREAD_MUTEX_INITIALIZER; 30 30 … … 84 84 { 85 85 pthread_mutex_lock(&lockErrorStack); 86 for ( intlcv=0;lcv<errorStackSize;lcv++) {86 for (psS32 lcv=0;lcv<errorStackSize;lcv++) { 87 87 p_psMemSetPersistent(errorStack[lcv]->msg,false); 88 88 p_psMemSetPersistent(errorStack[lcv]->name,false); … … 94 94 } 95 95 96 psErrorCode psErrorMsg(const char *name, psErrorCode code, bool new, const char* fmt, ...)96 psErrorCode psErrorMsg(const char *name, psErrorCode code, psBool new, const char* fmt, ...) 97 97 { 98 98 char errMsg[1024]; … … 131 131 } 132 132 133 psErr* psErrorGet( intwhich)133 psErr* psErrorGet(psS32 which) 134 134 { 135 135 psErr* result; … … 180 180 vfprintf(fd,fmt,va); 181 181 182 for ( intlcv=0;lcv<errorStackSize;lcv++) {182 for (psS32 lcv=0;lcv<errorStackSize;lcv++) { 183 183 if(errorStack[lcv]->code >= PS_ERR_BASE) { 184 184 fprintf(fd," -> %s: %s\n %s\n", -
trunk/psLib/src/sys/psError.h
r1869 r2204 12 12 * @author Eric Van Alst, MHPCC 13 13 * 14 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $15 * @date $Date: 2004- 09-23 22:18:13$14 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-10-27 00:57:31 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 51 51 */ 52 52 psErr* psErrorGet( 53 intwhich ///< position in the error stack. 0 is last error on stack.53 psS32 which ///< position in the error stack. 0 is last error on stack. 54 54 ); 55 55 … … 121 121 const char *name, ///< Name of error in the form aaa.bbb.ccc 122 122 psErrorCode code, ///< Error class code 123 bool new, ///< true if error originates at this location123 psBool new, ///< true if error originates at this location 124 124 const char* fmt, ///< printf style formatting statement defining error message 125 125 ... -
trunk/psLib/src/sys/psErrorCodes.c
r2129 r2204 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-10- 14 21:14:58$9 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-10-27 00:57:31 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 59 59 // first, search the static error codes 60 60 61 intn = 0;61 psS32 n = 0; 62 62 while(staticErrorCodes[n].code != PS_ERR_N_ERR_CLASSES && 63 63 staticErrorCodes[n].code != code) { … … 88 88 static void freeErrorDescription(psErrorDescription* err) 89 89 { 90 psFree(( void*)err->description);90 psFree((psPtr)err->description); 91 91 } 92 92 … … 125 125 126 126 void psErrorRegister(const psErrorDescription* errors, 127 intnerror)127 psS32 nerror) 128 128 { 129 129 if (nerror < 1) { … … 143 143 } 144 144 145 for ( inti=0;i<nerror;i++) {145 for (psS32 i=0;i<nerror;i++) { 146 146 psErrorDescription* err = psErrorDescriptionAlloc( 147 147 errors[i].code, errors[i].description); 148 148 p_psMemSetPersistent(err,true); 149 p_psMemSetPersistent(( void*)err->description,true);149 p_psMemSetPersistent((psPtr)err->description,true); 150 150 if (! psListAdd(dynamicErrorCodes, 151 151 PS_LIST_HEAD, … … 162 162 } 163 163 164 bool p_psErrorUnregister(psErrorCode code)164 psBool p_psErrorUnregister(psErrorCode code) 165 165 { 166 166 // Check input argument is non-negative … … 179 179 } 180 180 181 return psListRemove(dynamicErrorCodes,PS_LIST_UNKNOWN,( void*)desc);181 return psListRemove(dynamicErrorCodes,PS_LIST_UNKNOWN,(psPtr)desc); 182 182 } -
trunk/psLib/src/sys/psErrorCodes.h
r2129 r2204 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-10- 14 21:14:58$9 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-10-27 00:57:31 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 15 15 #ifndef PS_ERROR_CODES_H 16 16 #define PS_ERROR_CODES_H 17 18 #include "psType.h" 17 19 18 20 /* N.B., lines between '//~Start' and '//~End' are automatic generated from … … 93 95 void psErrorRegister( 94 96 const psErrorDescription* errors, ///< Array of error codes to register 95 intnerror ///< number of errors in input array97 psS32 nerror ///< number of errors in input array 96 98 ); 97 99 98 100 /** Clears error codes registered via psErrorRegister. 99 101 * 100 * @return bool TRUE if given errorcode was removed, otherwise FALSE.102 * @return psBool TRUE if given errorcode was removed, otherwise FALSE. 101 103 */ 102 bool p_psErrorUnregister(104 psBool p_psErrorUnregister( 103 105 psErrorCode code ///< the error code to find and remove 104 106 ); -
trunk/psLib/src/sys/psLogMsg.c
r1807 r2204 11 11 * @author George Gusciora, MHPCC 12 12 * 13 * @version $Revision: 1.3 3$ $Name: not supported by cvs2svn $14 * @date $Date: 2004- 09-14 20:01:52$13 * @version $Revision: 1.34 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:31 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 19 19 /***************************************************************************** 20 20 NOTES: currently, the prototype code has the following global variables: 21 static intp_psGlobalLogDest;22 static intp_psGlobalLogLevel;23 static intp_psLogTime;24 static intp_psLogHost;25 static intp_psLogLevel;26 static intp_psLogName;27 static intp_psLogMsg;21 static psS32 p_psGlobalLogDest; 22 static psS32 p_psGlobalLogLevel; 23 static psS32 p_psLogTime; 24 static psS32 p_psLogHost; 25 static psS32 p_psLogLevel; 26 static psS32 p_psLogName; 27 static psS32 p_psLogMsg; 28 28 *****************************************************************************/ 29 29 #include <limits.h> … … 34 34 #include <time.h> 35 35 #include <unistd.h> 36 #include <stdbool.h>37 36 38 37 #include "psLogMsg.h" … … 49 48 50 49 static FILE *logDest = (FILE *) 1; // flag to initialize to stderr before using. 51 static intglobalLogLevel = PS_LOG_INFO; // log all messages at this or above52 static bool logTime = true; // Flag to include time info53 static bool logHost = true; // Flag to include host info54 static bool logLevel = true; // Flag to include level info55 static bool logName = true; // Flag to include name info56 static bool logMsg = true; // Flag to include message info50 static psS32 globalLogLevel = PS_LOG_INFO; // log all messages at this or above 51 static psBool logTime = true; // Flag to include time info 52 static psBool logHost = true; // Flag to include host info 53 static psBool logLevel = true; // Flag to include level info 54 static psBool logName = true; // Flag to include name info 55 static psBool logMsg = true; // Flag to include message info 57 56 58 57 /***************************************************************************** 59 58 psLogSetLevel(): Set the current log level and return old level. 60 59 Input: 61 level ( int): the new log level.60 level (psS32): the new log level. 62 61 Output: 63 62 none … … 65 64 The old log level. 66 65 *****************************************************************************/ 67 int psLogSetLevel(intlevel)66 psS32 psLogSetLevel(psS32 level) 68 67 { 69 68 // Save old global log level for changing it. 70 intoldLevel = globalLogLevel;69 psS32 oldLevel = globalLogLevel; 71 70 72 71 if ((level < MIN_LOG_LEVEL) || (level > MAX_LOG_LEVEL)) { … … 86 85 87 86 Input: 88 dest ( int): the new log destination87 dest (psS32): the new log destination 89 88 Output: 90 89 None. … … 92 91 An integer specifying the old log destination. 93 92 *****************************************************************************/ 94 bool psLogSetDestination(const char *dest)93 psBool psLogSetDestination(const char *dest) 95 94 { 96 95 char protocol[5]; … … 245 244 NULL. 246 245 *****************************************************************************/ 247 void psLogMsgV(const char *name, intlevel, const char *fmt, va_list ap)248 { 249 static intfirst = 1; // Flag for calling gethostname()246 void psLogMsgV(const char *name, psS32 level, const char *fmt, va_list ap) 247 { 248 static psS32 first = 1; // Flag for calling gethostname() 250 249 static char hostname[HOST_NAME_MAX + 1]; 251 250 … … 254 253 char head[MAX_LOG_LINE_LENGTH + 2]; // the added two are for the ending | and \0 255 254 char *head_ptr = head; // where we've got to in head 256 intmaxLength = MAX_LOG_LINE_LENGTH;255 psS32 maxLength = MAX_LOG_LINE_LENGTH; 257 256 time_t clock = time(NULL); // The current time. 258 257 struct tm *utc = gmtime(&clock); // The current gm time. … … 375 374 NULL 376 375 *****************************************************************************/ 377 void psLogMsg(const char *name, intlevel, const char *fmt, ...)376 void psLogMsg(const char *name, psS32 level, const char *fmt, ...) 378 377 { 379 378 va_list ap; -
trunk/psLib/src/sys/psLogMsg.h
r1807 r2204 11 11 * @author George Gusciora, MHPCC 12 12 * 13 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $14 * @date $Date: 2004- 09-14 20:01:52$13 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:31 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 19 19 #define PS_LOG_MSG_H 20 20 #include <stdarg.h> 21 #include <stdbool.h> 21 22 #include "psType.h" 22 23 23 24 /** @addtogroup LogTrace … … 31 32 * argument which can specify more general log destinations. 32 33 * 33 * @return inttrue if set successfully, otherwise false.34 * @return psS32 true if set successfully, otherwise false. 34 35 */ 35 bool psLogSetDestination(36 psBool psLogSetDestination( 36 37 const char *dest ///< Specifies where to send messages. 37 38 ); … … 43 44 * be displayed. 44 45 * 45 * @return intold logging level46 * @return psS32 old logging level 46 47 */ 47 intpsLogSetLevel(48 intlevel ///< Specifies the system log level48 psS32 psLogSetLevel( 49 psS32 level ///< Specifies the system log level 49 50 ); 50 51 … … 68 69 void psLogMsg( 69 70 const char *name, ///< name of the log source 70 intmyLevel, ///< severity level of this log message71 psS32 myLevel, ///< severity level of this log message 71 72 const char *fmt, ///< printf-style format command 72 73 ... … … 79 80 void psLogMsgV( 80 81 const char *name, ///< name of the log source 81 intmyLevel, ///< severity level of this log message82 psS32 myLevel, ///< severity level of this log message 82 83 const char *fmt, ///< printf-style format command 83 84 va_list ap ///< varargs argument list -
trunk/psLib/src/sys/psMemory.c
r1840 r2204 8 8 * @author Robert Lupton, Princeton University 9 9 * 10 * @version $Revision: 1.4 1$ $Name: not supported by cvs2svn $11 * @date $Date: 2004- 09-21 22:30:19$10 * @version $Revision: 1.42 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-10-27 00:57:31 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 #include <stdlib.h> 19 19 #include <stdio.h> 20 #include <stdbool.h>21 20 #include <stdint.h> 22 21 … … 28 27 #include "psSysUtilsErrors.h" 29 28 30 #define P_PS_MEMMAGIC ( void *)0xdeadbeef // Magic number in psMemBlock header29 #define P_PS_MEMMAGIC (psPtr )0xdeadbeef // Magic number in psMemBlock header 31 30 32 31 #define P_PS_LARGE_BLOCK_SIZE 65536 // size where under, we try to recycle 33 32 34 static intcheckMemBlock(const psMemBlock* m, const char *funcName);33 static psS32 checkMemBlock(const psMemBlock* m, const char *funcName); 35 34 static psMemBlock* lastMemBlockAllocated = NULL; 36 35 static pthread_mutex_t memBlockListMutex = PTHREAD_MUTEX_INITIALIZER; … … 39 38 static pthread_mutex_t recycleMemBlockListMutex = PTHREAD_MUTEX_INITIALIZER; 40 39 41 static intrecycleBins = 13;42 static intrecycleBinSize[14] = {43 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, P_PS_LARGE_BLOCK_SIZE44 };40 static psS32 recycleBins = 13; 41 static psS32 recycleBinSize[14] = { 42 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, P_PS_LARGE_BLOCK_SIZE 43 }; 45 44 46 45 // N.B. recycleBinSize should be terminated by P_PS_LARGE_BLOCK_SIZE (simplifies search loops) … … 61 60 * Default memExhausted callback. 62 61 */ 63 static void *memExhaustedCallbackDefault(size_t size)64 { 65 void *ptr = NULL;62 static psPtr memExhaustedCallbackDefault(size_t size) 63 { 64 psPtr ptr = NULL; 66 65 67 66 pthread_mutex_lock(&recycleMemBlockListMutex); 68 intlevel = recycleBins - 1;67 psS32 level = recycleBins - 1; 69 68 70 69 while (level >= 0 && ptr == NULL) { … … 98 97 } 99 98 100 static void memProblemCallbackDefault(const psMemBlock* ptr, const char *file, intlineno)99 static void memProblemCallbackDefault(const psMemBlock* ptr, const char *file, psS32 lineno) 101 100 { 102 101 if (ptr->refCounter < 1) { … … 223 222 */ 224 223 225 static intcheckMemBlock(const psMemBlock* m, const char *funcName)224 static psS32 checkMemBlock(const psMemBlock* m, const char *funcName) 226 225 { 227 226 // n.b. since this is called by psMemCheckCorruption while the memblock list is mutex locked, … … 248 247 return 1; 249 248 } 250 if (*( void **)((int8_t *) (m + 1) + m->userMemorySize) != P_PS_MEMMAGIC) {249 if (*(psPtr *)((int8_t *) (m + 1) + m->userMemorySize) != P_PS_MEMMAGIC) { 251 250 psErrorMsg(PS_ERRORNAME_DOMAIN "checkMemBlock", true, PS_ERR_MEMORY_CORRUPTION, 252 251 PS_ERRORTEXT_psMemory_OVERFLOW, … … 258 257 } 259 258 260 int psMemCheckCorruption(bool abort_on_error)261 { 262 intnbad = 0; // number of bad blocks263 bool failure = false;259 psS32 psMemCheckCorruption(psBool abort_on_error) 260 { 261 psS32 nbad = 0; // number of bad blocks 262 psBool failure = false; 264 263 265 264 // get exclusive access to the memBlock list to avoid it changing on us while we use it. … … 289 288 } 290 289 291 void *p_psAlloc(size_t size, const char *file, intlineno)290 psPtr p_psAlloc(size_t size, const char *file, psS32 lineno) 292 291 { 293 292 … … 297 296 if (size < P_PS_LARGE_BLOCK_SIZE) { 298 297 // find the bin we need. 299 intlevel = 0;298 psS32 level = 0; 300 299 301 300 while (size > recycleBinSize[level]) { … … 323 322 324 323 if (ptr == NULL) { 325 ptr = malloc(sizeof(psMemBlock) + size + sizeof( void *));324 ptr = malloc(sizeof(psMemBlock) + size + sizeof(psPtr )); 326 325 327 326 if (ptr == NULL) { … … 332 331 } 333 332 334 ptr->startblock = P_PS_MEMMAGIC;335 ptr->endblock = P_PS_MEMMAGIC;333 *(psPtr*)&ptr->startblock = P_PS_MEMMAGIC; 334 *(psPtr*)&ptr->endblock = P_PS_MEMMAGIC; 336 335 ptr->userMemorySize = size; 337 336 pthread_mutex_init(&ptr->refCounterMutex, NULL); … … 345 344 ptr->freeFcn = NULL; 346 345 ptr->persistent = false; 347 *( unsigned int*)&ptr->lineno = lineno;348 *( void **)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;346 *(psU32 *)&ptr->lineno = lineno; 347 *(psPtr *)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC; 349 348 ptr->previousBlock = NULL; 350 349 … … 371 370 } 372 371 373 void *p_psRealloc(void *vptr, size_t size, const char *file, intlineno)372 psPtr p_psRealloc(psPtr vptr, size_t size, const char *file, psS32 lineno) 374 373 { 375 374 if (vptr == NULL) { … … 377 376 } else { 378 377 psMemBlock* ptr = ((psMemBlock* ) vptr) - 1; 379 bool isBlockLast = false;378 psBool isBlockLast = false; 380 379 381 380 if (checkMemBlock(ptr, __func__) != 0) { … … 389 388 isBlockLast = (ptr == lastMemBlockAllocated); 390 389 391 ptr = (psMemBlock* ) realloc(ptr, sizeof(psMemBlock) + size + sizeof( void *));390 ptr = (psMemBlock* ) realloc(ptr, sizeof(psMemBlock) + size + sizeof(psPtr )); 392 391 393 392 if (ptr == NULL) { … … 399 398 400 399 ptr->userMemorySize = size; 401 *( void **)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;400 *(psPtr *)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC; 402 401 403 402 if (isBlockLast) { … … 423 422 } 424 423 425 void p_psFree( void *vptr, const char *file, intlineno)424 void p_psFree(psPtr vptr, const char *file, psS32 lineno) 426 425 { 427 426 if (vptr == NULL) { … … 444 443 * Check for memory leaks. 445 444 */ 446 intpsMemCheckLeaks(psMemoryId id0, psMemBlock* ** arr, FILE * fd)447 { 448 intnleak = 0;449 intj = 0;445 psS32 psMemCheckLeaks(psMemoryId id0, psMemBlock* ** arr, FILE * fd) 446 { 447 psS32 nleak = 0; 448 psS32 j = 0; 450 449 psMemBlock* topBlock = lastMemBlockAllocated; 451 450 … … 499 498 */ 500 499 // return refCounter 501 psReferenceCount psMemGetRefCounter( void *vptr)500 psReferenceCount psMemGetRefCounter(psPtr vptr) 502 501 { 503 502 psMemBlock* ptr; 504 unsigned intrefCount;503 psU32 refCount; 505 504 506 505 if (vptr == NULL) { … … 522 521 523 522 // increment and return refCounter 524 void *p_psMemIncrRefCounter(void *vptr, const char *file, intlineno)523 psPtr p_psMemIncrRefCounter(psPtr vptr, const char *file, psS32 lineno) 525 524 { 526 525 psMemBlock* ptr; … … 544 543 545 544 // decrement and return refCounter 546 void *p_psMemDecrRefCounter(void *vptr, const char *file, intlineno)545 psPtr p_psMemDecrRefCounter(psPtr vptr, const char *file, psS32 lineno) 547 546 { 548 547 if (vptr == NULL) { … … 593 592 if (ptr->userMemorySize < P_PS_LARGE_BLOCK_SIZE) { 594 593 595 intlevel = 1;594 psS32 level = 1; 596 595 597 596 while (ptr->userMemorySize >= recycleBinSize[level]) { … … 635 634 } 636 635 637 void p_psMemSetDeallocator( void *vptr, psFreeFcn freeFcn)636 void p_psMemSetDeallocator(psPtr vptr, psFreeFcn freeFcn) 638 637 { 639 638 if (vptr == NULL) { … … 650 649 651 650 } 652 psFreeFcn p_psMemGetDeallocator( void *vptr)651 psFreeFcn p_psMemGetDeallocator(psPtr vptr) 653 652 { 654 653 if (vptr == NULL) { … … 665 664 } 666 665 667 bool p_psMemGetPersistent(void *vptr)666 psBool p_psMemGetPersistent(psPtr vptr) 668 667 { 669 668 if (vptr == NULL) { … … 680 679 } 681 680 682 void p_psMemSetPersistent( void *vptr,bool value)681 void p_psMemSetPersistent(psPtr vptr,psBool value) 683 682 { 684 683 if (vptr == NULL) { -
trunk/psLib/src/sys/psMemory.h
r1810 r2204 12 12 * @ingroup MemoryManagement 13 13 * 14 * @version $Revision: 1.3 0$ $Name: not supported by cvs2svn $15 * @date $Date: 2004- 09-14 23:48:25$14 * @version $Revision: 1.31 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-10-27 00:57:31 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 22 22 23 23 #include <stdio.h> // needed for FILE 24 #include <stdbool.h>25 24 #include <pthread.h> // we need a mutex to make this stuff thread safe. 25 26 #include "psType.h" 26 27 27 28 /** @addtogroup MemoryManagement … … 48 49 49 50 /// typedef for memory identification numbers. Guaranteed to be some variety of integer. 50 typedef unsigned longpsMemoryId;51 typedef psU64 psMemoryId; 51 52 52 53 /// typedef for a memory block's reference count. Guaranteed to be some variety of integer. 53 typedef unsigned longpsReferenceCount;54 typedef psU64 psReferenceCount; 54 55 55 56 /// typedef for deallocator. 56 typedef void (*psFreeFcn) ( void *ptr);57 typedef void (*psFreeFcn) (psPtr ptr); 57 58 58 59 /** Book-keeping data for storage allocator. … … 63 64 typedef struct psMemBlock 64 65 { 65 const void *startblock; ///< initialised to p_psMEMMAGIC66 const psPtr startblock; ///< initialised to p_psMEMMAGIC 66 67 struct psMemBlock* previousBlock; ///< previous block in allocation list 67 68 struct psMemBlock* nextBlock; ///< next block allocation list … … 70 71 const psMemoryId id; ///< a unique ID for this allocation 71 72 const char *file; ///< set from __FILE__ in e.g. p_psAlloc 72 const intlineno; ///< set from __LINE__ in e.g. p_psAlloc73 const psS32 lineno; ///< set from __LINE__ in e.g. p_psAlloc 73 74 pthread_mutex_t refCounterMutex; ///< mutex to ensure exclusive access to reference counter 74 75 psReferenceCount refCounter; ///< how many times pointer is referenced 75 bool persistent; ///< marks if this non-user persistent data like error stack, etc.76 const void *endblock; ///< initialised to p_psMEMMAGIC76 psBool persistent; ///< marks if this non-user persistent data like error stack, etc. 77 const psPtr endblock; ///< initialised to p_psMEMMAGIC 77 78 } 78 79 psMemBlock; … … 106 107 const psMemBlock* ptr, ///< the pointer to the problematic memory block. 107 108 const char *file, ///< the file in which the problem originated 108 intlineno ///< the line number in which the problem originated109 psS32 lineno ///< the line number in which the problem originated 109 110 ); 110 111 111 112 /** prototype of a callback function used when memory runs out 112 113 * 113 * @return void*pointer to requested buffer of the size size_t, or NULL if memory could not114 * @return psPtr pointer to requested buffer of the size size_t, or NULL if memory could not 114 115 * be found. 115 116 * … … 117 118 * @ingroup memCallback 118 119 */ 119 typedef void *(*psMemExhaustedCallback) (120 typedef psPtr (*psMemExhaustedCallback) ( 120 121 size_t size ///< the size of buffer required 121 122 ); … … 123 124 /** Memory allocation. This operates much like malloc(), but is guaranteed to return a non-NULL value. 124 125 * 125 * @return void*pointer to the allocated buffer. This will not be NULL.126 * @return psPtr pointer to the allocated buffer. This will not be NULL. 126 127 * @see psFree 127 128 */ 128 129 #ifdef DOXYGEN 129 void *psAlloc(size_t size ///< Size required130 psPtr psAlloc(size_t size ///< Size required 130 131 ); 131 132 #else 132 133 133 void *p_psAlloc(size_t size, ///< Size required134 psPtr p_psAlloc(size_t size, ///< Size required 134 135 const char *file, ///< File of call 135 intlineno ///< Line number of call136 psS32 lineno ///< Line number of call 136 137 ); 137 138 … … 148 149 */ 149 150 void p_psMemSetDeallocator( 150 void *ptr, ///< the memory block to operate on151 psPtr ptr, ///< the memory block to operate on 151 152 psFreeFcn freeFcn ///< the function to be executed at deallocation 152 153 ); … … 162 163 */ 163 164 psFreeFcn p_psMemGetDeallocator( 164 void *ptr ///< the memory block165 psPtr ptr ///< the memory block 165 166 ); 166 167 … … 176 177 */ 177 178 void p_psMemSetPersistent( 178 void *ptr, ///< the memory block to operate on179 bool value ///< true if memory is persistent, otherwise false179 psPtr ptr, ///< the memory block to operate on 180 psBool value ///< true if memory is persistent, otherwise false 180 181 ); 181 182 … … 187 188 * Memory marked as persistent is excluded from memory leak checks. 188 189 * 189 * @return bool true if memory is marked persistent, otherwise false.190 */ 191 bool p_psMemGetPersistent(192 void *ptr ///< the memory block to check.190 * @return psBool true if memory is marked persistent, otherwise false. 191 */ 192 psBool p_psMemGetPersistent( 193 psPtr ptr ///< the memory block to check. 193 194 ); 194 195 … … 196 197 /** Memory re-allocation. This operates much like realloc(), but is guaranteed to return a non-NULL value. 197 198 * 198 * @return void*pointer to resized buffer. This will not be NULL.199 * @return psPtr pointer to resized buffer. This will not be NULL. 199 200 * @see psAlloc, psFree 200 201 */ 201 202 #ifdef DOXYGEN 202 void *psRealloc(203 void *ptr ///< Pointer to re-allocate203 psPtr psRealloc( 204 psPtr ptr ///< Pointer to re-allocate 204 205 size_t size, ///< Size required 205 206 ); 206 207 #else 207 208 208 void *p_psRealloc(209 void *ptr, ///< Pointer to re-allocate209 psPtr p_psRealloc( 210 psPtr ptr, ///< Pointer to re-allocate 210 211 size_t size, ///< Size required 211 212 const char *file, ///< File of call 212 intlineno ///< Line number of call213 psS32 lineno ///< Line number of call 213 214 ); 214 215 … … 224 225 #ifdef DOXYGEN 225 226 void psFree( 226 void *ptr, ///< Pointer to free, if NULL, function returns immediately.227 psPtr ptr, ///< Pointer to free, if NULL, function returns immediately. 227 228 ); 228 229 #else 229 230 230 231 void p_psFree( 231 void *ptr, ///< Pointer to free232 psPtr ptr, ///< Pointer to free 232 233 const char *file, ///< File of call 233 intlineno ///< Line number of call234 psS32 lineno ///< Line number of call 234 235 ); 235 236 … … 248 249 * If memory leaks are found, the Memory Problem callback will be called as well. 249 250 * 250 * return intnumber of memory blocks found as 'leaks', i.e., the number of currently allocated memory251 * return psS32 number of memory blocks found as 'leaks', i.e., the number of currently allocated memory 251 252 * blocks above id0 that have not been freed. 252 253 * @see psAlloc, psFree, psgetMemId, psMemProblemCallbackSet 253 254 * @ingroup memTracing 254 255 */ 255 intpsMemCheckLeaks(256 psS32 psMemCheckLeaks( 256 257 psMemoryId id0, ///< don't list blocks with id < id0 257 258 psMemBlock* ** arr, ///< pointer to array of pointers to leaked blocks, or NULL … … 264 265 * @ingroup memTracing 265 266 */ 266 intpsMemCheckCorruption(267 bool abort_on_error ///< Abort on detecting corruption?267 psS32 psMemCheckCorruption( 268 psBool abort_on_error ///< Abort on detecting corruption? 268 269 ); 269 270 … … 273 274 */ 274 275 psReferenceCount psMemGetRefCounter( 275 void *vptr ///< Pointer to get refCounter for276 psPtr vptr ///< Pointer to get refCounter for 276 277 ); 277 278 … … 281 282 */ 282 283 #ifdef DOXYGEN 283 void *psMemIncrRefCounter(284 void *vptr ///< Pointer to increment refCounter, and return285 ); 286 #else 287 288 void *p_psMemIncrRefCounter(289 void *vptr, ///< Pointer to increment refCounter, and return284 psPtr psMemIncrRefCounter( 285 psPtr vptr ///< Pointer to increment refCounter, and return 286 ); 287 #else 288 289 psPtr p_psMemIncrRefCounter( 290 psPtr vptr, ///< Pointer to increment refCounter, and return 290 291 const char *file, ///< File of call 291 intlineno ///< Line number of call292 psS32 lineno ///< Line number of call 292 293 ); 293 294 … … 299 300 * @ingroup memRefCount 300 301 * 301 * @return void*the pointer deremented in refCount, or NULL if pointer is302 * @return psPtr the pointer deremented in refCount, or NULL if pointer is 302 303 * fully dereferenced. 303 304 */ 304 305 #ifdef DOXYGEN 305 void*psMemDecrRefCounter(306 void*vptr ///< Pointer to decrement refCounter, and return307 ); 308 #else 309 310 void *p_psMemDecrRefCounter(311 void *vptr, ///< Pointer to decrement refCounter, and return306 psPtr psMemDecrRefCounter( 307 psPtr vptr ///< Pointer to decrement refCounter, and return 308 ); 309 #else 310 311 psPtr p_psMemDecrRefCounter( 312 psPtr vptr, ///< Pointer to decrement refCounter, and return 312 313 const char *file, ///< File of call 313 intlineno ///< Line number of call314 psS32 lineno ///< Line number of call 314 315 ); 315 316 -
trunk/psLib/src/sys/psString.c
r1969 r2204 9 9 * @author Eric Van Alst, MHPCC 10 10 * 11 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10- 06 01:05:41 $11 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:31 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 31 31 } 32 32 33 char *psStringNCopy(const char *str, intnChar)33 char *psStringNCopy(const char *str, psS32 nChar) 34 34 { 35 35 char *returnValue = NULL; -
trunk/psLib/src/sys/psString.h
r1448 r2204 10 10 * @author Eric Van Alst, MHPCC 11 11 * 12 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2004- 08-10 01:55:34$12 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:31 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 19 19 #define PS_STRING_H 20 20 21 #include "psType.h" 21 22 22 23 /** This macro will convert the argument to a quoted string */ … … 62 63 /**< Input string of characters to copy */ 63 64 64 intnChar65 psS32 nChar 65 66 /**< Number of bytes to allocate for string copy */ 66 67 ); -
trunk/psLib/src/sys/psTrace.c
r1834 r2204 9 9 * @author George Gusciora, MHPCC 10 10 * 11 * @version $Revision: 1.3 5$ $Name: not supported by cvs2svn $12 * @date $Date: 2004- 09-20 22:03:35$11 * @version $Revision: 1.36 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:31 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 34 34 35 35 PS_DEFAULT_TRACE_LEVEL: This should only be used when adding the 36 intermediate components of a longname. Ie. the "B" in .A.B.C36 intermediate components of a psS64 name. Ie. the "B" in .A.B.C 37 37 38 38 *****************************************************************************/ … … 56 56 57 57 static void componentFree(p_psComponent* comp); 58 static p_psComponent* componentAlloc(const char *name, intlevel);58 static p_psComponent* componentAlloc(const char *name, psS32 level); 59 59 60 60 /***************************************************************************** 61 61 componentAlloc(): allocate memory for a new node, and initialize members. 62 62 *****************************************************************************/ 63 static p_psComponent* componentAlloc(const char *name, intlevel)63 static p_psComponent* componentAlloc(const char *name, psS32 level) 64 64 { 65 65 p_psComponent* comp = psAlloc(sizeof(p_psComponent)); … … 68 68 p_psMemSetDeallocator(comp, (psFreeFcn) componentFree); 69 69 comp->name = psStringCopy(name); 70 p_psMemSetPersistent(( void*)comp->name,true);70 p_psMemSetPersistent((psPtr)comp->name,true); 71 71 comp->level = level; 72 72 comp->n = 0; … … 86 86 87 87 if (comp->subcomp != NULL) { 88 for ( inti = 0; i < comp->n; i++) {88 for (psS32 i = 0; i < comp->n; i++) { 89 89 p_psMemSetPersistent(comp->subcomp[i],false); 90 90 psFree(comp->subcomp[i]); … … 94 94 } 95 95 96 p_psMemSetPersistent(( void*)comp->name,false);97 psFree(( void*)comp->name);96 p_psMemSetPersistent((psPtr)comp->name,false); 97 psFree((psPtr)comp->name); 98 98 } 99 99 … … 115 115 void p_psTraceReset(p_psComponent* currentNode) 116 116 { 117 inti = 0;117 psS32 i = 0; 118 118 119 119 if (NULL == currentNode) { … … 149 149 to ANSI-C. 150 150 *****************************************************************************/ 151 static bool componentAdd(const char *addNodeName, intlevel)152 { 153 inti = 0; // Loop index variable.151 static psBool componentAdd(const char *addNodeName, psS32 level) 152 { 153 psS32 i = 0; // Loop index variable. 154 154 char name[strlen(addNodeName) + 1]; // buffer for writeable copy. 155 155 char *pname = name; 156 156 char *firstComponent = NULL; // first component of name 157 157 p_psComponent* currentNode = cRoot; 158 intnodeExists = 0;158 psS32 nodeExists = 0; 159 159 160 160 // XXX: Verify that this is the correct behavior. … … 240 240 zero 241 241 *****************************************************************************/ 242 bool psTraceSetLevel(const char *comp, // component of interest243 intlevel) // desired trace level242 psBool psTraceSetLevel(const char *comp, // component of interest 243 psS32 level) // desired trace level 244 244 { 245 245 char *compName = NULL; … … 299 299 The trace level of the "name" component. 300 300 *****************************************************************************/ 301 static intdoGetTraceLevel(const char *aname)301 static psS32 doGetTraceLevel(const char *aname) 302 302 { 303 303 char name[strlen(aname) + 1]; // need a writeable copy: for strsep() … … 305 305 char *firstComponent = NULL; // first component of name 306 306 p_psComponent* currentNode = cRoot; 307 inti = 0;308 intdefaultLevel = 0;307 psS32 i = 0; 308 psS32 defaultLevel = 0; 309 309 310 310 if (NULL == currentNode) { … … 365 365 The level of "name" in the root component tree. 366 366 *****************************************************************************/ 367 intpsTraceGetLevel(const char *name)367 psS32 psTraceGetLevel(const char *name) 368 368 { 369 369 char *compName = NULL; 370 inttraceLevel;370 psS32 traceLevel; 371 371 372 372 if (cRoot == NULL) { … … 401 401 *****************************************************************************/ 402 402 static void doPrintTraceLevels(const p_psComponent* comp, 403 intdepth,404 intdefLevel)405 { 406 inti = 0;403 psS32 depth, 404 psS32 defLevel) 405 { 406 psS32 i = 0; 407 407 408 408 if (comp->name[0] == '\0') { … … 472 472 *****************************************************************************/ 473 473 void p_psTrace(const char *comp, // component being traced 474 intlevel, // desired trace level474 psS32 level, // desired trace level 475 475 ...) // arguments 476 476 { 477 477 char *fmt = NULL; 478 478 va_list ap; 479 inti = 0;479 psS32 i = 0; 480 480 481 481 if (NULL == comp) { -
trunk/psLib/src/sys/psTrace.h
r2202 r2204 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10-2 6 23:14:04$11 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:31 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 50 50 { 51 51 const char *name; // last part of name of component 52 intlevel; // trace level for this component53 intn; // number of subcomponents52 psS32 level; // trace level for this component 53 psS32 n; // number of subcomponents 54 54 struct p_psComponent* *subcomp; // next level of subcomponents 55 55 } … … 59 59 /// Send a trace message 60 60 void p_psTrace(const char *facil, ///< facilty of interest 61 intmyLevel, ///< desired trace level61 psS32 myLevel, ///< desired trace level 62 62 ...) ///< trace message arguments 63 63 ; … … 65 65 66 66 /// Set trace level 67 bool psTraceSetLevel(const char *facil, ///< facilty of interest68 intlevel) ///< desired trace level67 psBool psTraceSetLevel(const char *facil, ///< facilty of interest 68 psS32 level) ///< desired trace level 69 69 ; 70 70 71 71 /// Get the trace level 72 intpsTraceGetLevel(const char *facil) ///< facilty of interest72 psS32 psTraceGetLevel(const char *facil) ///< facilty of interest 73 73 ; 74 74 -
trunk/psLib/src/sys/psType.h
r1984 r2204 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.2 2$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-10- 06 21:40:13$13 * @version $Revision: 1.23 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:31 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 23 23 #include <stdint.h> 24 24 #include <float.h> 25 #include <stdbool.h> 25 26 26 27 /// @addtogroup DataContainer … … 52 53 typedef float _Complex psC32; ///< complex with 32-bit floating point Real and Imagary numbers 53 54 typedef double _Complex psC64; ///< complex with 64-bit floating point Real and Imagary numbers 54 typedef void *psPTR; ///< void pointer 55 typedef void* psPtr; ///< void pointer 56 typedef bool psBool; ///< boolean value 55 57 56 58 typedef enum { … … 60 62 PS_TYPE_S64 = 0x0108, ///< Long integer. 61 63 PS_TYPE_U8 = 0x0301, ///< Unsigned character. 62 PS_TYPE_U16 = 0x0302, ///< Unsigned shortinteger.64 PS_TYPE_U16 = 0x0302, ///< Unsigned psS16 integer. 63 65 PS_TYPE_U32 = 0x0304, ///< Unsigned integer. 64 PS_TYPE_U64 = 0x0308, ///< Unsigned longinteger.66 PS_TYPE_U64 = 0x0308, ///< Unsigned psS64 integer. 65 67 PS_TYPE_F32 = 0x0404, ///< Single-precision Floating point. 66 68 PS_TYPE_F64 = 0x0408, ///< Double-precision floating point. … … 115 117 #define PS_TYPE_C32_NAME "psC32" 116 118 #define PS_TYPE_C64_NAME "psC64" 117 #define PS_TYPE_PTR_NAME "psP TR"119 #define PS_TYPE_PTR_NAME "psPtr" 118 120 119 121 #define PS_TYPE_NAME(value,type) \ … … 183 185 #define PS_IS_PSELEMTYPE_COMPLEX(x) ((x & 0x800) == 0x800) 184 186 /// Macro to determine the storage size, in bytes, of the psElemType. 185 #define PSELEMTYPE_SIZEOF(x) ( (x==PS_TYPE_PTR) ? sizeof( void*) :(x & 0xFF) )187 #define PSELEMTYPE_SIZEOF(x) ( (x==PS_TYPE_PTR) ? sizeof(psPtr) :(x & 0xFF) ) 186 188 187 189 /** Dimensions of a data type. -
trunk/psLib/src/sysUtils/psError.c
r1905 r2204 10 10 * @author Eric Van Alst, MHPCC 11 11 * 12 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $13 * @date $Date: 2004- 09-27 20:38:02$12 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:31 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 26 26 #define MAX_ERROR_STACK_SIZE 64 27 27 static psErr* errorStack[MAX_ERROR_STACK_SIZE]; 28 static unsigned interrorStackSize = 0;28 static psU32 errorStackSize = 0; 29 29 pthread_mutex_t lockErrorStack = PTHREAD_MUTEX_INITIALIZER; 30 30 … … 84 84 { 85 85 pthread_mutex_lock(&lockErrorStack); 86 for ( intlcv=0;lcv<errorStackSize;lcv++) {86 for (psS32 lcv=0;lcv<errorStackSize;lcv++) { 87 87 p_psMemSetPersistent(errorStack[lcv]->msg,false); 88 88 p_psMemSetPersistent(errorStack[lcv]->name,false); … … 94 94 } 95 95 96 psErrorCode psErrorMsg(const char *name, psErrorCode code, bool new, const char* fmt, ...)96 psErrorCode psErrorMsg(const char *name, psErrorCode code, psBool new, const char* fmt, ...) 97 97 { 98 98 char errMsg[1024]; … … 131 131 } 132 132 133 psErr* psErrorGet( intwhich)133 psErr* psErrorGet(psS32 which) 134 134 { 135 135 psErr* result; … … 180 180 vfprintf(fd,fmt,va); 181 181 182 for ( intlcv=0;lcv<errorStackSize;lcv++) {182 for (psS32 lcv=0;lcv<errorStackSize;lcv++) { 183 183 if(errorStack[lcv]->code >= PS_ERR_BASE) { 184 184 fprintf(fd," -> %s: %s\n %s\n", -
trunk/psLib/src/sysUtils/psError.h
r1869 r2204 12 12 * @author Eric Van Alst, MHPCC 13 13 * 14 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $15 * @date $Date: 2004- 09-23 22:18:13$14 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-10-27 00:57:31 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 51 51 */ 52 52 psErr* psErrorGet( 53 intwhich ///< position in the error stack. 0 is last error on stack.53 psS32 which ///< position in the error stack. 0 is last error on stack. 54 54 ); 55 55 … … 121 121 const char *name, ///< Name of error in the form aaa.bbb.ccc 122 122 psErrorCode code, ///< Error class code 123 bool new, ///< true if error originates at this location123 psBool new, ///< true if error originates at this location 124 124 const char* fmt, ///< printf style formatting statement defining error message 125 125 ... -
trunk/psLib/src/sysUtils/psErrorCodes.c
r2129 r2204 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-10- 14 21:14:58$9 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-10-27 00:57:31 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 59 59 // first, search the static error codes 60 60 61 intn = 0;61 psS32 n = 0; 62 62 while(staticErrorCodes[n].code != PS_ERR_N_ERR_CLASSES && 63 63 staticErrorCodes[n].code != code) { … … 88 88 static void freeErrorDescription(psErrorDescription* err) 89 89 { 90 psFree(( void*)err->description);90 psFree((psPtr)err->description); 91 91 } 92 92 … … 125 125 126 126 void psErrorRegister(const psErrorDescription* errors, 127 intnerror)127 psS32 nerror) 128 128 { 129 129 if (nerror < 1) { … … 143 143 } 144 144 145 for ( inti=0;i<nerror;i++) {145 for (psS32 i=0;i<nerror;i++) { 146 146 psErrorDescription* err = psErrorDescriptionAlloc( 147 147 errors[i].code, errors[i].description); 148 148 p_psMemSetPersistent(err,true); 149 p_psMemSetPersistent(( void*)err->description,true);149 p_psMemSetPersistent((psPtr)err->description,true); 150 150 if (! psListAdd(dynamicErrorCodes, 151 151 PS_LIST_HEAD, … … 162 162 } 163 163 164 bool p_psErrorUnregister(psErrorCode code)164 psBool p_psErrorUnregister(psErrorCode code) 165 165 { 166 166 // Check input argument is non-negative … … 179 179 } 180 180 181 return psListRemove(dynamicErrorCodes,PS_LIST_UNKNOWN,( void*)desc);181 return psListRemove(dynamicErrorCodes,PS_LIST_UNKNOWN,(psPtr)desc); 182 182 } -
trunk/psLib/src/sysUtils/psErrorCodes.h
r2129 r2204 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $10 * @date $Date: 2004-10- 14 21:14:58$9 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2004-10-27 00:57:31 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 15 15 #ifndef PS_ERROR_CODES_H 16 16 #define PS_ERROR_CODES_H 17 18 #include "psType.h" 17 19 18 20 /* N.B., lines between '//~Start' and '//~End' are automatic generated from … … 93 95 void psErrorRegister( 94 96 const psErrorDescription* errors, ///< Array of error codes to register 95 intnerror ///< number of errors in input array97 psS32 nerror ///< number of errors in input array 96 98 ); 97 99 98 100 /** Clears error codes registered via psErrorRegister. 99 101 * 100 * @return bool TRUE if given errorcode was removed, otherwise FALSE.102 * @return psBool TRUE if given errorcode was removed, otherwise FALSE. 101 103 */ 102 bool p_psErrorUnregister(104 psBool p_psErrorUnregister( 103 105 psErrorCode code ///< the error code to find and remove 104 106 ); -
trunk/psLib/src/sysUtils/psLogMsg.c
r1807 r2204 11 11 * @author George Gusciora, MHPCC 12 12 * 13 * @version $Revision: 1.3 3$ $Name: not supported by cvs2svn $14 * @date $Date: 2004- 09-14 20:01:52$13 * @version $Revision: 1.34 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:31 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 19 19 /***************************************************************************** 20 20 NOTES: currently, the prototype code has the following global variables: 21 static intp_psGlobalLogDest;22 static intp_psGlobalLogLevel;23 static intp_psLogTime;24 static intp_psLogHost;25 static intp_psLogLevel;26 static intp_psLogName;27 static intp_psLogMsg;21 static psS32 p_psGlobalLogDest; 22 static psS32 p_psGlobalLogLevel; 23 static psS32 p_psLogTime; 24 static psS32 p_psLogHost; 25 static psS32 p_psLogLevel; 26 static psS32 p_psLogName; 27 static psS32 p_psLogMsg; 28 28 *****************************************************************************/ 29 29 #include <limits.h> … … 34 34 #include <time.h> 35 35 #include <unistd.h> 36 #include <stdbool.h>37 36 38 37 #include "psLogMsg.h" … … 49 48 50 49 static FILE *logDest = (FILE *) 1; // flag to initialize to stderr before using. 51 static intglobalLogLevel = PS_LOG_INFO; // log all messages at this or above52 static bool logTime = true; // Flag to include time info53 static bool logHost = true; // Flag to include host info54 static bool logLevel = true; // Flag to include level info55 static bool logName = true; // Flag to include name info56 static bool logMsg = true; // Flag to include message info50 static psS32 globalLogLevel = PS_LOG_INFO; // log all messages at this or above 51 static psBool logTime = true; // Flag to include time info 52 static psBool logHost = true; // Flag to include host info 53 static psBool logLevel = true; // Flag to include level info 54 static psBool logName = true; // Flag to include name info 55 static psBool logMsg = true; // Flag to include message info 57 56 58 57 /***************************************************************************** 59 58 psLogSetLevel(): Set the current log level and return old level. 60 59 Input: 61 level ( int): the new log level.60 level (psS32): the new log level. 62 61 Output: 63 62 none … … 65 64 The old log level. 66 65 *****************************************************************************/ 67 int psLogSetLevel(intlevel)66 psS32 psLogSetLevel(psS32 level) 68 67 { 69 68 // Save old global log level for changing it. 70 intoldLevel = globalLogLevel;69 psS32 oldLevel = globalLogLevel; 71 70 72 71 if ((level < MIN_LOG_LEVEL) || (level > MAX_LOG_LEVEL)) { … … 86 85 87 86 Input: 88 dest ( int): the new log destination87 dest (psS32): the new log destination 89 88 Output: 90 89 None. … … 92 91 An integer specifying the old log destination. 93 92 *****************************************************************************/ 94 bool psLogSetDestination(const char *dest)93 psBool psLogSetDestination(const char *dest) 95 94 { 96 95 char protocol[5]; … … 245 244 NULL. 246 245 *****************************************************************************/ 247 void psLogMsgV(const char *name, intlevel, const char *fmt, va_list ap)248 { 249 static intfirst = 1; // Flag for calling gethostname()246 void psLogMsgV(const char *name, psS32 level, const char *fmt, va_list ap) 247 { 248 static psS32 first = 1; // Flag for calling gethostname() 250 249 static char hostname[HOST_NAME_MAX + 1]; 251 250 … … 254 253 char head[MAX_LOG_LINE_LENGTH + 2]; // the added two are for the ending | and \0 255 254 char *head_ptr = head; // where we've got to in head 256 intmaxLength = MAX_LOG_LINE_LENGTH;255 psS32 maxLength = MAX_LOG_LINE_LENGTH; 257 256 time_t clock = time(NULL); // The current time. 258 257 struct tm *utc = gmtime(&clock); // The current gm time. … … 375 374 NULL 376 375 *****************************************************************************/ 377 void psLogMsg(const char *name, intlevel, const char *fmt, ...)376 void psLogMsg(const char *name, psS32 level, const char *fmt, ...) 378 377 { 379 378 va_list ap; -
trunk/psLib/src/sysUtils/psLogMsg.h
r1807 r2204 11 11 * @author George Gusciora, MHPCC 12 12 * 13 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $14 * @date $Date: 2004- 09-14 20:01:52$13 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:31 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 19 19 #define PS_LOG_MSG_H 20 20 #include <stdarg.h> 21 #include <stdbool.h> 21 22 #include "psType.h" 22 23 23 24 /** @addtogroup LogTrace … … 31 32 * argument which can specify more general log destinations. 32 33 * 33 * @return inttrue if set successfully, otherwise false.34 * @return psS32 true if set successfully, otherwise false. 34 35 */ 35 bool psLogSetDestination(36 psBool psLogSetDestination( 36 37 const char *dest ///< Specifies where to send messages. 37 38 ); … … 43 44 * be displayed. 44 45 * 45 * @return intold logging level46 * @return psS32 old logging level 46 47 */ 47 intpsLogSetLevel(48 intlevel ///< Specifies the system log level48 psS32 psLogSetLevel( 49 psS32 level ///< Specifies the system log level 49 50 ); 50 51 … … 68 69 void psLogMsg( 69 70 const char *name, ///< name of the log source 70 intmyLevel, ///< severity level of this log message71 psS32 myLevel, ///< severity level of this log message 71 72 const char *fmt, ///< printf-style format command 72 73 ... … … 79 80 void psLogMsgV( 80 81 const char *name, ///< name of the log source 81 intmyLevel, ///< severity level of this log message82 psS32 myLevel, ///< severity level of this log message 82 83 const char *fmt, ///< printf-style format command 83 84 va_list ap ///< varargs argument list -
trunk/psLib/src/sysUtils/psMemory.c
r1840 r2204 8 8 * @author Robert Lupton, Princeton University 9 9 * 10 * @version $Revision: 1.4 1$ $Name: not supported by cvs2svn $11 * @date $Date: 2004- 09-21 22:30:19$10 * @version $Revision: 1.42 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-10-27 00:57:31 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 #include <stdlib.h> 19 19 #include <stdio.h> 20 #include <stdbool.h>21 20 #include <stdint.h> 22 21 … … 28 27 #include "psSysUtilsErrors.h" 29 28 30 #define P_PS_MEMMAGIC ( void *)0xdeadbeef // Magic number in psMemBlock header29 #define P_PS_MEMMAGIC (psPtr )0xdeadbeef // Magic number in psMemBlock header 31 30 32 31 #define P_PS_LARGE_BLOCK_SIZE 65536 // size where under, we try to recycle 33 32 34 static intcheckMemBlock(const psMemBlock* m, const char *funcName);33 static psS32 checkMemBlock(const psMemBlock* m, const char *funcName); 35 34 static psMemBlock* lastMemBlockAllocated = NULL; 36 35 static pthread_mutex_t memBlockListMutex = PTHREAD_MUTEX_INITIALIZER; … … 39 38 static pthread_mutex_t recycleMemBlockListMutex = PTHREAD_MUTEX_INITIALIZER; 40 39 41 static intrecycleBins = 13;42 static intrecycleBinSize[14] = {43 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, P_PS_LARGE_BLOCK_SIZE44 };40 static psS32 recycleBins = 13; 41 static psS32 recycleBinSize[14] = { 42 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, P_PS_LARGE_BLOCK_SIZE 43 }; 45 44 46 45 // N.B. recycleBinSize should be terminated by P_PS_LARGE_BLOCK_SIZE (simplifies search loops) … … 61 60 * Default memExhausted callback. 62 61 */ 63 static void *memExhaustedCallbackDefault(size_t size)64 { 65 void *ptr = NULL;62 static psPtr memExhaustedCallbackDefault(size_t size) 63 { 64 psPtr ptr = NULL; 66 65 67 66 pthread_mutex_lock(&recycleMemBlockListMutex); 68 intlevel = recycleBins - 1;67 psS32 level = recycleBins - 1; 69 68 70 69 while (level >= 0 && ptr == NULL) { … … 98 97 } 99 98 100 static void memProblemCallbackDefault(const psMemBlock* ptr, const char *file, intlineno)99 static void memProblemCallbackDefault(const psMemBlock* ptr, const char *file, psS32 lineno) 101 100 { 102 101 if (ptr->refCounter < 1) { … … 223 222 */ 224 223 225 static intcheckMemBlock(const psMemBlock* m, const char *funcName)224 static psS32 checkMemBlock(const psMemBlock* m, const char *funcName) 226 225 { 227 226 // n.b. since this is called by psMemCheckCorruption while the memblock list is mutex locked, … … 248 247 return 1; 249 248 } 250 if (*( void **)((int8_t *) (m + 1) + m->userMemorySize) != P_PS_MEMMAGIC) {249 if (*(psPtr *)((int8_t *) (m + 1) + m->userMemorySize) != P_PS_MEMMAGIC) { 251 250 psErrorMsg(PS_ERRORNAME_DOMAIN "checkMemBlock", true, PS_ERR_MEMORY_CORRUPTION, 252 251 PS_ERRORTEXT_psMemory_OVERFLOW, … … 258 257 } 259 258 260 int psMemCheckCorruption(bool abort_on_error)261 { 262 intnbad = 0; // number of bad blocks263 bool failure = false;259 psS32 psMemCheckCorruption(psBool abort_on_error) 260 { 261 psS32 nbad = 0; // number of bad blocks 262 psBool failure = false; 264 263 265 264 // get exclusive access to the memBlock list to avoid it changing on us while we use it. … … 289 288 } 290 289 291 void *p_psAlloc(size_t size, const char *file, intlineno)290 psPtr p_psAlloc(size_t size, const char *file, psS32 lineno) 292 291 { 293 292 … … 297 296 if (size < P_PS_LARGE_BLOCK_SIZE) { 298 297 // find the bin we need. 299 intlevel = 0;298 psS32 level = 0; 300 299 301 300 while (size > recycleBinSize[level]) { … … 323 322 324 323 if (ptr == NULL) { 325 ptr = malloc(sizeof(psMemBlock) + size + sizeof( void *));324 ptr = malloc(sizeof(psMemBlock) + size + sizeof(psPtr )); 326 325 327 326 if (ptr == NULL) { … … 332 331 } 333 332 334 ptr->startblock = P_PS_MEMMAGIC;335 ptr->endblock = P_PS_MEMMAGIC;333 *(psPtr*)&ptr->startblock = P_PS_MEMMAGIC; 334 *(psPtr*)&ptr->endblock = P_PS_MEMMAGIC; 336 335 ptr->userMemorySize = size; 337 336 pthread_mutex_init(&ptr->refCounterMutex, NULL); … … 345 344 ptr->freeFcn = NULL; 346 345 ptr->persistent = false; 347 *( unsigned int*)&ptr->lineno = lineno;348 *( void **)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;346 *(psU32 *)&ptr->lineno = lineno; 347 *(psPtr *)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC; 349 348 ptr->previousBlock = NULL; 350 349 … … 371 370 } 372 371 373 void *p_psRealloc(void *vptr, size_t size, const char *file, intlineno)372 psPtr p_psRealloc(psPtr vptr, size_t size, const char *file, psS32 lineno) 374 373 { 375 374 if (vptr == NULL) { … … 377 376 } else { 378 377 psMemBlock* ptr = ((psMemBlock* ) vptr) - 1; 379 bool isBlockLast = false;378 psBool isBlockLast = false; 380 379 381 380 if (checkMemBlock(ptr, __func__) != 0) { … … 389 388 isBlockLast = (ptr == lastMemBlockAllocated); 390 389 391 ptr = (psMemBlock* ) realloc(ptr, sizeof(psMemBlock) + size + sizeof( void *));390 ptr = (psMemBlock* ) realloc(ptr, sizeof(psMemBlock) + size + sizeof(psPtr )); 392 391 393 392 if (ptr == NULL) { … … 399 398 400 399 ptr->userMemorySize = size; 401 *( void **)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC;400 *(psPtr *)((int8_t *) (ptr + 1) + size) = P_PS_MEMMAGIC; 402 401 403 402 if (isBlockLast) { … … 423 422 } 424 423 425 void p_psFree( void *vptr, const char *file, intlineno)424 void p_psFree(psPtr vptr, const char *file, psS32 lineno) 426 425 { 427 426 if (vptr == NULL) { … … 444 443 * Check for memory leaks. 445 444 */ 446 intpsMemCheckLeaks(psMemoryId id0, psMemBlock* ** arr, FILE * fd)447 { 448 intnleak = 0;449 intj = 0;445 psS32 psMemCheckLeaks(psMemoryId id0, psMemBlock* ** arr, FILE * fd) 446 { 447 psS32 nleak = 0; 448 psS32 j = 0; 450 449 psMemBlock* topBlock = lastMemBlockAllocated; 451 450 … … 499 498 */ 500 499 // return refCounter 501 psReferenceCount psMemGetRefCounter( void *vptr)500 psReferenceCount psMemGetRefCounter(psPtr vptr) 502 501 { 503 502 psMemBlock* ptr; 504 unsigned intrefCount;503 psU32 refCount; 505 504 506 505 if (vptr == NULL) { … … 522 521 523 522 // increment and return refCounter 524 void *p_psMemIncrRefCounter(void *vptr, const char *file, intlineno)523 psPtr p_psMemIncrRefCounter(psPtr vptr, const char *file, psS32 lineno) 525 524 { 526 525 psMemBlock* ptr; … … 544 543 545 544 // decrement and return refCounter 546 void *p_psMemDecrRefCounter(void *vptr, const char *file, intlineno)545 psPtr p_psMemDecrRefCounter(psPtr vptr, const char *file, psS32 lineno) 547 546 { 548 547 if (vptr == NULL) { … … 593 592 if (ptr->userMemorySize < P_PS_LARGE_BLOCK_SIZE) { 594 593 595 intlevel = 1;594 psS32 level = 1; 596 595 597 596 while (ptr->userMemorySize >= recycleBinSize[level]) { … … 635 634 } 636 635 637 void p_psMemSetDeallocator( void *vptr, psFreeFcn freeFcn)636 void p_psMemSetDeallocator(psPtr vptr, psFreeFcn freeFcn) 638 637 { 639 638 if (vptr == NULL) { … … 650 649 651 650 } 652 psFreeFcn p_psMemGetDeallocator( void *vptr)651 psFreeFcn p_psMemGetDeallocator(psPtr vptr) 653 652 { 654 653 if (vptr == NULL) { … … 665 664 } 666 665 667 bool p_psMemGetPersistent(void *vptr)666 psBool p_psMemGetPersistent(psPtr vptr) 668 667 { 669 668 if (vptr == NULL) { … … 680 679 } 681 680 682 void p_psMemSetPersistent( void *vptr,bool value)681 void p_psMemSetPersistent(psPtr vptr,psBool value) 683 682 { 684 683 if (vptr == NULL) { -
trunk/psLib/src/sysUtils/psMemory.h
r1810 r2204 12 12 * @ingroup MemoryManagement 13 13 * 14 * @version $Revision: 1.3 0$ $Name: not supported by cvs2svn $15 * @date $Date: 2004- 09-14 23:48:25$14 * @version $Revision: 1.31 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-10-27 00:57:31 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 22 22 23 23 #include <stdio.h> // needed for FILE 24 #include <stdbool.h>25 24 #include <pthread.h> // we need a mutex to make this stuff thread safe. 25 26 #include "psType.h" 26 27 27 28 /** @addtogroup MemoryManagement … … 48 49 49 50 /// typedef for memory identification numbers. Guaranteed to be some variety of integer. 50 typedef unsigned longpsMemoryId;51 typedef psU64 psMemoryId; 51 52 52 53 /// typedef for a memory block's reference count. Guaranteed to be some variety of integer. 53 typedef unsigned longpsReferenceCount;54 typedef psU64 psReferenceCount; 54 55 55 56 /// typedef for deallocator. 56 typedef void (*psFreeFcn) ( void *ptr);57 typedef void (*psFreeFcn) (psPtr ptr); 57 58 58 59 /** Book-keeping data for storage allocator. … … 63 64 typedef struct psMemBlock 64 65 { 65 const void *startblock; ///< initialised to p_psMEMMAGIC66 const psPtr startblock; ///< initialised to p_psMEMMAGIC 66 67 struct psMemBlock* previousBlock; ///< previous block in allocation list 67 68 struct psMemBlock* nextBlock; ///< next block allocation list … … 70 71 const psMemoryId id; ///< a unique ID for this allocation 71 72 const char *file; ///< set from __FILE__ in e.g. p_psAlloc 72 const intlineno; ///< set from __LINE__ in e.g. p_psAlloc73 const psS32 lineno; ///< set from __LINE__ in e.g. p_psAlloc 73 74 pthread_mutex_t refCounterMutex; ///< mutex to ensure exclusive access to reference counter 74 75 psReferenceCount refCounter; ///< how many times pointer is referenced 75 bool persistent; ///< marks if this non-user persistent data like error stack, etc.76 const void *endblock; ///< initialised to p_psMEMMAGIC76 psBool persistent; ///< marks if this non-user persistent data like error stack, etc. 77 const psPtr endblock; ///< initialised to p_psMEMMAGIC 77 78 } 78 79 psMemBlock; … … 106 107 const psMemBlock* ptr, ///< the pointer to the problematic memory block. 107 108 const char *file, ///< the file in which the problem originated 108 intlineno ///< the line number in which the problem originated109 psS32 lineno ///< the line number in which the problem originated 109 110 ); 110 111 111 112 /** prototype of a callback function used when memory runs out 112 113 * 113 * @return void*pointer to requested buffer of the size size_t, or NULL if memory could not114 * @return psPtr pointer to requested buffer of the size size_t, or NULL if memory could not 114 115 * be found. 115 116 * … … 117 118 * @ingroup memCallback 118 119 */ 119 typedef void *(*psMemExhaustedCallback) (120 typedef psPtr (*psMemExhaustedCallback) ( 120 121 size_t size ///< the size of buffer required 121 122 ); … … 123 124 /** Memory allocation. This operates much like malloc(), but is guaranteed to return a non-NULL value. 124 125 * 125 * @return void*pointer to the allocated buffer. This will not be NULL.126 * @return psPtr pointer to the allocated buffer. This will not be NULL. 126 127 * @see psFree 127 128 */ 128 129 #ifdef DOXYGEN 129 void *psAlloc(size_t size ///< Size required130 psPtr psAlloc(size_t size ///< Size required 130 131 ); 131 132 #else 132 133 133 void *p_psAlloc(size_t size, ///< Size required134 psPtr p_psAlloc(size_t size, ///< Size required 134 135 const char *file, ///< File of call 135 intlineno ///< Line number of call136 psS32 lineno ///< Line number of call 136 137 ); 137 138 … … 148 149 */ 149 150 void p_psMemSetDeallocator( 150 void *ptr, ///< the memory block to operate on151 psPtr ptr, ///< the memory block to operate on 151 152 psFreeFcn freeFcn ///< the function to be executed at deallocation 152 153 ); … … 162 163 */ 163 164 psFreeFcn p_psMemGetDeallocator( 164 void *ptr ///< the memory block165 psPtr ptr ///< the memory block 165 166 ); 166 167 … … 176 177 */ 177 178 void p_psMemSetPersistent( 178 void *ptr, ///< the memory block to operate on179 bool value ///< true if memory is persistent, otherwise false179 psPtr ptr, ///< the memory block to operate on 180 psBool value ///< true if memory is persistent, otherwise false 180 181 ); 181 182 … … 187 188 * Memory marked as persistent is excluded from memory leak checks. 188 189 * 189 * @return bool true if memory is marked persistent, otherwise false.190 */ 191 bool p_psMemGetPersistent(192 void *ptr ///< the memory block to check.190 * @return psBool true if memory is marked persistent, otherwise false. 191 */ 192 psBool p_psMemGetPersistent( 193 psPtr ptr ///< the memory block to check. 193 194 ); 194 195 … … 196 197 /** Memory re-allocation. This operates much like realloc(), but is guaranteed to return a non-NULL value. 197 198 * 198 * @return void*pointer to resized buffer. This will not be NULL.199 * @return psPtr pointer to resized buffer. This will not be NULL. 199 200 * @see psAlloc, psFree 200 201 */ 201 202 #ifdef DOXYGEN 202 void *psRealloc(203 void *ptr ///< Pointer to re-allocate203 psPtr psRealloc( 204 psPtr ptr ///< Pointer to re-allocate 204 205 size_t size, ///< Size required 205 206 ); 206 207 #else 207 208 208 void *p_psRealloc(209 void *ptr, ///< Pointer to re-allocate209 psPtr p_psRealloc( 210 psPtr ptr, ///< Pointer to re-allocate 210 211 size_t size, ///< Size required 211 212 const char *file, ///< File of call 212 intlineno ///< Line number of call213 psS32 lineno ///< Line number of call 213 214 ); 214 215 … … 224 225 #ifdef DOXYGEN 225 226 void psFree( 226 void *ptr, ///< Pointer to free, if NULL, function returns immediately.227 psPtr ptr, ///< Pointer to free, if NULL, function returns immediately. 227 228 ); 228 229 #else 229 230 230 231 void p_psFree( 231 void *ptr, ///< Pointer to free232 psPtr ptr, ///< Pointer to free 232 233 const char *file, ///< File of call 233 intlineno ///< Line number of call234 psS32 lineno ///< Line number of call 234 235 ); 235 236 … … 248 249 * If memory leaks are found, the Memory Problem callback will be called as well. 249 250 * 250 * return intnumber of memory blocks found as 'leaks', i.e., the number of currently allocated memory251 * return psS32 number of memory blocks found as 'leaks', i.e., the number of currently allocated memory 251 252 * blocks above id0 that have not been freed. 252 253 * @see psAlloc, psFree, psgetMemId, psMemProblemCallbackSet 253 254 * @ingroup memTracing 254 255 */ 255 intpsMemCheckLeaks(256 psS32 psMemCheckLeaks( 256 257 psMemoryId id0, ///< don't list blocks with id < id0 257 258 psMemBlock* ** arr, ///< pointer to array of pointers to leaked blocks, or NULL … … 264 265 * @ingroup memTracing 265 266 */ 266 intpsMemCheckCorruption(267 bool abort_on_error ///< Abort on detecting corruption?267 psS32 psMemCheckCorruption( 268 psBool abort_on_error ///< Abort on detecting corruption? 268 269 ); 269 270 … … 273 274 */ 274 275 psReferenceCount psMemGetRefCounter( 275 void *vptr ///< Pointer to get refCounter for276 psPtr vptr ///< Pointer to get refCounter for 276 277 ); 277 278 … … 281 282 */ 282 283 #ifdef DOXYGEN 283 void *psMemIncrRefCounter(284 void *vptr ///< Pointer to increment refCounter, and return285 ); 286 #else 287 288 void *p_psMemIncrRefCounter(289 void *vptr, ///< Pointer to increment refCounter, and return284 psPtr psMemIncrRefCounter( 285 psPtr vptr ///< Pointer to increment refCounter, and return 286 ); 287 #else 288 289 psPtr p_psMemIncrRefCounter( 290 psPtr vptr, ///< Pointer to increment refCounter, and return 290 291 const char *file, ///< File of call 291 intlineno ///< Line number of call292 psS32 lineno ///< Line number of call 292 293 ); 293 294 … … 299 300 * @ingroup memRefCount 300 301 * 301 * @return void*the pointer deremented in refCount, or NULL if pointer is302 * @return psPtr the pointer deremented in refCount, or NULL if pointer is 302 303 * fully dereferenced. 303 304 */ 304 305 #ifdef DOXYGEN 305 void*psMemDecrRefCounter(306 void*vptr ///< Pointer to decrement refCounter, and return307 ); 308 #else 309 310 void *p_psMemDecrRefCounter(311 void *vptr, ///< Pointer to decrement refCounter, and return306 psPtr psMemDecrRefCounter( 307 psPtr vptr ///< Pointer to decrement refCounter, and return 308 ); 309 #else 310 311 psPtr p_psMemDecrRefCounter( 312 psPtr vptr, ///< Pointer to decrement refCounter, and return 312 313 const char *file, ///< File of call 313 intlineno ///< Line number of call314 psS32 lineno ///< Line number of call 314 315 ); 315 316 -
trunk/psLib/src/sysUtils/psString.c
r1969 r2204 9 9 * @author Eric Van Alst, MHPCC 10 10 * 11 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10- 06 01:05:41 $11 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:31 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 31 31 } 32 32 33 char *psStringNCopy(const char *str, intnChar)33 char *psStringNCopy(const char *str, psS32 nChar) 34 34 { 35 35 char *returnValue = NULL; -
trunk/psLib/src/sysUtils/psString.h
r1448 r2204 10 10 * @author Eric Van Alst, MHPCC 11 11 * 12 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2004- 08-10 01:55:34$12 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:31 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 19 19 #define PS_STRING_H 20 20 21 #include "psType.h" 21 22 22 23 /** This macro will convert the argument to a quoted string */ … … 62 63 /**< Input string of characters to copy */ 63 64 64 intnChar65 psS32 nChar 65 66 /**< Number of bytes to allocate for string copy */ 66 67 ); -
trunk/psLib/src/sysUtils/psTrace.c
r1834 r2204 9 9 * @author George Gusciora, MHPCC 10 10 * 11 * @version $Revision: 1.3 5$ $Name: not supported by cvs2svn $12 * @date $Date: 2004- 09-20 22:03:35$11 * @version $Revision: 1.36 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:31 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 34 34 35 35 PS_DEFAULT_TRACE_LEVEL: This should only be used when adding the 36 intermediate components of a longname. Ie. the "B" in .A.B.C36 intermediate components of a psS64 name. Ie. the "B" in .A.B.C 37 37 38 38 *****************************************************************************/ … … 56 56 57 57 static void componentFree(p_psComponent* comp); 58 static p_psComponent* componentAlloc(const char *name, intlevel);58 static p_psComponent* componentAlloc(const char *name, psS32 level); 59 59 60 60 /***************************************************************************** 61 61 componentAlloc(): allocate memory for a new node, and initialize members. 62 62 *****************************************************************************/ 63 static p_psComponent* componentAlloc(const char *name, intlevel)63 static p_psComponent* componentAlloc(const char *name, psS32 level) 64 64 { 65 65 p_psComponent* comp = psAlloc(sizeof(p_psComponent)); … … 68 68 p_psMemSetDeallocator(comp, (psFreeFcn) componentFree); 69 69 comp->name = psStringCopy(name); 70 p_psMemSetPersistent(( void*)comp->name,true);70 p_psMemSetPersistent((psPtr)comp->name,true); 71 71 comp->level = level; 72 72 comp->n = 0; … … 86 86 87 87 if (comp->subcomp != NULL) { 88 for ( inti = 0; i < comp->n; i++) {88 for (psS32 i = 0; i < comp->n; i++) { 89 89 p_psMemSetPersistent(comp->subcomp[i],false); 90 90 psFree(comp->subcomp[i]); … … 94 94 } 95 95 96 p_psMemSetPersistent(( void*)comp->name,false);97 psFree(( void*)comp->name);96 p_psMemSetPersistent((psPtr)comp->name,false); 97 psFree((psPtr)comp->name); 98 98 } 99 99 … … 115 115 void p_psTraceReset(p_psComponent* currentNode) 116 116 { 117 inti = 0;117 psS32 i = 0; 118 118 119 119 if (NULL == currentNode) { … … 149 149 to ANSI-C. 150 150 *****************************************************************************/ 151 static bool componentAdd(const char *addNodeName, intlevel)152 { 153 inti = 0; // Loop index variable.151 static psBool componentAdd(const char *addNodeName, psS32 level) 152 { 153 psS32 i = 0; // Loop index variable. 154 154 char name[strlen(addNodeName) + 1]; // buffer for writeable copy. 155 155 char *pname = name; 156 156 char *firstComponent = NULL; // first component of name 157 157 p_psComponent* currentNode = cRoot; 158 intnodeExists = 0;158 psS32 nodeExists = 0; 159 159 160 160 // XXX: Verify that this is the correct behavior. … … 240 240 zero 241 241 *****************************************************************************/ 242 bool psTraceSetLevel(const char *comp, // component of interest243 intlevel) // desired trace level242 psBool psTraceSetLevel(const char *comp, // component of interest 243 psS32 level) // desired trace level 244 244 { 245 245 char *compName = NULL; … … 299 299 The trace level of the "name" component. 300 300 *****************************************************************************/ 301 static intdoGetTraceLevel(const char *aname)301 static psS32 doGetTraceLevel(const char *aname) 302 302 { 303 303 char name[strlen(aname) + 1]; // need a writeable copy: for strsep() … … 305 305 char *firstComponent = NULL; // first component of name 306 306 p_psComponent* currentNode = cRoot; 307 inti = 0;308 intdefaultLevel = 0;307 psS32 i = 0; 308 psS32 defaultLevel = 0; 309 309 310 310 if (NULL == currentNode) { … … 365 365 The level of "name" in the root component tree. 366 366 *****************************************************************************/ 367 intpsTraceGetLevel(const char *name)367 psS32 psTraceGetLevel(const char *name) 368 368 { 369 369 char *compName = NULL; 370 inttraceLevel;370 psS32 traceLevel; 371 371 372 372 if (cRoot == NULL) { … … 401 401 *****************************************************************************/ 402 402 static void doPrintTraceLevels(const p_psComponent* comp, 403 intdepth,404 intdefLevel)405 { 406 inti = 0;403 psS32 depth, 404 psS32 defLevel) 405 { 406 psS32 i = 0; 407 407 408 408 if (comp->name[0] == '\0') { … … 472 472 *****************************************************************************/ 473 473 void p_psTrace(const char *comp, // component being traced 474 intlevel, // desired trace level474 psS32 level, // desired trace level 475 475 ...) // arguments 476 476 { 477 477 char *fmt = NULL; 478 478 va_list ap; 479 inti = 0;479 psS32 i = 0; 480 480 481 481 if (NULL == comp) { -
trunk/psLib/src/sysUtils/psTrace.h
r2202 r2204 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10-2 6 23:14:04$11 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:31 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 50 50 { 51 51 const char *name; // last part of name of component 52 intlevel; // trace level for this component53 intn; // number of subcomponents52 psS32 level; // trace level for this component 53 psS32 n; // number of subcomponents 54 54 struct p_psComponent* *subcomp; // next level of subcomponents 55 55 } … … 59 59 /// Send a trace message 60 60 void p_psTrace(const char *facil, ///< facilty of interest 61 intmyLevel, ///< desired trace level61 psS32 myLevel, ///< desired trace level 62 62 ...) ///< trace message arguments 63 63 ; … … 65 65 66 66 /// Set trace level 67 bool psTraceSetLevel(const char *facil, ///< facilty of interest68 intlevel) ///< desired trace level67 psBool psTraceSetLevel(const char *facil, ///< facilty of interest 68 psS32 level) ///< desired trace level 69 69 ; 70 70 71 71 /// Get the trace level 72 intpsTraceGetLevel(const char *facil) ///< facilty of interest72 psS32 psTraceGetLevel(const char *facil) ///< facilty of interest 73 73 ; 74 74 -
trunk/psLib/src/sysUtils/psType.h
r1984 r2204 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.2 2$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-10- 06 21:40:13$13 * @version $Revision: 1.23 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:31 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 23 23 #include <stdint.h> 24 24 #include <float.h> 25 #include <stdbool.h> 25 26 26 27 /// @addtogroup DataContainer … … 52 53 typedef float _Complex psC32; ///< complex with 32-bit floating point Real and Imagary numbers 53 54 typedef double _Complex psC64; ///< complex with 64-bit floating point Real and Imagary numbers 54 typedef void *psPTR; ///< void pointer 55 typedef void* psPtr; ///< void pointer 56 typedef bool psBool; ///< boolean value 55 57 56 58 typedef enum { … … 60 62 PS_TYPE_S64 = 0x0108, ///< Long integer. 61 63 PS_TYPE_U8 = 0x0301, ///< Unsigned character. 62 PS_TYPE_U16 = 0x0302, ///< Unsigned shortinteger.64 PS_TYPE_U16 = 0x0302, ///< Unsigned psS16 integer. 63 65 PS_TYPE_U32 = 0x0304, ///< Unsigned integer. 64 PS_TYPE_U64 = 0x0308, ///< Unsigned longinteger.66 PS_TYPE_U64 = 0x0308, ///< Unsigned psS64 integer. 65 67 PS_TYPE_F32 = 0x0404, ///< Single-precision Floating point. 66 68 PS_TYPE_F64 = 0x0408, ///< Double-precision floating point. … … 115 117 #define PS_TYPE_C32_NAME "psC32" 116 118 #define PS_TYPE_C64_NAME "psC64" 117 #define PS_TYPE_PTR_NAME "psP TR"119 #define PS_TYPE_PTR_NAME "psPtr" 118 120 119 121 #define PS_TYPE_NAME(value,type) \ … … 183 185 #define PS_IS_PSELEMTYPE_COMPLEX(x) ((x & 0x800) == 0x800) 184 186 /// Macro to determine the storage size, in bytes, of the psElemType. 185 #define PSELEMTYPE_SIZEOF(x) ( (x==PS_TYPE_PTR) ? sizeof( void*) :(x & 0xFF) )187 #define PSELEMTYPE_SIZEOF(x) ( (x==PS_TYPE_PTR) ? sizeof(psPtr) :(x & 0xFF) ) 186 188 187 189 /** Dimensions of a data type. -
trunk/psLib/src/types/psArray.c
r1920 r2204 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $12 * @date $Date: 2004- 09-28 23:26:48$11 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:31 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 42 42 43 43 /*****************************************************************************/ 44 psArray* psArrayAlloc( unsigned intnalloc)44 psArray* psArrayAlloc(psU32 nalloc) 45 45 { 46 46 psArray* psArr = NULL; … … 54 54 55 55 // Create vector data array 56 psArr->data = psAlloc(nalloc * sizeof(psP TR));56 psArr->data = psAlloc(nalloc * sizeof(psPtr)); 57 57 58 58 return psArr; 59 59 } 60 60 61 psArray* psArrayRealloc(psArray* restrict in, unsigned intnalloc)61 psArray* psArrayRealloc(psArray* restrict in, psU32 nalloc) 62 62 { 63 63 if (in == NULL) { … … 65 65 } else if (in->nalloc != nalloc) { // No need to realloc to same size 66 66 if (nalloc < in->n) { 67 for ( inti = nalloc; i < in->n; i++) { // For reduction in vector size67 for (psS32 i = nalloc; i < in->n; i++) { // For reduction in vector size 68 68 psFree(in->data[i]); 69 69 } … … 71 71 } 72 72 // Realloc after decrementation to avoid accessing freed array elements 73 in->data = psRealloc(in->data, nalloc * sizeof(psP TR));73 in->data = psRealloc(in->data, nalloc * sizeof(psPtr)); 74 74 in->nalloc = nalloc; 75 75 } … … 89 89 } 90 90 91 bool psArrayRemove(psArray* psArr,92 psPTRdata)91 psBool psArrayRemove(psArray* psArr, 92 psPtr data) 93 93 { 94 bool success = false;94 psBool success = false; 95 95 96 96 if (psArr == NULL) { … … 98 98 } 99 99 100 intn = psArr->n;101 psP TR* psArrData = psArr->data;102 for ( inti = n-1; i<0; i--) {100 psS32 n = psArr->n; 101 psPtr* psArrData = psArr->data; 102 for (psS32 i = n-1; i<0; i--) { 103 103 if (psArrData[i] == data) { 104 memmove(psArrData[i],psArrData[i+1],(n-i-1)*sizeof(psP TR));104 memmove(psArrData[i],psArrData[i+1],(n-i-1)*sizeof(psPtr)); 105 105 n--; 106 106 success = true; … … 119 119 } 120 120 121 for ( inti = 0; i < psArr->n; i++) {121 for (psS32 i = 0; i < psArr->n; i++) { 122 122 psFree(psArr->data[i]); 123 123 psArr->data[i] = NULL; … … 131 131 } 132 132 133 qsort(in->data, in->n, sizeof(psP TR), (int (*)(const void *, const void*))compare);133 qsort(in->data, in->n, sizeof(psPtr), (int (*)(const void* , const void*))compare); 134 134 135 135 return in; -
trunk/psLib/src/types/psArray.h
r1920 r2204 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $15 * @date $Date: 2004- 09-28 23:26:48$14 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-10-27 00:57:31 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 20 20 #ifndef PS_ARRAY_H 21 21 #define PS_ARRAY_H 22 23 #include<stdbool.h>24 22 25 23 #include "psType.h" … … 36 34 typedef struct 37 35 { 38 unsigned intnalloc; ///< Total number of elements available.39 unsigned intn; ///< Number of elements in use.40 psP TR* data; ///< An Array of pointer elements36 psU32 nalloc; ///< Total number of elements available. 37 psU32 n; ///< Number of elements in use. 38 psPtr* data; ///< An Array of pointer elements 41 39 } 42 40 psArray; … … 57 55 */ 58 56 psArray* psArrayAlloc( 59 unsigned intnalloc ///< Total number of elements to make available.57 psU32 nalloc ///< Total number of elements to make available. 60 58 ); 61 59 … … 70 68 psArray* psArrayRealloc( 71 69 psArray* restrict psArr, ///< array to reallocate. 72 unsigned intnalloc ///< Total number of elements to make available.70 psU32 nalloc ///< Total number of elements to make available. 73 71 ); 74 72 … … 81 79 * 82 80 */ 83 bool psArrayRemove(81 psBool psArrayRemove( 84 82 psArray* psArr, ///< array to operate on 85 psP TRdata ///< the data pointer to remove from psArray83 psPtr data ///< the data pointer to remove from psArray 86 84 ); 87 85 -
trunk/psLib/src/types/psBitSet.c
r1842 r2204 11 11 * @author Robert DeSonia, MHPCC 12 12 * 13 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $14 * @date $Date: 2004- 09-21 23:17:52$13 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:31 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 21 21 #include <ctype.h> 22 22 #include <math.h> 23 #include <stdbool.h>24 23 25 24 #include "psBitSet.h" … … 48 47 * @return char*: Pointer to byte in which bit is contained. 49 48 */ 50 static char mask( intbit)49 static char mask(psS32 bit) 51 50 { 52 51 char mask = (char)0x01; … … 67 66 } 68 67 69 psBitSet* psBitSetAlloc( intn)70 { 71 intnumBytes = 0;68 psBitSet* psBitSetAlloc(psS32 n) 69 { 70 psS32 numBytes = 0; 72 71 psBitSet* newObj = NULL; 73 72 … … 95 94 96 95 psBitSet* psBitSetSet(psBitSet* inBitSet, 97 intbit)96 psS32 bit) 98 97 { 99 98 char *byte = NULL; … … 120 119 121 120 psBitSet* psBitSetClear(psBitSet* inBitSet, 122 intbit)121 psS32 bit) 123 122 { 124 123 char *byte = NULL; … … 144 143 } 145 144 146 bool psBitSetTest(const psBitSet* inBitSet,147 intbit)145 psBool psBitSetTest(const psBitSet* inBitSet, 146 psS32 bit) 148 147 { 149 148 char *byte = NULL; … … 173 172 const psBitSet* restrict inBitSet2) 174 173 { 175 inti = 0;176 intn = 0;174 psS32 i = 0; 175 psS32 n = 0; 177 176 char* outBits = NULL; 178 177 char* inBits1 = NULL; 179 178 char* inBits2 = NULL; 180 intop = UNKNOWN_OP;179 psS32 op = UNKNOWN_OP; 181 180 182 181 if (inBitSet1 == NULL) { … … 198 197 199 198 // make operator all caps 200 inttempStrLen = strlen(operator);199 psS32 tempStrLen = strlen(operator); 201 200 char* tempStr = psAlloc(tempStrLen+1); 202 201 203 for ( intlcv=0;lcv<tempStrLen;lcv++) {202 for (psS32 lcv=0;lcv<tempStrLen;lcv++) { 204 203 tempStr[lcv] = (char)toupper(operator[lcv]); 205 204 } … … 308 307 char *psBitSetToString(const psBitSet* restrict inBitSet) 309 308 { 310 inti = 0;311 intnumBits = inBitSet->n * 8;309 psS32 i = 0; 310 psS32 numBits = inBitSet->n * 8; 312 311 char *outString = psAlloc((size_t) numBits + 1); 313 312 -
trunk/psLib/src/types/psBitSet.h
r1807 r2204 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $15 * @date $Date: 2004- 09-14 20:01:52$14 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-10-27 00:57:31 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 20 20 #ifndef PSBITSET_H 21 21 #define PSBITSET_H 22 23 #include "psType.h" 22 24 23 25 /// @addtogroup BitSet … … 35 37 typedef struct 36 38 { 37 intn; ///< Number of bytes in the array39 psS32 n; ///< Number of bytes in the array 38 40 char *bits; ///< Aray of bytes holding bits 39 41 } … … 54 56 /*@null@*/ 55 57 psBitSet* psBitSetAlloc( 56 intn ///< Number of bits in psBitSet array58 psS32 n ///< Number of bits in psBitSet array 57 59 ); 58 60 … … 68 70 /* @returned@ */ 69 71 psBitSet* restrict inMask, ///< Pointer to psBitSet to be set. 70 intbit ///< Bit to be set.72 psS32 bit ///< Bit to be set. 71 73 ); 72 74 … … 82 84 /* @returned@ */ 83 85 psBitSet* restrict inMask, ///< Pointer to psBitSet to be cleared. 84 intbit ///< Bit to be cleared.86 psS32 bit ///< Bit to be cleared. 85 87 ); 86 88 … … 95 97 */ 96 98 97 bool psBitSetTest(99 psBool psBitSetTest( 98 100 const psBitSet* restrict inMask, ///< Pointer psBitSet to be tested. 99 intbit ///< Bit to be tested.101 psS32 bit ///< Bit to be tested. 100 102 ); 101 103 -
trunk/psLib/src/types/psHash.c
r1842 r2204 11 11 * @author George Gusciora, MHPCC 12 12 * 13 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $14 * @date $Date: 2004- 09-21 23:17:53$13 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:31 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 19 19 #include <stdio.h> 20 20 #include <string.h> 21 #include <stdbool.h>22 21 #include "psHash.h" 23 22 #include "psMemory.h" … … 29 28 #include "psCollectionsErrors.h" 30 29 31 static psHashBucket* hashBucketAlloc(const char *key, void *data, psHashBucket* next);30 static psHashBucket* hashBucketAlloc(const char *key, psPtr data, psHashBucket* next); 32 31 static void hashBucketFree(psHashBucket* bucket); 33 static void *doHashWork(psHash* table, const char *key, void *data, bool remove32 static psPtr doHashWork(psHash* table, const char *key, psPtr data, psBool remove 34 33 ); 35 34 static void hashFree(psHash* table); … … 45 44 psList* psHashKeyList(psHash* table) 46 45 { 47 inti = 0; // Loop index variable46 psS32 i = 0; // Loop index variable 48 47 psList* myLinkList = NULL; // The output data structure 49 48 psHashBucket* ptr = NULL; // Used to step thru linked list. … … 85 84 *****************************************************************************/ 86 85 static psHashBucket* hashBucketAlloc(const char *key, 87 void *data,86 psPtr data, 88 87 psHashBucket* next) 89 88 { … … 135 134 The new hash table. 136 135 *****************************************************************************/ 137 psHash* psHashAlloc( intnbucket) // initial number of buckets138 { 139 inti = 0; // loop index variable136 psHash* psHashAlloc(psS32 nbucket) // initial number of buckets 137 { 138 psS32 i = 0; // loop index variable 140 139 141 140 // Create the new hash table. … … 172 171 static void hashFree(psHash* table) 173 172 { 174 inti = 0; // Loop index variable.173 psS32 i = 0; // Loop index variable. 175 174 176 175 if (table == NULL) { … … 212 211 there is little common code between those functions. 213 212 *****************************************************************************/ 214 static void *doHashWork(psHash* table,213 static psPtr doHashWork(psHash* table, 215 214 const char *key, 216 void *data, bool remove215 psPtr data, psBool remove 217 216 ) 218 217 { 219 long inthash = 1; // This will contain an integer value218 psS64 hash = 1; // This will contain an integer value 220 219 221 220 // "hashed" from the key. … … 236 235 } 237 236 // NOTE: This is the originally supplied hash function. 238 // for ( inti = 0, len = strlen(key); i < len; i++) {237 // for (psS32 i = 0, len = strlen(key); i < len; i++) { 239 238 // hash = (hash << 1) ^ key[i]; 240 239 // } … … 273 272 // of removing an item from a single-linked list. 274 273 275 void *data = ptr->data;274 psPtr data = ptr->data; 276 275 277 276 optr->next = ptr->next; … … 344 343 boolean value defining success or failure 345 344 *****************************************************************************/ 346 bool psHashAdd(psHash* table,347 const char *key,348 void *data)345 psBool psHashAdd(psHash* table, 346 const char *key, 347 psPtr data) 349 348 { 350 349 if (table == NULL) { … … 380 379 The data associated with that key. 381 380 *****************************************************************************/ 382 void *psHashLookup(psHash* table, // table to lookup key in381 psPtr psHashLookup(psHash* table, // table to lookup key in 383 382 const char *key) // key to lookup 384 383 { … … 409 408 boolean value defining success or failure 410 409 *****************************************************************************/ 411 bool psHashRemove(psHash* table,412 const char *key)413 { 414 void *data = NULL;415 bool retVal = false;410 psBool psHashRemove(psHash* table, 411 const char *key) 412 { 413 psPtr data = NULL; 414 psBool retVal = false; 416 415 417 416 if (table == NULL) { -
trunk/psLib/src/types/psHash.h
r1441 r2204 11 11 * @author George Gusciora, MHPCC 12 12 * 13 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $14 * @date $Date: 2004- 08-09 23:40:55$13 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:31 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 22 22 * \{ 23 23 */ 24 #include<stdbool.h>25 24 26 25 #include "psList.h" … … 30 29 { 31 30 char *key; ///< key for this item of data 32 void *data; ///< the data itself31 psPtr data; ///< the data itself 33 32 struct psHashBucket* next; ///< list of other possible keys 34 33 } … … 40 39 typedef struct psHash 41 40 { 42 intnbucket; ///< Number of buckets in hash table.41 psS32 nbucket; ///< Number of buckets in hash table. 43 42 psHashBucket* *buckets; ///< The bucket data. 44 43 } … … 46 45 47 46 /// Allocate hash buckets in table. 48 psHash* psHashAlloc( intnbucket ///< The number of buckets to allocate.47 psHash* psHashAlloc(psS32 nbucket ///< The number of buckets to allocate. 49 48 ); 50 49 51 50 /// Insert entry into table. 52 bool psHashAdd(psHash* table, ///< table to insert in53 const char *key, ///< key to use54 void *data ///< data to insert55 );51 psBool psHashAdd(psHash* table, ///< table to insert in 52 const char *key, ///< key to use 53 psPtr data ///< data to insert 54 ); 56 55 57 56 /// Lookup key in table. 58 void *psHashLookup(psHash* table, ///< table to lookup key in57 psPtr psHashLookup(psHash* table, ///< table to lookup key in 59 58 const char *key ///< key to lookup 60 59 ); 61 60 62 61 /// Remove key from table. 63 bool psHashRemove(psHash* table, ///< table to lookup key in64 const char *key ///< key to lookup65 );62 psBool psHashRemove(psHash* table, ///< table to lookup key in 63 const char *key ///< key to lookup 64 ); 66 65 67 66 /// List all keys in table. -
trunk/psLib/src/types/psList.c
r1807 r2204 6 6 * @author Robert Daniel DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 19$ $Name: not supported by cvs2svn $9 * @date $Date: 2004- 09-14 20:01:52$8 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-10-27 00:57:31 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 13 13 14 14 #include <stdlib.h> 15 #include <stdbool.h>16 15 #include <stdio.h> 17 16 #include <pthread.h> // we need a mutex to make this stuff thread safe. … … 26 25 #include "psCollectionsErrors.h" 27 26 28 #define ITER_INIT_HEAD (( void *)1) // next iteration should return head29 #define ITER_INIT_TAIL (( void *)2) // next iteration should return tail27 #define ITER_INIT_HEAD ((psPtr )1) // next iteration should return head 28 #define ITER_INIT_TAIL ((psPtr )2) // next iteration should return tail 30 29 31 30 // private functions. 32 31 static psListElem* listGetIterator(psList* list); 33 static intlistGetIteratorIndex(psList* list);34 static void listSetIterator(psList* list, int where, bool lockList);32 static psS32 listGetIteratorIndex(psList* list); 33 static void listSetIterator(psList* list, psS32 where, psBool lockList); 35 34 static void listFree(psList* list); 36 35 37 psList* psListAlloc( void *data)36 psList* psListAlloc(psPtr data) 38 37 { 39 38 psList* list = psAlloc(sizeof(psList)); … … 82 81 } 83 82 84 bool psListAdd(psList* list, int location, void *data)83 psBool psListAdd(psList* list, psS32 location, psPtr data) 85 84 { 86 85 psListElem* position; 87 86 psListElem* elem; 88 intcursorIndex = 0;87 psS32 cursorIndex = 0; 89 88 90 89 if (list == NULL) { … … 168 167 * Remove an element from a list 169 168 */ 170 bool psListRemove(psList* list, int location, void *data)169 psBool psListRemove(psList* list, psS32 location, psPtr data) 171 170 { 172 171 psListElem* elem = NULL; // element to remove 173 intcursorIndex = 0;172 psS32 cursorIndex = 0; 174 173 175 174 if (list == NULL) { … … 184 183 // search list for the data item. 185 184 186 inti = 0; // index185 psS32 i = 0; // index 187 186 188 187 for (psListElem* ptr = list->head; ptr != NULL; ptr = ptr->next) { … … 247 246 } 248 247 249 void psListSetIterator(psList* list, intwhere)248 void psListSetIterator(psList* list, psS32 where) 250 249 { 251 250 listSetIterator(list, where, true); 252 251 } 253 252 254 static void listSetIterator(psList* list, int where, bool lockList)253 static void listSetIterator(psList* list, psS32 where, psBool lockList) 255 254 { 256 255 psListElem* cursor; 257 intposition;256 psS32 position; 258 257 259 258 if (list == NULL) { … … 272 271 } 273 272 274 if (where >= ( int)list->size) {273 if (where >= (psS32)list->size) { 275 274 list->iter = NULL; 276 275 if (lockList) { … … 323 322 } 324 323 325 intposition = listGetIteratorIndex(list);324 psS32 position = listGetIteratorIndex(list); 326 325 327 326 if (where < position) { 328 intdiff = position - where;329 330 for ( intcount = 0; count < diff; count++) {327 psS32 diff = position - where; 328 329 for (psS32 count = 0; count < diff; count++) { 331 330 listSetIterator(list, PS_LIST_PREVIOUS, false); 332 331 } 333 332 } else { 334 intdiff = where - position;335 336 for ( intcount = 0; count < diff; count++) {333 psS32 diff = where - position; 334 335 for (psS32 count = 0; count < diff; count++) { 337 336 listSetIterator(list, PS_LIST_NEXT, false); 338 337 } … … 363 362 } 364 363 365 intlistGetIteratorIndex(psList* list)364 psS32 listGetIteratorIndex(psList* list) 366 365 { 367 366 if (list->iter == ITER_INIT_HEAD) { … … 374 373 } 375 374 376 void *psListGet(psList* list, intlocation)375 psPtr psListGet(psList* list, psS32 location) 377 376 { 378 377 psListElem* element; … … 391 390 * and now return the previous/next element of the list 392 391 */ 393 void *psListGetNext(psList* list)392 psPtr psListGetNext(psList* list) 394 393 { 395 394 return psListGet(list, PS_LIST_NEXT); 396 395 } 397 396 398 void *psListGetPrevious(psList* list)397 psPtr psListGetPrevious(psList* list) 399 398 { 400 399 return psListGet(list, PS_LIST_PREVIOUS); 401 400 } 402 401 403 void *psListGetCurrent(psList* list)402 psPtr psListGetCurrent(psList* list) 404 403 { 405 404 return psListGet(list, PS_LIST_CURRENT); … … 412 411 { 413 412 psListElem* ptr; 414 unsigned intn;413 psU32 n; 415 414 psArray* restrict arr; 416 415 … … 429 428 ptr = list->head; 430 429 n = list->size; 431 for ( inti = 0; i < n; i++) {430 for (psS32 i = 0; i < n; i++) { 432 431 arr->data[i] = psMemIncrRefCounter(ptr->data); 433 432 ptr = ptr->next; … … 439 438 psList* psArrayToList(psArray* arr) 440 439 { 441 unsigned intn;440 psU32 n; 442 441 psList* list; // list of elements 443 442 … … 448 447 list = psListAlloc(NULL); 449 448 n = arr->n; 450 for ( inti = 0; i < n; i++) {449 for (psS32 i = 0; i < n; i++) { 451 450 psListAdd(list, PS_LIST_TAIL, arr->data[i]); 452 451 } -
trunk/psLib/src/types/psList.h
r1747 r2204 10 10 * @ingroup LinkedList 11 11 * 12 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $13 * @date $Date: 2004- 09-09 02:23:27$12 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:31 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 17 17 18 18 #include <pthread.h> // we need a mutex to make this stuff thread safe. 19 #include <stdbool.h> // we use the bool type.20 19 21 20 #include "psCompare.h" … … 46 45 struct psListElem* prev; ///< previous link in list 47 46 struct psListElem* next; ///< next link in list 48 void *data; ///< real data item47 psPtr data; ///< real data item 49 48 } 50 49 psListElem; … … 57 56 typedef struct 58 57 { 59 unsigned intsize; ///< number of elements on list58 psU32 size; ///< number of elements on list 60 59 psListElem* head; ///< first element on list (may be NULL) 61 60 psListElem* tail; ///< last element on list (may be NULL) 62 61 psListElem* iter; ///< iteration cursor 63 unsigned intiterIndex; ///< the numeric position of the iteration cursor in the list62 psU32 iterIndex; ///< the numeric position of the iteration cursor in the list 64 63 pthread_mutex_t lock; ///< mutex to lock a node during changes 65 64 } … … 71 70 */ 72 71 psList* psListAlloc( 73 void *data72 psPtr data 74 73 ///< initial data item; may be NULL if no an empty psList is desired 75 74 ) … … 81 80 * NULL, the return value will also be NULL. 82 81 */ 83 bool psListAdd(82 psBool psListAdd( 84 83 psList* restrict list, ///< list to add to (if NULL, nothing is done) 85 intlocation, ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location.86 void *data ///< data item to add. If NULL, list is not modified.84 psS32 location, ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location. 85 psPtr data ///< data item to add. If NULL, list is not modified. 87 86 ); 88 87 89 88 /** Remove an item from a list. If location parameter is PS_LIST_UNKNOWN, 90 89 * 91 * @return bool TRUE if element is successfully removed, otherwise FALSE.90 * @return psBool TRUE if element is successfully removed, otherwise FALSE. 92 91 */ 93 bool psListRemove(92 psBool psListRemove( 94 93 psList* restrict list, 95 94 ///< list to remove element from 96 intlocation,95 psS32 location, 97 96 ///< index of item, or PS_LIST_UNKNOWN, PS_LIST_NEXT, PS_LIST_PREV, or numbered location. 98 void *data97 psPtr data 99 98 ///< if location is PS_LIST_UNKNOWN, data item to find and remove, otherwise this is ignored. 100 99 ); … … 102 101 /** Retrieve an item from a list. 103 102 * 104 * @return void*the item corresponding to the location parameter. If103 * @return psPtr the item corresponding to the location parameter. If 105 104 * location is invalid (e.g., a numbered index greater 106 105 * than the list size or if the list is empty), a 107 106 * NULL is returned. 108 107 */ 109 void *psListGet(108 psPtr psListGet( 110 109 psList* restrict list, ///< list to retrieve element from 111 intlocation ///< index number, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN110 psS32 location ///< index number, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN 112 111 ); 113 112 … … 118 117 void psListSetIterator( 119 118 psList* restrict list, ///< list to retrieve element from 120 intlocation ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL119 psS32 location ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL 121 120 ); 122 121 … … 124 123 * the next list position. 125 124 * 126 * @return void*the data item next on the list or NULL if the iterator125 * @return psPtr the data item next on the list or NULL if the iterator 127 126 * is already pointing to the last element or the list 128 127 * parameter was NULL. 129 128 */ 130 void *psListGetNext(129 psPtr psListGetNext( 131 130 psList* restrict list ///< list to retrieve element from 132 131 ); … … 135 134 * not move the iterator location. 136 135 * 137 * @return void*the data item cooresponding to current iterator136 * @return psPtr the data item cooresponding to current iterator 138 137 * cursor position of the list, or NULL if either the 139 138 * iterator is not valid or list parameter was NULL. 140 139 */ 141 void *psListGetCurrent(140 psPtr psListGetCurrent( 142 141 psList* restrict list ///< list to retrieve element from 143 142 ); … … 146 145 * iterator to the previous list position. 147 146 * 148 * @return void*the data item previous on the list or NULL if the iterator147 * @return psPtr the data item previous on the list or NULL if the iterator 149 148 * is already pointing to the first element or the list 150 149 * parameter was NULL. 151 150 */ 152 void *psListGetPrevious(151 psPtr psListGetPrevious( 153 152 psList* restrict list ///< list to retrieve element from 154 153 ); -
trunk/psLib/src/types/psMetadata.c
r2040 r2204 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.3 4$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-10- 09 03:05:53$14 * @version $Revision: 1.35 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-10-27 00:57:30 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 59 59 /*****************************************************************************/ 60 60 61 static intmetadataId = 0;61 static psS32 metadataId = 0; 62 62 63 63 /*****************************************************************************/ … … 143 143 144 144 // Set metadata item unique id 145 *( int*)(&metadataItem->id) = ++metadataId;145 *(psS32 *)(&metadataItem->id) = ++metadataId; 146 146 147 147 // Set metadata item type … … 154 154 break; 155 155 case PS_META_BOOL: 156 metadataItem->data.B = ( bool)va_arg(argPtr, int);156 metadataItem->data.B = (psBool)va_arg(argPtr, psS32); 157 157 break; 158 158 case PS_META_S32: … … 215 215 } 216 216 217 bool psMetadataAddItem( psMetadata *restrict md, psMetadataItem *restrict metadataItem, intlocation )217 psBool psMetadataAddItem( psMetadata *restrict md, psMetadataItem *restrict metadataItem, psS32 location ) 218 218 { 219 219 char * key = NULL; … … 337 337 } 338 338 339 bool psMetadataAdd(psMetadata* restrict md, intwhere, const char *name, psMetadataType type,340 const char *comment, ...)339 psBool psMetadataAdd(psMetadata* restrict md, psS32 where, const char *name, psMetadataType type, 340 const char *comment, ...) 341 341 { 342 342 va_list argPtr; … … 359 359 } 360 360 361 bool psMetadataRemove(psMetadata* restrict md, intwhere, const char *restrict key)362 { 363 intnumChildren = 0;361 psBool psMetadataRemove(psMetadata* restrict md, psS32 where, const char *restrict key) 362 { 363 psS32 numChildren = 0; 364 364 psList* mdList = NULL; 365 365 psHash* mdTable = NULL; … … 471 471 } 472 472 473 psMetadataItem* psMetadataGet(psMetadata* restrict md, intwhere)473 psMetadataItem* psMetadataGet(psMetadata* restrict md, psS32 where) 474 474 { 475 475 psList* mdList = NULL; … … 497 497 } 498 498 499 bool psMetadataSetIterator(psMetadata* restrict md, intwhere)499 psBool psMetadataSetIterator(psMetadata* restrict md, psS32 where) 500 500 { 501 501 psList* mdList = NULL; … … 517 517 } 518 518 519 psMetadataItem* psMetadataGetNext(psMetadata* restrict md, const char *restrict match, intwhich)519 psMetadataItem* psMetadataGetNext(psMetadata* restrict md, const char *restrict match, psS32 which) 520 520 { 521 521 psList* mdList = NULL; … … 553 553 } 554 554 555 psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, intwhich)555 psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, const char *restrict match, psS32 which) 556 556 { 557 557 psList* mdList = NULL; -
trunk/psLib/src/types/psMetadata.h
r1970 r2204 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.2 3$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-10- 06 01:06:27$13 * @version $Revision: 1.24 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:30 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 38 38 PS_META_F32, ///< Single-precision float data. 39 39 PS_META_F64, ///< Double-precision float data. 40 PS_META_STR, ///< String data (Stored in as void *).41 PS_META_VEC, ///< Vector data (Stored in as void *).42 PS_META_IMG, ///< Image data (Stored in as void *).43 PS_META_JPEG, ///< JPEG data (Stored in as void *).44 PS_META_PNG, ///< PNG data (Stored in as void *).45 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as void *).46 PS_META_UNKNOWN, ///< Other data (Stored in as void *).40 PS_META_STR, ///< String data (Stored in as psPtr ). 41 PS_META_VEC, ///< Vector data (Stored in as psPtr ). 42 PS_META_IMG, ///< Image data (Stored in as psPtr ). 43 PS_META_JPEG, ///< JPEG data (Stored in as psPtr ). 44 PS_META_PNG, ///< PNG data (Stored in as psPtr ). 45 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as psPtr ). 46 PS_META_UNKNOWN, ///< Other data (Stored in as psPtr ). 47 47 PS_META_NTYPE ///< Number of types. Must be last. 48 48 } psMetadataType; … … 55 55 typedef struct psMetadataItem 56 56 { 57 const intid; ///< Unique ID for metadata item.57 const psS32 id; ///< Unique ID for metadata item. 58 58 char *restrict name; ///< Name of metadata item. 59 59 psMetadataType type; ///< Type of metadata item. 60 60 union { 61 bool B; ///< boolean data61 psBool B; ///< boolean data 62 62 psS32 S32; ///< Signed 32-bit integer data. 63 63 psF32 F32; ///< Single-precision float data. 64 64 psF64 F64; ///< Double-precision float data. 65 psP TRV; ///< Pointer to other type of data.65 psPtr V; ///< Pointer to other type of data. 66 66 } data; ///< Union for data types. 67 67 char *comment; ///< Optional comment ("", not NULL). … … 144 144 * @return bool: True for success, false for failure. 145 145 */ 146 bool psMetadataAddItem(146 psBool psMetadataAddItem( 147 147 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 148 148 psMetadataItem* restrict item, ///< Metadata item to be added. 149 intlocation ///< Location to be added.149 psS32 location ///< Location to be added. 150 150 ); 151 151 … … 156 156 * @return bool: True for success, false for failure. 157 157 */ 158 bool psMetadataAdd(159 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 160 intwhere, ///< Location to be added.158 psBool psMetadataAdd( 159 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 160 psS32 where, ///< Location to be added. 161 161 const char *name, ///< Name of metadata item. 162 162 psMetadataType type, ///< Type of metadata item. … … 175 175 * @return bool: True for success, false for failure. 176 176 */ 177 bool psMetadataRemove(178 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 179 intwhere, ///< Location to be removed.177 psBool psMetadataRemove( 178 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 179 psS32 where, ///< Location to be removed. 180 180 const char *restrict key ///< Name of metadata key. 181 181 ); … … 203 203 psMetadataItem* psMetadataGet( 204 204 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 205 intwhere ///< Location to be retrieved.205 psS32 where ///< Location to be retrieved. 206 206 ); 207 207 … … 213 213 * @return void: void. 214 214 */ 215 bool psMetadataSetIterator(215 psBool psMetadataSetIterator( 216 216 psMetadata* restrict md, ///< Metadata collection to iterate. 217 intwhere ///< Location of iterator.217 psS32 where ///< Location of iterator. 218 218 ); 219 219 … … 227 227 psMetadata* restrict md, ///< Metadata collection to iterate. 228 228 const char *restrict match, ///< Beginning of key name. 229 intwhich ///< Iterator to be used.229 psS32 which ///< Iterator to be used. 230 230 ); 231 231 … … 239 239 psMetadata* restrict md, ///< Metadata collection to iterate. 240 240 const char *restrict match, ///< Beginning of key name. 241 intwhich ///< Iterator to be used.241 psS32 which ///< Iterator to be used. 242 242 ); 243 243 -
trunk/psLib/src/types/psMetadataConfig.c
r2014 r2204 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10- 08 00:43:12$11 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:30 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 104 104 /** Determines if a line is blank (whitespace only) or a commentline. It returns true if so. The input string 105 105 * must be null terminated. */ 106 bool ignoreLine(char *inString)106 psBool ignoreLine(char *inString) 107 107 { 108 108 while(*inString!='\0' && *inString!='#') { … … 119 119 /** Removes leading and trailing whitespace and # characters from a string. The cleaned string is a new null 120 120 * terminated copy of the original input string. */ 121 char *cleanString(char *inString, intsLen)121 char *cleanString(char *inString, psS32 sLen) 122 122 { 123 123 char *ptrB = NULL; … … 149 149 150 150 /** Count repeat occurances of a single character within a line. The input string must be null terminated. */ 151 intrepeatedChars(char *inString, char ch)152 { 153 intcount = 0;151 psS32 repeatedChars(char *inString, char ch) 152 { 153 psS32 count = 0; 154 154 155 155 … … 166 166 /** Returns cleaned token based on delimiter, but not including delimiter. Also changes the pointer location 167 167 * the beginning of the string. Tokens are newly allocated null terminated strings. */ 168 char* getToken(char **inString, char *delimiter, int*status)168 char* getToken(char **inString, char *delimiter, psS32 *status) 169 169 { 170 170 char *cleanToken = NULL; 171 intsLen = 0;171 psS32 sLen = 0; 172 172 173 173 … … 195 195 /** Returns single parsed value as a double precision number. The input string must be cleaned and null 196 196 * terminated. */ 197 double parseValue(char *inString, int*status)197 double parseValue(char *inString, psS32 *status) 198 198 { 199 199 char *end = NULL; … … 212 212 213 213 /** Returns true or false. 'T', 't', '1', 'F', 'f', and '0' are acceptable, parsable variations. */ 214 bool parseBool(char *inString, int*status)215 { 216 bool value = false;214 psBool parseBool(char *inString, psS32 *status) 215 { 216 psBool value = false; 217 217 218 218 … … 229 229 230 230 /** Returns parsed vector filled with with data. The input string must be null terminated. */ 231 psVector* parseVector(char *inString, psElemType elemType, int*status)231 psVector* parseVector(char *inString, psElemType elemType, psS32 *status) 232 232 { 233 233 char *end = NULL; 234 234 char *saveValue = NULL; 235 inti = 0;236 intnumValues = 0;235 psS32 i = 0; 236 psS32 numValues = 0; 237 237 double value = 0.0; 238 238 psVector *vec = NULL; … … 341 341 342 342 343 psMetadata* psMetadataReadHeader(psMetadata* output, char *extName, intextNum, char *fileName)344 { 345 bool tempBool;346 bool success;343 psMetadata* psMetadataReadHeader(psMetadata* output, char *extName, psS32 extNum, char *fileName) 344 { 345 psBool tempBool; 346 psBool success; 347 347 char keyType; 348 348 char keyName[FITS_LINE_SIZE]; … … 350 350 char keyComment[FITS_LINE_SIZE]; 351 351 char fitsErr[MAX_STRING_LENGTH]; 352 inti;353 inthduType = 0;354 intstatus = 0;355 intnumKeys = 0;356 intkeyNum = 0;352 psS32 i; 353 psS32 hduType = 0; 354 psS32 status = 0; 355 psS32 numKeys = 0; 356 psS32 keyNum = 0; 357 357 psMetadataType metadataItemType; 358 358 fitsfile *fd = NULL; … … 449 449 450 450 451 int psMetadataParseConfig(psMetadata** md, char *fileName, bool overwrite)452 { 453 bool tempBool;451 psS32 psMetadataParseConfig(psMetadata** md, char *fileName, psBool overwrite) 452 { 453 psBool tempBool; 454 454 char *line = NULL; 455 455 char *strName = NULL; … … 458 458 char *strComment = NULL; 459 459 char *linePtr = NULL; 460 intstatus = 0;461 intlineCount = 0;462 intfailedLines = 0;460 psS32 status = 0; 461 psS32 lineCount = 0; 462 psS32 failedLines = 0; 463 463 psF64 tempDbl = 0.0; 464 464 psS32 tempInt = 0.0; -
trunk/psLib/src/types/psMetadataConfig.h
r1973 r2204 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10- 06 01:17:39$11 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:30 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 50 50 psMetadata* output, ///< Resulting metadata from read. 51 51 char *extName, ///< File name extension string. 52 intextNum, ///< File name extension number. Starts at 1.52 psS32 extNum, ///< File name extension number. Starts at 1. 53 53 char *fileName ///< Name of file to read. 54 54 ); … … 58 58 * Loads pre-defined settings by parsing a configuration file into a psMetadata structure. 59 59 * 60 * @return int: Number of lines that failed to be read.60 * @return psS32 : Number of lines that failed to be read. 61 61 */ 62 intpsMetadataParseConfig(62 psS32 psMetadataParseConfig( 63 63 psMetadata** md, ///< Resulting metadata from read. 64 64 char *fileName, ///< Name of file to read. 65 bool overwrite ///< Allow overwrite of duplicate specifications.65 psBool overwrite ///< Allow overwrite of duplicate specifications. 66 66 ); 67 67 -
trunk/psLib/src/xml/psXML.c
r2014 r2204 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10- 08 00:43:12$11 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:30 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 104 104 /** Determines if a line is blank (whitespace only) or a commentline. It returns true if so. The input string 105 105 * must be null terminated. */ 106 bool ignoreLine(char *inString)106 psBool ignoreLine(char *inString) 107 107 { 108 108 while(*inString!='\0' && *inString!='#') { … … 119 119 /** Removes leading and trailing whitespace and # characters from a string. The cleaned string is a new null 120 120 * terminated copy of the original input string. */ 121 char *cleanString(char *inString, intsLen)121 char *cleanString(char *inString, psS32 sLen) 122 122 { 123 123 char *ptrB = NULL; … … 149 149 150 150 /** Count repeat occurances of a single character within a line. The input string must be null terminated. */ 151 intrepeatedChars(char *inString, char ch)152 { 153 intcount = 0;151 psS32 repeatedChars(char *inString, char ch) 152 { 153 psS32 count = 0; 154 154 155 155 … … 166 166 /** Returns cleaned token based on delimiter, but not including delimiter. Also changes the pointer location 167 167 * the beginning of the string. Tokens are newly allocated null terminated strings. */ 168 char* getToken(char **inString, char *delimiter, int*status)168 char* getToken(char **inString, char *delimiter, psS32 *status) 169 169 { 170 170 char *cleanToken = NULL; 171 intsLen = 0;171 psS32 sLen = 0; 172 172 173 173 … … 195 195 /** Returns single parsed value as a double precision number. The input string must be cleaned and null 196 196 * terminated. */ 197 double parseValue(char *inString, int*status)197 double parseValue(char *inString, psS32 *status) 198 198 { 199 199 char *end = NULL; … … 212 212 213 213 /** Returns true or false. 'T', 't', '1', 'F', 'f', and '0' are acceptable, parsable variations. */ 214 bool parseBool(char *inString, int*status)215 { 216 bool value = false;214 psBool parseBool(char *inString, psS32 *status) 215 { 216 psBool value = false; 217 217 218 218 … … 229 229 230 230 /** Returns parsed vector filled with with data. The input string must be null terminated. */ 231 psVector* parseVector(char *inString, psElemType elemType, int*status)231 psVector* parseVector(char *inString, psElemType elemType, psS32 *status) 232 232 { 233 233 char *end = NULL; 234 234 char *saveValue = NULL; 235 inti = 0;236 intnumValues = 0;235 psS32 i = 0; 236 psS32 numValues = 0; 237 237 double value = 0.0; 238 238 psVector *vec = NULL; … … 341 341 342 342 343 psMetadata* psMetadataReadHeader(psMetadata* output, char *extName, intextNum, char *fileName)344 { 345 bool tempBool;346 bool success;343 psMetadata* psMetadataReadHeader(psMetadata* output, char *extName, psS32 extNum, char *fileName) 344 { 345 psBool tempBool; 346 psBool success; 347 347 char keyType; 348 348 char keyName[FITS_LINE_SIZE]; … … 350 350 char keyComment[FITS_LINE_SIZE]; 351 351 char fitsErr[MAX_STRING_LENGTH]; 352 inti;353 inthduType = 0;354 intstatus = 0;355 intnumKeys = 0;356 intkeyNum = 0;352 psS32 i; 353 psS32 hduType = 0; 354 psS32 status = 0; 355 psS32 numKeys = 0; 356 psS32 keyNum = 0; 357 357 psMetadataType metadataItemType; 358 358 fitsfile *fd = NULL; … … 449 449 450 450 451 int psMetadataParseConfig(psMetadata** md, char *fileName, bool overwrite)452 { 453 bool tempBool;451 psS32 psMetadataParseConfig(psMetadata** md, char *fileName, psBool overwrite) 452 { 453 psBool tempBool; 454 454 char *line = NULL; 455 455 char *strName = NULL; … … 458 458 char *strComment = NULL; 459 459 char *linePtr = NULL; 460 intstatus = 0;461 intlineCount = 0;462 intfailedLines = 0;460 psS32 status = 0; 461 psS32 lineCount = 0; 462 psS32 failedLines = 0; 463 463 psF64 tempDbl = 0.0; 464 464 psS32 tempInt = 0.0; -
trunk/psLib/src/xml/psXML.h
r1973 r2204 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10- 06 01:17:39$11 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:30 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 50 50 psMetadata* output, ///< Resulting metadata from read. 51 51 char *extName, ///< File name extension string. 52 intextNum, ///< File name extension number. Starts at 1.52 psS32 extNum, ///< File name extension number. Starts at 1. 53 53 char *fileName ///< Name of file to read. 54 54 ); … … 58 58 * Loads pre-defined settings by parsing a configuration file into a psMetadata structure. 59 59 * 60 * @return int: Number of lines that failed to be read.60 * @return psS32 : Number of lines that failed to be read. 61 61 */ 62 intpsMetadataParseConfig(62 psS32 psMetadataParseConfig( 63 63 psMetadata** md, ///< Resulting metadata from read. 64 64 char *fileName, ///< Name of file to read. 65 bool overwrite ///< Allow overwrite of duplicate specifications.65 psBool overwrite ///< Allow overwrite of duplicate specifications. 66 66 ); 67 67 -
trunk/psLib/test/FullUnitTest
r1602 r2204 19 19 # RETURN : integer number of tests which failed 20 20 # 21 # $Revision: 1.1 4$ $Name: not supported by cvs2svn $22 # $Date: 2004- 08-20 00:51:22$21 # $Revision: 1.15 $ $Name: not supported by cvs2svn $ 22 # $Date: 2004-10-27 00:57:31 $ 23 23 # 24 24 # Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 29 29 use Cwd; 30 30 31 # Provides functions for handling longcommand line options31 # Provides functions for handling psS64 command line options 32 32 use Getopt::Long; 33 33 -
trunk/psLib/test/astronomy/tst_psAstrometry.c
r2096 r2204 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-10- 13 23:58:20$7 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-10-27 00:57:31 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 17 17 #include "pslib.h" 18 18 19 static inttestExposureAlloc(void);20 static inttestObservatoryAlloc(void);21 static inttestFPAAlloc(void);22 static inttestChipAlloc(void);23 static inttestCellAlloc(void);24 static inttestReadoutAlloc(void);19 static psS32 testExposureAlloc(void); 20 static psS32 testObservatoryAlloc(void); 21 static psS32 testFPAAlloc(void); 22 static psS32 testChipAlloc(void); 23 static psS32 testCellAlloc(void); 24 static psS32 testReadoutAlloc(void); 25 25 26 26 testDescription tests[] = { … … 34 34 }; 35 35 36 int main(intargc, char* argv[])36 psS32 main(psS32 argc, char* argv[]) 37 37 { 38 38 psLogSetLevel(PS_LOG_INFO); … … 41 41 } 42 42 43 static inttestExposureAlloc(void)43 static psS32 testExposureAlloc(void) 44 44 { 45 45 psTime* now = psTimeGetTime(PS_TIME_UTC); … … 123 123 } 124 124 125 static inttestObservatoryAlloc(void)125 static psS32 testObservatoryAlloc(void) 126 126 { 127 127 char* name = "The Kaiser Royal Observatory"; … … 173 173 } 174 174 175 static inttestFPAAlloc(void)175 static psS32 testFPAAlloc(void) 176 176 { 177 177 … … 220 220 } 221 221 222 for ( intlcv=0; lcv < 8; lcv++) {222 for (psS32 lcv=0; lcv < 8; lcv++) { 223 223 if (fpa->chips->data[lcv] != NULL) { 224 224 psLogMsg(__func__,PS_LOG_ERROR, … … 307 307 */ 308 308 309 for ( intlcv=0; lcv < 8; lcv++) {309 for (psS32 lcv=0; lcv < 8; lcv++) { 310 310 fpa->chips->data[lcv] = psAlloc(4); 311 311 } … … 329 329 } 330 330 331 static inttestChipAlloc(void)331 static psS32 testChipAlloc(void) 332 332 { 333 333 char* name = "The Kaiser Royal Observatory"; … … 372 372 } 373 373 374 for ( intlcv=0; lcv < 8; lcv++) {374 for (psS32 lcv=0; lcv < 8; lcv++) { 375 375 if (chip->cells->data[lcv] != NULL) { 376 376 psLogMsg(__func__,PS_LOG_ERROR, … … 477 477 } 478 478 479 static inttestCellAlloc(void)479 static psS32 testCellAlloc(void) 480 480 { 481 481 char* name = "The Kaiser Royal Observatory"; … … 522 522 } 523 523 524 for ( intlcv=0; lcv < 8; lcv++) {524 for (psS32 lcv=0; lcv < 8; lcv++) { 525 525 if (cell1->readouts->data[lcv] != NULL) { 526 526 psLogMsg(__func__,PS_LOG_ERROR, … … 641 641 } 642 642 643 static inttestReadoutAlloc(void)643 static psS32 testReadoutAlloc(void) 644 644 { 645 645 psImage* image = psImageAlloc(64,64,PS_TYPE_S8); -
trunk/psLib/test/astronomy/tst_psAstrometry01.c
r2109 r2204 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-10- 14 02:05:00$7 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-10-27 00:57:31 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 14 14 #include "pslib.h" 15 15 16 static inttest1( void );17 static inttest2( void );18 static inttest3( void );16 static psS32 test1( void ); 17 static psS32 test2( void ); 18 static psS32 test3( void ); 19 19 20 20 testDescription tests[] = { … … 115 115 psFPA *genSystem() 116 116 { 117 inti;118 intj;119 intk;117 psS32 i; 118 psS32 j; 119 psS32 k; 120 120 psImage *tmpImage; 121 121 // psTime* now = psTimeGetTime(PS_TIME_UTC); … … 170 170 for (k=0;k<NUM_READOUTS;k++) { 171 171 tmpImage = psImageAlloc(READOUT_NUM_COLS, READOUT_NUM_ROWS, PS_TYPE_F32); 172 for ( introw=0;row<READOUT_NUM_ROWS;row++) {173 for( intcol=0;col<READOUT_NUM_COLS;col++) {172 for (psS32 row=0;row<READOUT_NUM_ROWS;row++) { 173 for(psS32 col=0;col<READOUT_NUM_COLS;col++) { 174 174 tmpImage->data.F32[row][col] = (float) ((i * (CHIP_WIDTH + CHIP_GAP)) + 175 175 (j * (CELL_WIDTH + CELL_GAP))); … … 185 185 } 186 186 187 int main( intargc, char* argv[] )187 psS32 main( psS32 argc, char* argv[] ) 188 188 { 189 189 psLogSetLevel( PS_LOG_INFO ); … … 201 201 #define Y0 60.0 202 202 203 inttest1( void )204 { 205 inti;206 intj;203 psS32 test1( void ) 204 { 205 psS32 i; 206 psS32 j; 207 207 psFixedPattern *tmp = NULL; 208 208 float x0 = X0; … … 212 212 psImage *x = psImageAlloc(X_NUM_COLS, X_NUM_ROWS, PS_TYPE_F64); 213 213 psImage *y = psImageAlloc(Y_NUM_COLS, Y_NUM_ROWS, PS_TYPE_F64); 214 inttestStatus = 0;215 intnumPixels = 0;214 psS32 testStatus = 0; 215 psS32 numPixels = 0; 216 216 217 217 for (i=0;i<X_NUM_ROWS;i++) { … … 295 295 } 296 296 297 inttest2()298 { 299 inttestStatus = 0;297 psS32 test2() 298 { 299 psS32 testStatus = 0; 300 300 301 301 psTime* now = psTimeGetTime(PS_TIME_UTC); … … 371 371 } 372 372 373 intprintCell(psCell *cell)373 psS32 printCell(psCell *cell) 374 374 { 375 375 psReadout **readouts = (psReadout **) cell->readouts->data; … … 377 377 378 378 printf("-------------------------------\n"); 379 for ( inti = 0; i < readout->image->numRows ; i++) {380 for ( intj = 0; j < readout->image->numCols ; j++) {379 for (psS32 i = 0; i < readout->image->numRows ; i++) { 380 for (psS32 j = 0; j < readout->image->numCols ; j++) { 381 381 printf("(%.1f) ", readout->image->data.F32[i][j]); 382 382 } … … 415 415 416 416 *****************************************************************************/ 417 inttest3( void )418 { 419 intx;420 inty;417 psS32 test3( void ) 418 { 419 psS32 x; 420 psS32 y; 421 421 psPlane fpaCoord; 422 422 psFPA *myFPA = genSystem(); … … 426 426 psPlane testCoord; 427 427 428 intxReadout = 0;429 intxFPA = 0;430 for ( intchip=0;chip<NUM_CHIPS;chip++) {431 for ( intcell=0;cell<NUM_CELLS;cell++) {428 psS32 xReadout = 0; 429 psS32 xFPA = 0; 430 for (psS32 chip=0;chip<NUM_CHIPS;chip++) { 431 for (psS32 cell=0;cell<NUM_CELLS;cell++) { 432 432 for(x=0;x<CELL_WIDTH;x++) { 433 433 for (y=0;y<CELL_HEIGHT;y++) { … … 444 444 psCoordChipToCell(&cellCoord, &chipCoord, myCell); 445 445 446 if (x != ( int) cellCoord.x) {446 if (x != (psS32) cellCoord.x) { 447 447 printf("ERROR: x coord was %f, should be %d\n", cellCoord.x, x); 448 448 } 449 if (y != ( int) cellCoord.y) {449 if (y != (psS32) cellCoord.y) { 450 450 printf("ERROR: y coord was %f, should be %d\n", cellCoord.y, y); 451 451 } -
trunk/psLib/test/astronomy/tst_psCoord.c
r2201 r2204 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-10-2 6 22:51:56$8 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-10-27 00:57:31 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 15 15 #include "pslib.h" 16 16 17 static inttest1( void );18 static inttest1b( void );19 static inttest1c( void );20 static inttest2( void );21 static inttest3( void );22 static inttest4( void );23 static inttest5( void );24 static inttest6( void );25 static inttest7( void );26 static inttest8( void );27 static inttest20( void );28 static inttest21( void );29 static inttest40( void );30 static inttest41( void );17 static psS32 test1( void ); 18 static psS32 test1b( void ); 19 static psS32 test1c( void ); 20 static psS32 test2( void ); 21 static psS32 test3( void ); 22 static psS32 test4( void ); 23 static psS32 test5( void ); 24 static psS32 test6( void ); 25 static psS32 test7( void ); 26 static psS32 test8( void ); 27 static psS32 test20( void ); 28 static psS32 test21( void ); 29 static psS32 test40( void ); 30 static psS32 test41( void ); 31 31 32 32 testDescription tests[] = { … … 56 56 57 57 58 int main( intargc, char* argv[] )58 psS32 main( psS32 argc, char* argv[] ) 59 59 { 60 60 psLogSetLevel( PS_LOG_INFO ); … … 87 87 #define X0_SMALL 2.0 88 88 89 inttest1( void )89 psS32 test1( void ) 90 90 { 91 91 float tmpF32; 92 inttestStatus = 0;92 psS32 testStatus = 0; 93 93 psSphereTransform *myST = psSphereTransformAlloc(NPLAT, X0_BIG, X0_SMALL); 94 94 … … 122 122 #define NY_TERMS 4 123 123 #define NZ_TERMS 5 124 inttest1b( void )125 { 126 inttestStatus = 0;124 psS32 test1b( void ) 125 { 126 psS32 testStatus = 0; 127 127 psPlaneTransform *myPT = psPlaneTransformAlloc(NX_TERMS, NY_TERMS); 128 128 … … 148 148 return(testStatus); 149 149 } 150 inttest1c( void )151 { 152 inttestStatus = 0;150 psS32 test1c( void ) 151 { 152 psS32 testStatus = 0; 153 153 psPlaneDistort *myPD = psPlaneDistortAlloc(NW_TERMS, NX_TERMS, NY_TERMS, NZ_TERMS); 154 154 … … 195 195 #define N 10 196 196 // We do a simple identity transformation on a few x,y pairs. 197 inttest2( void )198 { 199 inti;200 inttestStatus = 0;197 psS32 test2( void ) 198 { 199 psS32 i; 200 psS32 testStatus = 0; 201 201 psPlane in; 202 202 psPlane out; … … 235 235 // We do a simple identity transformation on a few x,y pairs. For x and y, 236 236 // we add in the COLOR and MAGNITUDE. 237 inttest3( void )238 { 239 inti;240 inttestStatus = 0;237 psS32 test3( void ) 238 { 239 psS32 i; 240 psS32 testStatus = 0; 241 241 psPlane in; 242 242 psPlane out; … … 277 277 #define DEG_INC 30.0 278 278 // We do a simple identity transformation on a few RA, DEC pairs. 279 inttest4( void )280 { 281 inttestStatus = 0;279 psS32 test4( void ) 280 { 281 psS32 testStatus = 0; 282 282 psSphere in; 283 283 psSphere out; … … 315 315 } 316 316 317 inttest5( void )318 { 319 inttestStatus = 0;317 psS32 test5( void ) 318 { 319 psS32 testStatus = 0; 320 320 psTime* now = psTimeGetTime(PS_TIME_UTC); 321 321 struct tm *tm_time = psTimeToTM(now); … … 354 354 355 355 356 inttest6( void )357 { 358 inttestStatus = 0;356 psS32 test6( void ) 357 { 358 psS32 testStatus = 0; 359 359 psTime* now = psTimeGetTime(PS_TIME_UTC); 360 360 struct tm *tm_time = psTimeToTM(now); … … 393 393 394 394 395 inttest7( void )396 { 397 inttestStatus = 0;395 psS32 test7( void ) 396 { 397 psS32 testStatus = 0; 398 398 // XXX: This test code is simply a copy of the original source code. 399 399 double phi = 62.6; … … 426 426 } 427 427 428 inttest8( void )429 { 430 inttestStatus = 0;428 psS32 test8( void ) 429 { 430 psS32 testStatus = 0; 431 431 // XXX: This test code is simply a copy of the original source code. 432 432 double phi = -62.6; … … 459 459 } 460 460 461 inttest20( void )462 { 463 inttestStatus = 0;461 psS32 test20( void ) 462 { 463 psS32 testStatus = 0; 464 464 psSphere in; 465 465 double R; … … 553 553 554 554 #define SPACE_INC 10.0 555 inttest21( void )556 { 557 inttestStatus = 0;555 psS32 test21( void ) 556 { 557 psS32 testStatus = 0; 558 558 psPlane in; 559 559 double R; … … 649 649 } 650 650 651 inttest40( void )652 { 653 inttestStatus = 0;651 psS32 test40( void ) 652 { 653 psS32 testStatus = 0; 654 654 psSphere position1; 655 655 psSphere position2; … … 714 714 } 715 715 716 inttest41( void )717 { 718 inttestStatus = 0;716 psS32 test41( void ) 717 { 718 psS32 testStatus = 0; 719 719 psSphere position1; 720 720 psSphere *position2; -
trunk/psLib/test/astronomy/tst_psMetadataIO.c
r1986 r2204 13 13 * @author Ross Harman, MHPCC 14 14 * 15 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $16 * @date $Date: 2004-10- 06 22:51:31 $15 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-10-27 00:57:31 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 80 80 vec = (psVector*)metadataItem->data.V; 81 81 printf("Key Value: "); 82 for( inti=0; i<vec->nalloc;i++) {82 for(psS32 i=0; i<vec->nalloc;i++) { 83 83 printf("%d ", vec->data.S32[i]); 84 84 } … … 103 103 static void printMetadataTable(psHash *mdTable) 104 104 { 105 inti;105 psS32 i; 106 106 psHashBucket* ptr = NULL; 107 107 for(i=0; i<mdTable->nbucket; i++) { … … 123 123 124 124 125 int main(intargc, char* argv[])125 psS32 main(psS32 argc, char* argv[]) 126 126 { 127 127 // Test A - Read config file with overwrite set true 128 128 printPositiveTestHeader(stdout, "psMetadata", "Test A - Read config file with overwrite set true"); 129 129 psMetadata *metadata1 = NULL; 130 intfailedLines1 = 0;130 psS32 failedLines1 = 0; 131 131 failedLines1 = psMetadataParseConfig(&metadata1, "test.config", true); 132 132 printf("Failed lines: %d Expected: 6\n", failedLines1); … … 138 138 printPositiveTestHeader(stdout, "psMetadata", "Test B - Read config file with overwrite set false"); 139 139 psMetadata *metadata2 = NULL; 140 intfailedLines2 = 0;140 psS32 failedLines2 = 0; 141 141 failedLines2 = psMetadataParseConfig(&metadata2, "test.config", false); 142 142 printf("Failed lines: %d Expected: 7", failedLines2); … … 148 148 printPositiveTestHeader(stdout, "psMetadata", "Test C - Read config file without auto-allocation of metadata"); 149 149 psMetadata *metadata3 = psMetadataAlloc(); 150 intfailedLines3 = 0;150 psS32 failedLines3 = 0; 151 151 failedLines3 = psMetadataParseConfig(&metadata3, "test.config", false); 152 152 printf("Failed lines: %d Expected: 7", failedLines3); … … 176 176 psMemCheckLeaks(0, NULL, stdout); 177 177 psMemCheckCorruption(0); 178 intnBad = psMemCheckCorruption(0);178 psS32 nBad = psMemCheckCorruption(0); 179 179 if(nBad) { 180 180 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/astronomy/tst_psMetadata_01.c
r2153 r2204 17 17 * @author Ross Harman, MHPCC 18 18 * 19 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $20 * @date $Date: 2004-10- 15 19:26:31$19 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 20 * @date $Date: 2004-10-27 00:57:33 $ 21 21 * 22 22 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 96 96 static void printMetadataTable(psHash *mdTable) 97 97 { 98 inti;98 psS32 i; 99 99 psHashBucket* ptr = NULL; 100 100 for(i=0; i<mdTable->nbucket; i++) { … … 116 116 117 117 118 int main(intargc, char* argv[])118 psS32 main(psS32 argc, char* argv[]) 119 119 { 120 120 psMetadata *metadata1 = NULL; … … 262 262 psMemCheckLeaks(0, NULL, stdout); 263 263 psMemCheckCorruption(0); 264 intnBad = psMemCheckCorruption(0);264 psS32 nBad = psMemCheckCorruption(0); 265 265 if(nBad) { 266 266 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/astronomy/tst_psMetadata_02.c
r2012 r2204 14 14 * @author Ross Harman, MHPCC 15 15 * 16 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $17 * @date $Date: 2004-10- 07 22:31:31$16 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2004-10-27 00:57:33 $ 18 18 * 19 19 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 60 60 61 61 62 int main( intargc, char* argv[] )62 psS32 main( psS32 argc, char* argv[] ) 63 63 { 64 64 psMetadataItem *item1 = NULL; … … 136 136 psMemCheckLeaks(0, NULL, stdout); 137 137 psMemCheckCorruption(0); 138 intnBad = psMemCheckCorruption(0);138 psS32 nBad = psMemCheckCorruption(0); 139 139 if(nBad) { 140 140 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/astronomy/tst_psMetadata_03.c
r2018 r2204 14 14 * @author Ross Harman, MHPCC 15 15 * 16 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $17 * @date $Date: 2004-10- 08 01:33:14$16 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2004-10-27 00:57:33 $ 18 18 * 19 19 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 60 60 61 61 62 int main( intargc, char* argv[] )62 psS32 main( psS32 argc, char* argv[] ) 63 63 { 64 64 psMetadataItem *item1 = NULL; … … 231 231 } 232 232 psMemCheckCorruption(0); 233 intnBad = psMemCheckCorruption(0);233 psS32 nBad = psMemCheckCorruption(0); 234 234 if(nBad) { 235 235 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/astronomy/tst_psMetadata_04.c
r2023 r2204 18 18 * @author Ross Harman, MHPCC 19 19 * 20 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $21 * @date $Date: 2004-10- 08 20:53:21$20 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 21 * @date $Date: 2004-10-27 00:57:33 $ 22 22 * 23 23 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 64 64 65 65 66 int main( intargc, char* argv[] )66 psS32 main( psS32 argc, char* argv[] ) 67 67 { 68 68 psMetadataItem *item1 = NULL; … … 201 201 } 202 202 psMemCheckCorruption(0); 203 intnBad = psMemCheckCorruption(0);203 psS32 nBad = psMemCheckCorruption(0); 204 204 if(nBad) { 205 205 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/astronomy/tst_psMetadata_05.c
r2049 r2204 22 22 * @author Ross Harman, MHPCC 23 23 * 24 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $25 * @date $Date: 2004-10- 12 01:40:32$24 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 25 * @date $Date: 2004-10-27 00:57:33 $ 26 26 * 27 27 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 68 68 69 69 70 int main( intargc, char* argv[] )70 psS32 main( psS32 argc, char* argv[] ) 71 71 { 72 longdata;72 psS64 data; 73 73 psF32 fpdata; 74 74 psMetadataItem *item1 = NULL; … … 271 271 } 272 272 psMemCheckCorruption(0); 273 intnBad = psMemCheckCorruption(0);273 psS32 nBad = psMemCheckCorruption(0); 274 274 if(nBad) { 275 275 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/astronomy/tst_psMetadata_06.c
r2050 r2204 13 13 * @author Ross Harman, MHPCC 14 14 * 15 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $16 * @date $Date: 2004-10- 12 01:54:00$15 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-10-27 00:57:33 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 59 59 60 60 61 int main( intargc, char* argv[] )61 psS32 main( psS32 argc, char* argv[] ) 62 62 { 63 63 psMetadataItem *item1a = NULL; … … 134 134 } 135 135 psMemCheckCorruption(0); 136 intnBad = psMemCheckCorruption(0);136 psS32 nBad = psMemCheckCorruption(0); 137 137 if(nBad) { 138 138 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/astronomy/tst_psTime_01.c
r2048 r2204 23 23 * @author Ross Harman, MHPCC 24 24 * 25 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $26 * @date $Date: 2004-10- 12 01:34:09$25 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 26 * @date $Date: 2004-10-27 00:57:33 $ 27 27 * 28 28 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 34 34 #include <string.h> 35 35 36 int main(intargc, char* argv[])36 psS32 main(psS32 argc, char* argv[]) 37 37 { 38 38 psTime *testTime; … … 55 55 // Test B - Print test time 56 56 printPositiveTestHeader(stdout,"psTime", "Print test time"); 57 printf("Test time: Seconds = %ld Microseconds = %ld\n", ( long)testTime->sec, (long)testTime->usec);57 printf("Test time: Seconds = %ld Microseconds = %ld\n", (psS64)testTime->sec, (psS64)testTime->usec); 58 58 printFooter(stdout, "psTime", "Print test time", true); 59 59 … … 75 75 psTime *timeD = NULL; 76 76 timeD = psTimeFromISOTime(isoString); 77 printf("psTime: Seconds = %ld Microseconds = %d\n", ( long)timeD->sec, (psU32)timeD->usec);77 printf("psTime: Seconds = %ld Microseconds = %d\n", (psS64)timeD->sec, (psU32)timeD->usec); 78 78 psFree(isoString); 79 79 psFree(timeD); … … 90 90 timeE = psTimeConvert(timeE, PS_TIME_UTC); 91 91 psFree(timeE); 92 printf("psTime: Seconds = %ld Microseconds = %d\n", ( long)timeE->sec, (psU32)timeE->usec);92 printf("psTime: Seconds = %ld Microseconds = %d\n", (psS64)timeE->sec, (psU32)timeE->usec); 93 93 printFooter(stdout, "psTime", "Convert psTime time to UTC time", true); 94 94 … … 103 103 timeF = psTimeConvert(timeF, PS_TIME_TAI); 104 104 psFree(timeF); 105 printf("psTime: Seconds = %ld Microseconds = %d\n", ( long)timeF->sec, (psU32)timeF->usec);105 printf("psTime: Seconds = %ld Microseconds = %d\n", (psS64)timeF->sec, (psU32)timeF->usec); 106 106 printFooter(stdout, "psTime", "Convert UTC time to psTime", true); 107 107 … … 119 119 psTime *timeH = NULL; 120 120 timeH = psTimeFromMJD(mjdTime); 121 printf("psTime: Seconds = %ld Microseconds = %d\n", ( long)timeH->sec, (psU32)timeH->usec);121 printf("psTime: Seconds = %ld Microseconds = %d\n", (psS64)timeH->sec, (psU32)timeH->usec); 122 122 psFree(timeH); 123 123 printFooter(stdout, "psTime", "Convert MJD time to psTime", true); … … 136 136 psTime *timeJ = NULL; 137 137 timeJ = psTimeFromJD(jdTime); 138 printf("psTime: Seconds = %ld Microseconds = %d\n", ( long)timeJ->sec, (psU32)timeJ->usec);138 printf("psTime: Seconds = %ld Microseconds = %d\n", (psS64)timeJ->sec, (psU32)timeJ->usec); 139 139 psFree(timeJ); 140 140 printFooter(stdout, "psTime", "Convert JD time to psTime", true); … … 145 145 struct timeval timevalTime; 146 146 timevalTime = psTimeToTimeval(testTime); 147 printf("timevalTime: Seconds = %ld Microseconds = %ld\n", ( long)timevalTime.tv_sec, (long)timevalTime.tv_usec);147 printf("timevalTime: Seconds = %ld Microseconds = %ld\n", (psS64)timevalTime.tv_sec, (psS64)timevalTime.tv_usec); 148 148 printFooter(stdout, "psTime", "Convert psTime to timeval time", true); 149 149 … … 153 153 psTime *timeL = NULL; 154 154 timeL = psTimeFromTimeval(&timevalTime); 155 printf("psTime: Seconds = %ld Microseconds = %d\n", ( long)timeL->sec, (psU32)timeL->usec);155 printf("psTime: Seconds = %ld Microseconds = %d\n", (psS64)timeL->sec, (psU32)timeL->usec); 156 156 psFree(timeL); 157 157 printFooter(stdout, "psTime", "Convert timeval time to psTime", true); … … 176 176 psTime *timeN = NULL; 177 177 timeN = psTimeFromTM(tmTime); 178 printf("psTime: Seconds = %ld Microseconds = %d\n", ( long)timeN->sec, (psU32)timeN->usec);178 printf("psTime: Seconds = %ld Microseconds = %d\n", (psS64)timeN->sec, (psU32)timeN->usec); 179 179 psFree(timeN); 180 180 psFree(tmTime); … … 198 198 psMemCheckLeaks(0, NULL, stdout); 199 199 psMemCheckCorruption(0); 200 intnBad = psMemCheckCorruption(0);200 psS32 nBad = psMemCheckCorruption(0); 201 201 if(nBad) { 202 202 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/astronomy/tst_psTime_02.c
r2177 r2204 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-10-2 0 20:02:46$12 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:33 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 20 20 #include "psTest.h" 21 21 22 int main(intargc, char* argv[])22 psS32 main(psS32 argc, char* argv[]) 23 23 { 24 24 … … 44 44 psMemCheckLeaks(0, NULL, stdout); 45 45 psMemCheckCorruption(0); 46 intnBad = psMemCheckCorruption(0);46 psS32 nBad = psMemCheckCorruption(0); 47 47 if(nBad) { 48 48 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/astronomy/tst_psTime_03.c
r2177 r2204 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-10-2 0 20:03:10$14 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-10-27 00:57:33 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 23 23 24 24 #define PRINT_TIME(TEXT,TIME) \ 25 printf("%s Seconds = %ld Microseconds = %u\n", TEXT, ( long int)TIME->sec, TIME->usec);25 printf("%s Seconds = %ld Microseconds = %u\n", TEXT, (psS64)TIME->sec, TIME->usec); 26 26 27 int main(intargc, char* argv[])27 psS32 main(psS32 argc, char* argv[]) 28 28 { 29 29 … … 135 135 psMemCheckLeaks(0, NULL, stdout); 136 136 psMemCheckCorruption(0); 137 intnBad = psMemCheckCorruption(0);137 psS32 nBad = psMemCheckCorruption(0); 138 138 if(nBad) { 139 139 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/collections/tst_psArray.c
r1920 r2204 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $15 * @date $Date: 2004- 09-28 23:26:49$14 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-10-27 00:57:33 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 26 26 typedef struct 27 27 { 28 intx;28 psS32 x; 29 29 float y; 30 30 } … … 32 32 33 33 34 int main(intargc,35 char* argv[])34 psS32 main(psS32 argc, 35 char* argv[]) 36 36 { 37 37 // Create array of pointers … … 51 51 // Test B - Add data to void pointer array 52 52 printPositiveTestHeader(stdout, "psArray", "Add data to void pointer array"); 53 for( inti = 0; i < 5; i++) {53 for(psS32 i = 0; i < 5; i++) { 54 54 testStruct *ts = psAlloc(sizeof(testStruct)); 55 55 ts->x = 10*i; … … 60 60 } 61 61 62 for( inti = 0; i < 5; i++) {62 for(psS32 i = 0; i < 5; i++) { 63 63 testStruct *ts = (testStruct*)psArr->data[i]; 64 64 printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y); … … 85 85 psArr = psArrayRealloc(psArr,10); 86 86 printf("Adding more elements to void pointer array...\n"); 87 for( inti = 5; i < 10; i++) {87 for(psS32 i = 5; i < 10; i++) { 88 88 testStruct *ts = psAlloc(sizeof(testStruct)); 89 89 ts->x = 10*i; … … 94 94 psMemIncrRefCounter(ts); 95 95 } 96 for( inti = 0; i < 10; i++) {96 for(psS32 i = 0; i < 10; i++) { 97 97 testStruct *ts = (testStruct*)psArr->data[i]; 98 98 printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y); … … 118 118 printPositiveTestHeader(stdout,"psArray","Reallocate void pointer array smaller"); 119 119 psArr = psArrayRealloc(psArr,3); 120 for( inti = 0; i < 3; i++) {120 for(psS32 i = 0; i < 3; i++) { 121 121 testStruct *ts = (testStruct*)psArr->data[i]; 122 122 printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y); … … 142 142 printPositiveTestHeader(stdout, "psArray", "Free void pointer array"); 143 143 psFree(psArr); 144 for( inti = 0; i < 10; i++) {144 for(psS32 i = 0; i < 10; i++) { 145 145 psFree(mySt[i]); 146 146 } 147 147 psMemCheckLeaks(0, NULL, stdout); 148 intnBad = psMemCheckCorruption(0);148 psS32 nBad = psMemCheckCorruption(0); 149 149 if(nBad) { 150 150 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/collections/tst_psBitSet.c
r1807 r2204 17 17 * @author Ross Harman, MHPCC 18 18 * 19 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $20 * @date $Date: 2004- 09-14 20:01:52$19 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 20 * @date $Date: 2004-10-27 00:57:33 $ 21 21 * 22 22 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 27 27 #include "psTest.h" 28 28 29 static inttestBitSet01a(void);30 static inttestBitSet01b(void);31 static inttestBitSet01c(void);32 static inttestBitSet02(void);33 static inttestBitSet03(void);34 static inttestBitSet04(void);35 static inttestBitSet05(void);36 static inttestBitSet06(void);29 static psS32 testBitSet01a(void); 30 static psS32 testBitSet01b(void); 31 static psS32 testBitSet01c(void); 32 static psS32 testBitSet02(void); 33 static psS32 testBitSet03(void); 34 static psS32 testBitSet04(void); 35 static psS32 testBitSet05(void); 36 static psS32 testBitSet06(void); 37 37 38 38 testDescription tests[] = { … … 50 50 51 51 52 int main( intargc, char* argv[] )52 psS32 main( psS32 argc, char* argv[] ) 53 53 { 54 54 psLogSetLevel( PS_LOG_INFO ); … … 57 57 } 58 58 59 inttestBitSet01a(void)59 psS32 testBitSet01a(void) 60 60 { 61 61 psErr* err; … … 109 109 } 110 110 111 inttestBitSet01b(void)111 psS32 testBitSet01b(void) 112 112 { 113 113 char *binOut = NULL; … … 212 212 } 213 213 214 static inttestBitSet01c(void)214 static psS32 testBitSet01c(void) 215 215 { 216 216 psBitSet* bs = psBitSetAlloc(24); … … 275 275 } 276 276 277 inttestBitSet02()277 psS32 testBitSet02() 278 278 { 279 279 char *binOut1 = NULL; … … 284 284 psBitSet* bs2 = psBitSetAlloc(24); 285 285 psBitSet* and = psBitSetAlloc(24); 286 for( inti=0; i<24; i++) {286 for(psS32 i=0; i<24; i++) { 287 287 if ((i & 2) == 0) { 288 288 bs1 = psBitSetSet(bs1, i); … … 312 312 } 313 313 314 for( inti=0; i<24; i++) {315 bool truth = psBitSetTest(and,i);316 bool res = psBitSetTest(outbs,i);314 for(psS32 i=0; i<24; i++) { 315 psBool truth = psBitSetTest(and,i); 316 psBool res = psBitSetTest(outbs,i); 317 317 if ( res != truth) { 318 318 binOut1 = psBitSetToString(bs1); … … 331 331 psAbort(__func__,"psBitSetOp failed to create a new psBitSet for the result"); 332 332 } 333 for( inti=0; i<24; i++) {334 bool truth = psBitSetTest(and,i);335 bool res = psBitSetTest(outbs,i);333 for(psS32 i=0; i<24; i++) { 334 psBool truth = psBitSetTest(and,i); 335 psBool res = psBitSetTest(outbs,i); 336 336 if ( res != truth) { 337 337 binOut1 = psBitSetToString(bs1); … … 351 351 } 352 352 353 static inttestBitSet03(void)353 static psS32 testBitSet03(void) 354 354 { 355 355 char *binOut1 = NULL; … … 360 360 psBitSet* bs2 = psBitSetAlloc(24); 361 361 psBitSet* or = psBitSetAlloc(24); 362 for( inti=0; i<24; i++) {362 for(psS32 i=0; i<24; i++) { 363 363 if ((i/2) % 2) { 364 364 bs1 = psBitSetSet(bs1, i); … … 389 389 } 390 390 391 for( inti=0; i<24; i++) {392 bool truth = psBitSetTest(or,i);393 bool res = psBitSetTest(outbs,i);391 for(psS32 i=0; i<24; i++) { 392 psBool truth = psBitSetTest(or,i); 393 psBool res = psBitSetTest(outbs,i); 394 394 if ( res != truth) { 395 395 binOut1 = psBitSetToString(bs1); … … 408 408 psAbort(__func__,"psBitSetOp failed to create a new psBitSet for the result"); 409 409 } 410 for( inti=0; i<24; i++) {411 bool truth = psBitSetTest(or,i);412 bool res = psBitSetTest(outbs,i);410 for(psS32 i=0; i<24; i++) { 411 psBool truth = psBitSetTest(or,i); 412 psBool res = psBitSetTest(outbs,i); 413 413 if ( res != truth) { 414 414 binOut1 = psBitSetToString(bs1); … … 429 429 } 430 430 431 static inttestBitSet04(void)431 static psS32 testBitSet04(void) 432 432 { 433 433 char *binOut1 = NULL; … … 438 438 psBitSet* bs2 = psBitSetAlloc(24); 439 439 psBitSet* xor = psBitSetAlloc(24); 440 for( inti=0; i<24; i++) {440 for(psS32 i=0; i<24; i++) { 441 441 if ((i/2) % 2) { 442 442 bs1 = psBitSetSet(bs1, i); … … 467 467 } 468 468 469 for( inti=0; i<24; i++) {470 bool truth = psBitSetTest(xor,i);471 bool res = psBitSetTest(outbs,i);469 for(psS32 i=0; i<24; i++) { 470 psBool truth = psBitSetTest(xor,i); 471 psBool res = psBitSetTest(outbs,i); 472 472 if ( res != truth) { 473 473 binOut1 = psBitSetToString(bs1); … … 486 486 psAbort(__func__,"psBitSetOp failed to create a new psBitSet for the result"); 487 487 } 488 for( inti=0; i<24; i++) {489 bool truth = psBitSetTest(xor,i);490 bool res = psBitSetTest(outbs,i);488 for(psS32 i=0; i<24; i++) { 489 psBool truth = psBitSetTest(xor,i); 490 psBool res = psBitSetTest(outbs,i); 491 491 if ( res != truth) { 492 492 binOut1 = psBitSetToString(bs1); … … 507 507 } 508 508 509 static inttestBitSet05(void)509 static psS32 testBitSet05(void) 510 510 { 511 511 char *binOut1 = NULL; … … 514 514 psBitSet* bs1 = psBitSetAlloc(24); 515 515 psBitSet* not = psBitSetAlloc(24); 516 for( inti=0; i<24; i++) {516 for(psS32 i=0; i<24; i++) { 517 517 if (i % 2) { 518 518 bs1 = psBitSetSet(bs1, i); … … 538 538 } 539 539 540 for( inti=0; i<24; i++) {541 bool truth = psBitSetTest(not,i);542 bool res = psBitSetTest(outbs,i);540 for(psS32 i=0; i<24; i++) { 541 psBool truth = psBitSetTest(not,i); 542 psBool res = psBitSetTest(outbs,i); 543 543 if ( res != truth) { 544 544 binOut1 = psBitSetToString(bs1); … … 556 556 psAbort(__func__,"psBitSetOp failed to create a new psBitSet for the result"); 557 557 } 558 for( inti=0; i<24; i++) {559 bool truth = psBitSetTest(not,i);560 bool res = psBitSetTest(outbs,i);558 for(psS32 i=0; i<24; i++) { 559 psBool truth = psBitSetTest(not,i); 560 psBool res = psBitSetTest(outbs,i); 561 561 if ( res != truth) { 562 562 binOut1 = psBitSetToString(bs1); … … 575 575 } 576 576 577 static inttestBitSet06(void)577 static psS32 testBitSet06(void) 578 578 { 579 579 psErr* err; -
trunk/psLib/test/collections/tst_psHash00.c
r1421 r2204 8 8 #include "psHash.h" 9 9 #define NUM_HASH_TABLE_BUCKETS 10 10 intmain()10 psS32 main() 11 11 { 12 12 psHash *myHashTable = NULL; 13 inttestStatus = true;14 inti = 0;15 intcurrentId = psMemGetId();16 intmemLeaks = 0;13 psS32 testStatus = true; 14 psS32 i = 0; 15 psS32 currentId = psMemGetId(); 16 psS32 memLeaks = 0; 17 17 printPositiveTestHeader(stdout, 18 18 "psHash functions", -
trunk/psLib/test/collections/tst_psHash01.c
r1811 r2204 7 7 #include "psHash.h" 8 8 #define NUM_HASH_TABLE_BUCKETS 100 9 intimGlobal = 0;9 psS32 imGlobal = 0; 10 10 11 11 typedef struct … … 32 32 } 33 33 34 intmain()34 psS32 main() 35 35 { 36 36 psHash *myHashTable = NULL; 37 inttestStatus = true;38 intcurrentId = psMemGetId();37 psS32 testStatus = true; 38 psS32 currentId = psMemGetId(); 39 39 ID* id = NULL; 40 intmemLeaks = 0;40 psS32 memLeaks = 0; 41 41 42 42 printPositiveTestHeader(stdout, -
trunk/psLib/test/collections/tst_psHash02.c
r1421 r2204 12 12 #include "psHash.h" 13 13 #define NUM_HASH_TABLE_BUCKETS 100 14 intimGlobal = 0;14 psS32 imGlobal = 0; 15 15 16 16 typedef struct … … 36 36 } 37 37 38 intmain()38 psS32 main() 39 39 { 40 40 psHash *myHashTable = NULL; 41 inttestStatus = true;42 inti = 0;41 psS32 testStatus = true; 42 psS32 i = 0; 43 43 ID *id = NULL; 44 44 char *myKeys[] = {"ENTRY00", "ENTRY01", "ENTRY02", "ENTRY03", NULL … … 46 46 char *myData[] = {"IDA", "IDB", "IDC", "IDD", NULL 47 47 }; 48 intcurrentId = psMemGetId();49 intmemLeaks = 0;48 psS32 currentId = psMemGetId(); 49 psS32 memLeaks = 0; 50 50 51 51 printPositiveTestHeader(stdout, -
trunk/psLib/test/collections/tst_psHash03.c
r1811 r2204 11 11 #include "psMemory.h" 12 12 #define NUM_HASH_TABLE_BUCKETS 100 13 intimGlobal = 0;14 intcurrentId = 0;13 psS32 imGlobal = 0; 14 psS32 currentId = 0; 15 15 16 16 typedef struct … … 27 27 psMemBlock **memBlocks = NULL; 28 28 psMemBlock *tmp = NULL; 29 intnumBlocks = 0;29 psS32 numBlocks = 0; 30 30 31 31 numBlocks = psMemCheckLeaks(currentId, &memBlocks, NULL); … … 36 36 if (memBlocks != NULL) { 37 37 for (tmp = *memBlocks; tmp != NULL; tmp = tmp->nextBlock) { 38 printf("%d ", ( int) tmp->id);38 printf("%d ", (psS32) tmp->id); 39 39 } 40 40 } … … 62 62 } 63 63 64 intmain()64 psS32 main() 65 65 { 66 66 psHash *myHashTable = NULL; 67 inttestStatus = true;68 inti = 0;69 intTotalKeys = 0;70 bool retVal = false;67 psS32 testStatus = true; 68 psS32 i = 0; 69 psS32 TotalKeys = 0; 70 psBool retVal = false; 71 71 ID *id = NULL; 72 72 ID *ids[4]; … … 75 75 char *myData[] = {"IDA", "IDB", "IDC", "IDD", NULL 76 76 }; 77 intmemLeaks = 0;77 psS32 memLeaks = 0; 78 78 79 79 currentId = psMemGetId(); -
trunk/psLib/test/collections/tst_psHash04.c
r1421 r2204 7 7 #include "psHash.h" 8 8 #define NUM_HASH_TABLE_BUCKETS 100 9 intimGlobal = 0;9 psS32 imGlobal = 0; 10 10 11 11 typedef struct … … 32 32 } 33 33 34 intmain()34 psS32 main() 35 35 { 36 36 psHash *myHashTable = NULL; 37 inttestStatus = true;38 inti = 0;37 psS32 testStatus = true; 38 psS32 i = 0; 39 39 char *myKeys[] = {"ENTRY00", "ENTRY01", "ENTRY02", "ENTRY03", NULL 40 40 }; 41 41 char *myData[] = {"IDA", "IDB", "IDC", "IDD", NULL 42 42 }; 43 intcurrentId = psMemGetId();44 intmemLeaks = 0;43 psS32 currentId = psMemGetId(); 44 psS32 memLeaks = 0; 45 45 psList *myLinkList = NULL; 46 46 psListElem *tmp = NULL; -
trunk/psLib/test/collections/tst_psList.c
r1749 r2204 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2004- 09-09 02:24:59$8 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-10-27 00:57:33 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 19 19 20 static inttestListAlloc(void);21 static inttestListAdd(void);22 static inttestListGet(void);23 static inttestListRemove(void);24 static inttestListConvert(void);25 static inttestListIterator(void);26 static inttestListFree(void);27 static inttestListSort(void);20 static psS32 testListAlloc(void); 21 static psS32 testListAdd(void); 22 static psS32 testListGet(void); 23 static psS32 testListRemove(void); 24 static psS32 testListConvert(void); 25 static psS32 testListIterator(void); 26 static psS32 testListFree(void); 27 static psS32 testListSort(void); 28 28 29 29 testDescription tests[] = { … … 39 39 }; 40 40 41 int main(intargc, char* argv[])41 psS32 main(psS32 argc, char* argv[]) 42 42 { 43 43 psLogSetLevel(PS_LOG_INFO); … … 50 50 } 51 51 52 inttestListAlloc(void)52 psS32 testListAlloc(void) 53 53 { 54 54 psList* list; 55 intref;55 psS32 ref; 56 56 float* data; 57 57 … … 117 117 } 118 118 119 inttestListAdd(void)119 psS32 testListAdd(void) 120 120 { 121 121 psList* list = NULL; 122 int* data = NULL;122 psS32* data = NULL; 123 123 124 124 psLogMsg(__func__,PS_LOG_INFO,"psListAdd shall add an element to list"); … … 134 134 */ 135 135 136 data = psAlloc(sizeof( int));136 data = psAlloc(sizeof(psS32)); 137 137 *data = 1; 138 138 … … 161 161 162 162 // 3. where is PS_LIST_HEAD or PS_LIST_TAIL 163 data = psAlloc(sizeof( int));163 data = psAlloc(sizeof(psS32)); 164 164 *data = 2; 165 165 if ( ! psListAdd(list,PS_LIST_HEAD,data) ) { … … 181 181 182 182 // verify that the head is the inserted data item 183 if (*( int*)list->head->data != 2) {183 if (*(psS32*)list->head->data != 2) { 184 184 psError(__func__,"psListAdd with PS_LIST_HEAD didn't insert at the head."); 185 185 return 5; 186 186 } 187 187 188 data = psAlloc(sizeof( int));188 data = psAlloc(sizeof(psS32)); 189 189 *data = 3; 190 190 if ( ! psListAdd(list,PS_LIST_TAIL,data) ) { … … 205 205 206 206 // verify that the head is still the same 207 if (*( int*)list->head->data != 2) {207 if (*(psS32*)list->head->data != 2) { 208 208 psError(__func__,"psListAdd with PS_LIST_TAIL modified the head."); 209 209 return 7; … … 211 211 212 212 // verify that the tail is the data item inserted 213 if (*( int*)list->tail->data != 3) {213 if (*(psS32*)list->tail->data != 3) { 214 214 psError(__func__,"psListAdd with PS_LIST_TAIL didn't insert at the tail."); 215 215 return 8; … … 218 218 // 4. where is not PS_LIST_* but <0 219 219 220 data = psAlloc(sizeof( int));220 data = psAlloc(sizeof(psS32)); 221 221 *data = 4; 222 222 psLogMsg(__func__,PS_LOG_INFO,"Following should error with invalid insert location"); … … 239 239 240 240 // 5. where is >0 241 data = psAlloc(sizeof( int));241 data = psAlloc(sizeof(psS32)); 242 242 *data = 5; 243 243 … … 253 253 psFree(data); 254 254 // verify that the size incremented 255 if (list->size != 4 || *( int*)list->head->next->data != 5) {255 if (list->size != 4 || *(psS32*)list->head->next->data != 5) { 256 256 printListInt(list); 257 257 psError(__func__,"psListAdd didn't insert to position #1."); … … 259 259 } 260 260 261 data = psAlloc(sizeof( int));261 data = psAlloc(sizeof(psS32)); 262 262 *data = 6; 263 263 if ( ! psListAdd(list,3,data) ) { … … 271 271 psFree(data); 272 272 // verify that the size incremented 273 if (list->size != 5 || *( int*)list->head->next->next->next->data != 6) {273 if (list->size != 5 || *(psS32 *)list->head->next->next->next->data != 6) { 274 274 printListInt(list); 275 275 psError(__func__,"psListAdd didn't insert to position #4."); … … 277 277 } 278 278 279 data = psAlloc(sizeof( int));279 data = psAlloc(sizeof(psS32)); 280 280 *data = 7; 281 281 if ( ! psListAdd(list,2,data) ) { … … 289 289 psFree(data); 290 290 // verify that the size incremented 291 if (list->size != 6 || *( int*)list->head->next->next->data != 7) {291 if (list->size != 6 || *(psS32 *)list->head->next->next->data != 7) { 292 292 printListInt(list); 293 293 psError(__func__,"psListAdd didn't insert to position #2."); … … 295 295 } 296 296 297 data = psAlloc(sizeof( int));297 data = psAlloc(sizeof(psS32)); 298 298 *data = 7; 299 299 psLogMsg(__func__,PS_LOG_INFO,"Following should be a warning."); … … 325 325 void printListInt(psList* list) 326 326 { 327 int* data = NULL;328 bool first = true;327 psS32* data = NULL; 328 psBool first = true; 329 329 330 330 psListSetIterator(list,PS_LIST_HEAD); … … 333 333 while ( data != NULL ) { 334 334 if (!first) { 335 printf(", %d",*( int*)data);335 printf(", %d",*(psS32*)data); 336 336 } else { 337 printf("%d",*( int*)data);337 printf("%d",*(psS32*)data); 338 338 first = false; 339 339 } … … 345 345 346 346 347 inttestListGet(void)347 psS32 testListGet(void) 348 348 { 349 349 psList* list = NULL; 350 int* data;350 psS32* data; 351 351 352 352 /* … … 371 371 372 372 // create a list 373 data = psAlloc(sizeof( int));373 data = psAlloc(sizeof(psS32)); 374 374 *data = 0; 375 375 list = psListAlloc(data); 376 376 psFree(data); 377 377 378 data = psAlloc(sizeof( int));378 data = psAlloc(sizeof(psS32)); 379 379 *data = 1; 380 380 psListAdd(list,PS_LIST_TAIL,data); 381 381 psFree(data); 382 382 383 data = psAlloc(sizeof( int));383 data = psAlloc(sizeof(psS32)); 384 384 *data = 2; 385 385 psListAdd(list,PS_LIST_TAIL,data); 386 386 psFree(data); 387 387 388 data = psAlloc(sizeof( int));388 data = psAlloc(sizeof(psS32)); 389 389 *data = 3; 390 390 psListAdd(list,PS_LIST_TAIL,data); … … 392 392 393 393 // 2. which>0 and which<list.n. 394 data = ( int*)psListGet(list,3);394 data = (psS32*)psListGet(list,3); 395 395 if (data == NULL || *data != 3) { 396 396 psError(__func__,"psListGet failed with which=3"); 397 397 return 2; 398 398 } 399 data = ( int*)psListGet(list,1);399 data = (psS32*)psListGet(list,1); 400 400 if (data == NULL || *data != 1) { 401 401 psError(__func__,"psListGet failed with which=1"); … … 404 404 405 405 // 3. which>=list.n. 406 data = ( int*)psListGet(list,5);406 data = (psS32*)psListGet(list,5); 407 407 if (data != NULL) { 408 408 psError(__func__,"psListGet failed with which=5"); 409 409 return 4; 410 410 } 411 data = ( int*)psListGet(list,4);411 data = (psS32*)psListGet(list,4); 412 412 if (data != NULL) { 413 413 psError(__func__,"psListGet failed with which=4"); … … 416 416 417 417 // 4. which=PS_LIST_HEAD 418 data = ( int*)psListGet(list,PS_LIST_HEAD);418 data = (psS32*)psListGet(list,PS_LIST_HEAD); 419 419 if (data == NULL || *data != 0) { 420 420 psError(__func__,"psListGet failed with which=PS_LIST_HEAD"); … … 423 423 424 424 // 5. which=PS_LIST_NEXT 425 data = ( int*)psListGet(list,PS_LIST_NEXT);425 data = (psS32*)psListGet(list,PS_LIST_NEXT); 426 426 if (data == NULL || *data != 1) { 427 427 psError(__func__,"psListGet failed with which=PS_LIST_NEXT"); … … 430 430 431 431 // 6. which=PS_LIST_TAIL 432 data = ( int*)psListGet(list,PS_LIST_TAIL);432 data = (psS32*)psListGet(list,PS_LIST_TAIL); 433 433 if (data == NULL || *data != 3) { 434 434 psError(__func__,"psListGet failed with which=PS_LIST_TAIL"); … … 437 437 438 438 // 7. which=PS_LIST_PREV 439 data = ( int*)psListGet(list,PS_LIST_PREVIOUS);439 data = (psS32*)psListGet(list,PS_LIST_PREVIOUS); 440 440 if (data == NULL || *data != 2) { 441 441 psError(__func__,"psListGet failed with which=PS_LIST_PREV"); … … 448 448 } 449 449 450 inttestListRemove(void)450 psS32 testListRemove(void) 451 451 { 452 452 psList* list = NULL; 453 int* data;453 psS32* data; 454 454 455 455 /* … … 480 480 list = psListAlloc(NULL); 481 481 482 for ( intlcv=0;lcv<15;lcv++) {483 data = psAlloc(sizeof( int));482 for (psS32 lcv=0;lcv<15;lcv++) { 483 data = psAlloc(sizeof(psS32)); 484 484 *data = lcv; 485 485 psListAdd(list,PS_LIST_TAIL,data); … … 682 682 } 683 683 684 inttestListConvert(void)684 psS32 testListConvert(void) 685 685 { 686 686 687 687 psList* list = NULL; 688 688 psArray* arr = NULL; 689 int* data;689 psS32* data; 690 690 691 691 /* 692 692 array=psListToArray(list) shall take each element of the list, increment 693 their reference, and insert them into the returned fresh void*array.693 their reference, and insert them into the returned fresh psPtr array. 694 694 The list shall not be changed, except for the element reference increment. 695 695 */ … … 699 699 // create a list 700 700 list = psListAlloc(NULL); 701 for ( intlcv=0;lcv<15;lcv++) {702 data = psAlloc(sizeof( int));701 for (psS32 lcv=0;lcv<15;lcv++) { 702 data = psAlloc(sizeof(psS32)); 703 703 *data = lcv; 704 704 psListAdd(list,PS_LIST_TAIL,data); … … 712 712 return 1; 713 713 } 714 for ( inti=0;i<arr->n;i++) {715 if (i != *( int*)arr->data[i]) {714 for (psS32 i=0;i<arr->n;i++) { 715 if (i != *(psS32*)arr->data[i]) { 716 716 psError(__func__,"Element %d of array is incorrect (%d).", 717 i,*( int*)arr->data[i]);717 i,*(psS32*)arr->data[i]); 718 718 return 1; 719 719 } 720 if (i != *( int*)psListGet(list,i)) {720 if (i != *(psS32*)psListGet(list,i)) { 721 721 psError(__func__,"Element %d of list is incorrect (%d).", 722 i,*( int*)arr->data[i]);722 i,*(psS32*)arr->data[i]); 723 723 return 1; 724 724 } … … 738 738 arr = psArrayAlloc(15); 739 739 arr->n = arr->nalloc; 740 for ( intlcv=0;lcv<15;lcv++) {741 data = psAlloc(sizeof( int));740 for (psS32 lcv=0;lcv<15;lcv++) { 741 data = psAlloc(sizeof(psS32)); 742 742 *data = lcv; 743 743 arr->data[lcv] = data; … … 750 750 return 1; 751 751 } 752 for ( inti=0;i<arr->n;i++) {753 if (i != *( int*)arr->data[i]) {752 for (psS32 i=0;i<arr->n;i++) { 753 if (i != *(psS32*)arr->data[i]) { 754 754 psError(__func__,"Element %d of array is incorrect (%d).", 755 i,*( int*)arr->data[i]);755 i,*(psS32*)arr->data[i]); 756 756 return 1; 757 757 } 758 if (i != *( int*)psListGet(list,i)) {758 if (i != *(psS32*)psListGet(list,i)) { 759 759 psError(__func__,"Element %d of list is incorrect (%d).", 760 i,*( int*)arr->data[i]);760 i,*(psS32*)arr->data[i]); 761 761 return 1; 762 762 } … … 810 810 } 811 811 812 inttestListIterator(void)812 psS32 testListIterator(void) 813 813 { 814 814 psList* list = NULL; 815 int* data;815 psS32* data; 816 816 817 817 psLogMsg(__func__,PS_LOG_INFO," psListSetIterator/psListGetNext/psListGetPrev" … … 837 837 // create a list 838 838 list = psListAlloc(NULL); 839 for ( intlcv=0;lcv<15;lcv++) {840 data = psAlloc(sizeof( int));839 for (psS32 lcv=0;lcv<15;lcv++) { 840 data = psAlloc(sizeof(psS32)); 841 841 *data = lcv; 842 842 psListAdd(list,PS_LIST_TAIL,data); … … 852 852 // 3. set list.cursor to list.tail if where=PS_LIST_TAIL 853 853 psListSetIterator(list,PS_LIST_TAIL); 854 if (*( int*)psListGetCurrent(list) != 14) {854 if (*(psS32*)psListGetCurrent(list) != 14) { 855 855 psError(__func__,"Didn't successfully move cursor to tail."); 856 856 return 1; … … 859 859 // 2. set list.cursor to list.head if where=PS_LIST_HEAD 860 860 psListSetIterator(list,PS_LIST_HEAD); 861 if (*( int*)psListGetCurrent(list) != 0) {861 if (*(psS32*)psListGetCurrent(list) != 0) { 862 862 psError(__func__,"Didn't successfully move cursor to head."); 863 863 return 2; … … 866 866 // 4. set list.cursor to list.cursor->next if where=PS_LIST_NEXT 867 867 psListSetIterator(list,PS_LIST_NEXT); 868 if (*( int*)psListGetCurrent(list) != 1) {868 if (*(psS32*)psListGetCurrent(list) != 1) { 869 869 psError(__func__,"Didn't successfully move cursor to next."); 870 870 return 3; 871 871 } 872 872 psListSetIterator(list,PS_LIST_NEXT); 873 if (*( int*)psListGetCurrent(list) != 2) {873 if (*(psS32*)psListGetCurrent(list) != 2) { 874 874 psError(__func__,"Didn't successfully move cursor to next twice."); 875 875 return 4; … … 878 878 // 5. set list.cursor to list.cursor->prev if where=PS_LIST_PREV 879 879 psListSetIterator(list,PS_LIST_PREVIOUS); 880 if (*( int*)psListGetCurrent(list) != 1) {880 if (*(psS32*)psListGetCurrent(list) != 1) { 881 881 psError(__func__,"Didn't successfully move cursor to previous."); 882 882 return 5; 883 883 } 884 884 psListSetIterator(list,PS_LIST_PREVIOUS); 885 if (*( int*)psListGetCurrent(list) != 0) {885 if (*(psS32*)psListGetCurrent(list) != 0) { 886 886 psError(__func__,"Didn't successfully move cursor to previous twice."); 887 887 return 6; … … 892 892 psLogMsg(__func__,PS_LOG_INFO,"Following should error with 'Can't move to an unknown position.'"); 893 893 psListSetIterator(list,PS_LIST_UNKNOWN); 894 if (*( int*)psListGetCurrent(list) != 1) {894 if (*(psS32*)psListGetCurrent(list) != 1) { 895 895 psError(__func__,"PS_LIST_UNKNOWN moved cursor."); 896 896 return 7; 897 897 } 898 898 psListSetIterator(list,PS_LIST_CURRENT); 899 if (*( int*)psListGetCurrent(list) != 1) {899 if (*(psS32*)psListGetCurrent(list) != 1) { 900 900 psError(__func__,"PS_LIST_CURRENT moved cursor."); 901 901 return 8; … … 903 903 904 904 // test psListGetPrevious/Next 905 if (*( int*)psListGetNext(list) != 2) {905 if (*(psS32*)psListGetNext(list) != 2) { 906 906 psError(__func__,"psListGetNext didn't move cursor to next."); 907 907 return 9; 908 908 } 909 if (*( int*)psListGetNext(list) != 3) {909 if (*(psS32*)psListGetNext(list) != 3) { 910 910 psError(__func__,"psListGetNext didn't move cursor to next."); 911 911 return 10; 912 912 } 913 if (*( int*)psListGetPrevious(list) != 2) {913 if (*(psS32*)psListGetPrevious(list) != 2) { 914 914 psError(__func__,"psListGetPrevious didn't move cursor to previous."); 915 915 return 11; 916 916 } 917 if (*( int*)psListGetPrevious(list) != 1) {917 if (*(psS32*)psListGetPrevious(list) != 1) { 918 918 psError(__func__,"psListGetPrevious didn't move cursor to previous."); 919 919 return 12; 920 920 } 921 if (*( int*)psListGetPrevious(list) != 0) {921 if (*(psS32*)psListGetPrevious(list) != 0) { 922 922 psError(__func__,"psListGetPrevious didn't move cursor to previous.."); 923 923 return 13; … … 939 939 } 940 940 941 inttestListFree(void)941 psS32 testListFree(void) 942 942 { 943 943 float* data[15]; … … 954 954 955 955 list = psListAlloc(NULL); 956 for ( intlcv=0;lcv<15;lcv++) {957 data[lcv] = psAlloc(sizeof( int));956 for (psS32 lcv=0;lcv<15;lcv++) { 957 data[lcv] = psAlloc(sizeof(psS32)); 958 958 *data[lcv] = lcv; 959 959 psListAdd(list,PS_LIST_TAIL,data[lcv]); … … 987 987 */ 988 988 989 for ( inti=0;i<15;i++) {989 for (psS32 i=0;i<15;i++) { 990 990 if (psMemGetRefCounter(data[i]) != 1) { 991 991 psError(__func__,"pslistFree didn't decrement the data item's reference counter"); … … 998 998 } 999 999 1000 inttestListSort(void)1000 psS32 testListSort(void) 1001 1001 { 1002 1002 psList* list; … … 1004 1004 list = psListAlloc(NULL); 1005 1005 1006 for ( intlcv=0;lcv<15;lcv++) {1007 float* data = psAlloc(sizeof( int));1006 for (psS32 lcv=0;lcv<15;lcv++) { 1007 float* data = psAlloc(sizeof(psS32)); 1008 1008 if (lcv < 7) { 1009 1009 *data = 13-lcv*2; … … 1070 1070 list = psListAlloc(NULL); 1071 1071 1072 for ( intlcv=0;lcv<15;lcv++) {1073 psU32* data = psAlloc(sizeof( int));1072 for (psS32 lcv=0;lcv<15;lcv++) { 1073 psU32* data = psAlloc(sizeof(psS32)); 1074 1074 if (lcv < 7) { 1075 1075 *data = 13-lcv*2; -
trunk/psLib/test/collections/tst_psMetadataIO.c
r1986 r2204 13 13 * @author Ross Harman, MHPCC 14 14 * 15 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $16 * @date $Date: 2004-10- 06 22:51:31 $15 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-10-27 00:57:31 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 80 80 vec = (psVector*)metadataItem->data.V; 81 81 printf("Key Value: "); 82 for( inti=0; i<vec->nalloc;i++) {82 for(psS32 i=0; i<vec->nalloc;i++) { 83 83 printf("%d ", vec->data.S32[i]); 84 84 } … … 103 103 static void printMetadataTable(psHash *mdTable) 104 104 { 105 inti;105 psS32 i; 106 106 psHashBucket* ptr = NULL; 107 107 for(i=0; i<mdTable->nbucket; i++) { … … 123 123 124 124 125 int main(intargc, char* argv[])125 psS32 main(psS32 argc, char* argv[]) 126 126 { 127 127 // Test A - Read config file with overwrite set true 128 128 printPositiveTestHeader(stdout, "psMetadata", "Test A - Read config file with overwrite set true"); 129 129 psMetadata *metadata1 = NULL; 130 intfailedLines1 = 0;130 psS32 failedLines1 = 0; 131 131 failedLines1 = psMetadataParseConfig(&metadata1, "test.config", true); 132 132 printf("Failed lines: %d Expected: 6\n", failedLines1); … … 138 138 printPositiveTestHeader(stdout, "psMetadata", "Test B - Read config file with overwrite set false"); 139 139 psMetadata *metadata2 = NULL; 140 intfailedLines2 = 0;140 psS32 failedLines2 = 0; 141 141 failedLines2 = psMetadataParseConfig(&metadata2, "test.config", false); 142 142 printf("Failed lines: %d Expected: 7", failedLines2); … … 148 148 printPositiveTestHeader(stdout, "psMetadata", "Test C - Read config file without auto-allocation of metadata"); 149 149 psMetadata *metadata3 = psMetadataAlloc(); 150 intfailedLines3 = 0;150 psS32 failedLines3 = 0; 151 151 failedLines3 = psMetadataParseConfig(&metadata3, "test.config", false); 152 152 printf("Failed lines: %d Expected: 7", failedLines3); … … 176 176 psMemCheckLeaks(0, NULL, stdout); 177 177 psMemCheckCorruption(0); 178 intnBad = psMemCheckCorruption(0);178 psS32 nBad = psMemCheckCorruption(0); 179 179 if(nBad) { 180 180 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/collections/tst_psMetadata_01.c
r2153 r2204 17 17 * @author Ross Harman, MHPCC 18 18 * 19 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $20 * @date $Date: 2004-10- 15 19:26:31$19 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 20 * @date $Date: 2004-10-27 00:57:33 $ 21 21 * 22 22 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 96 96 static void printMetadataTable(psHash *mdTable) 97 97 { 98 inti;98 psS32 i; 99 99 psHashBucket* ptr = NULL; 100 100 for(i=0; i<mdTable->nbucket; i++) { … … 116 116 117 117 118 int main(intargc, char* argv[])118 psS32 main(psS32 argc, char* argv[]) 119 119 { 120 120 psMetadata *metadata1 = NULL; … … 262 262 psMemCheckLeaks(0, NULL, stdout); 263 263 psMemCheckCorruption(0); 264 intnBad = psMemCheckCorruption(0);264 psS32 nBad = psMemCheckCorruption(0); 265 265 if(nBad) { 266 266 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/collections/tst_psMetadata_02.c
r2012 r2204 14 14 * @author Ross Harman, MHPCC 15 15 * 16 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $17 * @date $Date: 2004-10- 07 22:31:31$16 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2004-10-27 00:57:33 $ 18 18 * 19 19 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 60 60 61 61 62 int main( intargc, char* argv[] )62 psS32 main( psS32 argc, char* argv[] ) 63 63 { 64 64 psMetadataItem *item1 = NULL; … … 136 136 psMemCheckLeaks(0, NULL, stdout); 137 137 psMemCheckCorruption(0); 138 intnBad = psMemCheckCorruption(0);138 psS32 nBad = psMemCheckCorruption(0); 139 139 if(nBad) { 140 140 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/collections/tst_psMetadata_03.c
r2018 r2204 14 14 * @author Ross Harman, MHPCC 15 15 * 16 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $17 * @date $Date: 2004-10- 08 01:33:14$16 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2004-10-27 00:57:33 $ 18 18 * 19 19 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 60 60 61 61 62 int main( intargc, char* argv[] )62 psS32 main( psS32 argc, char* argv[] ) 63 63 { 64 64 psMetadataItem *item1 = NULL; … … 231 231 } 232 232 psMemCheckCorruption(0); 233 intnBad = psMemCheckCorruption(0);233 psS32 nBad = psMemCheckCorruption(0); 234 234 if(nBad) { 235 235 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/collections/tst_psMetadata_04.c
r2023 r2204 18 18 * @author Ross Harman, MHPCC 19 19 * 20 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $21 * @date $Date: 2004-10- 08 20:53:21$20 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 21 * @date $Date: 2004-10-27 00:57:33 $ 22 22 * 23 23 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 64 64 65 65 66 int main( intargc, char* argv[] )66 psS32 main( psS32 argc, char* argv[] ) 67 67 { 68 68 psMetadataItem *item1 = NULL; … … 201 201 } 202 202 psMemCheckCorruption(0); 203 intnBad = psMemCheckCorruption(0);203 psS32 nBad = psMemCheckCorruption(0); 204 204 if(nBad) { 205 205 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/collections/tst_psMetadata_05.c
r2049 r2204 22 22 * @author Ross Harman, MHPCC 23 23 * 24 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $25 * @date $Date: 2004-10- 12 01:40:32$24 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 25 * @date $Date: 2004-10-27 00:57:33 $ 26 26 * 27 27 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 68 68 69 69 70 int main( intargc, char* argv[] )70 psS32 main( psS32 argc, char* argv[] ) 71 71 { 72 longdata;72 psS64 data; 73 73 psF32 fpdata; 74 74 psMetadataItem *item1 = NULL; … … 271 271 } 272 272 psMemCheckCorruption(0); 273 intnBad = psMemCheckCorruption(0);273 psS32 nBad = psMemCheckCorruption(0); 274 274 if(nBad) { 275 275 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/collections/tst_psMetadata_06.c
r2050 r2204 13 13 * @author Ross Harman, MHPCC 14 14 * 15 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $16 * @date $Date: 2004-10- 12 01:54:00$15 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-10-27 00:57:33 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 59 59 60 60 61 int main( intargc, char* argv[] )61 psS32 main( psS32 argc, char* argv[] ) 62 62 { 63 63 psMetadataItem *item1a = NULL; … … 134 134 } 135 135 psMemCheckCorruption(0); 136 intnBad = psMemCheckCorruption(0);136 psS32 nBad = psMemCheckCorruption(0); 137 137 if(nBad) { 138 138 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/collections/tst_psVector.c
r1920 r2204 14 14 * @author Ross Harman, MHPCC 15 15 * 16 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $17 * @date $Date: 2004- 09-28 23:26:49$16 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2004-10-27 00:57:33 $ 18 18 * 19 19 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 24 24 #include "psTest.h" 25 25 26 int main(intargc,27 char* argv[])26 psS32 main(psS32 argc, 27 char* argv[]) 28 28 { 29 29 … … 40 40 // Test B - Add data to integer vector 41 41 printPositiveTestHeader(stdout, "psVector", "Add data to S32 vector"); 42 for( inti = 0; i < 5; i++) {42 for(psS32 i = 0; i < 5; i++) { 43 43 psVec->data.S32[i] = i*10; 44 44 printf("Elem %d = %d\n", i, psVec->data.S32[i]); … … 53 53 psVec = psVectorRealloc(psVec,10); 54 54 printf("Adding more elements to S32 vector...\n"); 55 for( inti = 5; i < 10; i++) {55 for(psS32 i = 5; i < 10; i++) { 56 56 psVec->data.S32[i] = i*10; 57 57 psVec->n++; … … 67 67 psVec = psVectorRealloc(psVec,3); 68 68 printf("Vector size = %d\n", psVec->nalloc); 69 for( inti = 0; i < 3; i++) {69 for(psS32 i = 0; i < 3; i++) { 70 70 printf("Elem %d = %d\n", i, psVec->data.S32[i]); 71 71 } … … 78 78 printPositiveTestHeader(stdout, "psVector", "Free S32 vector"); 79 79 psFree(psVec); 80 intleaks = psMemCheckLeaks(0, NULL, stdout);80 psS32 leaks = psMemCheckLeaks(0, NULL, stdout); 81 81 if(leaks != 0) { 82 82 printf("ERROR: Found %d memory leaks\n",leaks); 83 83 } 84 intnBad = psMemCheckCorruption(0);84 psS32 nBad = psMemCheckCorruption(0); 85 85 if(nBad) { 86 86 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/collections/tst_psVectorSort_01.c
r1406 r2204 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2004- 08-06 22:34:05$12 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:33 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 20 20 #include "psTest.h" 21 21 22 int main(intargc,23 char* argv[])22 psS32 main(psS32 argc, 23 char* argv[]) 24 24 { 25 25 psVector *in = NULL; … … 41 41 in->data.F32[5] = 5.0f; 42 42 in->data.F32[6] = -20.0f; 43 for( inti=0; i<7; i++) {43 for(psS32 i=0; i<7; i++) { 44 44 printf("vec[%d] = %f\n", i, in->data.F32[i]); 45 45 } … … 51 51 tempVec = out; 52 52 out = psVectorSort(out, in); 53 for( inti=0; i<7; i++) {53 for(psS32 i=0; i<7; i++) { 54 54 printf("vec[%d] = %f\n", i, out->data.F32[i]); 55 55 } … … 63 63 printPositiveTestHeader(stdout,"psVectorSort", "Sort input float vector into itself"); 64 64 in = psVectorSort(in, in); 65 for( inti=0; i<7; i++) {65 for(psS32 i=0; i<7; i++) { 66 66 printf("vec[%d] = %f\n", i, out->data.F32[i]); 67 67 } … … 74 74 psFree(out); 75 75 psMemCheckLeaks(0, NULL, stdout); 76 intnBad = psMemCheckCorruption(0);76 psS32 nBad = psMemCheckCorruption(0); 77 77 if(nBad) { 78 78 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/collections/tst_psVectorSort_02.c
r1406 r2204 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $13 * @date $Date: 2004- 08-06 22:34:05$12 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:33 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 20 20 #include "psTest.h" 21 21 22 int main(intargc,23 char* argv[])22 psS32 main(psS32 argc, 23 char* argv[]) 24 24 { 25 25 psVector *in = NULL; … … 36 36 in->data.F32[3] = 1.0f; 37 37 in->data.F32[4] = 5.0f; 38 for( inti=0; i<5; i++) {38 for(psS32 i=0; i<5; i++) { 39 39 printf("arr[%d] = %f\n", i, in->data.F32[i]); 40 40 } … … 45 45 printPositiveTestHeader(stdout,"psVectorSortIndex", "Create sorted index vector"); 46 46 out = psVectorSortIndex(out, in); 47 for( inti=0; i<5; i++) {47 for(psS32 i=0; i<5; i++) { 48 48 printf("arr[%d] = %d\n", i, out->data.U32[i]); 49 49 } … … 61 61 psFree(in); 62 62 psFree(out); 63 intnLeaks = psMemCheckLeaks(0, NULL, stdout);63 psS32 nLeaks = psMemCheckLeaks(0, NULL, stdout); 64 64 if(nLeaks) { 65 65 printf("ERROR: Found %d memory leaks\n", nLeaks); 66 66 } 67 intnBad = psMemCheckCorruption(0);67 psS32 nBad = psMemCheckCorruption(0); 68 68 if(nBad) { 69 69 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/collections/tst_psVectorSort_03.c
r1406 r2204 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $15 * @date $Date: 2004- 08-06 22:34:05$14 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-10-27 00:57:33 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 22 22 #include "psTest.h" 23 23 24 int main(intargc,25 char* argv[])24 psS32 main(psS32 argc, 25 char* argv[]) 26 26 { 27 27 psVector *in = NULL; … … 37 37 out->n = 6; 38 38 in->n = 5; 39 for( inti=0; i<5; i++) {39 for(psS32 i=0; i<5; i++) { 40 40 printf("arr[%d] = %f\n", i, in->data.F32[i]); 41 41 } … … 55 55 out2 = psVectorAlloc(5, PS_TYPE_F64); 56 56 out2->n = 5; 57 for( intj=0; j<5; j++) {57 for(psS32 j=0; j<5; j++) { 58 58 printf("vec[%d] = %f\n", j, in2->data.F32[j]); 59 59 } … … 72 72 psFree(out); 73 73 psFree(out2); 74 intnLeaks = psMemCheckLeaks(0, NULL, stdout);74 psS32 nLeaks = psMemCheckLeaks(0, NULL, stdout); 75 75 if(nLeaks) { 76 76 printf("ERROR: Found %d memory leaks\n", nLeaks); 77 77 } 78 intnBad = psMemCheckCorruption(0);78 psS32 nBad = psMemCheckCorruption(0); 79 79 if(nBad) { 80 80 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/collections/tst_psVectorSort_04.c
r1406 r2204 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2004- 08-06 22:34:05$11 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-27 00:57:33 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 19 19 #include "psTest.h" 20 20 21 int main(intargc,22 char* argv[])21 psS32 main(psS32 argc, 22 char* argv[]) 23 23 { 24 24 psVector *badIn = NULL; … … 34 34 printPositiveTestHeader(stdout, "psVectorSort", "Free vectors"); 35 35 psFree(goodOut); 36 intnLeaks = psMemCheckLeaks(0, NULL, stdout);36 psS32 nLeaks = psMemCheckLeaks(0, NULL, stdout); 37 37 if(nLeaks) { 38 38 printf("ERROR: Found %d memory blocks\n", nLeaks); 39 39 } 40 intnBad = psMemCheckCorruption(0);40 psS32 nBad = psMemCheckCorruption(0); 41 41 if(nBad) { 42 42 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/dataManip/tst_psFunc00.c
r1985 r2204 22 22 #define CN 6 23 23 #define DN 8 24 intmain()24 psS32 main() 25 25 { 26 26 psPolynomial1D *my1DPoly = NULL; … … 32 32 psDPolynomial3D *my3DPolyD = NULL; 33 33 psDPolynomial4D *my4DPolyD = NULL; 34 inttestStatus = true;35 intmemLeaks = 0;36 inta = 0;37 intb = 0;38 intc = 0;39 intd = 0;40 intcurrentId = 0;34 psS32 testStatus = true; 35 psS32 memLeaks = 0; 36 psS32 a = 0; 37 psS32 b = 0; 38 psS32 c = 0; 39 psS32 d = 0; 40 psS32 currentId = 0; 41 41 42 42 currentId = psMemGetId(); -
trunk/psLib/test/dataManip/tst_psFunc01.c
r1811 r2204 13 13 #define MY_STDEV 2.0 14 14 #define N 30 15 intmain()15 psS32 main() 16 16 { 17 inttestStatus = true;17 psS32 testStatus = true; 18 18 float x = 0.0; 19 intmemLeaks;20 intcurrentId = psMemGetId();19 psS32 memLeaks; 20 psS32 currentId = psMemGetId(); 21 21 psVector *myGaussData = NULL; 22 22 printPositiveTestHeader(stdout, … … 52 52 53 53 myGaussData = psGaussianDev(MY_MEAN, MY_STDEV, N); 54 for ( inti = 0; i < N ; i++) {54 for (psS32 i = 0; i < N ; i++) { 55 55 printf("Gaussian Deviate [%d] is %f\n", i, myGaussData->data.F32[i]); 56 56 } -
trunk/psLib/test/dataManip/tst_psFunc02.c
r1946 r2204 14 14 #define CUBIC 3 15 15 16 intmain()16 psS32 main() 17 17 { 18 inttestStatus = true;19 intmemLeaks=0;20 inti;21 intcurrentId = psMemGetId();18 psS32 testStatus = true; 19 psS32 memLeaks=0; 20 psS32 i; 21 psS32 currentId = psMemGetId(); 22 22 psSpline1D *tmpSpline; 23 23 -
trunk/psLib/test/dataManip/tst_psFunc03.c
r1946 r2204 15 15 #define CUBIC 3 16 16 17 intmain()17 psS32 main() 18 18 { 19 inttestStatus = true;20 intmemLeaks=0;21 inti;22 intcurrentId = psMemGetId();19 psS32 testStatus = true; 20 psS32 memLeaks=0; 21 psS32 i; 22 psS32 currentId = psMemGetId(); 23 23 psSpline1D *tmpSpline; 24 24 psVector *bounds; -
trunk/psLib/test/dataManip/tst_psFunc04.c
r1982 r2204 17 17 #define N 8 18 18 19 intt00()19 psS32 t00() 20 20 { 21 inttestStatus = true;22 intmemLeaks=0;23 inti;21 psS32 testStatus = true; 22 psS32 memLeaks=0; 23 psS32 i; 24 24 float x; 25 25 float y; 26 intcurrentId = psMemGetId();26 psS32 currentId = psMemGetId(); 27 27 psSpline1D *tmpSpline; 28 28 psVector *data; … … 69 69 } 70 70 71 intt01()71 psS32 t01() 72 72 { 73 inttestStatus = true;74 intmemLeaks=0;75 inti;73 psS32 testStatus = true; 74 psS32 memLeaks=0; 75 psS32 i; 76 76 float x; 77 77 float y; 78 intcurrentId = psMemGetId();78 psS32 currentId = psMemGetId(); 79 79 psSpline1D *tmpSpline; 80 80 psVector *data; … … 121 121 } 122 122 123 intmain()123 psS32 main() 124 124 { 125 125 t00(); -
trunk/psLib/test/dataManip/tst_psFunc05.c
r1991 r2204 18 18 #define SPLINE_ORDER 1 19 19 20 intmain()20 psS32 main() 21 21 { 22 inttestStatus = true;23 intmemLeaks=0;24 inti;25 intcurrentId = psMemGetId();22 psS32 testStatus = true; 23 psS32 memLeaks=0; 24 psS32 i; 25 psS32 currentId = psMemGetId(); 26 26 psSpline1D *tmpSpline; 27 27 psVector *data; -
trunk/psLib/test/dataManip/tst_psFunc07.c
r1985 r2204 32 32 } 33 33 34 intt00()34 psS32 t00() 35 35 { 36 inttestStatus = true;37 intmemLeaks=0;38 intcurrentId = psMemGetId();39 inti;36 psS32 testStatus = true; 37 psS32 memLeaks=0; 38 psS32 currentId = psMemGetId(); 39 psS32 i; 40 40 psSpline1D *tmpSpline = NULL; 41 41 psVector *x = NULL; … … 101 101 102 102 // This is the F64 version of the above test code. 103 intt01()103 psS32 t01() 104 104 { 105 inttestStatus = true;106 intmemLeaks=0;107 intcurrentId = psMemGetId();108 inti;105 psS32 testStatus = true; 106 psS32 memLeaks=0; 107 psS32 currentId = psMemGetId(); 108 psS32 i; 109 109 psSpline1D *tmpSpline = NULL; 110 110 psVector *x = NULL; … … 169 169 } 170 170 171 intmain()171 psS32 main() 172 172 { 173 173 t00(); -
trunk/psLib/test/dataManip/tst_psHist00.c
r1811 r2204 10 10 #define UPPER 30.0 11 11 12 intmain()12 psS32 main() 13 13 { 14 14 psHistogram *myHist = NULL; 15 inttestStatus = true;16 intmemLeaks = 0;17 inti = 0;18 intnb = 0;19 intnumBins = 0;20 intcurrentId = 0;15 psS32 testStatus = true; 16 psS32 memLeaks = 0; 17 psS32 i = 0; 18 psS32 nb = 0; 19 psS32 numBins = 0; 20 psS32 currentId = 0; 21 21 22 22 currentId = psMemGetId(); -
trunk/psLib/test/dataManip/tst_psHist01.c
r1811 r2204 10 10 #define UPPER 30.0 11 11 12 intmain()12 psS32 main() 13 13 { 14 14 psHistogram *myHist = NULL; 15 15 psVector *myBounds = NULL; 16 inttestStatus = true;17 intmemLeaks = 0;18 inti = 0;19 intnb = 0;20 intnumBins = 0;21 intcurrentId = 0;16 psS32 testStatus = true; 17 psS32 memLeaks = 0; 18 psS32 i = 0; 19 psS32 nb = 0; 20 psS32 numBins = 0; 21 psS32 currentId = 0; 22 22 23 23 currentId = psMemGetId(); -
trunk/psLib/test/dataManip/tst_psHist02.c
r1811 r2204 14 14 #define NUM_DATA 10000 15 15 16 intmain()16 psS32 main() 17 17 { 18 18 psHistogram * myHist = NULL; … … 20 20 psVector *myData = NULL; 21 21 psVector *myMask = NULL; 22 inttestStatus = true;23 intmemLeaks = 0;24 intnb = 0;25 intnumBins = 0;26 inti = 0;27 intcurrentId = 0;22 psS32 testStatus = true; 23 psS32 memLeaks = 0; 24 psS32 nb = 0; 25 psS32 numBins = 0; 26 psS32 i = 0; 27 psS32 currentId = 0; 28 28 29 29 currentId = psMemGetId(); -
trunk/psLib/test/dataManip/tst_psHist03.c
r1824 r2204 12 12 #define NUM_DATA 20 13 13 14 intmain()14 psS32 main() 15 15 { 16 16 psHistogram *myHist = NULL; 17 17 psVector *myBounds = NULL; 18 18 psVector *myData = psVectorAlloc( NUM_DATA, PS_TYPE_F32 ); 19 inttestStatus = true;20 intmemLeaks = 0;21 inti = 0;22 intnb = 0;23 intnumBins = 0;24 intcurrentId = 0;19 psS32 testStatus = true; 20 psS32 memLeaks = 0; 21 psS32 i = 0; 22 psS32 nb = 0; 23 psS32 numBins = 0; 24 psS32 currentId = 0; 25 25 26 26 currentId = psMemGetId(); -
trunk/psLib/test/dataManip/tst_psMatrix01.c
r1406 r2204 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $14 * @date $Date: 2004- 08-06 22:34:06$13 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-27 00:57:33 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 22 22 23 23 #define PRINT_MATRIX(IMAGE) \ 24 for( inti=IMAGE->numRows-1; i>-1; i--) { \25 for( intj=0; j<IMAGE->numCols; j++) { \24 for(psS32 i=IMAGE->numRows-1; i>-1; i--) { \ 25 for(psS32 j=0; j<IMAGE->numCols; j++) { \ 26 26 printf("%f ", IMAGE->data.F64[i][j]); \ 27 27 } \ … … 29 29 } 30 30 31 int main( intargc,32 char* argv[] )31 psS32 main( psS32 argc, 32 char* argv[] ) 33 33 { 34 34 psImage * tempImage = NULL; … … 79 79 psFree( outImage ); 80 80 psFree( outImageNull ); 81 intnLeaks = psMemCheckLeaks( 0, NULL, stdout );81 psS32 nLeaks = psMemCheckLeaks( 0, NULL, stdout ); 82 82 if ( nLeaks != 0 ) { 83 83 printf( "ERROR: Found %d memory leaks\n", nLeaks ); 84 84 } 85 intnBad = psMemCheckCorruption( 0 );85 psS32 nBad = psMemCheckCorruption( 0 ); 86 86 if ( nBad ) { 87 87 printf( "ERROR: Found %d bad memory blocks\n", nBad ); -
trunk/psLib/test/dataManip/tst_psMatrix02.c
r1406 r2204 13 13 * @author Ross Harman, MHPCC 14 14 * 15 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $16 * @date $Date: 2004- 08-06 22:34:06$15 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-10-27 00:57:33 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 23 23 #include "psTest.h" 24 24 25 int main(intargc,26 char* argv[])25 psS32 main(psS32 argc, 26 char* argv[]) 27 27 { 28 28 psImage *nullImage = NULL; -
trunk/psLib/test/dataManip/tst_psMatrix03.c
r1406 r2204 14 14 * @author Ross Harman, MHPCC 15 15 * 16 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $17 * @date $Date: 2004- 08-06 22:34:06$16 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2004-10-27 00:57:33 $ 18 18 * 19 19 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 25 25 26 26 #define PRINT_MATRIX(IMAGE) \ 27 for( inti=IMAGE->numRows-1; i>-1; i--) { \28 for( intj=0; j<IMAGE->numCols; j++) { \27 for(psS32 i=IMAGE->numRows-1; i>-1; i--) { \ 28 for(psS32 j=0; j<IMAGE->numCols; j++) { \ 29 29 printf("%f ", IMAGE->data.F64[i][j]); \ 30 30 } \ … … 33 33 \ 34 34 #define PRINT_VECTOR(VECTOR) \ 35 for( inti=0; i<VECTOR->n; i++) { \35 for(psS32 i=0; i<VECTOR->n; i++) { \ 36 36 printf("%f\n", VECTOR->data.F64[i]); \ 37 37 } 38 38 39 39 40 int main(intargc,41 char* argv[])40 psS32 main(psS32 argc, 41 char* argv[]) 42 42 { 43 43 psImage *luImage = NULL; … … 112 112 psFree(inVector); 113 113 psMemCheckLeaks(0, NULL, stdout); 114 intnBad = psMemCheckCorruption(0);114 psS32 nBad = psMemCheckCorruption(0); 115 115 if(nBad) { 116 116 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/dataManip/tst_psMatrix04.c
r1406 r2204 13 13 * @author Ross Harman, MHPCC 14 14 * 15 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $16 * @date $Date: 2004- 08-06 22:34:06$15 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-10-27 00:57:33 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 24 24 25 25 #define PRINT_MATRIX(IMAGE) \ 26 for( inti=IMAGE->numRows-1; i>-1; i--) { \27 for( intj=0; j<IMAGE->numCols; j++) { \26 for(psS32 i=IMAGE->numRows-1; i>-1; i--) { \ 27 for(psS32 j=0; j<IMAGE->numCols; j++) { \ 28 28 printf("%f ", IMAGE->data.F64[i][j]); \ 29 29 } \ … … 32 32 33 33 34 int main(intargc,35 char* argv[])34 psS32 main(psS32 argc, 35 char* argv[]) 36 36 { 37 37 float det = 0.0f; … … 87 87 psFree(det2); 88 88 psMemCheckLeaks(0, NULL, stdout); 89 intnBad = psMemCheckCorruption(0);89 psS32 nBad = psMemCheckCorruption(0); 90 90 if(nBad) { 91 91 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/dataManip/tst_psMatrix05.c
r1406 r2204 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2004- 08-06 22:34:06$12 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:33 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 21 21 22 22 #define PRINT_MATRIX(IMAGE) \ 23 for( inti=0; i<IMAGE->numRows; i++) { \24 for( intj=0; j<IMAGE->numCols; j++) { \23 for(psS32 i=0; i<IMAGE->numRows; i++) { \ 24 for(psS32 j=0; j<IMAGE->numCols; j++) { \ 25 25 printf("%f ", IMAGE->data.F64[i][j]); \ 26 26 } \ … … 29 29 30 30 31 int main( intargc,32 char* argv[] )31 psS32 main( psS32 argc, 32 char* argv[] ) 33 33 { 34 34 psImage * outImage = NULL; … … 68 68 psFree( inImage1 ); 69 69 psFree( inImage2 ); 70 intnLeaks = psMemCheckLeaks( 0, NULL, stdout );70 psS32 nLeaks = psMemCheckLeaks( 0, NULL, stdout ); 71 71 if ( nLeaks != 0 ) { 72 72 printf( "ERROR: Found %d memory leaks\n", nLeaks ); 73 73 } 74 intnBad = psMemCheckCorruption( 0 );74 psS32 nBad = psMemCheckCorruption( 0 ); 75 75 if ( nBad ) { 76 76 printf( "ERROR: Found %d bad memory blocks\n", nBad ); -
trunk/psLib/test/dataManip/tst_psMatrix06.c
r1406 r2204 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2004- 08-06 22:34:06$12 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:33 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 21 21 22 22 #define PRINT_MATRIX(IMAGE) \ 23 for( inti=0; i<IMAGE->numRows; i++) { \24 for( intj=0; j<IMAGE->numCols; j++) { \23 for(psS32 i=0; i<IMAGE->numRows; i++) { \ 24 for(psS32 j=0; j<IMAGE->numCols; j++) { \ 25 25 printf("%f ", IMAGE->data.F64[i][j]); \ 26 26 } \ … … 29 29 30 30 31 int main( intargc,32 char* argv[] )31 psS32 main( psS32 argc, 32 char* argv[] ) 33 33 { 34 34 psImage * outImage = NULL; … … 76 76 psFree( outImage ); 77 77 psFree( inImage ); 78 intnLeaks = psMemCheckLeaks( 0, NULL, stdout );78 psS32 nLeaks = psMemCheckLeaks( 0, NULL, stdout ); 79 79 if ( nLeaks != 0 ) { 80 80 printf( "ERROR: Found %d memory leaks\n", nLeaks ); 81 81 } 82 intnBad = psMemCheckCorruption( 0 );82 psS32 nBad = psMemCheckCorruption( 0 ); 83 83 if ( nBad ) { 84 84 printf( "ERROR: Found %d bad memory blocks\n", nBad ); -
trunk/psLib/test/dataManip/tst_psMatrix07.c
r1406 r2204 16 16 * @author Ross Harman, MHPCC 17 17 * 18 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $19 * @date $Date: 2004- 08-06 22:34:06$18 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 19 * @date $Date: 2004-10-27 00:57:33 $ 20 20 * 21 21 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 27 27 28 28 #define PRINT_MATRIX(IMAGE) \ 29 for( inti=0; i<IMAGE->numRows; i++) { \30 for( intj=0; j<IMAGE->numCols; j++) { \29 for(psS32 i=0; i<IMAGE->numRows; i++) { \ 30 for(psS32 j=0; j<IMAGE->numCols; j++) { \ 31 31 printf("%f ", IMAGE->data.F64[i][j]); \ 32 32 } \ … … 35 35 36 36 #define PRINT_VECTOR(VECTOR) \ 37 for( inti=0; i<VECTOR->n; i++) { \37 for(psS32 i=0; i<VECTOR->n; i++) { \ 38 38 printf("%f\n", VECTOR->data.F64[i]); \ 39 39 } 40 40 41 41 42 int main(intargc,43 char* argv[])42 psS32 main(psS32 argc, 43 char* argv[]) 44 44 { 45 45 psVector *v1 = NULL; … … 169 169 psFree(badImage); 170 170 psMemCheckLeaks(0, NULL, stdout); 171 intnBad = psMemCheckCorruption(0);171 psS32 nBad = psMemCheckCorruption(0); 172 172 if(nBad) { 173 173 printf("ERROR: Found %d bad memory blocks\n", nBad); -
trunk/psLib/test/dataManip/tst_psMatrixVectorArithmetic01.c
r1648 r2204 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $13 * @date $Date: 2004- 08-27 23:31:22$12 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:33 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 24 24 printf("%f+%fi ", creal(SCALAR->data.TYPE), cimag(SCALAR->data.TYPE)); \ 25 25 } else if(PS_IS_PSELEMTYPE_INT(SCALAR->type.type)) { \ 26 printf("%d ", ( int)SCALAR->data.TYPE); \26 printf("%d ", (psS32)SCALAR->data.TYPE); \ 27 27 } else { \ 28 28 printf("%f ", (double)SCALAR->data.TYPE); \ … … 31 31 32 32 #define PRINT_VECTOR(VECTOR,TYPE) \ 33 for( inti=0; i<VECTOR->n; i++) { \33 for(psS32 i=0; i<VECTOR->n; i++) { \ 34 34 if(PS_IS_PSELEMTYPE_COMPLEX(VECTOR->type.type)) { \ 35 35 printf("%f+%fi ", creal(VECTOR->data.TYPE[i]), cimag(VECTOR->data.TYPE[i])); \ 36 36 } else if(PS_IS_PSELEMTYPE_INT(VECTOR->type.type)) { \ 37 printf("%d ", ( int)VECTOR->data.TYPE[i]); \37 printf("%d ", (psS32)VECTOR->data.TYPE[i]); \ 38 38 } else { \ 39 39 printf("%f ", (double)VECTOR->data.TYPE[i]); \ … … 44 44 45 45 #define PRINT_MATRIX(IMAGE,TYPE) \ 46 for( inti=IMAGE->numRows-1; i>-1; i--) { \47 for( intj=0; j<IMAGE->numCols; j++) { \46 for(psS32 i=IMAGE->numRows-1; i>-1; i--) { \ 47 for(psS32 j=0; j<IMAGE->numCols; j++) { \ 48 48 if(PS_IS_PSELEMTYPE_COMPLEX(IMAGE->type.type)) { \ 49 49 printf("%f+%fi ", creal(IMAGE->data.TYPE[i][j]), cimag(IMAGE->data.TYPE[i][j])); \ 50 50 } else if(PS_IS_PSELEMTYPE_INT(IMAGE->type.type)) { \ 51 printf("%d ", ( int)IMAGE->data.TYPE[i][j]); \51 printf("%d ", (psS32)IMAGE->data.TYPE[i][j]); \ 52 52 } else { \ 53 53 printf("%f ", (double)IMAGE->data.TYPE[i][j]); \ … … 61 61 #define CREATE_AND_SET_VECTOR(NAME,TYPE,VALUE,SIZE) \ 62 62 psVector *NAME = (psVector*)psVectorAlloc(SIZE, PS_TYPE_##TYPE); \ 63 for( inti=0; i<SIZE; i++) { \63 for(psS32 i=0; i<SIZE; i++) { \ 64 64 NAME->data.TYPE[i] = VALUE; \ 65 65 } \ … … 69 69 #define CREATE_AND_SET_IMAGE(NAME,TYPE,VALUE,NROWS,NCOLS) \ 70 70 psImage *NAME = (psImage*)psImageAlloc(NCOLS,NROWS,PS_TYPE_##TYPE); \ 71 for( inti=0; i<NAME->numRows; i++) { \72 for( intj=0; j<NAME->numCols; j++) { \71 for(psS32 i=0; i<NAME->numRows; i++) { \ 72 for(psS32 j=0; j<NAME->numCols; j++) { \ 73 73 NAME->data.TYPE[i][j] = VALUE; \ 74 74 } \ … … 78 78 #define CHECK_MEMORY \ 79 79 psMemCheckLeaks(0, NULL, stdout); \ 80 intnBad = psMemCheckCorruption(0); \80 psS32 nBad = psMemCheckCorruption(0); \ 81 81 if(nBad) { \ 82 82 printf("ERROR: Found %d bad memory blocks\n", nBad); \ … … 84 84 85 85 86 int main(intargc, char* argv[])86 psS32 main(psS32 argc, char* argv[]) 87 87 { 88 88 -
trunk/psLib/test/dataManip/tst_psMatrixVectorArithmetic02.c
r2057 r2204 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-10- 12 20:50:40$12 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:33 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 24 24 25 25 #define CHECK_VECTOR(VECTOR,TYPE,TRUTH) \ 26 for( inti=0; i<VECTOR->n; i++) { \26 for(psS32 i=0; i<VECTOR->n; i++) { \ 27 27 if(cabs(VECTOR->data.TYPE[i])-cabs(TRUTH) > FLT_EPSILON){ \ 28 28 printf("ERROR:Truth and calculated values don't match for vector operation:\n"); \ … … 31 31 printf("Calculated: %.2f%+.2fi\n", creal(TRUTH), cimag(TRUTH)); \ 32 32 } else if(PS_IS_PSELEMTYPE_INT(VECTOR->type.type)) { \ 33 printf("Truth: %d\n", ( int)(VECTOR->data.TYPE[i])); \34 printf("Calculated: %d\n", ( int)(TRUTH)); \33 printf("Truth: %d\n", (psS32)(VECTOR->data.TYPE[i])); \ 34 printf("Calculated: %d\n", (psS32)(TRUTH)); \ 35 35 } else { \ 36 36 printf("Truth: %.2f\n", (double)(VECTOR->data.TYPE[i])); \ … … 43 43 44 44 #define CHECK_MATRIX(IMAGE,TYPE,TRUTH) \ 45 for( inti=IMAGE->numRows-1; i>-1; i--) { \46 for( intj=0; j<IMAGE->numCols; j++) { \45 for(psS32 i=IMAGE->numRows-1; i>-1; i--) { \ 46 for(psS32 j=0; j<IMAGE->numCols; j++) { \ 47 47 if(cabs(IMAGE->data.TYPE[i][j])-cabs(TRUTH) > FLT_EPSILON){ \ 48 48 printf("ERROR:Truth and calculated values don't match for matrix operation:\n"); \ … … 51 51 printf("Calculated: %.2f%+.2fi\n", creal(TRUTH), cimag(TRUTH)); \ 52 52 } else if(PS_IS_PSELEMTYPE_INT(IMAGE->type.type)) { \ 53 printf("Truth: %d\n", ( int)(IMAGE->data.TYPE[i][j])); \54 printf("Calculated: %d\n", ( int)(TRUTH)); \53 printf("Truth: %d\n", (psS32)(IMAGE->data.TYPE[i][j])); \ 54 printf("Calculated: %d\n", (psS32)(TRUTH)); \ 55 55 } else { \ 56 56 printf("Truth: %.2f\n", (double)(IMAGE->data.TYPE[i][j])); \ … … 66 66 #define CREATE_AND_SET_VECTOR(NAME,TYPE,VALUE,SIZE) \ 67 67 psVector *NAME = (psVector*)psVectorAlloc(SIZE, PS_TYPE_##TYPE); \ 68 for( inti=0; i<SIZE; i++) { \68 for(psS32 i=0; i<SIZE; i++) { \ 69 69 NAME->data.TYPE[i] = VALUE; \ 70 70 } \ … … 74 74 #define CREATE_AND_SET_IMAGE(NAME,TYPE,VALUE,NROWS,NCOLS) \ 75 75 psImage *NAME = (psImage*)psImageAlloc(NCOLS,NROWS,PS_TYPE_##TYPE); \ 76 for( inti=0; i<NAME->numRows; i++) { \77 for( intj=0; j<NAME->numCols; j++) { \76 for(psS32 i=0; i<NAME->numRows; i++) { \ 77 for(psS32 j=0; j<NAME->numCols; j++) { \ 78 78 NAME->data.TYPE[i][j] = VALUE; \ 79 79 } \ … … 86 86 return 50; \ 87 87 } \ 88 intnBad = psMemCheckCorruption(0); \88 psS32 nBad = psMemCheckCorruption(0); \ 89 89 if(nBad) { \ 90 90 psError(__func__,"ERROR: Found %d bad memory blocks\n", nBad); \ … … 93 93 94 94 95 int main( intargc, char* argv[] )95 psS32 main( psS32 argc, char* argv[] ) 96 96 { 97 97 -
trunk/psLib/test/dataManip/tst_psMatrixVectorArithmetic03.c
r2053 r2204 15 15 * @author Ross Harman, MHPCC 16 16 * 17 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $18 * @date $Date: 2004-10- 12 19:18:20$17 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 18 * @date $Date: 2004-10-27 00:57:33 $ 19 19 * 20 20 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 27 27 28 28 #define PRINT_VECTOR(VECTOR,TYPE) \ 29 for( inti=0; i<VECTOR->n; i++) { \29 for(psS32 i=0; i<VECTOR->n; i++) { \ 30 30 if(PS_IS_PSELEMTYPE_COMPLEX(VECTOR->type.type)) { \ 31 31 printf("%f+%fi ", creal(VECTOR->data.TYPE[i]), cimag(VECTOR->data.TYPE[i])); \ 32 32 } else if(PS_IS_PSELEMTYPE_INT(VECTOR->type.type)) { \ 33 printf("%d ", ( int)VECTOR->data.TYPE[i]); \33 printf("%d ", (psS32)VECTOR->data.TYPE[i]); \ 34 34 } else { \ 35 35 printf("%f ", (double)VECTOR->data.TYPE[i]); \ … … 40 40 41 41 #define PRINT_MATRIX(IMAGE,TYPE) \ 42 for( inti=IMAGE->numRows-1; i>-1; i--) { \43 for( intj=0; j<IMAGE->numCols; j++) { \42 for(psS32 i=IMAGE->numRows-1; i>-1; i--) { \ 43 for(psS32 j=0; j<IMAGE->numCols; j++) { \ 44 44 if(PS_IS_PSELEMTYPE_COMPLEX(IMAGE->type.type)) { \ 45 45 printf("%f+%fi ", creal(IMAGE->data.TYPE[i][j]), cimag(IMAGE->data.TYPE[i][j])); \ 46 46 } else if(PS_IS_PSELEMTYPE_INT(IMAGE->type.type)) { \ 47 printf("%d ", ( int)IMAGE->data.TYPE[i][j]); \47 printf("%d ", (psS32)IMAGE->data.TYPE[i][j]); \ 48 48 } else { \ 49 49 printf("%f ", (double)IMAGE->data.TYPE[i][j]); \ … … 57 57 #define CREATE_AND_SET_VECTOR(NAME,TYPE,VALUE,SIZE) \ 58 58 psVector *NAME = (psVector*)psVectorAlloc(SIZE, PS_TYPE_##TYPE); \ 59 for( inti=0; i<SIZE; i++) { \59 for(psS32 i=0; i<SIZE; i++) { \ 60 60 NAME->data.TYPE[i] = VALUE; \ 61 61 } \ … … 65 65 #define CREATE_AND_SET_IMAGE(NAME,TYPE,VALUE,NROWS,NCOLS) \ 66 66 psImage *NAME = (psImage*)psImageAlloc(NCOLS,NROWS,PS_TYPE_##TYPE); \ 67 for( inti=0; i<NAME->numRows; i++) { \68 for( intj=0; j<NAME->numCols; j++) { \67 for(psS32 i=0; i<NAME->numRows; i++) { \ 68 for(psS32 j=0; j<NAME->numCols; j++) { \ 69 69 NAME->data.TYPE[i][j] = VALUE; \ 70 70 } \ … … 72 72 73 73 74 int main(intargc, char* argv[])74 psS32 main(psS32 argc, char* argv[]) 75 75 { 76 76 CREATE_AND_SET_IMAGE(image1,F64,0,3,3); -
trunk/psLib/test/dataManip/tst_psMinimize00.c
r1811 r2204 36 36 float myFuncDeriv(const psVector *restrict myData, 37 37 const psVector *restrict myParams, 38 intwhichParamDeriv)38 psS32 whichParamDeriv) 39 39 { 40 40 float x = myData->data.F32[0]; … … 65 65 66 66 67 intmain()67 psS32 main() 68 68 { 69 69 psImage *domain = NULL; … … 74 74 psVector *tmpVecPtr = NULL; 75 75 float chiSq = 0.0; 76 inti = 0;77 intj = 0;78 intcurrentId = psMemGetId();79 inttestStatus = true;80 intmemLeaks = 0;76 psS32 i = 0; 77 psS32 j = 0; 78 psS32 currentId = psMemGetId(); 79 psS32 testStatus = true; 80 psS32 memLeaks = 0; 81 81 psVector *theParams = NULL; 82 82 -
trunk/psLib/test/dataManip/tst_psMinimize01.c
r1811 r2204 35 35 float myFuncDeriv(const psVector *restrict myData, 36 36 const psVector *restrict myParams, 37 intwhichParamDeriv)37 psS32 whichParamDeriv) 38 38 { 39 39 float x = myData->data.F32[0]; … … 58 58 } 59 59 60 intmain()60 psS32 main() 61 61 { 62 62 psImage *domain = NULL; … … 67 67 psVector *tmpVecPtr = NULL; 68 68 float chiSq = 0.0; 69 inti = 0;69 psS32 i = 0; 70 70 psVector *theParams = NULL; 71 intcurrentId = psMemGetId();72 inttestStatus = true;73 intmemLeaks = 0;71 psS32 currentId = psMemGetId(); 72 psS32 testStatus = true; 73 psS32 memLeaks = 0; 74 74 75 75 domain = psImageAlloc(DATA_WIDTH, NUM_DATA, PS_TYPE_F32); -
trunk/psLib/test/dataManip/tst_psMinimize02.c
r1811 r2204 34 34 float myFuncDeriv0(const psVector *restrict myParams, 35 35 const psVector *restrict myCoords, 36 intwhichParamDeriv)36 psS32 whichParamDeriv) 37 37 { 38 38 float P0 = myCoords->data.F32[0]; … … 75 75 float myFuncDeriv(const psVector *restrict myParams, 76 76 const psVector *restrict myCoords, 77 intwhichParamDeriv)77 psS32 whichParamDeriv) 78 78 { 79 79 float x = myCoords->data.F32[0]; … … 104 104 105 105 106 intmain()106 psS32 main() 107 107 { 108 108 psVector *initialGuess = NULL; 109 109 psVector *paramMask = NULL; 110 110 psVector *coord = NULL; 111 inti = 0;112 intcurrentId = psMemGetId();113 inttestStatus = true;114 intmemLeaks = 0;111 psS32 i = 0; 112 psS32 currentId = psMemGetId(); 113 psS32 testStatus = true; 114 psS32 memLeaks = 0; 115 115 psVector *theParams = NULL; 116 116 -
trunk/psLib/test/dataManip/tst_psMinimize03.c
r1811 r2204 34 34 float myFuncDeriv0(const psVector *restrict myParams, 35 35 const psVector *restrict myCoords, 36 intwhichParamDeriv)36 psS32 whichParamDeriv) 37 37 { 38 38 float P0 = myCoords->data.F32[0]; … … 75 75 float myFuncDeriv(const psVector *restrict myParams, 76 76 const psVector *restrict myCoords, 77 intwhichParamDeriv)77 psS32 whichParamDeriv) 78 78 { 79 79 float x = myCoords->data.F32[0]; … … 104 104 105 105 106 intmain()106 psS32 main() 107 107 { 108 108 psVector *initialGuess = NULL; 109 109 psVector *paramMask = NULL; 110 110 psVector *coord = NULL; 111 inti = 0;112 intcurrentId = psMemGetId();113 inttestStatus = true;114 intmemLeaks = 0;111 psS32 i = 0; 112 psS32 currentId = psMemGetId(); 113 psS32 testStatus = true; 114 psS32 memLeaks = 0; 115 115 psVector *theParams = NULL; 116 116 -
trunk/psLib/test/dataManip/tst_psMinimize04.c
r2090 r2204 33 33 } 34 34 35 intt00()35 psS32 t00() 36 36 { 37 37 psPolynomial1D *myPoly = NULL; … … 39 39 psVector *y = NULL; 40 40 psVector *yErr = NULL; 41 inti = 0;42 intcurrentId = psMemGetId();43 inttestStatus = true;44 intmemLeaks = 0;41 psS32 i = 0; 42 psS32 currentId = psMemGetId(); 43 psS32 testStatus = true; 44 psS32 memLeaks = 0; 45 45 double expectData; 46 46 double actualData; … … 101 101 } 102 102 103 intt01()103 psS32 t01() 104 104 { 105 105 psPolynomial1D *myPoly = NULL; 106 106 psVector *x = NULL; 107 107 psVector *y = NULL; 108 inti = 0;109 intcurrentId = psMemGetId();110 inttestStatus = true;111 intmemLeaks = 0;108 psS32 i = 0; 109 psS32 currentId = psMemGetId(); 110 psS32 testStatus = true; 111 psS32 memLeaks = 0; 112 112 double expectData; 113 113 double actualData; … … 164 164 } 165 165 166 intt02()166 psS32 t02() 167 167 { 168 168 psPolynomial1D *myPoly = NULL; 169 169 psVector *y = NULL; 170 inti = 0;171 intcurrentId = psMemGetId();172 inttestStatus = true;173 intmemLeaks = 0;170 psS32 i = 0; 171 psS32 currentId = psMemGetId(); 172 psS32 testStatus = true; 173 psS32 memLeaks = 0; 174 174 double expectData; 175 175 double actualData; … … 223 223 } 224 224 225 intt03()226 { 227 intcurrentId = psMemGetId();228 inttestStatus = true;229 intmemLeaks = 0;225 psS32 t03() 226 { 227 psS32 currentId = psMemGetId(); 228 psS32 testStatus = true; 229 psS32 memLeaks = 0; 230 230 psPolynomial1D *myPoly = NULL; 231 231 … … 257 257 258 258 259 intmain()259 psS32 main() 260 260 { 261 261 t00(); -
trunk/psLib/test/dataManip/tst_psMinimize04_F32.c
r2091 r2204 33 33 } 34 34 35 intt00()35 psS32 t00() 36 36 { 37 37 psPolynomial1D *myPoly = NULL; … … 39 39 psVector *y = NULL; 40 40 psVector *yErr = NULL; 41 inti = 0;42 intcurrentId = psMemGetId();43 inttestStatus = true;44 intmemLeaks = 0;41 psS32 i = 0; 42 psS32 currentId = psMemGetId(); 43 psS32 testStatus = true; 44 psS32 memLeaks = 0; 45 45 float expectData; 46 46 float actualData; … … 100 100 } 101 101 102 intt01()102 psS32 t01() 103 103 { 104 104 psPolynomial1D *myPoly = NULL; 105 105 psVector *x = NULL; 106 106 psVector *y = NULL; 107 inti = 0;108 intcurrentId = psMemGetId();109 inttestStatus = true;110 intmemLeaks = 0;107 psS32 i = 0; 108 psS32 currentId = psMemGetId(); 109 psS32 testStatus = true; 110 psS32 memLeaks = 0; 111 111 float expectData; 112 112 float actualData; … … 163 163 } 164 164 165 intt02()165 psS32 t02() 166 166 { 167 167 psPolynomial1D *myPoly = NULL; 168 168 psVector *y = NULL; 169 inti = 0;170 intcurrentId = psMemGetId();171 inttestStatus = true;172 intmemLeaks = 0;169 psS32 i = 0; 170 psS32 currentId = psMemGetId(); 171 psS32 testStatus = true; 172 psS32 memLeaks = 0; 173 173 float expectData; 174 174 float actualData; … … 222 222 } 223 223 224 intt03()225 { 226 intcurrentId = psMemGetId();227 inttestStatus = true;228 intmemLeaks = 0;224 psS32 t03() 225 { 226 psS32 currentId = psMemGetId(); 227 psS32 testStatus = true; 228 psS32 memLeaks = 0; 229 229 230 230 printPositiveTestHeader(stdout, … … 251 251 252 252 253 intmain()253 psS32 main() 254 254 { 255 255 t00(); -
trunk/psLib/test/dataManip/tst_psMinimize04b.c
r2089 r2204 26 26 } 27 27 28 intt00()28 psS32 t00() 29 29 { 30 30 psPolynomial1D *myPoly = NULL; … … 32 32 psVector *y = NULL; 33 33 psVector *yErr = NULL; 34 inti = 0;35 intcurrentId = psMemGetId();36 inttestStatus = true;37 intmemLeaks = 0;34 psS32 i = 0; 35 psS32 currentId = psMemGetId(); 36 psS32 testStatus = true; 37 psS32 memLeaks = 0; 38 38 39 39 myPoly = psPolynomial1DAlloc(POLY_ORDER+1, PS_POLYNOMIAL_CHEB); … … 95 95 96 96 97 intt01()97 psS32 t01() 98 98 { 99 99 psPolynomial1D *myPoly = NULL; 100 100 psVector *x = NULL; 101 101 psVector *y = NULL; 102 inti = 0;103 intcurrentId = psMemGetId();104 inttestStatus = true;105 intmemLeaks = 0;102 psS32 i = 0; 103 psS32 currentId = psMemGetId(); 104 psS32 testStatus = true; 105 psS32 memLeaks = 0; 106 106 107 107 myPoly = psPolynomial1DAlloc(POLY_ORDER+1, PS_POLYNOMIAL_CHEB); … … 155 155 156 156 157 intt02()157 psS32 t02() 158 158 { 159 159 psPolynomial1D *myPoly = NULL; 160 160 psVector *x = NULL; 161 161 psVector *y = NULL; 162 inti = 0;163 intcurrentId = psMemGetId();164 inttestStatus = true;165 intmemLeaks = 0;162 psS32 i = 0; 163 psS32 currentId = psMemGetId(); 164 psS32 testStatus = true; 165 psS32 memLeaks = 0; 166 166 167 167 myPoly = psPolynomial1DAlloc(POLY_ORDER+1, PS_POLYNOMIAL_CHEB); … … 214 214 } 215 215 216 intt03()217 { 218 psPolynomial1D *myPoly = NULL; 219 intcurrentId = psMemGetId();220 inttestStatus = true;221 intmemLeaks = 0;216 psS32 t03() 217 { 218 psPolynomial1D *myPoly = NULL; 219 psS32 currentId = psMemGetId(); 220 psS32 testStatus = true; 221 psS32 memLeaks = 0; 222 222 223 223 printPositiveTestHeader(stdout, … … 244 244 } 245 245 246 intmain()246 psS32 main() 247 247 { 248 248 t00(); -
trunk/psLib/test/dataManip/tst_psMinimize04b_F32.c
r2086 r2204 26 26 } 27 27 28 intt00()28 psS32 t00() 29 29 { 30 30 psPolynomial1D *myPoly = NULL; … … 32 32 psVector *y = NULL; 33 33 psVector *yErr = NULL; 34 inti = 0;35 intcurrentId = psMemGetId();36 inttestStatus = true;37 intmemLeaks = 0;34 psS32 i = 0; 35 psS32 currentId = psMemGetId(); 36 psS32 testStatus = true; 37 psS32 memLeaks = 0; 38 38 39 39 myPoly = psPolynomial1DAlloc(POLY_ORDER+1, PS_POLYNOMIAL_CHEB); … … 95 95 96 96 97 intt01()97 psS32 t01() 98 98 { 99 99 psPolynomial1D *myPoly = NULL; 100 100 psVector *x = NULL; 101 101 psVector *y = NULL; 102 inti = 0;103 intcurrentId = psMemGetId();104 inttestStatus = true;105 intmemLeaks = 0;102 psS32 i = 0; 103 psS32 currentId = psMemGetId(); 104 psS32 testStatus = true; 105 psS32 memLeaks = 0; 106 106 107 107 myPoly = psPolynomial1DAlloc(POLY_ORDER+1, PS_POLYNOMIAL_CHEB); … … 155 155 156 156 157 intt02()157 psS32 t02() 158 158 { 159 159 psPolynomial1D *myPoly = NULL; 160 160 psVector *x = NULL; 161 161 psVector *y = NULL; 162 inti = 0;163 intcurrentId = psMemGetId();164 inttestStatus = true;165 intmemLeaks = 0;162 psS32 i = 0; 163 psS32 currentId = psMemGetId(); 164 psS32 testStatus = true; 165 psS32 memLeaks = 0; 166 166 167 167 myPoly = psPolynomial1DAlloc(POLY_ORDER+1, PS_POLYNOMIAL_CHEB); … … 214 214 } 215 215 216 intt03()217 { 218 psPolynomial1D *myPoly = NULL; 219 intcurrentId = psMemGetId();220 inttestStatus = true;221 intmemLeaks = 0;216 psS32 t03() 217 { 218 psPolynomial1D *myPoly = NULL; 219 psS32 currentId = psMemGetId(); 220 psS32 testStatus = true; 221 psS32 memLeaks = 0; 222 222 223 223 printPositiveTestHeader(stdout, … … 244 244 } 245 245 246 intmain()246 psS32 main() 247 247 { 248 248 t00(); -
trunk/psLib/test/dataManip/tst_psMinimize05.c
r2081 r2204 15 15 #define ERROR_TOLERANCE 0.10 16 16 float expectedParm[NUM_PARAMS]; 17 inttestStatus = true;17 psS32 testStatus = true; 18 18 19 19 /***************************************************************************** … … 32 32 float coordData = 0.0; 33 33 float expData = 0.0; 34 inti;34 psS32 i; 35 35 36 36 for (i=0;i<N;i++) { … … 62 62 63 63 64 intt00()65 { 66 intcurrentId = psMemGetId();67 intmemLeaks = 0;68 inti = 0;64 psS32 t00() 65 { 66 psS32 currentId = psMemGetId(); 67 psS32 memLeaks = 0; 68 psS32 i = 0; 69 69 psArray *myCoords; 70 70 psVector *myParams; … … 81 81 myCoords = psArrayAlloc(N); 82 82 for (i=0;i<N;i++) { 83 myCoords->data[i] = (psP TR*) psVectorAlloc(2, PS_TYPE_F32);83 myCoords->data[i] = (psPtr *) psVectorAlloc(2, PS_TYPE_F32); 84 84 ((psVector *) (myCoords->data[i]))->data.F32[0] = (float) (i+10); 85 85 ((psVector *) (myCoords->data[i]))->data.F32[1] = (float) (i+3); … … 137 137 } 138 138 139 intt01()140 { 141 intcurrentId = psMemGetId();142 intmemLeaks = 0;143 inti = 0;139 psS32 t01() 140 { 141 psS32 currentId = psMemGetId(); 142 psS32 memLeaks = 0; 143 psS32 i = 0; 144 144 psArray *myCoords; 145 145 psVector *myParams; … … 154 154 myCoords = psArrayAlloc(N); 155 155 for (i=0;i<N;i++) { 156 myCoords->data[i] = (psP TR*) psVectorAlloc(2, PS_TYPE_F32);156 myCoords->data[i] = (psPtr *) psVectorAlloc(2, PS_TYPE_F32); 157 157 ((psVector *) (myCoords->data[i]))->data.F32[0] = (float) (i+10); 158 158 ((psVector *) (myCoords->data[i]))->data.F32[1] = (float) (i+3); … … 208 208 } 209 209 210 intt02()211 { 212 intcurrentId = psMemGetId();213 intmemLeaks = 0;214 inti = 0;210 psS32 t02() 211 { 212 psS32 currentId = psMemGetId(); 213 psS32 memLeaks = 0; 214 psS32 i = 0; 215 215 psArray *myCoords; 216 216 psVector *myParams; … … 227 227 myCoords = psArrayAlloc(N); 228 228 for (i=0;i<N;i++) { 229 myCoords->data[i] = (psP TR*) psVectorAlloc(2, PS_TYPE_F32);229 myCoords->data[i] = (psPtr *) psVectorAlloc(2, PS_TYPE_F32); 230 230 ((psVector *) (myCoords->data[i]))->data.F32[0] = (float) (i+10); 231 231 ((psVector *) (myCoords->data[i]))->data.F32[1] = (float) (i+3); … … 269 269 } 270 270 271 intmain()271 psS32 main() 272 272 { 273 273 t00(); -
trunk/psLib/test/dataManip/tst_psMinimize06.c
r2202 r2204 12 12 #define NUM_PARAMS 3 13 13 float expectedParm[NUM_PARAMS]; 14 inttestStatus = true;14 psS32 testStatus = true; 15 15 16 16 /***************************************************************************** … … 29 29 { 30 30 psVector *sum = psVectorAlloc(myCoords->n, PS_TYPE_F32); 31 inti;32 intj;31 psS32 i; 32 psS32 j; 33 33 34 34 … … 52 52 } 53 53 54 intt01()54 psS32 t01() 55 55 { 56 intcurrentId = psMemGetId();57 intmemLeaks = 0;58 inti = 0;56 psS32 currentId = psMemGetId(); 57 psS32 memLeaks = 0; 58 psS32 i = 0; 59 59 psArray *myCoords; 60 60 psVector *myParams; … … 73 73 74 74 for (i=0;i<N;i++) { 75 myCoords->data[i] = (psP TR*) psVectorAlloc(2, PS_TYPE_F32);75 myCoords->data[i] = (psPtr *) psVectorAlloc(2, PS_TYPE_F32); 76 76 ((psVector *) (myCoords->data[i]))->data.F32[0] = (float) (i+10); 77 77 ((psVector *) (myCoords->data[i]))->data.F32[1] = (float) (i+3); … … 115 115 } 116 116 117 intmain()117 psS32 main() 118 118 { 119 119 t01(); -
trunk/psLib/test/dataManip/tst_psStats00.c
r1811 r2204 8 8 #define N 10 9 9 10 intmain()10 psS32 main() 11 11 { 12 12 psStats *myStats = NULL; 13 13 psStats *myStats2 = NULL; 14 inttestStatus = true;15 intglobalTestStatus = true;16 inti = 0;14 psS32 testStatus = true; 15 psS32 globalTestStatus = true; 16 psS32 i = 0; 17 17 psVector *myVector = NULL; 18 18 psVector *maskVector= NULL; … … 20 20 float realMeanNoMask = 0.0; 21 21 float realMeanWithMask = 0.0; 22 intcount = 0;23 intcurrentId = psMemGetId();24 intmemLeaks = 0;22 psS32 count = 0; 23 psS32 currentId = psMemGetId(); 24 psS32 memLeaks = 0; 25 25 26 26 /*************************************************************************/ -
trunk/psLib/test/dataManip/tst_psStats01.c
r1811 r2204 8 8 #define N 10 9 9 10 intmain()10 psS32 main() 11 11 { 12 12 psStats *myStats = NULL; 13 inttestStatus = true;14 intglobalTestStatus = true;15 inti = 0;13 psS32 testStatus = true; 14 psS32 globalTestStatus = true; 15 psS32 i = 0; 16 16 psVector *myVector = NULL; 17 17 psVector *maskVector= NULL; … … 19 19 float realMaxNoMask = 0.0; 20 20 float realMaxWithMask = 0.0; 21 intcurrentId = psMemGetId();22 intmemLeaks = 0;21 psS32 currentId = psMemGetId(); 22 psS32 memLeaks = 0; 23 23 24 24 /*************************************************************************/ -
trunk/psLib/test/dataManip/tst_psStats02.c
r1811 r2204 8 8 #define N 10 9 9 10 intmain()10 psS32 main() 11 11 { 12 12 psStats *myStats = NULL; 13 inttestStatus = true;14 intglobalTestStatus = true;15 inti = 0;13 psS32 testStatus = true; 14 psS32 globalTestStatus = true; 15 psS32 i = 0; 16 16 psVector *myVector = NULL; 17 17 psVector *maskVector= NULL; … … 19 19 float realMinNoMask = 1e99; 20 20 float realMinWithMask = 1e99; 21 intcurrentId = psMemGetId();22 intmemLeaks = 0;21 psS32 currentId = psMemGetId(); 22 psS32 memLeaks = 0; 23 23 24 24 /*************************************************************************/ -
trunk/psLib/test/dataManip/tst_psStats03.c
r1811 r2204 9 9 #define N ((4 * N1) + 1) 10 10 11 intmain()11 psS32 main() 12 12 { 13 13 psStats *myStats = NULL; 14 inttestStatus = true;15 intglobalTestStatus = true;16 inti = 0;14 psS32 testStatus = true; 15 psS32 globalTestStatus = true; 16 psS32 i = 0; 17 17 psVector *myVector = NULL; 18 18 psVector *maskVector= NULL; … … 20 20 float realMedianWithMask = (float) (N-3)/4; 21 21 float realMedianNoMask = (float) (N-1)/2; 22 intcurrentId = psMemGetId();23 intmemLeaks = 0;22 psS32 currentId = psMemGetId(); 23 psS32 memLeaks = 0; 24 24 25 25 /*************************************************************************/ -
trunk/psLib/test/dataManip/tst_psStats04.c
r1406 r2204 12 12 #define N ((4 * N1) + 1) 13 13 14 intmain()14 psS32 main() 15 15 { 16 16 psStats *myStats = NULL; 17 inttestStatus = true;18 inti = 0;17 psS32 testStatus = true; 18 psS32 i = 0; 19 19 psVector *myVector = NULL; 20 20 psVector *maskVector= NULL; -
trunk/psLib/test/dataManip/tst_psStats05.c
r1900 r2204 8 8 #define MISC_FLOAT_NUMBER 345.0 9 9 10 intmain()10 psS32 main() 11 11 { 12 12 psStats *myStats = NULL; 13 inttestStatus = true;14 intcurrentId = psMemGetId();15 intmemLeaks = 0;13 psS32 testStatus = true; 14 psS32 currentId = psMemGetId(); 15 psS32 memLeaks = 0; 16 16 17 17 /*************************************************************************/ -
trunk/psLib/test/dataManip/tst_psStats06.c
r1811 r2204 12 12 #define N 15 13 13 14 intmain()14 psS32 main() 15 15 { 16 16 psStats *myStats = NULL; 17 inttestStatus = true;18 intglobalTestStatus = true;19 inti = 0;17 psS32 testStatus = true; 18 psS32 globalTestStatus = true; 19 psS32 i = 0; 20 20 psVector *myVector = NULL; 21 21 psVector *maskVector= NULL; … … 26 26 float realStdevNoMask = 4.472136; 27 27 float realStdevWithMask = 2.160247; 28 intcount = 0;29 intcurrentId = psMemGetId();30 intmemLeaks = 0;28 psS32 count = 0; 29 psS32 currentId = psMemGetId(); 30 psS32 memLeaks = 0; 31 31 32 32 /*************************************************************************/ -
trunk/psLib/test/dataManip/tst_psStats07.c
r2198 r2204 15 15 #define ERROR_TOLERANCE 0.10 16 16 17 intt00()17 psS32 t00() 18 18 { 19 19 psStats * myStats = NULL; 20 inttestStatus = true;21 intglobalTestStatus = true;22 inti = 0;20 psS32 testStatus = true; 21 psS32 globalTestStatus = true; 22 psS32 i = 0; 23 23 psVector *myVector = NULL; 24 24 psVector *maskVector = NULL; … … 26 26 // They must be changed if we adjust the number of data points. 27 27 // We don't really know that they are correct. 28 intcount = 0;29 intcurrentId = psMemGetId();30 intmemLeaks = 0;28 psS32 count = 0; 29 psS32 currentId = psMemGetId(); 30 psS32 memLeaks = 0; 31 31 float realMeanNoMask = MEAN; 32 32 float realMedianNoMask = MEAN; … … 35 35 float realLQNoMask = MEAN - ( 0.6 * STDEV ); 36 36 float realUQNoMask = MEAN + ( 0.6 * STDEV ); 37 intrealN50NoMask = N / 4;38 intrealNfitNoMask = N / 4;37 psS32 realN50NoMask = N / 4; 38 psS32 realNfitNoMask = N / 4; 39 39 40 40 psTraceSetLevel(".psLib.dataManip.psStats", 10); … … 253 253 254 254 255 intt01()255 psS32 t01() 256 256 { 257 257 psStats * myStats = NULL; 258 inttestStatus = true;259 intglobalTestStatus = true;260 inti = 0;258 psS32 testStatus = true; 259 psS32 globalTestStatus = true; 260 psS32 i = 0; 261 261 psVector *myVector = NULL; 262 262 psVector *maskVector = NULL; … … 264 264 // A: They must be changed if we adjust the number of data points. 265 265 // B: We don't really know that they are correct. 266 intcount = 0;267 intcurrentId = psMemGetId();268 intmemLeaks = 0;266 psS32 count = 0; 267 psS32 currentId = psMemGetId(); 268 psS32 memLeaks = 0; 269 269 float realMeanWithMask = MEAN; 270 270 float realMedianWithMask = MEAN; … … 273 273 float realLQWithMask = MEAN; 274 274 float realUQWithMask = MEAN; 275 intrealN50WithMask = N / 4;276 intrealNfitWithMask = N / 4;275 psS32 realN50WithMask = N / 4; 276 psS32 realNfitWithMask = N / 4; 277 277 278 278 psTraceSetLevel(".psLib.dataManip.psStats", 10); … … 487 487 } 488 488 489 intmain()489 psS32 main() 490 490 { 491 491 t00(); -
trunk/psLib/test/dataManip/tst_psStats08.c
r1811 r2204 13 13 #define N (8 * N1) // Don't change this (N must be a multiple of 8) 14 14 15 intmain()15 psS32 main() 16 16 { 17 17 psStats *myStats = NULL; 18 inttestStatus = true;19 intglobalTestStatus = true;20 inti = 0;18 psS32 testStatus = true; 19 psS32 globalTestStatus = true; 20 psS32 i = 0; 21 21 psVector *myVector = NULL; 22 22 psVector *maskVector= NULL; … … 28 28 float realLQWithMask = N/8.0; 29 29 float realUQWithMask = 3.0 * (N/8.0); 30 intcount = 0;31 intcurrentId = psMemGetId();32 intmemLeaks = 0;30 psS32 count = 0; 31 psS32 currentId = psMemGetId(); 32 psS32 memLeaks = 0; 33 33 34 34 /*************************************************************************/ -
trunk/psLib/test/dataManip/tst_psStats09.c
r1811 r2204 16 16 #define MY_RANGE 2.0 17 17 18 intmain()18 psS32 main() 19 19 { 20 20 psStats *myStats = NULL; 21 inttestStatus = true;22 intglobalTestStatus = true;23 inti = 0;21 psS32 testStatus = true; 22 psS32 globalTestStatus = true; 23 psS32 i = 0; 24 24 psVector *maskVector= NULL; 25 25 psVector *myGaussData = NULL; … … 31 31 // float realclippedMeanWithMask = 0.0; 32 32 // float realclippedStdevWithMask = 0.0; 33 intcount = 0;34 intcurrentId = psMemGetId();35 intmemLeaks = 0;33 psS32 count = 0; 34 psS32 currentId = psMemGetId(); 35 psS32 memLeaks = 0; 36 36 37 37 /*************************************************************************/ -
trunk/psLib/test/dataManip/tst_psVectorFFT.c
r1406 r2204 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2004- 08-06 22:34:06$8 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-10-27 00:57:33 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 20 20 #define GENIMAGE(img,c,r,TYP, valueFcn) \ 21 21 img = psImageAlloc(c,r,PS_TYPE_##TYP); \ 22 for ( unsigned introw=0;row<r;row++) { \22 for (psU32 row=0;row<r;row++) { \ 23 23 ps##TYP* imgRow = img->data.TYP[row]; \ 24 for ( unsigned intcol=0;col<c;col++) { \24 for (psU32 col=0;col<c;col++) { \ 25 25 imgRow[col] = (ps##TYP)(valueFcn); \ 26 26 } \ 27 27 } 28 28 29 static inttestVectorFFT( void );30 static inttestVectorRealImaginary( void );31 static inttestVectorComplex( void );32 static inttestVectorConjugate( void );33 static inttestVectorPowerSpectrum( void );29 static psS32 testVectorFFT( void ); 30 static psS32 testVectorRealImaginary( void ); 31 static psS32 testVectorComplex( void ); 32 static psS32 testVectorConjugate( void ); 33 static psS32 testVectorPowerSpectrum( void ); 34 34 35 35 testDescription tests[] = { … … 54 54 }; 55 55 56 int main( intargc, char* argv[] )56 psS32 main( psS32 argc, char* argv[] ) 57 57 { 58 58 psLogSetLevel( PS_LOG_INFO ); … … 61 61 } 62 62 63 inttestVectorFFT( void )63 psS32 testVectorFFT( void ) 64 64 { 65 65 psVector * vec = NULL; … … 78 78 vec = psVectorAlloc( 100, PS_TYPE_F32 ); 79 79 vec->n = vec->nalloc; 80 for ( unsigned intn = 0; n < 100; n++ ) {80 for ( psU32 n = 0; n < 100; n++ ) { 81 81 vec->data.F32[ n ] = sinf( ( psF32 ) n / 50.0f * M_PI ); 82 82 } … … 91 91 92 92 // 3. verify that the only significant component cooresponds to the freqency of the input in step 1. 93 for ( unsigned intn = 0; n < 100; n++ ) {93 for ( psU32 n = 0; n < 100; n++ ) { 94 94 if ( n == 1 || n == 99 ) { 95 95 if ( fabsf( cabsf( vec2->data.C32[ n ] ) - 50.0f ) > 0.1f ) { … … 111 111 return 4; 112 112 } 113 for ( unsigned intn = 0; n < 100; n++ ) {113 for ( psU32 n = 0; n < 100; n++ ) { 114 114 psF32 val = sinf( ( psF32 ) n / 50.0f * M_PI ); 115 115 psF32 vecVal = crealf( vec3->data.C32[ n ] ) / 100; … … 128 128 } 129 129 130 inttestVectorRealImaginary( void )130 psS32 testVectorRealImaginary( void ) 131 131 { 132 132 psVector * vec = NULL; … … 143 143 vec = psVectorAlloc( 100, PS_TYPE_C32 ); 144 144 vec->n = vec->nalloc; 145 for ( unsigned intn = 0; n < 100; n++ ) {145 for ( psU32 n = 0; n < 100; n++ ) { 146 146 vec->data.C32[ n ] = n + I * ( n * 2 ); 147 147 } … … 171 171 172 172 // 3. compare results to the real/imaginary components of input 173 for ( unsigned intn = 0; n < 100; n++ ) {173 for ( psU32 n = 0; n < 100; n++ ) { 174 174 psF32 r = n; 175 175 psF32 i = ( n * 2 ); … … 193 193 } 194 194 195 inttestVectorComplex( void )195 psS32 testVectorComplex( void ) 196 196 { 197 197 psVector * vec = NULL; … … 220 220 vec->n = vec->nalloc; 221 221 vec2->n = vec2->nalloc; 222 for ( unsigned intn = 0; n < 100; n++ ) {222 for ( psU32 n = 0; n < 100; n++ ) { 223 223 vec->data.F32[ n ] = n; 224 224 vec2->data.F32[ n ] = ( n * 2 ); … … 237 237 // 4. call psVectorReal and psVectorImaginary on step 2 results (not needed, just use crealf/cimagf) 238 238 // 5. compare step 4 results to input. 239 for ( unsigned intn = 0; n < 100; n++ ) {239 for ( psU32 n = 0; n < 100; n++ ) { 240 240 if ( fabsf( crealf( vec3->data.C32[ n ] ) - n ) > FLT_EPSILON || 241 241 fabsf( cimagf( vec3->data.C32[ n ] ) - ( n * 2 ) ) > FLT_EPSILON ) { … … 278 278 } 279 279 280 inttestVectorConjugate( void )280 psS32 testVectorConjugate( void ) 281 281 { 282 282 psVector * vec = NULL; … … 293 293 vec = psVectorAlloc( 100, PS_TYPE_C32 ); 294 294 vec->n = vec->nalloc; 295 for ( unsigned intn = 0; n < 100; n++ ) {295 for ( psU32 n = 0; n < 100; n++ ) { 296 296 vec->data.C32[ n ] = n + I * ( n * 2 ); 297 297 } … … 307 307 308 308 // 4. verify each value is conjugate of input (a+bi -> a-bi) 309 for ( unsigned intn = 0; n < 100; n++ ) {309 for ( psU32 n = 0; n < 100; n++ ) { 310 310 if ( fabsf( crealf( vec->data.C32[ n ] ) - crealf( vec2->data.C32[ n ] ) ) > FLT_EPSILON || 311 311 fabsf( cimagf( vec->data.C32[ n ] ) + cimagf( vec2->data.C32[ n ] ) ) > FLT_EPSILON ) { … … 322 322 } 323 323 324 inttestVectorPowerSpectrum( void )324 psS32 testVectorPowerSpectrum( void ) 325 325 { 326 326 psVector * vec = NULL; … … 338 338 vec = psVectorAlloc( 100, PS_TYPE_C32 ); 339 339 vec->n = vec->nalloc; 340 for ( unsigned intn = 0; n < 100; n++ ) {340 for ( psU32 n = 0; n < 100; n++ ) { 341 341 vec->data.C32[ n ] = n + I * sinf( ( ( psF32 ) n ) / 50.f * M_PI ); 342 342 } … … 365 365 }; 366 366 367 for ( unsigned intn = 1; n < 50; n++ ) {367 for ( psU32 n = 1; n < 50; n++ ) { 368 368 val = ( cabsf( vec->data.C32[ n ] ) * cabsf( vec->data.C32[ n ] ) + 369 369 cabsf( vec->data.C32[ 100 - n ] ) * cabsf( vec->data.C32[ 100 - n ] ) ) / 100 / 100; -
trunk/psLib/test/image/tst_psImage.c
r1929 r2204 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.2 7$ $Name: not supported by cvs2svn $9 * @date $Date: 2004- 09-29 20:17:58$8 * @version $Revision: 1.28 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-10-27 00:57:33 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 21 21 #include "psType.h" 22 22 23 static inttestImageAlloc(void);24 static inttestImageCopy(void);23 static psS32 testImageAlloc(void); 24 static psS32 testImageCopy(void); 25 25 26 26 testDescription tests[] = { … … 31 31 }; 32 32 33 int main(intargc, char* argv[])33 psS32 main(psS32 argc, char* argv[]) 34 34 { 35 35 psLogSetLevel(PS_LOG_INFO); … … 38 38 } 39 39 40 inttestImageAlloc(void)40 psS32 testImageAlloc(void) 41 41 { 42 42 psImage* image = NULL; 43 unsigned intsizes = 6;44 unsigned intnumCols[] = {45 0,1,1,100,100,15046 };47 unsigned intnumRows[] = {48 0,1,100,1,150,10049 };50 unsigned inttypes = 13;43 psU32 sizes = 6; 44 psU32 numCols[] = { 45 0,1,1,100,100,150 46 }; 47 psU32 numRows[] = { 48 0,1,100,1,150,100 49 }; 50 psU32 types = 13; 51 51 psElemType type[] = { PS_TYPE_S8, PS_TYPE_S16, PS_TYPE_S32, PS_TYPE_S64, 52 52 PS_TYPE_U8, PS_TYPE_U16, PS_TYPE_U32, PS_TYPE_U64, … … 56 56 psLogMsg(__func__,PS_LOG_INFO,"#546 - psImageAlloc shall allocate memory for a psImage structure"); 57 57 58 for ( unsigned intt=0;t<types;t++) {58 for (psU32 t=0;t<types;t++) { 59 59 psLogMsg(__func__,PS_LOG_INFO,"Testing psImage with type %xh",type[t]); 60 60 61 for ( unsigned inti=0;i<sizes;i++) {61 for (psU32 i=0;i<sizes;i++) { 62 62 63 63 if (numRows[i] == 0 || numCols[i] == 0) { … … 112 112 switch (type[t]) { 113 113 case PS_TYPE_U16: { 114 unsigned introws = numRows[i];115 unsigned intcols = numCols[i];116 117 for ( intr=0;r<rows;r++) {118 for ( intc=0;c<cols;c++) {114 psU32 rows = numRows[i]; 115 psU32 cols = numCols[i]; 116 117 for (psS32 r=0;r<rows;r++) { 118 for (psS32 c=0;c<cols;c++) { 119 119 image->data.U16[r][c] = 2*c+r; 120 120 } 121 121 } 122 for ( intr=0;r<rows;r++) {123 for ( intc=0;c<cols;c++) {122 for (psS32 r=0;r<rows;r++) { 123 for (psS32 c=0;c<cols;c++) { 124 124 if (image->data.U16[r][c] != 2*c+r) { 125 125 psError(__func__,"Could not set all pixels in uint16 image at (%d,%d)",c,r); … … 132 132 break; 133 133 case PS_TYPE_F32: { 134 unsigned introws = numRows[i];135 unsigned intcols = numCols[i];136 137 for ( intr=0;r<rows;r++) {138 for ( intc=0;c<cols;c++) {134 psU32 rows = numRows[i]; 135 psU32 cols = numCols[i]; 136 137 for (psS32 r=0;r<rows;r++) { 138 for (psS32 c=0;c<cols;c++) { 139 139 image->data.F32[r][c] = 2.0f*c+r; 140 140 } 141 141 } 142 for ( intr=0;r<rows;r++) {143 for ( intc=0;c<cols;c++) {142 for (psS32 r=0;r<rows;r++) { 143 for (psS32 c=0;c<cols;c++) { 144 144 if (fabsf(image->data.F32[r][c] - (2.0f*c+r)) > FLT_EPSILON) { 145 145 psError(__func__,"Could not set all pixels in float image at (%d,%d)",c,r); … … 152 152 break; 153 153 case PS_TYPE_F64: { 154 unsigned introws = numRows[i];155 unsigned intcols = numCols[i];156 157 for ( intr=0;r<rows;r++) {158 for ( intc=0;c<cols;c++) {154 psU32 rows = numRows[i]; 155 psU32 cols = numCols[i]; 156 157 for (psS32 r=0;r<rows;r++) { 158 for (psS32 c=0;c<cols;c++) { 159 159 image->data.F64[r][c] = 2.0f*c+r; 160 160 } 161 161 } 162 for ( intr=0;r<rows;r++) {163 for ( intc=0;c<cols;c++) {162 for (psS32 r=0;r<rows;r++) { 163 for (psS32 c=0;c<cols;c++) { 164 164 if (fabs(image->data.F64[r][c] - (2.0f*c+r)) > DBL_EPSILON) { 165 165 psError(__func__,"Could not set all pixels in double image at (%d,%d)",c,r); … … 172 172 break; 173 173 case PS_TYPE_C32: { 174 unsigned introws = numRows[i];175 unsigned intcols = numCols[i];176 177 for ( intr=0;r<rows;r++) {178 for ( intc=0;c<cols;c++) {174 psU32 rows = numRows[i]; 175 psU32 cols = numCols[i]; 176 177 for (psS32 r=0;r<rows;r++) { 178 for (psS32 c=0;c<cols;c++) { 179 179 image->data.C32[r][c] = r + I * c; 180 180 } 181 181 } 182 for ( intr=0;r<rows;r++) {183 for ( intc=0;c<cols;c++) {182 for (psS32 r=0;r<rows;r++) { 183 for (psS32 c=0;c<cols;c++) { 184 184 if (fabsf(crealf(image->data.C32[r][c]) - r) > FLT_EPSILON || 185 185 fabsf(cimagf(image->data.C32[r][c]) - c) > FLT_EPSILON ) { … … 193 193 break; 194 194 case PS_TYPE_PTR: { 195 unsigned introws = numRows[i];196 unsigned intcols = numCols[i];195 psU32 rows = numRows[i]; 196 psU32 cols = numCols[i]; 197 197 psImage* temp = psImageAlloc(1,1,PS_TYPE_F32); 198 198 199 for ( intr=0;r<rows;r++) {200 for ( intc=0;c<cols;c++) {199 for (psS32 r=0;r<rows;r++) { 200 for (psS32 c=0;c<cols;c++) { 201 201 image->data.PTR[r][c] = psMemIncrRefCounter(temp); 202 202 } 203 203 } 204 for ( intr=0;r<rows;r++) {205 for ( intc=0;c<cols;c++) {204 for (psS32 r=0;r<rows;r++) { 205 for (psS32 c=0;c<cols;c++) { 206 206 if (image->data.PTR[r][c] != temp) { 207 207 psError(__func__, "Could not set pixel in pointer image at (%d,%d): %x %x", … … 218 218 default: { 219 219 // ignore type and just use as byte bucket. 220 unsigned introws = numRows[i];221 unsigned intcols = numCols[i]*PSELEMTYPE_SIZEOF(type[t]);222 223 for ( intr=0;r<rows;r++) {224 for ( intc=0;c<cols;c++) {220 psU32 rows = numRows[i]; 221 psU32 cols = numCols[i]*PSELEMTYPE_SIZEOF(type[t]); 222 223 for (psS32 r=0;r<rows;r++) { 224 for (psS32 c=0;c<cols;c++) { 225 225 image->data.U8[r][c] = (uint8_t)(r + c); 226 226 } 227 227 } 228 for ( intr=0;r<rows;r++) {229 for ( intc=0;c<cols;c++) {228 for (psS32 r=0;r<rows;r++) { 229 for (psS32 c=0;c<cols;c++) { 230 230 if (image->data.U8[r][c] != (uint8_t)(r + c)) { 231 231 psError(__func__,"Could not set all pixels in image (type=%d) at (%d,%d)", … … 253 253 } 254 254 255 inttestImageCopy(void)255 psS32 testImageCopy(void) 256 256 { 257 257 psImage* img = NULL; … … 259 259 psImage* img3 = NULL; 260 260 psImage* img4 = NULL; 261 unsigned intc = 128;262 unsigned intr = 256;261 psU32 c = 128; 262 psU32 r = 256; 263 263 264 264 img = psImageAlloc(c,r,PS_TYPE_F32); … … 296 296 return 4; 297 297 } 298 for ( unsigned introw=0;row<r;row++) {298 for (psU32 row=0;row<r;row++) { 299 299 psF32* imgInRow = img->data.F32[row]; 300 300 psF32* imgOutRow = img4->data.F32[row]; … … 324 324 return 2; \ 325 325 } \ 326 for ( unsigned introw=0;row<r;row++) { \326 for (psU32 row=0;row<r;row++) { \ 327 327 ps##IN* imgRow = img->data.IN[row]; \ 328 328 ps##OUT* img2Row = img2->data.OUT[row]; \ 329 for ( unsigned intcol=0;col<c;col++) { \329 for (psU32 col=0;col<c;col++) { \ 330 330 if (abs(imgRow[col] - (ps##IN)(row+col)) > 0.5) { \ 331 331 psError(__func__,"Input image was changed at %d,%d!", \ -
trunk/psLib/test/image/tst_psImageConvolve.c
r2068 r2204 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-10- 13 01:22:38$7 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-10-27 00:57:33 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 20 20 #include "psType.h" 21 21 22 static inttestKernelAlloc(void);23 static inttestKernelGenerate(void);24 //static inttestImageConvolve(void);22 static psS32 testKernelAlloc(void); 23 static psS32 testKernelGenerate(void); 24 //static psS32 testImageConvolve(void); 25 25 26 26 testDescription tests[] = { … … 31 31 }; 32 32 33 int main(intargc, char* argv[])33 psS32 main(psS32 argc, char* argv[]) 34 34 { 35 35 psLogSetLevel(PS_LOG_INFO); … … 38 38 } 39 39 40 static inttestKernelAlloc(void)40 static psS32 testKernelAlloc(void) 41 41 { 42 intnumCases = 4;43 intxMin[] = { -5, 0,-10, 5};44 intxMax[] = { 0, 5, -5, 10};45 intyMin[] = { -4, 0, -8, 4};46 intyMax[] = { 0, 4, -4, 8};47 inti;42 psS32 numCases = 4; 43 psS32 xMin[] = { -5, 0,-10, 5}; 44 psS32 xMax[] = { 0, 5, -5, 10}; 45 psS32 yMin[] = { -4, 0, -8, 4}; 46 psS32 yMax[] = { 0, 4, -4, 8}; 47 psS32 i; 48 48 psKernel* k; 49 49 … … 73 73 } 74 74 75 for ( intj=yMin[i]; j<yMax[i]; j++) {75 for (psS32 j=yMin[i]; j<yMax[i]; j++) { 76 76 if (k->kernel[j]+xMin[i] != k->image->data.PS_TYPE_KERNEL_DATA[j-yMin[i]]) { 77 77 psError(__func__,"The kernel pointer was set wrong for row %d.", … … 115 115 } 116 116 117 static inttestKernelGenerate(void)117 static psS32 testKernelGenerate(void) 118 118 { 119 intsize = 4;120 intt[] = { 1, 2, 8, 10 };121 intx[] = { 0, 1, 0, -1 };122 inty[] = { 2, 1, -1, -2 };119 psS32 size = 4; 120 psS32 t[] = { 1, 2, 8, 10 }; 121 psS32 x[] = { 0, 1, 0, -1 }; 122 psS32 y[] = { 2, 1, -1, -2 }; 123 123 psKernelType sum; 124 124 … … 127 127 psVector* tVec = psVectorAlloc(size,PS_TYPE_U32); 128 128 129 for ( inti = 0; i < size; i++) {129 for (psS32 i = 0; i < size; i++) { 130 130 xVec->data.U32[i] = x[i]; 131 131 yVec->data.U32[i] = y[i]; … … 148 148 149 149 sum = 0.0; 150 for ( inty = result->yMin; y <= result->yMax; y++) {151 for ( intx = result->xMin; x <= result->xMax; x++) {150 for (psS32 y = result->yMin; y <= result->yMax; y++) { 151 for (psS32 x = result->xMin; x <= result->xMax; x++) { 152 152 sum += result->kernel[y][x]; 153 153 } … … 182 182 tVec = psVectorAlloc(size,PS_TYPE_S16); 183 183 184 for ( inti = 0; i < size; i++) {184 for (psS32 i = 0; i < size; i++) { 185 185 xVec->data.S16[i] = x[i]; 186 186 yVec->data.S16[i] = y[i]; … … 203 203 204 204 sum = 0.0; 205 for ( inty = result->yMin; y <= result->yMax; y++) {206 for ( intx = result->xMin; x <= result->xMax; x++) {205 for (psS32 y = result->yMin; y <= result->yMax; y++) { 206 for (psS32 x = result->xMin; x <= result->xMax; x++) { 207 207 sum += result->kernel[y][x]; 208 208 } … … 236 236 tVec = psVectorAlloc(size,PS_TYPE_F32); 237 237 238 for ( inti = 0; i < size; i++) {238 for (psS32 i = 0; i < size; i++) { 239 239 xVec->data.F32[i] = x[i]+0.1; 240 240 yVec->data.F32[i] = y[i]+0.2; … … 291 291 292 292 /* 293 static inttestImageConvolve(void)293 static psS32 testImageConvolve(void) 294 294 { 295 const intr = 200;296 const intc = 300;297 intsum;295 const psS32 r = 200; 296 const psS32 c = 300; 297 psS32 sum; 298 298 299 299 // approximate a normalized gaussian kernel. … … 312 312 psKernel* nsk = psKernelAlloc(0,2,0,2); 313 313 sum = 0.0; 314 for ( inti=0;i<2;i++) {315 for ( intj=0;j<2;j++) {314 for (psS32 i=0;i<2;i++) { 315 for (psS32 j=0;j<2;j++) { 316 316 nsk->kernel[i][j] = i+j; 317 317 sum = i+j; 318 318 } 319 319 } 320 for ( inti=0;i<2;i++) {321 for ( intj=0;j<2;j++) {320 for (psS32 i=0;i<2;i++) { 321 for (psS32 j=0;j<2;j++) { 322 322 nsk->kernel[i][j] /= sum; 323 323 } … … 356 356 357 357 // test values 358 for ( inti=-1;i<1;i++) {359 for ( intj=-1;j<1;j++) {358 for (psS32 i=-1;i<1;i++) { 359 for (psS32 j=-1;j<1;j++) { 360 360 if (fabsf(out->data.F32[r/2+i][c/2+j] - g->kernel[i][j]) > 0.0001) { 361 361 psError(__func__,"Convolved image wrong at %d,%d. Value is %g, expected %g.", … … 423 423 psImageWriteSection(out2,0,0,0,NULL,0,"out2.fits"); 424 424 // test values 425 for ( inti=-1;i<1;i++) {426 for ( intj=-1;j<1;j++) {425 for (psS32 i=-1;i<1;i++) { 426 for (psS32 j=-1;j<1;j++) { 427 427 if (fabsf(out->data.F32[r/2+i][c/2+j] - g->kernel[i][j]) > 0.0001) { 428 428 psError(__func__,"Convolved image wrong at %d,%d. Value is %g, expected %g.", -
trunk/psLib/test/image/tst_psImageExtraction.c
r2156 r2204 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-10- 15 20:00:56$8 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-10-27 00:57:33 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 #include "psType.h" 19 19 20 static inttestImageSlice(void);21 static inttestImageSubset(void);22 static inttestImageSubsection(void);23 static inttestImageTrim(void);24 static inttestImageCut(void);25 static inttestImageRadialCut(void);20 static psS32 testImageSlice(void); 21 static psS32 testImageSubset(void); 22 static psS32 testImageSubsection(void); 23 static psS32 testImageTrim(void); 24 static psS32 testImageCut(void); 25 static psS32 testImageRadialCut(void); 26 26 27 27 … … 37 37 }; 38 38 39 int main( intargc, char* argv[] )39 psS32 main( psS32 argc, char* argv[] ) 40 40 { 41 41 return ! runTestSuite( stderr, "psImage", tests, argc, argv ); 42 42 } 43 43 44 inttestImageSlice(void)44 psS32 testImageSlice(void) 45 45 { 46 const intr = 200;47 const intc = 300;48 const intm = r / 2 -1;49 const intn = r / 4 -1;46 const psS32 r = 200; 47 const psS32 c = 300; 48 const psS32 m = r / 2 -1; 49 const psS32 n = r / 4 -1; 50 50 psVector* out = NULL; 51 51 psImage* image; … … 68 68 */ 69 69 70 for ( introw = 0;row < r;row++ ) {70 for ( psS32 row = 0;row < r;row++ ) { 71 71 psMaskType* maskRow = mask->data.PS_TYPE_MASK_DATA[row]; 72 for ( intcol = 0;col < c;col++ ) {72 for ( psS32 col = 0;col < c;col++ ) { 73 73 maskRow[ col ] = 0; 74 74 } … … 77 77 #define PSIMAGESLICE_TEST1(TYPE,M,N,DIRECTION,TRUTH_SIZE,TRUTHPIX_X,TRUTHPIX_Y,TESTNUM) \ 78 78 image = psImageAlloc( c, r, PS_TYPE_##TYPE ); \ 79 for ( introw = 0;row < r;row++ ) { \79 for ( psS32 row = 0;row < r;row++ ) { \ 80 80 ps##TYPE *imageRow = image->data.TYPE[ row ]; \ 81 81 ps##TYPE rowOffset = row * 2; \ 82 for ( intcol = 0;col < c;col++ ) { \82 for ( psS32 col = 0;col < c;col++ ) { \ 83 83 imageRow[ col ] = col + rowOffset; \ 84 84 } \ … … 98 98 } \ 99 99 \ 100 for ( inti=0;i<out->n;i++) { \100 for (psS32 i=0;i<out->n;i++) { \ 101 101 if (fabs(out->data.F64[i]-image->data.TYPE[r/10+TRUTHPIX_Y][c/10+TRUTHPIX_X]) > 1.0/(psF64)r) { \ 102 102 psError(__func__,"Improper result at position %d. Got %g, expected %g",i, \ … … 363 363 364 364 // #547: psImageSubset shall create child image of a specified size from a parent psImage structure 365 inttestImageSubset(void)365 psS32 testImageSubset(void) 366 366 { 367 367 psImage preSubsetStruct; … … 370 370 psImage* subset2 = NULL; 371 371 psImage* subset3 = NULL; 372 intc = 128;373 intr = 256;372 psS32 c = 128; 373 psS32 r = 256; 374 374 375 375 original = psImageAlloc(c,r,PS_TYPE_U32); 376 for ( introw=0;row<r;row++) {377 for ( intcol=0;col<c;col++) {376 for (psS32 row=0;row<r;row++) { 377 for (psS32 col=0;col<c;col++) { 378 378 original->data.F32[row][col] = row*1000+col; 379 379 } … … 404 404 "row member, if the input psImage structure image contains known values."); 405 405 406 for ( introw=0;row<r/2;row++) {407 for ( intcol=0;col<c/2;col++) {406 for (psS32 row=0;row<r/2;row++) { 407 for (psS32 col=0;col<c/2;col++) { 408 408 if (subset2->data.U32[row][col] != original->data.U32[row+r/4][col+c/4]) { 409 409 psError(__func__,"psImageSubset output #1 was wrong at %dx%d (%d vs %d).", … … 596 596 597 597 // #730: psImageSubsection shall create child image of a specified size from a parent psImage structure 598 inttestImageSubsection(void)598 psS32 testImageSubsection(void) 599 599 { 600 600 psImage* original; 601 601 psImage* subset; 602 intc = 128;603 intr = 256;604 inti;605 intnumRegions = 4;606 intx1[] = { 0, 32, 64, 32};607 intx2[] = { 32, 64,127, 64};608 inty1[] = { 0, 32, 32,128};609 inty2[] = { 32, 64, 64,255};602 psS32 c = 128; 603 psS32 r = 256; 604 psS32 i; 605 psS32 numRegions = 4; 606 psS32 x1[] = { 0, 32, 64, 32}; 607 psS32 x2[] = { 32, 64,127, 64}; 608 psS32 y1[] = { 0, 32, 32,128}; 609 psS32 y2[] = { 32, 64, 64,255}; 610 610 611 611 original = psImageAlloc(c,r,PS_TYPE_U32); 612 for ( introw=0;row<r;row++) {613 for ( intcol=0;col<c;col++) {612 for (psS32 row=0;row<r;row++) { 613 for (psS32 col=0;col<c;col++) { 614 614 original->data.F32[row][col] = row*1000+col; 615 615 } … … 664 664 } 665 665 666 intnumCols = x2[i]-x1[i]+1;667 intnumRows = y2[i]-y1[i]+1;666 psS32 numCols = x2[i]-x1[i]+1; 667 psS32 numRows = y2[i]-y1[i]+1; 668 668 if (subset->numCols != numCols || subset->numRows != numRows) { 669 669 psError(__func__,"psImageSubsection output size was not proper(%dx%d, should be %dx%d).", … … 672 672 } 673 673 674 for ( introw=0;row<numRows;row++) {675 for ( intcol=0;col<numCols;col++) {674 for (psS32 row=0;row<numRows;row++) { 675 for (psS32 col=0;col<numCols;col++) { 676 676 if (subset->data.U32[row][col] != original->data.U32[row+y1[i]][col+x1[i]]) { 677 677 psError(__func__,"psImageSubset output #1 was wrong at %dx%d (%d vs %d).", … … 751 751 } 752 752 753 static inttestImageTrim(void)753 static psS32 testImageTrim(void) 754 754 { 755 intr = 200;756 intc = 300;757 intqtrR = r/4;758 intqtrC = c/4;759 inthalfR = r/2;760 inthalfC = c/2;755 psS32 r = 200; 756 psS32 c = 300; 757 psS32 qtrR = r/4; 758 psS32 qtrC = c/4; 759 psS32 halfR = r/2; 760 psS32 halfC = c/2; 761 761 762 762 psImage* image = psImageAlloc(c,r,PS_TYPE_F32); 763 for ( introw = 0; row < image->numRows; row++) {764 for ( intcol = 0; col < image->numCols; col++) {763 for (psS32 row = 0; row < image->numRows; row++) { 764 for (psS32 col = 0; col < image->numCols; col++) { 765 765 image->data.F32[row][col] = (psF32)col + (psF32)row/1000.0f; 766 766 } … … 792 792 } 793 793 794 for ( introw = 0; row < image2->numRows; row++) {795 for ( intcol = 0; col < image2->numCols; col++) {794 for (psS32 row = 0; row < image2->numRows; row++) { 795 for (psS32 col = 0; col < image2->numCols; col++) { 796 796 if (fabsf(image2->data.F32[row][col] - image->data.F32[row+qtrR][col+qtrC]) > FLT_EPSILON) { 797 797 psLogMsg(__func__,PS_LOG_ERROR, … … 830 830 } 831 831 832 for ( introw = 0; row < image2->numRows; row++) {833 for ( intcol = 0; col < image2->numCols; col++) {832 for (psS32 row = 0; row < image2->numRows; row++) { 833 for (psS32 col = 0; col < image2->numCols; col++) { 834 834 if (fabsf(image2->data.F32[row][col] - 835 835 image->data.F32[row+qtrR][col+qtrC]) > FLT_EPSILON) { … … 869 869 } 870 870 871 for ( introw = 0; row < image2->numRows; row++) {872 for ( intcol = 0; col < image2->numCols; col++) {871 for (psS32 row = 0; row < image2->numRows; row++) { 872 for (psS32 col = 0; col < image2->numCols; col++) { 873 873 if (fabsf(image2->data.F32[row][col] - 874 874 image->data.F32[row+qtrR][col+qtrC]) > FLT_EPSILON) { … … 1014 1014 } 1015 1015 1016 static inttestImageCut(void)1016 static psS32 testImageCut(void) 1017 1017 { 1018 intc = 300;1019 intr = 200;1020 intnumPoints = 15;1018 psS32 c = 300; 1019 psS32 r = 200; 1020 psS32 numPoints = 15; 1021 1021 float startCol[] = { 40,150, 40, 0,280, 40,280, -1,300, 20, 20, 20, 20, 20, 20}; 1022 1022 float endCol[] = {240,150,240,299, 40,240, 40,240,240, -1,300,240,240,240,240}; 1023 1023 float startRow[] = { 20, 10,100, 0, 20,180,180, 10, 10, 10, 10, -1,200, 10, 10}; 1024 1024 float endRow[] = {160,180,100,199,160, 10, 10,180,180,180,180,180,180, -1,200}; 1025 bool success[] = {true,true,true,true,true,true,true,false,false,false,false,false,false,false,false};1026 unsigned intlength = 100;1025 psBool success[] = {true,true,true,true,true,true,true,false,false,false,false,false,false,false,false}; 1026 psU32 length = 100; 1027 1027 1028 1028 psImage* image = psImageAlloc(c,r,PS_TYPE_F32); 1029 1029 psImage* mask = psImageAlloc(c,r,PS_TYPE_MASK); 1030 for ( introw = 0; row < image->numRows; row++) {1031 for ( intcol = 0; col < image->numCols; col++) {1030 for (psS32 row = 0; row < image->numRows; row++) { 1031 for (psS32 col = 0; col < image->numCols; col++) { 1032 1032 image->data.F32[row][col] = (psF32)col + (psF32)row/1000.0f; 1033 1033 if ((row & 0x0F) == 0) { … … 1042 1042 1043 1043 psVector* result = NULL; 1044 for ( intn = 0; n < numPoints; n++) {1044 for (psS32 n = 0; n < numPoints; n++) { 1045 1045 psVector* orig = result; 1046 1046 if (! success[n]) { … … 1083 1083 float deltaCol = (endCol[n]-startCol[n])/(length-1); 1084 1084 psF32 truth; 1085 for ( inti = 0; i < length; i++) {1085 for (psS32 i = 0; i < length; i++) { 1086 1086 float x = (float)startCol[n]+(float)i*deltaCol; 1087 1087 float y = (float)startRow[n]+(float)i*deltaRow; … … 1177 1177 } 1178 1178 1179 static inttestImageRadialCut(void)1179 static psS32 testImageRadialCut(void) 1180 1180 { 1181 intc = 300;1182 intr = 200;1183 intcenterX = c/2;1184 intcenterY = r/2;1181 psS32 c = 300; 1182 psS32 r = 200; 1183 psS32 centerX = c/2; 1184 psS32 centerY = r/2; 1185 1185 psErr* err = NULL; 1186 1186 1187 1187 psImage* image = psImageAlloc(c,r,PS_TYPE_F32); 1188 1188 psImage* mask = psImageAlloc(c,r,PS_TYPE_MASK); 1189 for ( introw = 0; row < image->numRows; row++) {1190 for ( intcol = 0; col < image->numCols; col++) {1189 for (psS32 row = 0; row < image->numRows; row++) { 1190 for (psS32 col = 0; col < image->numCols; col++) { 1191 1191 image->data.F32[row][col] = sqrtf((col-centerX)*(col-centerX)+(row-centerY)*(row-centerY)); 1192 1192 if ((row & 0x0F) == 0) { … … 1200 1200 psStats* stat = psStatsAlloc(PS_STAT_SAMPLE_MEAN); 1201 1201 psVector* radii = psVectorAlloc(10,PS_TYPE_F32); 1202 for ( inti=0; i < 10; i++) {1202 for (psS32 i=0; i < 10; i++) { 1203 1203 radii->data.F32[i] = 10+i*10; 1204 1204 } … … 1220 1220 } 1221 1221 1222 for ( inti=0; i < 9; i++) {1222 for (psS32 i=0; i < 9; i++) { 1223 1223 if (fabs(result->data.F64[i] - (15.0+i*10)) > 1) { 1224 1224 psLogMsg(__func__,PS_LOG_ERROR, … … 1245 1245 } 1246 1246 1247 for ( inti=0; i < 9; i++) {1247 for (psS32 i=0; i < 9; i++) { 1248 1248 if (fabs(result->data.F64[i] - (15.0+i*10)) > 1) { 1249 1249 psLogMsg(__func__,PS_LOG_ERROR, -
trunk/psLib/test/image/tst_psImageFFT.c
r2078 r2204 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-10- 13 19:50:12$8 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-10-27 00:57:33 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 20 20 #define GENIMAGE(img,c,r,TYP, valueFcn) \ 21 21 img = psImageAlloc(c,r,PS_TYPE_##TYP); \ 22 for ( unsigned introw=0;row<r;row++) { \22 for (psU32 row=0;row<r;row++) { \ 23 23 ps##TYP* imgRow = img->data.TYP[row]; \ 24 for ( unsigned intcol=0;col<c;col++) { \24 for (psU32 col=0;col<c;col++) { \ 25 25 imgRow[col] = (ps##TYP)(valueFcn); \ 26 26 } \ 27 27 } 28 28 29 static inttestImageFFT(void);30 static inttestImageRealImaginary(void);31 static inttestImageComplex(void);32 static inttestImageConjugate(void);33 static inttestImagePowerSpectrum(void);29 static psS32 testImageFFT(void); 30 static psS32 testImageRealImaginary(void); 31 static psS32 testImageComplex(void); 32 static psS32 testImageConjugate(void); 33 static psS32 testImagePowerSpectrum(void); 34 34 35 35 testDescription tests[] = { … … 54 54 }; 55 55 56 int main(intargc, char* argv[])56 psS32 main(psS32 argc, char* argv[]) 57 57 { 58 58 psLogSetLevel(PS_LOG_INFO); … … 61 61 } 62 62 63 inttestImageFFT(void)63 psS32 testImageFFT(void) 64 64 { 65 65 psImage* img = NULL; 66 66 psImage* img2 = NULL; 67 67 psImage* img3 = NULL; 68 unsigned intm = 128;69 unsigned intn = 64;68 psU32 m = 128; 69 psU32 n = 64; 70 70 psImage* img4 = NULL; 71 71 psImage* img5 = NULL; … … 95 95 96 96 // 3. verify that the only significant component cooresponds to the freqency of the input in step 1. 97 for ( unsigned introw=0;row<n;row++) {97 for (psU32 row=0;row<n;row++) { 98 98 psC32* img2Row = img2->data.C32[row]; 99 for ( unsigned intcol=0;col<m;col++) {99 for (psU32 col=0;col<m;col++) { 100 100 psF32 mag = cabsf(img2Row[col])/m/n; 101 101 if (mag > 0.1f) { … … 130 130 } 131 131 132 for ( unsigned introw=0;row<n;row++) {132 for (psU32 row=0;row<n;row++) { 133 133 psC32* img3Row = img3->data.C32[row]; 134 134 psF32* imgRow = img->data.F32[row]; 135 for ( unsigned intcol=0;col<m;col++) {135 for (psU32 col=0;col<m;col++) { 136 136 psF32 pixel = creal(img3Row[col])/m/n; 137 137 if (fabsf(pixel-imgRow[col]) > 0.1) { … … 159 159 } 160 160 161 for ( unsigned introw=0;row<n;row++) {161 for (psU32 row=0;row<n;row++) { 162 162 psF32* img3Row = img3->data.F32[row]; 163 163 psF32* imgRow = img->data.F32[row]; 164 for ( unsigned intcol=0;col<m;col++) {164 for (psU32 col=0;col<m;col++) { 165 165 psF32 pixel = img3Row[col]/m/n; 166 166 if (fabsf(pixel-imgRow[col]) > 0.1) { … … 209 209 } 210 210 211 inttestImageRealImaginary(void)211 psS32 testImageRealImaginary(void) 212 212 { 213 213 psImage* img = NULL; 214 214 psImage* img2 = NULL; 215 215 psImage* img3 = NULL; 216 unsigned intm = 128;217 unsigned intn = 64;216 psU32 m = 128; 217 psU32 n = 64; 218 218 219 219 /* … … 250 250 251 251 // 3. compare results to the real/imaginary components of input 252 for ( unsigned introw=0;row<n;row++) {252 for (psU32 row=0;row<n;row++) { 253 253 psF32* img2Row = img2->data.F32[row]; 254 254 psF32* img3Row = img3->data.F32[row]; 255 for ( unsigned intcol=0;col<m;col++) {255 for (psU32 col=0;col<m;col++) { 256 256 if (fabsf(img2Row[col] - row) > FLT_EPSILON) { 257 257 psError(__func__,"psImageReal didn't return the real portion at n=%d", … … 274 274 } 275 275 276 inttestImageComplex(void)276 psS32 testImageComplex(void) 277 277 { 278 278 psImage* img = NULL; 279 279 psImage* img2 = NULL; 280 280 psImage* img3 = NULL; 281 unsigned intm = 128;282 unsigned intn = 64;281 psU32 m = 128; 282 psU32 n = 64; 283 283 284 284 /* … … 314 314 // 4. call psImageReal and psImageImaginary on step 2 results (not needed, just use crealf/cimagf) 315 315 // 5. compare step 4 results to input. 316 for ( unsigned introw=0;row<n;row++) {316 for (psU32 row=0;row<n;row++) { 317 317 psC32* img3Row = img3->data.C32[row]; 318 for ( unsigned intcol=0;col<m;col++) {318 for (psU32 col=0;col<m;col++) { 319 319 if (fabsf(crealf(img3Row[col]) - row) > FLT_EPSILON || 320 320 fabsf(cimagf(img3Row[col]) - col) > FLT_EPSILON) { … … 358 358 } 359 359 360 inttestImageConjugate(void)360 psS32 testImageConjugate(void) 361 361 { 362 362 psImage* img = NULL; 363 363 psImage* img2 = NULL; 364 unsigned intm = 128;365 unsigned intn = 64;364 psU32 m = 128; 365 psU32 n = 64; 366 366 367 367 /* … … 385 385 386 386 // 4. verify each value is conjugate of input (a+bi -> a-bi) 387 for ( unsigned introw=0;row<n;row++) {387 for (psU32 row=0;row<n;row++) { 388 388 psC32* img2Row = img2->data.C32[row]; 389 for ( unsigned intcol=0;col<m;col++) {389 for (psU32 col=0;col<m;col++) { 390 390 if (fabsf(crealf(img2Row[col]) - row) > FLT_EPSILON || 391 391 fabsf(cimagf(img2Row[col]) + col) > FLT_EPSILON) { … … 403 403 } 404 404 405 inttestImagePowerSpectrum(void)405 psS32 testImagePowerSpectrum(void) 406 406 { 407 407 psImage* img = NULL; 408 408 psImage* img2 = NULL; 409 unsigned intm = 128;410 unsigned intn = 64;409 psU32 m = 128; 410 psU32 n = 64; 411 411 412 412 /* … … 430 430 431 431 // 4. verify the values are the square of the absolute values of the original 432 for ( unsigned introw=0;row<n;row++) {432 for (psU32 row=0;row<n;row++) { 433 433 psC32* imgRow = img->data.C32[row]; 434 434 psF32* img2Row = img2->data.F32[row]; 435 for ( unsigned intcol=0;col<m;col++) {435 for (psU32 col=0;col<m;col++) { 436 436 psF32 power = cabs(imgRow[col]); 437 437 power *= power/n/n/m/m; -
trunk/psLib/test/image/tst_psImageIO.c
r1942 r2204 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-10- 02 02:09:21$8 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-10-27 00:57:33 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 25 25 #define GENIMAGE(img,c,r,TYP, valueFcn) \ 26 26 img = psImageAlloc(c,r,PS_TYPE_##TYP); \ 27 for ( unsigned introw=0;row<r;row++) { \27 for (psU32 row=0;row<r;row++) { \ 28 28 ps##TYP* imgRow = img->data.TYP[row]; \ 29 for ( unsigned intcol=0;col<c;col++) { \29 for (psU32 col=0;col<c;col++) { \ 30 30 imgRow[col] = (ps##TYP)(valueFcn); \ 31 31 } \ 32 32 } 33 33 34 static inttestImageRead(void);35 static inttestImageWrite(void);34 static psS32 testImageRead(void); 35 static psS32 testImageWrite(void); 36 36 37 37 testDescription tests[] = { … … 47 47 }; 48 48 49 int main(intargc, char* argv[])49 psS32 main(psS32 argc, char* argv[]) 50 50 { 51 51 psLogSetLevel(PS_LOG_INFO); … … 57 57 } 58 58 59 inttestImageRead(void)59 psS32 testImageRead(void) 60 60 { 61 intN = 256;62 intM = 128;61 psS32 N = 256; 62 psS32 M = 128; 63 63 psImage* image = NULL; 64 64 … … 127 127 return 6; \ 128 128 } \ 129 for ( unsigned introw = readN0; row < readN; row++) { \129 for (psU32 row = readN0; row < readN; row++) { \ 130 130 ps##TYP* imgRow = img->data.TYP[row-readN0]; \ 131 131 ps##TYP* img2Row = img2->data.TYP[row]; \ 132 132 ps##TYP* img3Row = img3->data.TYP[row-readN0]; \ 133 133 ps##TYP* img4Row = img4->data.TYP[row]; \ 134 for ( unsigned intcol = readM0; col < readM; col++) { \134 for (psU32 col = readM0; col < readM; col++) { \ 135 135 if (fabsf(imgRow[col-readM0]-img2Row[col]) > FLT_EPSILON) { \ 136 136 psError(__func__,"Image changed in I/O operation at %d,%d,0 (%.2f vs %.2f) for %s", \ … … 155 155 return 9; \ 156 156 } \ 157 for ( unsigned introw = readN0; row < readN; row++) { \157 for (psU32 row = readN0; row < readN; row++) { \ 158 158 ps##TYP* imgRow = img->data.TYP[row-readN0]; \ 159 159 ps##TYP* img2Row = img2->data.TYP[row]; \ 160 160 ps##TYP* img3Row = img3->data.TYP[row-readN0]; \ 161 161 ps##TYP* img4Row = img4->data.TYP[row]; \ 162 for ( unsigned intcol = readM0; col < readM; col++) { \162 for (psU32 col = readM0; col < readM; col++) { \ 163 163 if (fabsf(imgRow[col-readM0]-img2Row[col]) > FLT_EPSILON) { \ 164 164 psError(__func__,"Image changed in I/O operation at %d,%d,0 (%.2f vs %.2f) for %s", \ … … 258 258 } 259 259 260 inttestImageWrite(void)260 psS32 testImageWrite(void) 261 261 { 262 262 psImage* img = NULL; 263 263 psImage* img2 = NULL; 264 intm = 64;265 intn = 96;264 psS32 m = 64; 265 psS32 n = 96; 266 266 267 267 /* … … 318 318 return 16; 319 319 } 320 for ( unsigned introw=0;row<n;row++) {320 for (psU32 row=0;row<n;row++) { 321 321 psF32* imgRow = img->data.F32[row]; 322 for ( unsigned intcol=0;col<m;col++) {322 for (psU32 col=0;col<m;col++) { 323 323 if (fabsf(imgRow[col] - (row+2*col)) > FLT_EPSILON) { 324 324 psError(__func__,"The image values were not overwritten at %d,%d (%.2f vs %.2f)", -
trunk/psLib/test/image/tst_psImageManip.c
r2105 r2204 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 29$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-10- 14 01:22:59$8 * @version $Revision: 1.30 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-10-27 00:57:33 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 25 25 #include "psType.h" 26 26 27 static inttestImageClip(void);28 static inttestImageClipNAN(void);29 static inttestImageClipComplexRegion(void);30 static inttestImageOverlay(void);31 static inttestImageRebin(void);32 static inttestImageRoll(void);33 static inttestImageRotate(void);34 static inttestImageShift(void);35 static int testImageShiftCase(int cols, introws, float colShift,float rowShift);36 static inttestImageResample(void);27 static psS32 testImageClip(void); 28 static psS32 testImageClipNAN(void); 29 static psS32 testImageClipComplexRegion(void); 30 static psS32 testImageOverlay(void); 31 static psS32 testImageRebin(void); 32 static psS32 testImageRoll(void); 33 static psS32 testImageRotate(void); 34 static psS32 testImageShift(void); 35 static psS32 testImageShiftCase(psS32 cols, psS32 rows, float colShift,float rowShift); 36 static psS32 testImageResample(void); 37 37 38 38 testDescription tests[] = { … … 49 49 }; 50 50 51 int main(intargc, char* argv[])51 psS32 main(psS32 argc, char* argv[]) 52 52 { 53 53 psLogSetLevel(PS_LOG_INFO); … … 57 57 58 58 59 inttestImageClip(void)59 psS32 testImageClip(void) 60 60 { 61 61 psImage* img = NULL; 62 unsigned intc = 128;63 unsigned intr = 256;62 psU32 c = 128; 63 psU32 r = 256; 64 64 psF64 min; 65 65 psF64 max; 66 intnumClipped = 0;67 intretVal;66 psS32 numClipped = 0; 67 psS32 retVal; 68 68 69 69 psLogMsg(__func__,PS_LOG_INFO, … … 95 95 #define testImageClipByType(datatype) \ 96 96 img = psImageAlloc(c,r,PS_TYPE_##datatype); \ 97 for ( unsigned introw=0;row<r;row++) { \97 for (psU32 row=0;row<r;row++) { \ 98 98 ps##datatype* imgRow = img->data.datatype[row]; \ 99 for ( unsigned intcol=0;col<c;col++) { \99 for (psU32 col=0;col<c;col++) { \ 100 100 imgRow[col] = (ps##datatype)(row+col); \ 101 101 } \ … … 107 107 \ 108 108 numClipped = 0; \ 109 for ( unsigned introw=0;row<r;row++) { \109 for (psU32 row=0;row<r;row++) { \ 110 110 ps##datatype* imgRow = img->data.datatype[row]; \ 111 for ( unsigned intcol=0;col<c;col++) { \111 for (psU32 col=0;col<c;col++) { \ 112 112 ps##datatype value = (ps##datatype)(row+col); \ 113 113 if (value < min) { \ … … 134 134 #define testImageClipByComplexType(datatype) \ 135 135 img = psImageAlloc(c,r,PS_TYPE_##datatype); \ 136 for ( unsigned introw=0;row<r;row++) { \136 for (psU32 row=0;row<r;row++) { \ 137 137 ps##datatype* imgRow = img->data.datatype[row]; \ 138 for ( unsigned intcol=0;col<c;col++) { \138 for (psU32 col=0;col<c;col++) { \ 139 139 imgRow[col] = (ps##datatype)(row+I*col); \ 140 140 } \ … … 146 146 \ 147 147 numClipped = 0; \ 148 for ( unsigned introw=0;row<r;row++) { \148 for (psU32 row=0;row<r;row++) { \ 149 149 ps##datatype* imgRow = img->data.datatype[row]; \ 150 for ( unsigned intcol=0;col<c;col++) { \150 for (psU32 col=0;col<c;col++) { \ 151 151 ps##datatype value = row+I*col; \ 152 152 if (cabs(value) < min) { \ … … 225 225 } 226 226 227 inttestImageClipNAN(void)227 psS32 testImageClipNAN(void) 228 228 { 229 229 psImage* img = NULL; 230 unsigned intc = 128;231 unsigned intr = 256;232 intnumClipped = 0;233 intretVal;230 psU32 c = 128; 231 psU32 r = 256; 232 psS32 numClipped = 0; 233 psS32 retVal; 234 234 235 235 psLogMsg(__func__,PS_LOG_INFO, … … 317 317 } 318 318 319 inttestImageClipComplexRegion(void)319 psS32 testImageClipComplexRegion(void) 320 320 { 321 321 psImage* img = NULL; 322 unsigned intc = 1024;323 unsigned intr = 2048;324 intnumClipped = 0;325 intretVal;322 psU32 c = 1024; 323 psU32 r = 2048; 324 psS32 numClipped = 0; 325 psS32 retVal; 326 326 327 327 psLogMsg(__func__,PS_LOG_INFO, … … 581 581 } 582 582 583 inttestImageOverlay(void)583 psS32 testImageOverlay(void) 584 584 { 585 585 … … 588 588 psImage* img3 = NULL; 589 589 psImage* img4 = NULL; 590 unsigned intc = 128;591 unsigned intr = 256;592 intretVal;590 psU32 c = 128; 591 psU32 r = 256; 592 psS32 retVal; 593 593 594 594 /* … … 833 833 } 834 834 835 static inttestImageRebin(void)835 static psS32 testImageRebin(void) 836 836 { 837 837 … … 869 869 memset(meanTruthWMask->data.F32[0],0,sizeof(psF32)*4*4); \ 870 870 memset(maxTruth->data.F32[0],0,sizeof(psF32)*6*6); \ 871 for ( introw = 0; row<16; row++) { \871 for (psS32 row = 0; row<16; row++) { \ 872 872 ps##DATATYPE* inRow = in->data.DATATYPE[row]; \ 873 873 psF32* meanTruthRow = meanTruth->data.F32[row/4]; \ … … 875 875 psF32* maxTruthRow = maxTruth->data.F32[row/3]; \ 876 876 psU8* maskRow = mask->data.U8[row]; \ 877 for ( intcol = 0; col<16; col++) { \877 for (psS32 col = 0; col<16; col++) { \ 878 878 if(col != 15) { \ 879 879 maskRow[col] = 0; \ … … 891 891 } \ 892 892 } \ 893 for ( introw = 0; row<4; row++) { \893 for (psS32 row = 0; row<4; row++) { \ 894 894 psF32* meanTruthRow = meanTruth->data.F32[row]; \ 895 895 psF32* meanTruthWMaskRow = meanTruthWMask->data.F32[row]; \ 896 for ( intcol = 0; col<4; col++) { \896 for (psS32 col = 0; col<4; col++) { \ 897 897 meanTruthRow[col] /= 16; \ 898 898 if ( col == 3 ) { \ … … 915 915 return 2; \ 916 916 } \ 917 for ( introw = 0; row<4; row++) { \917 for (psS32 row = 0; row<4; row++) { \ 918 918 ps##DATATYPE* outRow = out->data.DATATYPE[row]; \ 919 919 psF32* truthRow = meanTruth->data.F32[row]; \ 920 for ( intcol = 0; col<4; col++) { \920 for (psS32 col = 0; col<4; col++) { \ 921 921 if (fabsf((float)outRow[col]-(float)truthRow[col]) > FLT_EPSILON) { \ 922 922 psError(__func__,"psImageRebin didn't produce the proper mean " \ … … 929 929 stats.options = PS_STAT_SAMPLE_MEAN; \ 930 930 out3 = psImageRebin(NULL,in,mask,1,4,&stats); \ 931 for ( introw = 0; row<4; row++) { \931 for (psS32 row = 0; row<4; row++) { \ 932 932 ps##DATATYPE* outRow = out3->data.DATATYPE[row]; \ 933 933 psF32* truthRow = meanTruthWMask->data.F32[row]; \ 934 for ( intcol = 0; col<4; col++) { \935 if(abs(( int)outRow[col]-(int)truthRow[col]) > FLT_EPSILON) { \934 for ( psS32 col = 0; col<4; col++) { \ 935 if(abs((psS32)outRow[col]-(psS32)truthRow[col]) > FLT_EPSILON) { \ 936 936 psError(__func__,"psImageRebin with mask didn't produce the proper mean " \ 937 937 "result at (%d,%d) [%f vs %f].", \ … … 957 957 return 5; \ 958 958 } \ 959 for ( introw = 0; row<6; row++) { \959 for (psS32 row = 0; row<6; row++) { \ 960 960 ps##DATATYPE* outRow = out->data.DATATYPE[row]; \ 961 961 psF32* truthRow = maxTruth->data.F32[row]; \ 962 for ( intcol = 0; col<6; col++) { \962 for (psS32 col = 0; col<6; col++) { \ 963 963 if (fabsf((float)outRow[col]-(float)truthRow[col]) > FLT_EPSILON) { \ 964 964 psError(__func__,"psImageRebin didn't produce the proper " \ … … 1082 1082 } 1083 1083 1084 static inttestImageRoll(void)1084 static psS32 testImageRoll(void) 1085 1085 { 1086 1086 … … 1088 1088 psImage* out; 1089 1089 psImage* out2; 1090 introws = 64;1091 intcols = 64;1092 introws1 = 8;1093 intcols1 = 8;1090 psS32 rows = 64; 1091 psS32 cols = 64; 1092 psS32 rows1 = 8; 1093 psS32 cols1 = 8; 1094 1094 1095 1095 /* … … 1108 1108 1109 1109 in = psImageAlloc(cols,rows,PS_TYPE_F32); 1110 for ( introw=0;row<rows;row++) {1110 for (psS32 row=0;row<rows;row++) { 1111 1111 psF32* inRow = in->data.F32[row]; 1112 for ( intcol=0;col<cols;col++) {1112 for (psS32 col=0;col<cols;col++) { 1113 1113 inRow[col] = (psF32)row+(psF32)col/1000.0f; 1114 1114 } … … 1116 1116 1117 1117 out = psImageRoll(NULL,in,0,0); 1118 for ( introw=0;row<rows;row++) {1118 for (psS32 row=0;row<rows;row++) { 1119 1119 psF32* inRow = in->data.F32[row]; 1120 1120 psF32* outRow = out->data.F32[row]; 1121 for ( intcol=0;col<cols;col++) {1121 for (psS32 col=0;col<cols;col++) { 1122 1122 if (inRow[col] != outRow[col]) { 1123 1123 psError(__func__,"psImageRoll didn't produce expected result " … … 1130 1130 1131 1131 out2 = psImageRoll(out,in,cols/4,0); 1132 for ( introw=0;row<rows;row++) {1132 for (psS32 row=0;row<rows;row++) { 1133 1133 psF32* inRow = in->data.F32[row]; 1134 1134 psF32* outRow = out->data.F32[row]; 1135 for ( intcol=0;col<cols;col++) {1135 for (psS32 col=0;col<cols;col++) { 1136 1136 if (inRow[(col+cols/4) % cols] != outRow[col]) { 1137 1137 psError(__func__,"psImageRoll didn't produce expected result " … … 1151 1151 1152 1152 out = psImageRoll(out,in,0,rows/4); 1153 for ( introw=0;row<rows;row++) {1153 for (psS32 row=0;row<rows;row++) { 1154 1154 psF32* inRow = in->data.F32[(row+rows/4)%rows]; 1155 1155 psF32* outRow = out->data.F32[row]; 1156 for ( intcol=0;col<cols;col++) {1156 for (psS32 col=0;col<cols;col++) { 1157 1157 if (inRow[col] != outRow[col]) { 1158 1158 psError(__func__,"psImageRoll didn't produce expected result " … … 1165 1165 1166 1166 out = psImageRoll(out,in,cols/4,rows/4); 1167 for ( introw=0;row<rows;row++) {1167 for (psS32 row=0;row<rows;row++) { 1168 1168 psF32* inRow = in->data.F32[(row+rows/4)%rows]; 1169 1169 psF32* outRow = out->data.F32[row]; 1170 for ( intcol=0;col<cols;col++) {1170 for (psS32 col=0;col<cols;col++) { 1171 1171 if (inRow[(col+cols/4) % cols] != outRow[col]) { 1172 1172 psError(__func__,"psImageRoll didn't produce expected result " … … 1179 1179 1180 1180 out = psImageRoll(out,in,-cols/4,0); 1181 for ( introw=0;row<rows;row++) {1181 for (psS32 row=0;row<rows;row++) { 1182 1182 psF32* inRow = in->data.F32[row]; 1183 1183 psF32* outRow = out->data.F32[row]; 1184 for ( intcol=0;col<cols;col++) {1184 for (psS32 col=0;col<cols;col++) { 1185 1185 if (inRow[(col+(cols-cols/4)) % cols] != outRow[col]) { 1186 1186 psError(__func__,"psImageRoll didn't produce expected result " … … 1193 1193 1194 1194 out = psImageRoll(out,in,0,-rows/4); 1195 for ( introw=0;row<rows;row++) {1195 for (psS32 row=0;row<rows;row++) { 1196 1196 psF32* inRow = in->data.F32[(row+rows-rows/4)%rows]; 1197 1197 psF32* outRow = out->data.F32[row]; 1198 for ( intcol=0;col<cols;col++) {1198 for (psS32 col=0;col<cols;col++) { 1199 1199 if (inRow[col] != outRow[col]) { 1200 1200 psError(__func__,"psImageRoll didn't produce expected result " … … 1207 1207 1208 1208 out = psImageRoll(out,in,-cols/4,-rows/4); 1209 for ( introw=0;row<rows;row++) {1209 for (psS32 row=0;row<rows;row++) { 1210 1210 psF32* inRow = in->data.F32[(row+rows-rows/4)%rows]; 1211 1211 psF32* outRow = out->data.F32[row]; 1212 for ( intcol=0;col<cols;col++) {1212 for (psS32 col=0;col<cols;col++) { 1213 1213 if (inRow[(col+cols-cols/4) % cols] != outRow[col]) { 1214 1214 psError(__func__,"psImageRoll didn't produce expected result " … … 1236 1236 in = psImageAlloc(rows1,cols1,PS_TYPE_##DATATYPE); \ 1237 1237 \ 1238 for ( introw=0;row<rows1;row++) { \1238 for (psS32 row=0;row<rows1;row++) { \ 1239 1239 ps##DATATYPE* inRow = in->data.DATATYPE[row]; \ 1240 for ( intcol=0;col<cols1;col++) { \1240 for (psS32 col=0;col<cols1;col++) { \ 1241 1241 inRow[col] = (ps##DATATYPE)row+(ps##DATATYPE)col; \ 1242 1242 } \ … … 1244 1244 \ 1245 1245 out = psImageRoll(NULL,in,rows1/4,cols1/4); \ 1246 for ( introw=0;row<rows1;row++) { \1246 for (psS32 row=0;row<rows1;row++) { \ 1247 1247 ps##DATATYPE* inRow = in->data.DATATYPE[(row+rows1/4)%rows1]; \ 1248 1248 ps##DATATYPE* outRow = out->data.DATATYPE[row]; \ 1249 for ( intcol=0;col<cols1;col++) { \1249 for (psS32 col=0;col<cols1;col++) { \ 1250 1250 if (inRow[(col+cols1/4)%cols1] != outRow[col]) { \ 1251 1251 psError(__func__,"psImageRoll didn't produce expected result " \ … … 1270 1270 } 1271 1271 1272 inttestImageRotate(void)1272 psS32 testImageRotate(void) 1273 1273 { 1274 1274 /* … … 1300 1300 psImage* fBiTruth = NULL; 1301 1301 psImage* sBiTruth = NULL; 1302 introws = 64;1303 intcols = 64;1302 psS32 rows = 64; 1303 psS32 cols = 64; 1304 1304 psImage* fImg = psImageAlloc(cols,rows,PS_TYPE_F32); 1305 1305 psImage* sImg = psImageAlloc(cols,rows,PS_TYPE_S16); 1306 1306 psImage* s32Img = psImageAlloc(cols,rows,PS_TYPE_S32); 1307 1307 1308 for( introw=0;row<rows;row++) {1308 for(psS32 row=0;row<rows;row++) { 1309 1309 psF32* fRow = fImg->data.F32[row]; 1310 1310 psS16* sRow = sImg->data.S16[row]; 1311 1311 psS32* s32Row = s32Img->data.S32[row]; 1312 for ( intcol=0;col<cols;col++) {1312 for (psS32 col=0;col<cols;col++) { 1313 1313 fRow[col] = (psF32)(row)+(psF32)(col)/100.0f; 1314 1314 sRow[col] = row-2*col; … … 1336 1336 ("temp/sBiOut.fits"); 1337 1337 ; 1338 intindex = 0;1339 bool fail = false;1340 for ( introt=-180;rot<=180;rot+=45) {1338 psS32 index = 0; 1339 psBool fail = false; 1340 for (psS32 rot=-180;rot<=180;rot+=45) { 1341 1341 psImage* oldOut = fOut; 1342 1342 psImage* oldBiOut = fBiOut; … … 1388 1388 fail = true; 1389 1389 } else { 1390 for ( introw=0;row<fTruth->numRows;row++) {1390 for (psS32 row=0;row<fTruth->numRows;row++) { 1391 1391 psF32* truthRow = fTruth->data.F32[row]; 1392 1392 psF32* outRow = fOut->data.F32[row]; 1393 for ( intcol=0;col<fTruth->numCols;col++) {1393 for (psS32 col=0;col<fTruth->numCols;col++) { 1394 1394 if (fabsf(truthRow[col]-outRow[col]) > 1) { 1395 1395 psError(__func__,"Float Image mismatch (%f vs %f) at %d,%d.", … … 1409 1409 if (sTruth->numRows != sOut->numRows || 1410 1410 sTruth->numCols != sOut->numCols) { 1411 psError(__func__,"Rotated shortimage size did not match truth "1411 psError(__func__,"Rotated psS16 image size did not match truth " 1412 1412 "image for %d deg rotation.",rot); 1413 1413 fail = true; 1414 1414 } else { 1415 for ( introw=0;row<sTruth->numRows;row++) {1415 for (psS32 row=0;row<sTruth->numRows;row++) { 1416 1416 psS16* truthRow = sTruth->data.S16[row]; 1417 1417 psS16* outRow = sOut->data.S16[row]; 1418 for ( intcol=0;col<sTruth->numCols;col++) {1418 for (psS32 col=0;col<sTruth->numCols;col++) { 1419 1419 if (fabsf(truthRow[col]-outRow[col]) > 1) { 1420 1420 psError(__func__,"Short Image mismatch (%d vs %d) " … … 1440 1440 fail = true; 1441 1441 } else { 1442 for ( introw=0;row<fBiTruth->numRows;row++) {1442 for (psS32 row=0;row<fBiTruth->numRows;row++) { 1443 1443 psF32* truthRow = fBiTruth->data.F32[row]; 1444 1444 psF32* outRow = fBiOut->data.F32[row]; 1445 for ( intcol=0;col<fBiTruth->numCols;col++) {1445 for (psS32 col=0;col<fBiTruth->numCols;col++) { 1446 1446 if (fabsf(truthRow[col]-outRow[col]) > 1) { 1447 1447 psError(__func__,"Float Image mismatch (%f vs %f) at %d,%d. BILINEAR", … … 1461 1461 if (sBiTruth->numRows != sBiOut->numRows || 1462 1462 sBiTruth->numCols != sBiOut->numCols) { 1463 psError(__func__,"Rotated shortimage size did not match truth "1463 psError(__func__,"Rotated psS16 image size did not match truth " 1464 1464 "image for %d deg rotation. BILINEAR",rot); 1465 1465 fail = true; 1466 1466 } else { 1467 for ( introw=0;row<sBiTruth->numRows;row++) {1467 for (psS32 row=0;row<sBiTruth->numRows;row++) { 1468 1468 psS16* truthRow = sBiTruth->data.S16[row]; 1469 1469 psS16* outRow = sBiOut->data.S16[row]; 1470 for ( intcol=0;col<sBiTruth->numCols;col++) {1470 for (psS32 col=0;col<sBiTruth->numCols;col++) { 1471 1471 if (fabsf(truthRow[col]-outRow[col]) > 1) { 1472 1472 psError(__func__,"Short Image mismatch (%d vs %d) " … … 1537 1537 } 1538 1538 1539 static inttestImageShift(void)1539 static psS32 testImageShift(void) 1540 1540 { 1541 1541 /* psImageShift: … … 1558 1558 */ 1559 1559 1560 intretVal=0;1560 psS32 retVal=0; 1561 1561 1562 1562 // integer shift … … 1627 1627 } 1628 1628 1629 static int testImageShiftCase(intcols,1630 introws,1631 float colShift,1632 float rowShift)1629 static psS32 testImageShiftCase(psS32 cols, 1630 psS32 rows, 1631 float colShift, 1632 float rowShift) 1633 1633 { 1634 1634 psImage* fOut = NULL; … … 1643 1643 psImage* sBiOut = psImageAlloc(cols,rows,PS_TYPE_S16); 1644 1644 1645 for( introw=0;row<rows;row++) {1645 for(psS32 row=0;row<rows;row++) { 1646 1646 psF32* fRow = fImg->data.F32[row]; 1647 1647 psS16* sRow = sImg->data.S16[row]; 1648 for ( intcol=0;col<cols;col++) {1648 for (psS32 col=0;col<cols;col++) { 1649 1649 fRow[col] = (psF32)(row)+(psF32)(col)/100.0f; 1650 1650 sRow[col] = row-2*col; … … 1657 1657 sBiOut = psImageShift(sBiOut, sImg, colShift, rowShift, -1, PS_INTERPOLATE_BILINEAR); 1658 1658 1659 for( introw=0;row<rows;row++) {1659 for(psS32 row=0;row<rows;row++) { 1660 1660 psF32* fRow = fOut->data.F32[row]; 1661 1661 psS16* sRow = sOut->data.S16[row]; … … 1663 1663 psS16* sBiRow = sBiOut->data.S16[row]; 1664 1664 1665 for ( intcol=0;col<cols;col++) {1665 for (psS32 col=0;col<cols;col++) { 1666 1666 psF32 fValue = psImagePixelInterpolate(fImg,col+colShift, 1667 1667 row+rowShift,NULL,0,NAN,PS_INTERPOLATE_FLAT); … … 1707 1707 } 1708 1708 1709 static inttestImageResample(void)1709 static psS32 testImageResample(void) 1710 1710 { 1711 1711 1712 introws = 60;1713 intcols = 80;1712 psS32 rows = 60; 1713 psS32 cols = 80; 1714 1714 psImage* result = NULL; 1715 intscale = 4;1715 psS32 scale = 4; 1716 1716 psErr* err; 1717 1717 1718 1718 psImage* image = psImageAlloc(cols,rows,PS_TYPE_F32); 1719 for( introw=0;row<rows;row++) {1719 for(psS32 row=0;row<rows;row++) { 1720 1720 psF32* imageRow = image->data.F32[row]; 1721 for ( intcol=0;col<cols;col++) {1721 for (psS32 col=0;col<cols;col++) { 1722 1722 imageRow[col] = row+2*col; 1723 1723 } … … 1753 1753 1754 1754 psF32 truthValue; 1755 for( introw=0;row<result->numRows;row++) {1756 for ( intcol=0;col<result->numCols;col++) {1755 for(psS32 row=0;row<result->numRows;row++) { 1756 for (psS32 col=0;col<result->numCols;col++) { 1757 1757 truthValue = psImagePixelInterpolate(image, 1758 1758 (float)col/(float)scale,(float)row/(float)scale, -
trunk/psLib/test/image/tst_psImageStats00.c
r1956 r2204 14 14 #define M 64 15 15 16 intmain()16 psS32 main() 17 17 { 18 18 psHistogram * myHist = NULL; … … 20 20 psImage *tmpImage = NULL; 21 21 psImage *tmpMask = NULL; 22 inttestStatus = true;23 intmemLeaks = 0;24 intnb = 0;25 inti = 0;26 intj = 0;27 intIMAGE_X_SIZE = 0;28 intIMAGE_Y_SIZE = 0;29 intcurrentId = 0;22 psS32 testStatus = true; 23 psS32 memLeaks = 0; 24 psS32 nb = 0; 25 psS32 i = 0; 26 psS32 j = 0; 27 psS32 IMAGE_X_SIZE = 0; 28 psS32 IMAGE_Y_SIZE = 0; 29 psS32 currentId = 0; 30 30 31 31 currentId = psMemGetId(); -
trunk/psLib/test/image/tst_psImageStats01.c
r1944 r2204 15 15 #define M 64 16 16 17 intmain()17 psS32 main() 18 18 { 19 19 psStats * myStats = NULL; … … 21 21 psImage *tmpImage = NULL; 22 22 psImage *tmpMask = NULL; 23 inttestStatus = true;24 intmemLeaks = 0;25 intnb = 0;26 inti = 0;27 intj = 0;28 intIMAGE_X_SIZE = 0;29 intIMAGE_Y_SIZE = 0;30 intcurrentId = 0;23 psS32 testStatus = true; 24 psS32 memLeaks = 0; 25 psS32 nb = 0; 26 psS32 i = 0; 27 psS32 j = 0; 28 psS32 IMAGE_X_SIZE = 0; 29 psS32 IMAGE_Y_SIZE = 0; 30 psS32 currentId = 0; 31 31 32 32 currentId = psMemGetId(); -
trunk/psLib/test/image/tst_psImageStats02.c
r2099 r2204 18 18 #define CHEBY_Y_DIM 8 19 19 #define THRESHOLD 10 20 intmain()20 psS32 main() 21 21 { 22 22 psStats * myStats = NULL; … … 26 26 psPolynomial2D *my2DPoly = NULL; 27 27 psPolynomial2D *null2DPoly = NULL; 28 inttestStatus = true;29 intmemLeaks = 0;30 inti = 0;31 intj = 0;32 intcurrentId = 0;28 psS32 testStatus = true; 29 psS32 memLeaks = 0; 30 psS32 i = 0; 31 psS32 j = 0; 32 psS32 currentId = 0; 33 33 34 34 currentId = psMemGetId(); -
trunk/psLib/test/image/tst_psImageStats03.c
r1909 r2204 13 13 #define IMAGE_SIZE 10 14 14 15 intmain()15 psS32 main() 16 16 { 17 17 psImage *tmpImage = NULL; 18 inttestStatus = true;19 intmemLeaks = 0;20 inti = 0;21 intj = 0;18 psS32 testStatus = true; 19 psS32 memLeaks = 0; 20 psS32 i = 0; 21 psS32 j = 0; 22 22 float pixel = 0.0; 23 23 float x = 0.0; 24 24 float y = 0.0; 25 intcurrentId = psMemGetId();25 psS32 currentId = psMemGetId(); 26 26 27 27 /*************************************************************************/ -
trunk/psLib/test/psTest.c
r1810 r2204 28 28 #define HEADER_BOTTOM "\\**********************************************************************************/\n\n" 29 29 30 bool p_runTestSuite( FILE *fp, const char* testPointFile, const char* packageName,31 testDescription tests[], intargc, char * const argv[] )32 { 33 bool success = true;34 bool runAll = true;35 bool useFork = true;36 bool found;37 intc;38 intn;30 psBool p_runTestSuite( FILE *fp, const char* testPointFile, const char* packageName, 31 testDescription tests[], psS32 argc, char * const argv[] ) 32 { 33 psBool success = true; 34 psBool runAll = true; 35 psBool useFork = true; 36 psBool found; 37 psS32 c; 38 psS32 n; 39 39 extern char *optarg; 40 40 … … 62 62 printf( "Testpoints:\n" ); 63 63 runAll = false; 64 for ( intindex = 0; tests[ index ].fcn != NULL; index++ ) {64 for ( psS32 index = 0; tests[ index ].fcn != NULL; index++ ) { 65 65 printf( " %6d - %s \n", tests[ index ].testPointNumber, 66 66 tests[ index ].testPointName ); … … 70 70 case 't': 71 71 runAll = false; 72 for ( intindex = 0; tests[ index ].fcn != NULL; index++ ) {72 for ( psS32 index = 0; tests[ index ].fcn != NULL; index++ ) { 73 73 if ( strcmp( optarg, tests[ index ].testPointName ) == 0 ) { 74 74 success = p_runTest( fp, … … 90 90 } 91 91 found = false; 92 for ( intindex = 0; tests[ index ].fcn != NULL; index++ ) {92 for ( psS32 index = 0; tests[ index ].fcn != NULL; index++ ) { 93 93 if ( n == tests[ index ].testPointNumber ) { 94 94 found = true; … … 116 116 117 117 if ( runAll ) { 118 for ( intindex = 0; tests[ index ].fcn != NULL; index++ ) {118 for ( psS32 index = 0; tests[ index ].fcn != NULL; index++ ) { 119 119 if ( ! tests[ index ].isDuplicateEntry ) { 120 120 success = p_runTest( fp, … … 136 136 } 137 137 138 bool p_runTest( FILE *fp, const char* testPointFile, const char* packageName, const char* testPointName,139 testFcn fcn, int expectedReturn, bool useFork )140 { 141 intchildReturn = 0;138 psBool p_runTest( FILE *fp, const char* testPointFile, const char* packageName, const char* testPointName, 139 testFcn fcn, psS32 expectedReturn, psBool useFork ) 140 { 141 psS32 childReturn = 0; 142 142 pid_t child; 143 143 … … 147 147 child = fork(); 148 148 if ( child == 0 ) { // I am the child process, run the test 149 intcurrentId = psMemGetId();150 intretVal = fcn();149 psS32 currentId = psMemGetId(); 150 psS32 retVal = fcn(); 151 151 if ( retVal == 0 ) { // only bother checking memory if test executed to end. 152 152 if ( psMemCheckLeaks( currentId, NULL, stderr ) != 0 ) { … … 171 171 } 172 172 } else { 173 intcurrentId = psMemGetId();173 psS32 currentId = psMemGetId(); 174 174 childReturn = fcn(); 175 175 if ( childReturn == 0 ) { // only bother checking memory if test executed to end. … … 215 215 const char* testPointName, 216 216 const char* expectedError, 217 intexitValue )217 psS32 exitValue ) 218 218 { 219 219 char TP[ 80 ]; … … 235 235 const char* packageName, 236 236 const char* testPointName, 237 bool success )237 psBool success ) 238 238 { 239 239 if ( success ) { -
trunk/psLib/test/psTest.h
r1193 r2204 4 4 5 5 #include <stdio.h> 6 #include <stdbool.h> 6 7 #include "psType.h" 7 8 8 9 #define printPositiveTestHeader(filePtr, packageName, testPointName) \ … … 15 16 p_printFooter(filePtr, __FILE__, packageName, testPointName, success) 16 17 17 typedef int(*testFcn)(void);18 typedef psS32 (*testFcn)(void); 18 19 19 20 typedef struct 20 21 { 21 22 testFcn fcn; 22 inttestPointNumber;23 psS32 testPointNumber; 23 24 const char* testPointName; 24 intexpectedReturn;25 boolisDuplicateEntry;25 psS32 expectedReturn; 26 psBool isDuplicateEntry; 26 27 } 27 28 testDescription; … … 36 37 /////////////////////////// PRIVATE FUNCTIONS ////////////////////////////// 37 38 38 bool p_runTest(39 psBool p_runTest( 39 40 FILE *fp, 40 41 const char* testPointFile, … … 42 43 const char* testPointName, 43 44 testFcn fcn, 44 intexpectedReturn,45 bool useFork45 psS32 expectedReturn, 46 psBool useFork 46 47 ); 47 48 48 bool p_runTestSuite(49 psBool p_runTestSuite( 49 50 FILE *fp, 50 51 const char* testPointFile, 51 52 const char* packageName, 52 53 testDescription tests[], 53 intargc,54 psS32 argc, 54 55 char * const argv[] 55 56 ); … … 68 69 const char* testPointName, 69 70 const char* expectedError, 70 intexitValue71 psS32 exitValue 71 72 ); 72 73 … … 76 77 const char* packageName, 77 78 const char* testPointName, 78 bool success79 psBool success 79 80 ); 80 81 -
trunk/psLib/test/runTest
r1602 r2204 30 30 # 31 31 # $Revison: $ $Name: not supported by cvs2svn $ 32 # $Date: 2004- 08-20 00:51:22$32 # $Date: 2004-10-27 00:57:31 $ 33 33 # 34 34 # Copyright 2004 Maui High Performance Computering Center, University of Hawaii … … 36 36 ################################################################################ 37 37 38 # Provides functions for handling longcommand line options38 # Provides functions for handling psS64 command line options 39 39 use Getopt::Long; 40 40 -
trunk/psLib/test/sysUtils/tst_psAbort.c
r1701 r2204 8 8 * @author Eric Van Alst, MHPCC 9 9 * 10 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $11 * @date $Date: 2004- 09-07 21:26:13 $10 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-10-27 00:57:33 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 17 17 #include "psTest.h" 18 18 19 static inttestAbort00(void);20 static inttestAbort01(void);21 static inttestAbort02(void);19 static psS32 testAbort00(void); 20 static psS32 testAbort01(void); 21 static psS32 testAbort02(void); 22 22 23 23 testDescription tests[] = { … … 28 28 }; 29 29 30 int main( intargc, char* argv[] )30 psS32 main( psS32 argc, char* argv[] ) 31 31 { 32 32 psLogSetLevel( PS_LOG_INFO ); … … 35 35 } 36 36 37 static inttestAbort00(void)37 static psS32 testAbort00(void) 38 38 { 39 intintval = 1;40 longlongval = 2;39 psS32 intval = 1; 40 psS64 longval = 2; 41 41 float floatval = 3.01; 42 42 char charval = 'E'; … … 54 54 } 55 55 56 static inttestAbort01(void)56 static psS32 testAbort01(void) 57 57 { 58 58 // Test point #2 String values in abort message … … 65 65 } 66 66 67 static inttestAbort02(void)67 static psS32 testAbort02(void) 68 68 { 69 69 // Test point #2 String values in abort message -
trunk/psLib/test/sysUtils/tst_psError.c
r2129 r2204 13 13 * @author Eric Van Alst, MHPCC 14 14 * 15 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $16 * @date $Date: 2004-10- 14 21:14:58$15 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-10-27 00:57:33 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 26 26 #include "psTest.h" 27 27 28 static inttestError00(void);29 static inttestError01(void);30 static inttestError02(void);31 static inttestError03(void);32 static inttestError04(void);33 static inttestError05(void);34 static inttestErrorRegister(void);28 static psS32 testError00(void); 29 static psS32 testError01(void); 30 static psS32 testError02(void); 31 static psS32 testError03(void); 32 static psS32 testError04(void); 33 static psS32 testError05(void); 34 static psS32 testErrorRegister(void); 35 35 36 36 // Function used in testError02 to verify the psErrorStackPrintV function … … 58 58 }; 59 59 60 int main( intargc, char* argv[] )60 psS32 main( psS32 argc, char* argv[] ) 61 61 { 62 62 psLogSetLevel( PS_LOG_INFO ); … … 65 65 } 66 66 67 static inttestError05(void)67 static psS32 testError05(void) 68 68 { 69 69 psErrorCode code = PS_ERR_BAD_PARAMETER_VALUE; … … 81 81 } 82 82 83 static inttestError04(void)83 static psS32 testError04(void) 84 84 { 85 85 psErrorCode code = PS_ERR_BAD_PARAMETER_VALUE; … … 134 134 } 135 135 136 static inttestError03(void)136 static psS32 testError03(void) 137 137 { 138 138 psErrorCode code = PS_ERR_BAD_PARAMETER_VALUE; … … 214 214 } 215 215 216 static inttestError02(void)216 static psS32 testError02(void) 217 217 { 218 218 psErrorCode code = PS_ERR_BAD_PARAMETER_VALUE; … … 228 228 } 229 229 230 static inttestError01(void)230 static psS32 testError01(void) 231 231 { 232 232 psErrorCode code=PS_ERR_BAD_PARAMETER_VALUE; … … 277 277 } 278 278 279 static inttestError00(void)280 { 281 282 intintval=1;283 longlongval = 2;279 static psS32 testError00(void) 280 { 281 282 psS32 intval=1; 283 psS64 longval = 2; 284 284 float floatval = 3.01; 285 285 char charval = 'E'; … … 300 300 } 301 301 302 static inttestErrorRegister(void)303 { 304 305 intnumErr = 4;302 static psS32 testErrorRegister(void) 303 { 304 305 psS32 numErr = 4; 306 306 psErrorDescription errDesc[] = { {PS_ERR_N_ERR_CLASSES+1,"first"}, 307 307 {PS_ERR_N_ERR_CLASSES+2,"second"}, … … 314 314 psErrorRegister(errDesc,numErr); 315 315 316 for ( inti = 0; i < numErr; i++) {316 for (psS32 i = 0; i < numErr; i++) { 317 317 const char* desc = psErrorCodeString(PS_ERR_N_ERR_CLASSES+1+i); 318 318 if (desc == NULL) { -
trunk/psLib/test/sysUtils/tst_psLogMsg.c
r1702 r2204 8 8 #include "psTest.h" 9 9 10 static inttestLogMsg00();11 static inttestLogMsg01();12 static inttestLogMsg02();13 static inttestLogMsg03();14 static inttestLogMsg04();15 static inttestLogMsg05();10 static psS32 testLogMsg00(); 11 static psS32 testLogMsg01(); 12 static psS32 testLogMsg02(); 13 static psS32 testLogMsg03(); 14 static psS32 testLogMsg04(); 15 static psS32 testLogMsg05(); 16 16 17 17 testDescription tests[] = { … … 39 39 }; 40 40 41 int main( intargc, char* argv[] )41 psS32 main( psS32 argc, char* argv[] ) 42 42 { 43 43 psLogSetLevel( PS_LOG_INFO ); … … 48 48 49 49 static void myLogMsg(const char *name, 50 intlevel,50 psS32 level, 51 51 const char *fmt, 52 52 ...) … … 60 60 } 61 61 62 static inttestLogMsg00()63 { 64 inti = 0;62 static psS32 testLogMsg00() 63 { 64 psS32 i = 0; 65 65 66 66 // Send a log messages for levels 0:9. Only the first four messages … … 74 74 } 75 75 76 static inttestLogMsg01()77 { 78 inti = 0;76 static psS32 testLogMsg01() 77 { 78 psS32 i = 0; 79 79 80 80 // Send a log messages for levels 0:9. Only the first four messages … … 88 88 } 89 89 90 static inttestLogMsg02()90 static psS32 testLogMsg02() 91 91 { 92 92 93 93 psLogSetLevel(9); 94 94 // Send a log messages for levels 0:9. 95 for ( inti=0;i<10;i++) {95 for (psS32 i=0;i<10;i++) { 96 96 psLogMsg(__func__, i, "Hello World! My level is %d\n", i); 97 97 } … … 105 105 } 106 106 107 static inttestLogMsg03()108 { 109 inti;107 static psS32 testLogMsg03() 108 { 109 psS32 i; 110 110 111 111 fprintf(stderr,"------------- psLogSetFormat() -------------\n"); … … 161 161 162 162 163 inttestLogMsg04()163 psS32 testLogMsg04() 164 164 { 165 165 psLogMsg("Under 15 chars", 0, "Hello World!\n"); … … 173 173 } 174 174 175 inttestLogMsg05()176 { 177 inti = 0;175 psS32 testLogMsg05() 176 { 177 psS32 i = 0; 178 178 FILE* file; 179 179 char line[256]; -
trunk/psLib/test/sysUtils/tst_psMemory.c
r1811 r2204 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.2 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2004- 09-14 23:55:47$8 * @version $Revision: 1.26 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-10-27 00:57:33 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 26 26 #include "pslib.h" 27 27 28 static intTPFreeReferencedMemory( void );29 static intTPOutOfMemory( void );30 static intTPReallocOutOfMemory( void );31 static void*TPOutOfMemoryExhaustedCallback( size_t size );32 static intTPCheckBufferPositive( void );33 static intTPrealloc( void );34 static intTPallocCallback( void );28 static psS32 TPFreeReferencedMemory( void ); 29 static psS32 TPOutOfMemory( void ); 30 static psS32 TPReallocOutOfMemory( void ); 31 static psPtr TPOutOfMemoryExhaustedCallback( size_t size ); 32 static psS32 TPCheckBufferPositive( void ); 33 static psS32 TPrealloc( void ); 34 static psS32 TPallocCallback( void ); 35 35 static psMemoryId memAllocateCallback( const psMemBlock *ptr ); 36 36 static psMemoryId memFreeCallback( const psMemBlock *ptr ); 37 static intTPcheckLeaks( void );38 static intTPmemCorruption( void );39 static intTPmultipleFree( void );40 void memProblemCallback( const psMemBlock *ptr, const char *file, intlineno );41 42 static intproblemCallbackCalled = 0;43 static intallocCallbackCalled = 0;44 static intfreeCallbackCalled = 0;45 static intexhaustedCallbackCalled = 0;37 static psS32 TPcheckLeaks( void ); 38 static psS32 TPmemCorruption( void ); 39 static psS32 TPmultipleFree( void ); 40 void memProblemCallback( const psMemBlock *ptr, const char *file, psS32 lineno ); 41 42 static psS32 problemCallbackCalled = 0; 43 static psS32 allocCallbackCalled = 0; 44 static psS32 freeCallbackCalled = 0; 45 static psS32 exhaustedCallbackCalled = 0; 46 46 47 47 testDescription tests[] = { … … 81 81 }; 82 82 83 int main( intargc, char* argv[] )83 psS32 main( psS32 argc, char* argv[] ) 84 84 { 85 85 psLogSetLevel( PS_LOG_INFO ); … … 89 89 90 90 // Testpoint #449, psAlloc shall allocate memory blocks writeable by caller. 91 intTPCheckBufferPositive( void )92 { 93 int* mem;94 const intsize = 100;95 intfailed = 0;91 psS32 TPCheckBufferPositive( void ) 92 { 93 psS32 * mem; 94 const psS32 size = 100; 95 psS32 failed = 0; 96 96 97 97 psLogMsg( __func__, PS_LOG_INFO, "psAlloc shall allocate memory blocks writeable by caller.\n" ); 98 98 99 mem = ( int* ) psAlloc( size * sizeof( int) );99 mem = ( psS32* ) psAlloc( size * sizeof( psS32 ) ); 100 100 if ( mem == NULL ) { 101 101 psError( __FILE__, "psAlloc returned a NULL value in %s!", __func__ ); … … 103 103 } 104 104 105 for ( intindex = 0;index < size;index++ ) {105 for ( psS32 index = 0;index < size;index++ ) { 106 106 mem[ index ] = index; 107 107 } 108 108 109 for ( intindex = 0;index < size;index++ ) {109 for ( psS32 index = 0;index < size;index++ ) { 110 110 if ( mem[ index ] != index ) { 111 111 failed++; … … 118 118 } 119 119 120 intTPFreeReferencedMemory( void )120 psS32 TPFreeReferencedMemory( void ) 121 121 { 122 122 // create memory 123 int* mem;124 intref = 0;123 psS32 * mem; 124 psS32 ref = 0; 125 125 126 126 psLogMsg( __func__, PS_LOG_INFO, "memory reference count shall be incrementable/decrementable" ); 127 127 128 mem = ( int* ) psAlloc( 100 * sizeof( int) );128 mem = ( psS32* ) psAlloc( 100 * sizeof( psS32 ) ); 129 129 130 130 ref = psMemGetRefCounter( mem ); … … 170 170 // Bug/Task #562 regression test. Upon requesting more memory than is available, psRealloc shall call 171 171 // the psMemExhaustedCallback. 172 intTPReallocOutOfMemory( void )173 { 174 int* mem[ 100 ];172 psS32 TPReallocOutOfMemory( void ) 173 { 174 psS32 * mem[ 100 ]; 175 175 psMemExhaustedCallback cb; 176 176 177 for ( intlcv = 0; lcv < 100; lcv++ ) {177 for ( psS32 lcv = 0; lcv < 100; lcv++ ) { 178 178 mem[ lcv ] = NULL; 179 179 } … … 186 186 cb = psMemExhaustedCallbackSet( TPOutOfMemoryExhaustedCallback ); 187 187 188 for ( intlcv = 0; lcv < 100; lcv++ ) {189 mem[ lcv ] = ( int* ) psAlloc( 10 );190 } 191 192 for ( intlcv = 0; lcv < 100; lcv++ ) {193 mem[ lcv ] = ( int* ) psRealloc( mem[ lcv ], SIZE_MAX/2 - 1000 );188 for ( psS32 lcv = 0; lcv < 100; lcv++ ) { 189 mem[ lcv ] = ( psS32* ) psAlloc( 10 ); 190 } 191 192 for ( psS32 lcv = 0; lcv < 100; lcv++ ) { 193 mem[ lcv ] = ( psS32* ) psRealloc( mem[ lcv ], SIZE_MAX/2 - 1000 ); 194 194 } 195 195 … … 201 201 } 202 202 203 for ( intlcv = 0; lcv < 100; lcv++ ) {203 for ( psS32 lcv = 0; lcv < 100; lcv++ ) { 204 204 psFree( mem[ lcv ] ); 205 205 } … … 209 209 // Testpoint #450, Upon requesting more memory than is available, psalloc shall call 210 210 // the psMemExhaustedCallback. 211 intTPOutOfMemory( void )212 { 213 int* mem[ 100 ];211 psS32 TPOutOfMemory( void ) 212 { 213 psS32 * mem[ 100 ]; 214 214 psMemExhaustedCallback cb; 215 215 216 for ( intlcv = 0; lcv < 100; lcv++ ) {216 for ( psS32 lcv = 0; lcv < 100; lcv++ ) { 217 217 mem[ lcv ] = NULL; 218 218 } … … 225 225 cb = psMemExhaustedCallbackSet( TPOutOfMemoryExhaustedCallback ); 226 226 227 for ( intlcv = 0; lcv < 100; lcv++ ) {228 mem[ lcv ] = ( int* ) psAlloc( SIZE_MAX/2 - 1000 );227 for ( psS32 lcv = 0; lcv < 100; lcv++ ) { 228 mem[ lcv ] = ( psS32* ) psAlloc( SIZE_MAX/2 - 1000 ); 229 229 } 230 230 … … 236 236 } 237 237 238 for ( intlcv = 0; lcv < 100; lcv++ ) {238 for ( psS32 lcv = 0; lcv < 100; lcv++ ) { 239 239 psFree( mem[ lcv ] ); 240 240 } … … 244 244 245 245 // Testpoint #451, psRealloc shall increase/decrease memory buffer while preserving contents 246 intTPrealloc( void )247 { 248 int* mem1;249 int* mem2;250 int* mem3;251 const intinitialSize = 100;246 psS32 TPrealloc( void ) 247 { 248 psS32 * mem1; 249 psS32* mem2; 250 psS32* mem3; 251 const psS32 initialSize = 100; 252 252 253 253 psLogMsg( __func__, PS_LOG_INFO, "psRealloc shall increase/decrease memory buffer while " … … 255 255 256 256 // allocate buffer with known values. 257 mem1 = ( int* ) psAlloc( initialSize * sizeof( int) );258 mem2 = ( int* ) psAlloc( initialSize * sizeof( int) );259 mem3 = ( int* ) psAlloc( initialSize * sizeof( int) );260 for ( intlcv = 0;lcv < initialSize;lcv++ ) {257 mem1 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) ); 258 mem2 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) ); 259 mem3 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) ); 260 for ( psS32 lcv = 0;lcv < initialSize;lcv++ ) { 261 261 mem1[ lcv ] = mem2[ lcv ] = mem3[ lcv ] = lcv; 262 262 } … … 266 266 267 267 // realloc to 2x 268 mem1 = ( int* ) psRealloc( mem1, 2 * initialSize * sizeof( int) );269 mem2 = ( int* ) psRealloc( mem2, 2 * initialSize * sizeof( int) );270 mem3 = ( int* ) psRealloc( mem3, 2 * initialSize * sizeof( int) );268 mem1 = ( psS32* ) psRealloc( mem1, 2 * initialSize * sizeof( psS32 ) ); 269 mem2 = ( psS32* ) psRealloc( mem2, 2 * initialSize * sizeof( psS32 ) ); 270 mem3 = ( psS32* ) psRealloc( mem3, 2 * initialSize * sizeof( psS32 ) ); 271 271 272 272 // check values of initial block 273 for ( inti = 0;i < initialSize;i++ ) {273 for ( psS32 i = 0;i < initialSize;i++ ) { 274 274 if ( mem1[ i ] != i || mem2[ i ] != i || mem3[ i ] != i ) { 275 275 psError( __FILE__, "Realloc didn't preserve the contents with expanding buffer in %s.", … … 283 283 284 284 // realloc to 1/2 initial value. 285 mem1 = ( int* ) psRealloc( mem1, ( initialSize / 2 ) * sizeof( int) );286 mem2 = ( int* ) psRealloc( mem2, ( initialSize / 2 ) * sizeof( int) );287 mem3 = ( int* ) psRealloc( mem3, ( initialSize / 2 ) * sizeof( int) );285 mem1 = ( psS32* ) psRealloc( mem1, ( initialSize / 2 ) * sizeof( psS32 ) ); 286 mem2 = ( psS32* ) psRealloc( mem2, ( initialSize / 2 ) * sizeof( psS32 ) ); 287 mem3 = ( psS32* ) psRealloc( mem3, ( initialSize / 2 ) * sizeof( psS32 ) ); 288 288 289 289 // check values of initial block 290 for ( inti = 0;i < initialSize / 2;i++ ) {290 for ( psS32 i = 0;i < initialSize / 2;i++ ) { 291 291 if ( mem1[ i ] != i || mem2[ i ] != i || mem3[ i ] != i ) { 292 292 psError( __FILE__, "Realloc didn't preserve the contents with shrinking buffer in %s.", … … 303 303 } 304 304 305 intTPallocCallback( void )306 { 307 int* mem1;308 int* mem2;309 int* mem3;310 intcurrentId = psMemGetId();311 const intinitialSize = 100;312 intmark;305 psS32 TPallocCallback( void ) 306 { 307 psS32 * mem1; 308 psS32* mem2; 309 psS32* mem3; 310 psS32 currentId = psMemGetId(); 311 const psS32 initialSize = 100; 312 psS32 mark; 313 313 314 314 allocCallbackCalled = 0; … … 324 324 325 325 // allocate buffer with known values. 326 mem1 = ( int* ) psAlloc( initialSize * sizeof( int) );327 mem2 = ( int* ) psAlloc( initialSize * sizeof( int) );328 mem3 = ( int* ) psAlloc( initialSize * sizeof( int) );326 mem1 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) ); 327 mem2 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) ); 328 mem3 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) ); 329 329 330 330 psFree( mem1 ); … … 343 343 mark = psMemGetId(); 344 344 345 mem1 = ( int* ) psAlloc( initialSize * sizeof( int) );345 mem1 = ( psS32* ) psAlloc( initialSize * sizeof( psS32 ) ); 346 346 347 347 psMemAllocateCallbackSetID( mark ); 348 348 349 mem1 = ( int* ) psRealloc( mem1, initialSize * 2 * sizeof( int) );349 mem1 = ( psS32* ) psRealloc( mem1, initialSize * 2 * sizeof( psS32 ) ); 350 350 351 351 psFree( mem1 ); … … 361 361 } 362 362 363 intTPcheckLeaks( void )364 { 365 const intnumBuffers = 5;366 int* buffers[ 5 ];367 intlcv;368 intcurrentId = psMemGetId();363 psS32 TPcheckLeaks( void ) 364 { 365 const psS32 numBuffers = 5; 366 psS32* buffers[ 5 ]; 367 psS32 lcv; 368 psS32 currentId = psMemGetId(); 369 369 psMemBlock** blks; 370 intnLeaks = 0;371 intlineMark = 0;370 psS32 nLeaks = 0; 371 psS32 lineMark = 0; 372 372 373 373 psLogMsg( __func__, PS_LOG_INFO, "psMemCheckLeaks shall return the number of blocks above an ID " … … 376 376 for ( lcv = 0;lcv < numBuffers;lcv++ ) { 377 377 lineMark = __LINE__ + 1; 378 buffers[ lcv ] = psAlloc( sizeof( int) );378 buffers[ lcv ] = psAlloc( sizeof( psS32 ) ); 379 379 } 380 380 … … 406 406 for ( lcv = 0;lcv < numBuffers;lcv++ ) { 407 407 lineMark = __LINE__ + 1; 408 buffers[ lcv ] = psAlloc( sizeof( int) );408 buffers[ lcv ] = psAlloc( sizeof( psS32 ) ); 409 409 } 410 410 … … 434 434 for ( lcv = 0;lcv < numBuffers;lcv++ ) { 435 435 lineMark = __LINE__ + 1; 436 buffers[ lcv ] = psAlloc( sizeof( int) );436 buffers[ lcv ] = psAlloc( sizeof( psS32 ) ); 437 437 } 438 438 … … 464 464 } 465 465 466 intTPmemCorruption( void )467 { 468 int* buffer = NULL;469 intoldValue = 0;470 intcorruptions = 0;466 psS32 TPmemCorruption( void ) 467 { 468 psS32 * buffer = NULL; 469 psS32 oldValue = 0; 470 psS32 corruptions = 0; 471 471 psMemProblemCallback cb; 472 472 473 473 psLogMsg( __func__, PS_LOG_INFO, "psMemCheckCorruption shall detect memory corruptions" ); 474 474 475 buffer = psAlloc( sizeof( int) );475 buffer = psAlloc( sizeof( psS32 ) ); 476 476 477 477 // cause memory corruption via buffer underflow … … 514 514 } 515 515 516 void memProblemCallback( const psMemBlock *ptr, const char *file, intlineno )516 void memProblemCallback( const psMemBlock *ptr, const char *file, psS32 lineno ) 517 517 { 518 518 psLogMsg( __func__, PS_LOG_INFO, "memory callback called for id %d (%s:%d).", … … 536 536 } 537 537 538 void*TPOutOfMemoryExhaustedCallback( size_t size )538 psPtr TPOutOfMemoryExhaustedCallback( size_t size ) 539 539 { 540 540 psLogMsg( __func__, PS_LOG_INFO, "Custom MemExhaustedCallback was invoked." ); … … 543 543 } 544 544 545 intTPmultipleFree( void )546 { 547 548 void *buffer = psAlloc( 1024 );545 psS32 TPmultipleFree( void ) 546 { 547 548 psPtr buffer = psAlloc( 1024 ); 549 549 550 550 psFree( buffer ); -
trunk/psLib/test/sysUtils/tst_psString.c
r1977 r2204 17 17 * @author Eric Van Alst, MHPCC 18 18 * 19 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $20 * @date $Date: 2004-10- 06 01:59:08$19 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 20 * @date $Date: 2004-10-27 00:57:33 $ 21 21 * 22 22 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 #include "psTest.h" 29 29 30 static inttestStringCopy00(void);31 static inttestStringCopy01(void);32 static inttestStringCopy02(void);33 static inttestStringCopy03(void);34 static inttestStringCopy04(void);35 static inttestStringCopy05(void);36 static inttestStringCopy06(void);30 static psS32 testStringCopy00(void); 31 static psS32 testStringCopy01(void); 32 static psS32 testStringCopy02(void); 33 static psS32 testStringCopy03(void); 34 static psS32 testStringCopy04(void); 35 static psS32 testStringCopy05(void); 36 static psS32 testStringCopy06(void); 37 37 38 38 testDescription tests[] = { … … 47 47 }; 48 48 49 int main( intargc, char* argv[] )49 psS32 main( psS32 argc, char* argv[] ) 50 50 { 51 51 psLogSetLevel( PS_LOG_INFO ); … … 55 55 56 56 /* 57 int main( intargc,57 psS32 main( psS32 argc, 58 58 char * argv[] ) 59 59 { 60 bool tpResult = false;60 psBool tpResult = false; 61 61 char stringval[20] = "E R R O R"; 62 62 char stringval1[20] = "e r r o r"; 63 63 char *stringvalnocopy = "F A I L"; 64 64 char *substringval = "e r r"; 65 intsubstringlen = 6;65 psS32 substringlen = 6; 66 66 char *emptyval = ""; 67 inttpFails = 0;68 char *strResult; 69 intincreaseSize = 5;70 intnegativeSize = -5;71 intresult = 0;72 intresult1 = 0;73 intmemBlockAllocated = 0;67 psS32 tpFails = 0; 68 char *strResult; 69 psS32 increaseSize = 5; 70 psS32 negativeSize = -5; 71 psS32 result = 0; 72 psS32 result1 = 0; 73 psS32 memBlockAllocated = 0; 74 74 psMemBlock ***memBlockPtr = NULL; 75 75 76 76 */ 77 77 78 static inttestStringCopy00(void)79 { 80 char stringval[20] = "E R R O R"; 81 intresult = 0;82 intresult1 = 0;78 static psS32 testStringCopy00(void) 79 { 80 char stringval[20] = "E R R O R"; 81 psS32 result = 0; 82 psS32 result1 = 0; 83 83 char *strResult; 84 84 … … 107 107 } 108 108 109 static inttestStringCopy01(void)109 static psS32 testStringCopy01(void) 110 110 { 111 111 char *emptyval = ""; 112 intresult = 0;112 psS32 result = 0; 113 113 char *strResult; 114 114 … … 130 130 } 131 131 132 static inttestStringCopy02(void)133 { 134 intresult = 0;135 intresult1 = 0;132 static psS32 testStringCopy02(void) 133 { 134 psS32 result = 0; 135 psS32 result1 = 0; 136 136 char *strResult; 137 137 char stringval1[20] = "e r r o r"; 138 intsubstringlen = 5;138 psS32 substringlen = 5; 139 139 char *substringval = "e r r"; 140 140 … … 161 161 } 162 162 163 static inttestStringCopy03(void)164 { 165 intresult = 0;166 intresult1 = 0;163 static psS32 testStringCopy03(void) 164 { 165 psS32 result = 0; 166 psS32 result1 = 0; 167 167 char *strResult; 168 168 char *stringvalnocopy = "F A I L"; … … 185 185 } 186 186 187 static inttestStringCopy04(void)188 { 189 intresult = 0;190 intresult1 = 0;191 char *strResult; 192 char stringval[20] = "E R R O R"; 193 intincreaseSize = 5;187 static psS32 testStringCopy04(void) 188 { 189 psS32 result = 0; 190 psS32 result1 = 0; 191 char *strResult; 192 char stringval[20] = "E R R O R"; 193 psS32 increaseSize = 5; 194 194 195 195 // Test point #5 Copy string to larger string - psStringNCopy … … 205 205 strResult, stringval); 206 206 fprintf(stderr," strlne result = %d expected %d\n",result1, 207 ( int)strlen(stringval));207 (psS32)strlen(stringval)); 208 208 return 1; 209 209 } … … 214 214 } 215 215 216 static inttestStringCopy05(void)217 { 218 char *strResult; 219 char stringval[20] = "E R R O R"; 220 intnegativeSize = -5;216 static psS32 testStringCopy05(void) 217 { 218 char *strResult; 219 char stringval[20] = "E R R O R"; 220 psS32 negativeSize = -5; 221 221 222 222 // Test point #6 Copy string with negative size - psStringNCopy … … 224 224 if ( strResult != NULL ) { 225 225 fprintf(stderr,"Failed test point #6 return value = %ld expected NULL\n", 226 ( unsigned long)strResult);226 (psU64)strResult); 227 227 return 1; 228 228 } … … 232 232 } 233 233 234 static inttestStringCopy06(void)235 { 236 char *strResult; 237 char stringval[20] = "E R R O R"; 238 intresult = 0;234 static psS32 testStringCopy06(void) 235 { 236 char *strResult; 237 char stringval[20] = "E R R O R"; 238 psS32 result = 0; 239 239 240 240 // Test point #7 Verify creation of string literal - PS_STRING -
trunk/psLib/test/sysUtils/tst_psStringCopy.c
r1977 r2204 17 17 * @author Eric Van Alst, MHPCC 18 18 * 19 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $20 * @date $Date: 2004-10- 06 01:59:08$19 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 20 * @date $Date: 2004-10-27 00:57:33 $ 21 21 * 22 22 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 #include "psTest.h" 29 29 30 static inttestStringCopy00(void);31 static inttestStringCopy01(void);32 static inttestStringCopy02(void);33 static inttestStringCopy03(void);34 static inttestStringCopy04(void);35 static inttestStringCopy05(void);36 static inttestStringCopy06(void);30 static psS32 testStringCopy00(void); 31 static psS32 testStringCopy01(void); 32 static psS32 testStringCopy02(void); 33 static psS32 testStringCopy03(void); 34 static psS32 testStringCopy04(void); 35 static psS32 testStringCopy05(void); 36 static psS32 testStringCopy06(void); 37 37 38 38 testDescription tests[] = { … … 47 47 }; 48 48 49 int main( intargc, char* argv[] )49 psS32 main( psS32 argc, char* argv[] ) 50 50 { 51 51 psLogSetLevel( PS_LOG_INFO ); … … 55 55 56 56 /* 57 int main( intargc,57 psS32 main( psS32 argc, 58 58 char * argv[] ) 59 59 { 60 bool tpResult = false;60 psBool tpResult = false; 61 61 char stringval[20] = "E R R O R"; 62 62 char stringval1[20] = "e r r o r"; 63 63 char *stringvalnocopy = "F A I L"; 64 64 char *substringval = "e r r"; 65 intsubstringlen = 6;65 psS32 substringlen = 6; 66 66 char *emptyval = ""; 67 inttpFails = 0;68 char *strResult; 69 intincreaseSize = 5;70 intnegativeSize = -5;71 intresult = 0;72 intresult1 = 0;73 intmemBlockAllocated = 0;67 psS32 tpFails = 0; 68 char *strResult; 69 psS32 increaseSize = 5; 70 psS32 negativeSize = -5; 71 psS32 result = 0; 72 psS32 result1 = 0; 73 psS32 memBlockAllocated = 0; 74 74 psMemBlock ***memBlockPtr = NULL; 75 75 76 76 */ 77 77 78 static inttestStringCopy00(void)79 { 80 char stringval[20] = "E R R O R"; 81 intresult = 0;82 intresult1 = 0;78 static psS32 testStringCopy00(void) 79 { 80 char stringval[20] = "E R R O R"; 81 psS32 result = 0; 82 psS32 result1 = 0; 83 83 char *strResult; 84 84 … … 107 107 } 108 108 109 static inttestStringCopy01(void)109 static psS32 testStringCopy01(void) 110 110 { 111 111 char *emptyval = ""; 112 intresult = 0;112 psS32 result = 0; 113 113 char *strResult; 114 114 … … 130 130 } 131 131 132 static inttestStringCopy02(void)133 { 134 intresult = 0;135 intresult1 = 0;132 static psS32 testStringCopy02(void) 133 { 134 psS32 result = 0; 135 psS32 result1 = 0; 136 136 char *strResult; 137 137 char stringval1[20] = "e r r o r"; 138 intsubstringlen = 5;138 psS32 substringlen = 5; 139 139 char *substringval = "e r r"; 140 140 … … 161 161 } 162 162 163 static inttestStringCopy03(void)164 { 165 intresult = 0;166 intresult1 = 0;163 static psS32 testStringCopy03(void) 164 { 165 psS32 result = 0; 166 psS32 result1 = 0; 167 167 char *strResult; 168 168 char *stringvalnocopy = "F A I L"; … … 185 185 } 186 186 187 static inttestStringCopy04(void)188 { 189 intresult = 0;190 intresult1 = 0;191 char *strResult; 192 char stringval[20] = "E R R O R"; 193 intincreaseSize = 5;187 static psS32 testStringCopy04(void) 188 { 189 psS32 result = 0; 190 psS32 result1 = 0; 191 char *strResult; 192 char stringval[20] = "E R R O R"; 193 psS32 increaseSize = 5; 194 194 195 195 // Test point #5 Copy string to larger string - psStringNCopy … … 205 205 strResult, stringval); 206 206 fprintf(stderr," strlne result = %d expected %d\n",result1, 207 ( int)strlen(stringval));207 (psS32)strlen(stringval)); 208 208 return 1; 209 209 } … … 214 214 } 215 215 216 static inttestStringCopy05(void)217 { 218 char *strResult; 219 char stringval[20] = "E R R O R"; 220 intnegativeSize = -5;216 static psS32 testStringCopy05(void) 217 { 218 char *strResult; 219 char stringval[20] = "E R R O R"; 220 psS32 negativeSize = -5; 221 221 222 222 // Test point #6 Copy string with negative size - psStringNCopy … … 224 224 if ( strResult != NULL ) { 225 225 fprintf(stderr,"Failed test point #6 return value = %ld expected NULL\n", 226 ( unsigned long)strResult);226 (psU64)strResult); 227 227 return 1; 228 228 } … … 232 232 } 233 233 234 static inttestStringCopy06(void)235 { 236 char *strResult; 237 char stringval[20] = "E R R O R"; 238 intresult = 0;234 static psS32 testStringCopy06(void) 235 { 236 char *strResult; 237 char stringval[20] = "E R R O R"; 238 psS32 result = 0; 239 239 240 240 // Test point #7 Verify creation of string literal - PS_STRING -
trunk/psLib/test/sysUtils/tst_psTrace.c
r2202 r2204 10 10 11 11 12 static inttestTrace00(void);13 static inttestTrace01(void);14 static inttestTrace02(void);15 static inttestTrace03(void);16 static inttestTrace04(void);17 static inttestTrace05(void);18 static inttestTrace05a(void);19 static inttestTrace06(void);20 static inttestTrace08(void);12 static psS32 testTrace00(void); 13 static psS32 testTrace01(void); 14 static psS32 testTrace02(void); 15 static psS32 testTrace03(void); 16 static psS32 testTrace04(void); 17 static psS32 testTrace05(void); 18 static psS32 testTrace05a(void); 19 static psS32 testTrace06(void); 20 static psS32 testTrace08(void); 21 21 22 22 testDescription tests[] = { … … 37 37 }; 38 38 39 int main( intargc, char* argv[] )39 psS32 main( psS32 argc, char* argv[] ) 40 40 { 41 41 psLogSetLevel( PS_LOG_INFO ); … … 44 44 } 45 45 46 static inttestTrace00(void)47 { 48 inti;49 intlev = 0;46 static psS32 testTrace00(void) 47 { 48 psS32 i; 49 psS32 lev = 0; 50 50 51 51 psTraceSetDestination(stderr); … … 94 94 } 95 95 96 static inttestTrace01(void)96 static psS32 testTrace01(void) 97 97 { 98 98 psTraceSetDestination(stderr); … … 104 104 } 105 105 106 static inttestTrace02(void)106 static psS32 testTrace02(void) 107 107 { 108 108 psTraceReset(); … … 133 133 } 134 134 135 static inttestTrace03(void)136 { 137 inti = 0;138 intlev = 0;135 static psS32 testTrace03(void) 136 { 137 psS32 i = 0; 138 psS32 lev = 0; 139 139 140 140 psTraceSetDestination(stderr); … … 176 176 177 177 178 static inttestTrace04(void)178 static psS32 testTrace04(void) 179 179 { 180 180 FILE *fp; 181 intnb = 0;181 psS32 nb = 0; 182 182 183 183 fp = fopen("tst_psTrace02_OUT", "w"); … … 221 221 } 222 222 223 static inttestTrace05(void)223 static psS32 testTrace05(void) 224 224 { 225 225 psTraceSetDestination(stderr); … … 247 247 } 248 248 249 static inttestTrace05a(void)249 static psS32 testTrace05a(void) 250 250 { 251 251 (void)psTraceSetLevel(".", 9); … … 271 271 } 272 272 273 static inttestTrace06(void)273 static psS32 testTrace06(void) 274 274 { 275 275 psTraceSetDestination(stderr); … … 311 311 312 312 // Ensure that the leading dot in the component names are optional. 313 static inttestTrace08(void)313 static psS32 testTrace08(void) 314 314 { 315 315 psTraceReset(); -
trunk/psLib/test/sysUtils/verified/tst_psTrace.stderr
r2110 r2204 25 25 /***************************** TESTPOINT ******************************************\ 26 26 * TestFile: tst_psTrace.c * 27 * TestPoint: psTrace{psTraceSetLevel(): test static inheritance}*27 * TestPoint: psTrace{psTraceSetLevel(): test static/dynamic inheritance} * 28 28 * TestType: Positive * 29 29 \**********************************************************************************/ … … 42 42 E 5 43 43 44 ---> TESTPOINT PASSED (psTrace{psTraceSetLevel(): test static inheritance} | tst_psTrace.c)44 ---> TESTPOINT PASSED (psTrace{psTraceSetLevel(): test static/dynamic inheritance} | tst_psTrace.c) 45 45 46 46 /***************************** TESTPOINT ******************************************\ -
trunk/psLib/test/tst_template.c
r1364 r2204 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2004- 08-02 18:30:10$8 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-10-27 00:57:31 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 15 15 #include "pslib.h" 16 16 17 static inttest1( void );18 static inttest2( void );19 static inttest3( void );17 static psS32 test1( void ); 18 static psS32 test2( void ); 19 static psS32 test3( void ); 20 20 21 21 // test descrription consists of: … … 45 45 test3, 1114, "psFunctionFunk", 0, false 46 46 }, 47 47 48 48 // testpoint #1112 handled by same test function as #1111 49 49 { 50 50 test1, 1112, "psFunctionBang", 0, true 51 51 }, 52 52 53 53 // A null terminates the testDescription list 54 54 { … … 56 56 } 57 57 }; 58 59 int main( intargc, char* argv[] )58 59 psS32 main( psS32 argc, char* argv[] ) 60 60 { 61 61 psLogSetLevel( PS_LOG_INFO ); 62 62 63 63 return ( ! runTestSuite( stderr, "psImage", tests, argc, argv ) ); 64 64 } 65 65 66 inttest1( void )66 psS32 test1( void ) 67 67 { 68 68 // no need to check for memory leaks, as the runTestSuite does that for you. 69 69 70 70 // here is where one implements the tests for generally a single testpoint. 71 71 72 72 return 0; // the value that indicates success is part of the testDescription 73 73 } 74 74 75 inttest2( void )75 psS32 test2( void ) 76 76 { 77 77 // no need to check for memory leaks, as the runTestSuite does that for you. 78 78 79 79 // here is where one implements the tests for generally a single testpoint. 80 80 81 81 return 0; // the value that indicates success is part of the testDescription 82 82 } 83 83 84 inttest3( void )84 psS32 test3( void ) 85 85 { 86 86 // no need to check for memory leaks, as the runTestSuite does that for you. 87 87 88 88 // here is where one implements the tests for generally a single testpoint. 89 89 90 90 return 0; // the value that indicates success is part of the testDescription 91 91 }
Note:
See TracChangeset
for help on using the changeset viewer.
