Changeset 3107
- Timestamp:
- Feb 2, 2005, 10:22:22 AM (21 years ago)
- Location:
- trunk/psLib
- Files:
-
- 12 edited
-
src/collections/psCollectionsErrors.dat (modified) (1 diff)
-
src/collections/psCollectionsErrors.h (modified) (2 diffs)
-
src/collections/psList.c (modified) (9 diffs)
-
src/collections/psList.h (modified) (5 diffs)
-
src/sys/psErrorCodes.c (modified) (2 diffs)
-
src/sysUtils/psErrorCodes.c (modified) (2 diffs)
-
src/types/psList.c (modified) (9 diffs)
-
src/types/psList.h (modified) (5 diffs)
-
test/astronomy/tst_psMetadataIO.c (modified) (2 diffs)
-
test/astronomy/tst_psMetadata_01.c (modified) (2 diffs)
-
test/collections/tst_psMetadataIO.c (modified) (2 diffs)
-
test/collections/tst_psMetadata_01.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/collections/psCollectionsErrors.dat
r2855 r3107 37 37 psList_ITERATOR_INVALID Specified iterator is not valid. 38 38 psList_ITERATOR_NULL Specified iterator is NULL. 39 psList_ITERATOR_NONMUTABLE Specified iterator indicates list is non-mutable. 39 40 psList_LIST_NULL Specified psList reference is NULL. 40 41 psList_DATA_NULL Specified data item is NULL. -
trunk/psLib/src/collections/psCollectionsErrors.h
r2855 r3107 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $10 * @date $Date: 200 4-12-30 20:18:36$9 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-02-02 20:21:48 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 54 54 #define PS_ERRORTEXT_psList_ITERATOR_INVALID "Specified iterator is not valid." 55 55 #define PS_ERRORTEXT_psList_ITERATOR_NULL "Specified iterator is NULL." 56 #define PS_ERRORTEXT_psList_ITERATOR_NONMUTABLE "Specified iterator indicates list is non-mutable." 56 57 #define PS_ERRORTEXT_psList_LIST_NULL "Specified psList reference is NULL." 57 58 #define PS_ERRORTEXT_psList_DATA_NULL "Specified data item is NULL." -
trunk/psLib/src/collections/psList.c
r3085 r3107 6 6 * @author Robert Daniel DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.3 0$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-0 1-25 01:04:17$8 * @version $Revision: 1.31 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-02-02 20:21:48 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 137 137 138 138 // create a default iterator 139 psListIteratorAlloc(list,PS_LIST_HEAD );139 psListIteratorAlloc(list,PS_LIST_HEAD,true); 140 140 141 141 pthread_mutex_init(&(list->lock), NULL) … … 149 149 } 150 150 151 psListIterator* psListIteratorAlloc(psList* list, int location )151 psListIterator* psListIteratorAlloc(psList* list, int location, bool mutable) 152 152 { 153 153 psListIterator* iter = psAlloc(sizeof(psListIterator)); … … 160 160 iter->index = 0; 161 161 iter->offEnd = false; 162 iter->mutable = mutable; 162 163 163 164 // add to the list's array of iterators … … 201 202 iterator->offEnd = false; 202 203 return true; 204 } 205 206 if (location < 0) { 207 location = list->size + location; 203 208 } 204 209 … … 289 294 psError(PS_ERR_BAD_PARAMETER_NULL, true, 290 295 PS_ERRORTEXT_psList_ITERATOR_NULL); 296 return false; 297 } 298 299 // Check if the list pointed by the iterator can be changed 300 if (!iterator->mutable) { 301 psError(PS_ERR_BAD_PARAMETER_NULL, true, 302 PS_ERRORTEXT_psList_ITERATOR_NONMUTABLE); 291 303 return false; 292 304 } … … 360 372 } 361 373 374 // Check if the list pointed by the iterator can be changed 375 if (!iterator->mutable) { 376 psError(PS_ERR_BAD_PARAMETER_NULL, true, 377 PS_ERRORTEXT_psList_ITERATOR_NONMUTABLE); 378 return false; 379 } 380 362 381 psListElem* cursor = iterator->cursor; 363 382 psList* list = iterator->list; … … 493 512 * and now return the previous/next element of the list 494 513 */ 495 psPtr psListGet Next(psListIterator* iterator)514 psPtr psListGetAndIncrement(psListIterator* iterator) 496 515 { 497 516 if (iterator == NULL ) { … … 518 537 } 519 538 520 psPtr psListGet Previous(psListIterator* iterator)539 psPtr psListGetAndDecrement(psListIterator* iterator) 521 540 { 522 541 if (iterator == NULL ) { -
trunk/psLib/src/collections/psList.h
r2681 r3107 10 10 * @ingroup LinkedList 11 11 * 12 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $13 * @date $Date: 200 4-12-10 02:50:14$12 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-02-02 20:21:48 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 78 78 int index; ///< the index number in the list 79 79 bool offEnd; ///< Iterator off the end? 80 bool mutable; ///< Is it permissible to modify the list? 80 81 } 81 82 psListIterator; … … 98 99 psListIterator* psListIteratorAlloc( 99 100 psList* list, ///< the psList to iterate with 100 int location ///< the initial starting point.101 int location, ///< the initial starting point. 101 102 ///< This can be a numeric index, PS_LIST_HEAD, or PS_LIST_TAIL. 103 bool mutable ///< Is it permissible to modify list? 102 104 ); 103 105 … … 175 177 * iterator goes past the end of the list. 176 178 */ 177 psPtr psListGet Next(179 psPtr psListGetAndIncrement( 178 180 psListIterator* restrict iterator ///< iterator to move 179 181 ); … … 184 186 * iterator goes past the beginning of the list. 185 187 */ 186 psPtr psListGet Previous(188 psPtr psListGetAndDecrement( 187 189 psListIterator* restrict iterator ///< iterator to move 188 190 ); -
trunk/psLib/src/sys/psErrorCodes.c
r2703 r3107 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $10 * @date $Date: 200 4-12-13 20:49:56$9 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-02-02 20:22:22 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 76 76 77 77 // search dynamic list of error descriptions before giving up. 78 psListIterator* iter = psListIteratorAlloc(dynamicErrorCodes,PS_LIST_HEAD );79 while ((desc = (psErrorDescription*)psListGet Next(iter)) != NULL) {78 psListIterator* iter = psListIteratorAlloc(dynamicErrorCodes,PS_LIST_HEAD,true); 79 while ((desc = (psErrorDescription*)psListGetAndIncrement(iter)) != NULL) { 80 80 if (desc->code == code) { 81 81 psFree(iter); -
trunk/psLib/src/sysUtils/psErrorCodes.c
r2703 r3107 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $10 * @date $Date: 200 4-12-13 20:49:56$9 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-02-02 20:22:22 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 76 76 77 77 // search dynamic list of error descriptions before giving up. 78 psListIterator* iter = psListIteratorAlloc(dynamicErrorCodes,PS_LIST_HEAD );79 while ((desc = (psErrorDescription*)psListGet Next(iter)) != NULL) {78 psListIterator* iter = psListIteratorAlloc(dynamicErrorCodes,PS_LIST_HEAD,true); 79 while ((desc = (psErrorDescription*)psListGetAndIncrement(iter)) != NULL) { 80 80 if (desc->code == code) { 81 81 psFree(iter); -
trunk/psLib/src/types/psList.c
r3085 r3107 6 6 * @author Robert Daniel DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.3 0$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-0 1-25 01:04:17$8 * @version $Revision: 1.31 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-02-02 20:21:48 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 137 137 138 138 // create a default iterator 139 psListIteratorAlloc(list,PS_LIST_HEAD );139 psListIteratorAlloc(list,PS_LIST_HEAD,true); 140 140 141 141 pthread_mutex_init(&(list->lock), NULL) … … 149 149 } 150 150 151 psListIterator* psListIteratorAlloc(psList* list, int location )151 psListIterator* psListIteratorAlloc(psList* list, int location, bool mutable) 152 152 { 153 153 psListIterator* iter = psAlloc(sizeof(psListIterator)); … … 160 160 iter->index = 0; 161 161 iter->offEnd = false; 162 iter->mutable = mutable; 162 163 163 164 // add to the list's array of iterators … … 201 202 iterator->offEnd = false; 202 203 return true; 204 } 205 206 if (location < 0) { 207 location = list->size + location; 203 208 } 204 209 … … 289 294 psError(PS_ERR_BAD_PARAMETER_NULL, true, 290 295 PS_ERRORTEXT_psList_ITERATOR_NULL); 296 return false; 297 } 298 299 // Check if the list pointed by the iterator can be changed 300 if (!iterator->mutable) { 301 psError(PS_ERR_BAD_PARAMETER_NULL, true, 302 PS_ERRORTEXT_psList_ITERATOR_NONMUTABLE); 291 303 return false; 292 304 } … … 360 372 } 361 373 374 // Check if the list pointed by the iterator can be changed 375 if (!iterator->mutable) { 376 psError(PS_ERR_BAD_PARAMETER_NULL, true, 377 PS_ERRORTEXT_psList_ITERATOR_NONMUTABLE); 378 return false; 379 } 380 362 381 psListElem* cursor = iterator->cursor; 363 382 psList* list = iterator->list; … … 493 512 * and now return the previous/next element of the list 494 513 */ 495 psPtr psListGet Next(psListIterator* iterator)514 psPtr psListGetAndIncrement(psListIterator* iterator) 496 515 { 497 516 if (iterator == NULL ) { … … 518 537 } 519 538 520 psPtr psListGet Previous(psListIterator* iterator)539 psPtr psListGetAndDecrement(psListIterator* iterator) 521 540 { 522 541 if (iterator == NULL ) { -
trunk/psLib/src/types/psList.h
r2681 r3107 10 10 * @ingroup LinkedList 11 11 * 12 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $13 * @date $Date: 200 4-12-10 02:50:14$12 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-02-02 20:21:48 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 78 78 int index; ///< the index number in the list 79 79 bool offEnd; ///< Iterator off the end? 80 bool mutable; ///< Is it permissible to modify the list? 80 81 } 81 82 psListIterator; … … 98 99 psListIterator* psListIteratorAlloc( 99 100 psList* list, ///< the psList to iterate with 100 int location ///< the initial starting point.101 int location, ///< the initial starting point. 101 102 ///< This can be a numeric index, PS_LIST_HEAD, or PS_LIST_TAIL. 103 bool mutable ///< Is it permissible to modify list? 102 104 ); 103 105 … … 175 177 * iterator goes past the end of the list. 176 178 */ 177 psPtr psListGet Next(179 psPtr psListGetAndIncrement( 178 180 psListIterator* restrict iterator ///< iterator to move 179 181 ); … … 184 186 * iterator goes past the beginning of the list. 185 187 */ 186 psPtr psListGet Previous(188 psPtr psListGetAndDecrement( 187 189 psListIterator* restrict iterator ///< iterator to move 188 190 ); -
trunk/psLib/test/astronomy/tst_psMetadataIO.c
r2681 r3107 13 13 * @author Ross Harman, MHPCC 14 14 * 15 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $16 * @date $Date: 200 4-12-10 02:50:15 $15 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2005-02-02 20:20:55 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 41 41 psMetadataItem *entryChild = NULL; 42 42 43 psListIterator* iter = psListIteratorAlloc(metadataItemList, PS_LIST_HEAD );43 psListIterator* iter = psListIteratorAlloc(metadataItemList, PS_LIST_HEAD, true); 44 44 45 while ( (entryChild=psListGet Next(iter)) != NULL) {45 while ( (entryChild=psListGetAndIncrement(iter)) != NULL) { 46 46 printMetadataItem(entryChild, spaces); 47 47 } -
trunk/psLib/test/astronomy/tst_psMetadata_01.c
r2681 r3107 18 18 * @author Ross Harman, MHPCC 19 19 * 20 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $21 * @date $Date: 200 4-12-10 02:50:15 $20 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 21 * @date $Date: 2005-02-02 20:20:55 $ 22 22 * 23 23 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 46 46 psMetadataItem *entryChild = NULL; 47 47 48 psListIterator* iter = psListIteratorAlloc(metadataItemList, PS_LIST_HEAD );49 50 while ( (entryChild=psListGet Next(iter)) != NULL) {48 psListIterator* iter = psListIteratorAlloc(metadataItemList, PS_LIST_HEAD, true); 49 50 while ( (entryChild=psListGetAndIncrement(iter)) != NULL) { 51 51 printMetadataItem(entryChild, spaces); 52 52 } -
trunk/psLib/test/collections/tst_psMetadataIO.c
r2681 r3107 13 13 * @author Ross Harman, MHPCC 14 14 * 15 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $16 * @date $Date: 200 4-12-10 02:50:15 $15 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2005-02-02 20:20:55 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 41 41 psMetadataItem *entryChild = NULL; 42 42 43 psListIterator* iter = psListIteratorAlloc(metadataItemList, PS_LIST_HEAD );43 psListIterator* iter = psListIteratorAlloc(metadataItemList, PS_LIST_HEAD, true); 44 44 45 while ( (entryChild=psListGet Next(iter)) != NULL) {45 while ( (entryChild=psListGetAndIncrement(iter)) != NULL) { 46 46 printMetadataItem(entryChild, spaces); 47 47 } -
trunk/psLib/test/collections/tst_psMetadata_01.c
r2681 r3107 18 18 * @author Ross Harman, MHPCC 19 19 * 20 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $21 * @date $Date: 200 4-12-10 02:50:15 $20 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 21 * @date $Date: 2005-02-02 20:20:55 $ 22 22 * 23 23 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 46 46 psMetadataItem *entryChild = NULL; 47 47 48 psListIterator* iter = psListIteratorAlloc(metadataItemList, PS_LIST_HEAD );49 50 while ( (entryChild=psListGet Next(iter)) != NULL) {48 psListIterator* iter = psListIteratorAlloc(metadataItemList, PS_LIST_HEAD, true); 49 50 while ( (entryChild=psListGetAndIncrement(iter)) != NULL) { 51 51 printMetadataItem(entryChild, spaces); 52 52 }
Note:
See TracChangeset
for help on using the changeset viewer.
