Changeset 3108
- Timestamp:
- Feb 2, 2005, 10:22:56 AM (21 years ago)
- Location:
- trunk/psLib
- Files:
-
- 5 edited
-
src/dataIO/psFits.c (modified) (3 diffs)
-
src/fileUtils/psFits.c (modified) (3 diffs)
-
src/fits/psFits.c (modified) (3 diffs)
-
test/collections/tst_psList.c (modified) (22 diffs)
-
test/collections/verified/tst_psList.stderr (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataIO/psFits.c
r3039 r3108 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-0 1-18 20:01:48$9 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-02-02 20:22:56 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 1069 1069 //transverse the metadata list and add each key. 1070 1070 1071 psListIterator* iter = psListIteratorAlloc(header->list,PS_LIST_HEAD );1071 psListIterator* iter = psListIteratorAlloc(header->list,PS_LIST_HEAD,true); 1072 1072 psMetadataItem* item; 1073 while ( (item=psListGet Next(iter)) != NULL ) {1073 while ( (item=psListGetAndIncrement(iter)) != NULL ) { 1074 1074 if (item->type == PS_META_PRIMITIVE) { // we only write primitive data types. 1075 1075 switch (item->pType) { … … 1485 1485 if (rowMeta != NULL) { 1486 1486 psListIterator* iter = psListIteratorAlloc(rowMeta->list, 1487 PS_LIST_HEAD );1488 while ( (item=psListGet Next(iter)) != NULL) {1487 PS_LIST_HEAD,true); 1488 while ( (item=psListGetAndIncrement(iter)) != NULL) { 1489 1489 if (item->type == PS_META_PRIMITIVE) { 1490 1490 bool found = false; -
trunk/psLib/src/fileUtils/psFits.c
r3039 r3108 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-0 1-18 20:01:48$9 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-02-02 20:22:56 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 1069 1069 //transverse the metadata list and add each key. 1070 1070 1071 psListIterator* iter = psListIteratorAlloc(header->list,PS_LIST_HEAD );1071 psListIterator* iter = psListIteratorAlloc(header->list,PS_LIST_HEAD,true); 1072 1072 psMetadataItem* item; 1073 while ( (item=psListGet Next(iter)) != NULL ) {1073 while ( (item=psListGetAndIncrement(iter)) != NULL ) { 1074 1074 if (item->type == PS_META_PRIMITIVE) { // we only write primitive data types. 1075 1075 switch (item->pType) { … … 1485 1485 if (rowMeta != NULL) { 1486 1486 psListIterator* iter = psListIteratorAlloc(rowMeta->list, 1487 PS_LIST_HEAD );1488 while ( (item=psListGet Next(iter)) != NULL) {1487 PS_LIST_HEAD,true); 1488 while ( (item=psListGetAndIncrement(iter)) != NULL) { 1489 1489 if (item->type == PS_META_PRIMITIVE) { 1490 1490 bool found = false; -
trunk/psLib/src/fits/psFits.c
r3039 r3108 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-0 1-18 20:01:48$9 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-02-02 20:22:56 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 1069 1069 //transverse the metadata list and add each key. 1070 1070 1071 psListIterator* iter = psListIteratorAlloc(header->list,PS_LIST_HEAD );1071 psListIterator* iter = psListIteratorAlloc(header->list,PS_LIST_HEAD,true); 1072 1072 psMetadataItem* item; 1073 while ( (item=psListGet Next(iter)) != NULL ) {1073 while ( (item=psListGetAndIncrement(iter)) != NULL ) { 1074 1074 if (item->type == PS_META_PRIMITIVE) { // we only write primitive data types. 1075 1075 switch (item->pType) { … … 1485 1485 if (rowMeta != NULL) { 1486 1486 psListIterator* iter = psListIteratorAlloc(rowMeta->list, 1487 PS_LIST_HEAD );1488 while ( (item=psListGet Next(iter)) != NULL) {1487 PS_LIST_HEAD,true); 1488 while ( (item=psListGetAndIncrement(iter)) != NULL) { 1489 1489 if (item->type == PS_META_PRIMITIVE) { 1490 1490 bool found = false; -
trunk/psLib/test/collections/tst_psList.c
r3084 r3108 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.2 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-0 1-25 01:02:23$8 * @version $Revision: 1.26 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-02-02 20:20:18 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 135 135 136 136 list = psListAlloc(data); 137 currentIterator = psListIteratorAlloc(list,PS_LIST_HEAD );137 currentIterator = psListIteratorAlloc(list,PS_LIST_HEAD,true); 138 138 139 139 // Add data after HEAD and verify data … … 154 154 psFree(currentIterator); 155 155 156 currentIterator = psListIteratorAlloc(list,PS_LIST_TAIL );156 currentIterator = psListIteratorAlloc(list,PS_LIST_TAIL,true); 157 157 158 158 // Add data after TAIL and verify data … … 206 206 207 207 list = psListAlloc(NULL); 208 currentIterator = psListIteratorAlloc(list,PS_LIST_HEAD );208 currentIterator = psListIteratorAlloc(list,PS_LIST_HEAD,true); 209 209 210 210 // Add data before HEAD and verify data … … 225 225 psFree(currentIterator); 226 226 227 currentIterator = psListIteratorAlloc(list,PS_LIST_TAIL );227 currentIterator = psListIteratorAlloc(list,PS_LIST_TAIL,true); 228 228 229 229 // Add data after TAIL and verify data … … 477 477 psBool first = true; 478 478 479 psListIterator* iter = psListIteratorAlloc(list,PS_LIST_HEAD );480 481 while ( (data=(psS32*)psListGet Next(iter)) != NULL ) {479 psListIterator* iter = psListIteratorAlloc(list,PS_LIST_HEAD,true); 480 481 while ( (data=(psS32*)psListGetAndIncrement(iter)) != NULL ) { 482 482 if (!first) { 483 483 printf(", %d",*(psS32*)data); … … 929 929 } 930 930 931 psListIterator* iter = psListIteratorAlloc(list,PS_LIST_HEAD );931 psListIterator* iter = psListIteratorAlloc(list,PS_LIST_HEAD,true); 932 932 if (iter == NULL) { 933 933 psError(PS_ERR_UNKNOWN, true,"Failed to make an iterator."); … … 943 943 944 944 // Attempt to get next with NULL iterator 945 if ( psListGet Next(NULL) != NULL ) {945 if ( psListGetAndIncrement(NULL) != NULL ) { 946 946 psError(PS_ERR_UNKNOWN,true,"Did not return NULL when NULL iterator specified"); 947 947 return 24; … … 949 949 950 950 // Attempt to get previous with NULL iterator 951 if( psListGet Previous(NULL) != NULL) {951 if( psListGetAndDecrement(NULL) != NULL) { 952 952 psError(PS_ERR_UNKNOWN,true,"Did not return NULL when NULL iterator specified"); 953 953 return 25; … … 972 972 973 973 // test psListGetPrevious/Next 974 if (*(psS32*)psListGet Next(iter) != 0) {974 if (*(psS32*)psListGetAndIncrement(iter) != 0) { 975 975 psError(PS_ERR_UNKNOWN, true,"psListGetNext didn't move cursor to next."); 976 976 return 8; 977 977 } 978 if (*(psS32*)psListGet Next(iter) != 1) {978 if (*(psS32*)psListGetAndIncrement(iter) != 1) { 979 979 psError(PS_ERR_UNKNOWN, true,"psListGetNext didn't move cursor to next."); 980 980 return 9; 981 981 } 982 if (*(psS32*)psListGet Next(iter) != 2) {982 if (*(psS32*)psListGetAndIncrement(iter) != 2) { 983 983 psError(PS_ERR_UNKNOWN, true,"psListGetNext didn't move cursor to next."); 984 984 return 10; 985 985 } 986 986 987 if (*(psS32*)psListGet Previous(iter) != 3) {987 if (*(psS32*)psListGetAndDecrement(iter) != 3) { 988 988 psError(PS_ERR_UNKNOWN, true,"psListGetPrevious didn't move cursor to previous."); 989 989 return 11; 990 990 } 991 if (*(psS32*)psListGet Previous(iter) != 2) {991 if (*(psS32*)psListGetAndDecrement(iter) != 2) { 992 992 psError(PS_ERR_UNKNOWN, true,"psListGetPrevious didn't move cursor to previous."); 993 993 return 12; 994 994 } 995 if (*(psS32*)psListGet Previous(iter) != 1) {995 if (*(psS32*)psListGetAndDecrement(iter) != 1) { 996 996 psError(PS_ERR_UNKNOWN, true,"psListGetPrevious didn't move cursor to previous.."); 997 997 return 13; 998 998 } 999 if (*(psS32*)psListGet Previous(iter) != 0) {999 if (*(psS32*)psListGetAndDecrement(iter) != 0) { 1000 1000 psError(PS_ERR_UNKNOWN, true,"psListGetPrevious didn't move cursor to previous.."); 1001 1001 return 14; 1002 1002 } 1003 if (psListGet Previous(iter) != NULL) {1003 if (psListGetAndDecrement(iter) != NULL) { 1004 1004 psError(PS_ERR_UNKNOWN, true,"psListGetPrevious moved cursor beyond head."); 1005 1005 return 15; 1006 1006 } 1007 if (psListGet Next(iter) != NULL) {1007 if (psListGetAndIncrement(iter) != NULL) { 1008 1008 psError(PS_ERR_UNKNOWN,true,"psListGetNext should return NULL when above head"); 1009 1009 return 22; 1010 1010 } 1011 if (*(psS32*)psListGet Next(iter) != 0 ) {1011 if (*(psS32*)psListGetAndIncrement(iter) != 0 ) { 1012 1012 psError(PS_ERR_UNKNOWN,true,"psListGetNext didn't move cursor to next."); 1013 1013 return 23; … … 1015 1015 1016 1016 psListIteratorSet(iter,PS_LIST_TAIL); // works according to an above test 1017 if (*(psS32*)psListGet Next(iter) != 14) {1017 if (*(psS32*)psListGetAndIncrement(iter) != 14) { 1018 1018 psError(PS_ERR_UNKNOWN, true,"psListGetNext moved cursor beyond tail."); 1019 1019 return 16; 1020 1020 } 1021 if ((psListGet Next(iter) != NULL) || (!iter->offEnd)) {1021 if ((psListGetAndIncrement(iter) != NULL) || (!iter->offEnd)) { 1022 1022 psError(PS_ERR_UNKNOWN, true,"psListGetNext moved cursor beyond tail."); 1023 1023 return 17; 1024 1024 } 1025 if(psListGet Previous(iter) != NULL) {1025 if(psListGetAndDecrement(iter) != NULL) { 1026 1026 psError(PS_ERR_UNKNOWN,true,"psListGetPrevious did not return NULL when offEnd is true"); 1027 1027 return 18; … … 1031 1031 return 19; 1032 1032 } 1033 if(*(psS32*)psListGet Previous(iter) != 14) {1033 if(*(psS32*)psListGetAndDecrement(iter) != 14) { 1034 1034 psError(PS_ERR_UNKNOWN,true,"psListGetPrevious did not return correct value of tail."); 1035 1035 return 20; … … 1122 1122 1123 1123 printf("original list = ["); 1124 iter = psListIteratorAlloc(list,PS_LIST_HEAD );1125 while( (fValue=psListGet Next(iter)) != NULL ) {1124 iter = psListIteratorAlloc(list,PS_LIST_HEAD,true); 1125 while( (fValue=psListGetAndIncrement(iter)) != NULL ) { 1126 1126 printf(" %.1f",*fValue); 1127 1127 } … … 1132 1132 printf("sorted list = ["); 1133 1133 psListIteratorSet(iter,PS_LIST_HEAD); 1134 while( (fValue=psListGet Next(iter)) != NULL ) {1134 while( (fValue=psListGetAndIncrement(iter)) != NULL ) { 1135 1135 printf(" %.1f",*fValue); 1136 1136 } … … 1138 1138 1139 1139 psListIteratorSet(iter,PS_LIST_HEAD); 1140 float* prevFValue = psListGet Next(iter);1141 while( (fValue=psListGet Next(iter)) != NULL ) {1140 float* prevFValue = psListGetAndIncrement(iter); 1141 while( (fValue=psListGetAndIncrement(iter)) != NULL ) { 1142 1142 if (*prevFValue > *fValue) { 1143 1143 psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?"); … … 1150 1150 printf("descending sort list = ["); 1151 1151 psListIteratorSet(iter,PS_LIST_HEAD); 1152 while( (fValue=psListGet Next(iter)) != NULL ) {1152 while( (fValue=psListGetAndIncrement(iter)) != NULL ) { 1153 1153 printf(" %.1f",*fValue); 1154 1154 } … … 1156 1156 1157 1157 psListIteratorSet(iter,PS_LIST_HEAD); 1158 prevFValue = psListGet Next(iter);1159 while( (fValue=psListGet Next(iter)) != NULL ) {1158 prevFValue = psListGetAndIncrement(iter); 1159 while( (fValue=psListGetAndIncrement(iter)) != NULL ) { 1160 1160 if (*prevFValue < *fValue) { 1161 1161 psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?"); … … 1183 1183 1184 1184 printf("original list = ["); 1185 iter = psListIteratorAlloc(list,PS_LIST_HEAD );1186 while( (uValue=psListGet Next(iter)) != NULL ) {1185 iter = psListIteratorAlloc(list,PS_LIST_HEAD,true); 1186 while( (uValue=psListGetAndIncrement(iter)) != NULL ) { 1187 1187 printf(" %d",*uValue); 1188 1188 } … … 1193 1193 printf("sorted list = ["); 1194 1194 psListIteratorSet(iter,PS_LIST_HEAD); 1195 while( (uValue=psListGet Next(iter)) != NULL ) {1195 while( (uValue=psListGetAndIncrement(iter)) != NULL ) { 1196 1196 printf(" %d",*uValue); 1197 1197 } … … 1199 1199 1200 1200 psListIteratorSet(iter,PS_LIST_HEAD); 1201 psU32* prevUValue = psListGet Next(iter);1202 while( (uValue=psListGet Next(iter)) != NULL ) {1201 psU32* prevUValue = psListGetAndIncrement(iter); 1202 while( (uValue=psListGetAndIncrement(iter)) != NULL ) { 1203 1203 if (*prevUValue > *uValue) { 1204 1204 psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?"); … … 1211 1211 printf("descending sort list = ["); 1212 1212 psListIteratorSet(iter,PS_LIST_HEAD); 1213 while( (uValue=psListGet Next(iter)) != NULL ) {1213 while( (uValue=psListGetAndIncrement(iter)) != NULL ) { 1214 1214 printf(" %d",*uValue); 1215 1215 } … … 1217 1217 1218 1218 psListIteratorSet(iter,PS_LIST_HEAD); 1219 prevUValue = psListGet Next(iter);1220 while( (uValue=psListGet Next(iter)) != NULL ) {1219 prevUValue = psListGetAndIncrement(iter); 1220 while( (uValue=psListGetAndIncrement(iter)) != NULL ) { 1221 1221 if (*prevUValue < *uValue) { 1222 1222 psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?"); -
trunk/psLib/test/collections/verified/tst_psList.stderr
r3084 r3108 25 25 Following should error with invalid insert location 26 26 <DATE><TIME>|<HOST>|E|psListIteratorSet (psList.c:<LINENO>) 27 Specified location, - 10, is invalid.27 Specified location, -7, is invalid. 28 28 <DATE><TIME>|<HOST>|I|testListAdd 29 29 Following should be a warning. … … 96 96 <DATE><TIME>|<HOST>|I|testListIterator 97 97 psListSetIterator/psListGetNext/psListGetPrev shall move the list cursor to the specified location 98 <DATE><TIME>|<HOST>|W|psListGet Previous98 <DATE><TIME>|<HOST>|W|psListGetAndDecrement 99 99 Attempt to get previous with itertator cursor NULL and offEnd false 100 100
Note:
See TracChangeset
for help on using the changeset viewer.
