IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3108


Ignore:
Timestamp:
Feb 2, 2005, 10:22:56 AM (21 years ago)
Author:
evanalst
Message:

Update changes in psList.

Location:
trunk/psLib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/dataIO/psFits.c

    r3039 r3108  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-01-18 20:01:48 $
     9 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-02-02 20:22:56 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    10691069    //transverse the metadata list and add each key.
    10701070
    1071     psListIterator* iter = psListIteratorAlloc(header->list,PS_LIST_HEAD);
     1071    psListIterator* iter = psListIteratorAlloc(header->list,PS_LIST_HEAD,true);
    10721072    psMetadataItem* item;
    1073     while ( (item=psListGetNext(iter)) != NULL ) {
     1073    while ( (item=psListGetAndIncrement(iter)) != NULL ) {
    10741074        if (item->type == PS_META_PRIMITIVE) { // we only write primitive data types.
    10751075            switch (item->pType) {
     
    14851485        if (rowMeta != NULL) {
    14861486            psListIterator* iter = psListIteratorAlloc(rowMeta->list,
    1487                                    PS_LIST_HEAD);
    1488             while ( (item=psListGetNext(iter)) != NULL) {
     1487                                   PS_LIST_HEAD,true);
     1488            while ( (item=psListGetAndIncrement(iter)) != NULL) {
    14891489                if (item->type == PS_META_PRIMITIVE) {
    14901490                    bool found = false;
  • trunk/psLib/src/fileUtils/psFits.c

    r3039 r3108  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-01-18 20:01:48 $
     9 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-02-02 20:22:56 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    10691069    //transverse the metadata list and add each key.
    10701070
    1071     psListIterator* iter = psListIteratorAlloc(header->list,PS_LIST_HEAD);
     1071    psListIterator* iter = psListIteratorAlloc(header->list,PS_LIST_HEAD,true);
    10721072    psMetadataItem* item;
    1073     while ( (item=psListGetNext(iter)) != NULL ) {
     1073    while ( (item=psListGetAndIncrement(iter)) != NULL ) {
    10741074        if (item->type == PS_META_PRIMITIVE) { // we only write primitive data types.
    10751075            switch (item->pType) {
     
    14851485        if (rowMeta != NULL) {
    14861486            psListIterator* iter = psListIteratorAlloc(rowMeta->list,
    1487                                    PS_LIST_HEAD);
    1488             while ( (item=psListGetNext(iter)) != NULL) {
     1487                                   PS_LIST_HEAD,true);
     1488            while ( (item=psListGetAndIncrement(iter)) != NULL) {
    14891489                if (item->type == PS_META_PRIMITIVE) {
    14901490                    bool found = false;
  • trunk/psLib/src/fits/psFits.c

    r3039 r3108  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-01-18 20:01:48 $
     9 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-02-02 20:22:56 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    10691069    //transverse the metadata list and add each key.
    10701070
    1071     psListIterator* iter = psListIteratorAlloc(header->list,PS_LIST_HEAD);
     1071    psListIterator* iter = psListIteratorAlloc(header->list,PS_LIST_HEAD,true);
    10721072    psMetadataItem* item;
    1073     while ( (item=psListGetNext(iter)) != NULL ) {
     1073    while ( (item=psListGetAndIncrement(iter)) != NULL ) {
    10741074        if (item->type == PS_META_PRIMITIVE) { // we only write primitive data types.
    10751075            switch (item->pType) {
     
    14851485        if (rowMeta != NULL) {
    14861486            psListIterator* iter = psListIteratorAlloc(rowMeta->list,
    1487                                    PS_LIST_HEAD);
    1488             while ( (item=psListGetNext(iter)) != NULL) {
     1487                                   PS_LIST_HEAD,true);
     1488            while ( (item=psListGetAndIncrement(iter)) != NULL) {
    14891489                if (item->type == PS_META_PRIMITIVE) {
    14901490                    bool found = false;
  • trunk/psLib/test/collections/tst_psList.c

    r3084 r3108  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-01-25 01:02:23 $
     8 *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-02-02 20:20:18 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    135135
    136136    list = psListAlloc(data);
    137     currentIterator = psListIteratorAlloc(list,PS_LIST_HEAD);
     137    currentIterator = psListIteratorAlloc(list,PS_LIST_HEAD,true);
    138138
    139139    // Add data after HEAD and verify data
     
    154154    psFree(currentIterator);
    155155
    156     currentIterator = psListIteratorAlloc(list,PS_LIST_TAIL);
     156    currentIterator = psListIteratorAlloc(list,PS_LIST_TAIL,true);
    157157
    158158    // Add data after TAIL and verify data
     
    206206
    207207    list = psListAlloc(NULL);
    208     currentIterator = psListIteratorAlloc(list,PS_LIST_HEAD);
     208    currentIterator = psListIteratorAlloc(list,PS_LIST_HEAD,true);
    209209
    210210    // Add data before HEAD and verify data
     
    225225    psFree(currentIterator);
    226226
    227     currentIterator = psListIteratorAlloc(list,PS_LIST_TAIL);
     227    currentIterator = psListIteratorAlloc(list,PS_LIST_TAIL,true);
    228228
    229229    // Add data after TAIL and verify data
     
    477477    psBool first = true;
    478478
    479     psListIterator* iter = psListIteratorAlloc(list,PS_LIST_HEAD);
    480 
    481     while ( (data=(psS32*)psListGetNext(iter)) != NULL ) {
     479    psListIterator* iter = psListIteratorAlloc(list,PS_LIST_HEAD,true);
     480
     481    while ( (data=(psS32*)psListGetAndIncrement(iter)) != NULL ) {
    482482        if (!first) {
    483483            printf(", %d",*(psS32*)data);
     
    929929    }
    930930
    931     psListIterator* iter = psListIteratorAlloc(list,PS_LIST_HEAD);
     931    psListIterator* iter = psListIteratorAlloc(list,PS_LIST_HEAD,true);
    932932    if (iter == NULL) {
    933933        psError(PS_ERR_UNKNOWN, true,"Failed to make an iterator.");
     
    943943
    944944    // Attempt to get next with NULL iterator
    945     if ( psListGetNext(NULL) != NULL ) {
     945    if ( psListGetAndIncrement(NULL) != NULL ) {
    946946        psError(PS_ERR_UNKNOWN,true,"Did not return NULL when NULL iterator specified");
    947947        return 24;
     
    949949
    950950    // Attempt to get previous with NULL iterator
    951     if( psListGetPrevious(NULL) != NULL) {
     951    if( psListGetAndDecrement(NULL) != NULL) {
    952952        psError(PS_ERR_UNKNOWN,true,"Did not return NULL when NULL iterator specified");
    953953        return 25;
     
    972972
    973973    // test psListGetPrevious/Next
    974     if (*(psS32*)psListGetNext(iter) != 0) {
     974    if (*(psS32*)psListGetAndIncrement(iter) != 0) {
    975975        psError(PS_ERR_UNKNOWN, true,"psListGetNext didn't move cursor to next.");
    976976        return 8;
    977977    }
    978     if (*(psS32*)psListGetNext(iter) != 1) {
     978    if (*(psS32*)psListGetAndIncrement(iter) != 1) {
    979979        psError(PS_ERR_UNKNOWN, true,"psListGetNext didn't move cursor to next.");
    980980        return 9;
    981981    }
    982     if (*(psS32*)psListGetNext(iter) != 2) {
     982    if (*(psS32*)psListGetAndIncrement(iter) != 2) {
    983983        psError(PS_ERR_UNKNOWN, true,"psListGetNext didn't move cursor to next.");
    984984        return 10;
    985985    }
    986986
    987     if (*(psS32*)psListGetPrevious(iter) != 3) {
     987    if (*(psS32*)psListGetAndDecrement(iter) != 3) {
    988988        psError(PS_ERR_UNKNOWN, true,"psListGetPrevious didn't move cursor to previous.");
    989989        return 11;
    990990    }
    991     if (*(psS32*)psListGetPrevious(iter) != 2) {
     991    if (*(psS32*)psListGetAndDecrement(iter) != 2) {
    992992        psError(PS_ERR_UNKNOWN, true,"psListGetPrevious didn't move cursor to previous.");
    993993        return 12;
    994994    }
    995     if (*(psS32*)psListGetPrevious(iter) != 1) {
     995    if (*(psS32*)psListGetAndDecrement(iter) != 1) {
    996996        psError(PS_ERR_UNKNOWN, true,"psListGetPrevious didn't move cursor to previous..");
    997997        return 13;
    998998    }
    999     if (*(psS32*)psListGetPrevious(iter) != 0) {
     999    if (*(psS32*)psListGetAndDecrement(iter) != 0) {
    10001000        psError(PS_ERR_UNKNOWN, true,"psListGetPrevious didn't move cursor to previous..");
    10011001        return 14;
    10021002    }
    1003     if (psListGetPrevious(iter) != NULL) {
     1003    if (psListGetAndDecrement(iter) != NULL) {
    10041004        psError(PS_ERR_UNKNOWN, true,"psListGetPrevious moved cursor beyond head.");
    10051005        return 15;
    10061006    }
    1007     if (psListGetNext(iter) != NULL) {
     1007    if (psListGetAndIncrement(iter) != NULL) {
    10081008        psError(PS_ERR_UNKNOWN,true,"psListGetNext should return NULL when above head");
    10091009        return 22;
    10101010    }
    1011     if (*(psS32*)psListGetNext(iter) != 0 ) {
     1011    if (*(psS32*)psListGetAndIncrement(iter) != 0 ) {
    10121012        psError(PS_ERR_UNKNOWN,true,"psListGetNext didn't move cursor to next.");
    10131013        return 23;
     
    10151015
    10161016    psListIteratorSet(iter,PS_LIST_TAIL); // works according to an above test
    1017     if (*(psS32*)psListGetNext(iter) != 14) {
     1017    if (*(psS32*)psListGetAndIncrement(iter) != 14) {
    10181018        psError(PS_ERR_UNKNOWN, true,"psListGetNext moved cursor beyond tail.");
    10191019        return 16;
    10201020    }
    1021     if ((psListGetNext(iter) != NULL) || (!iter->offEnd)) {
     1021    if ((psListGetAndIncrement(iter) != NULL) || (!iter->offEnd)) {
    10221022        psError(PS_ERR_UNKNOWN, true,"psListGetNext moved cursor beyond tail.");
    10231023        return 17;
    10241024    }
    1025     if(psListGetPrevious(iter) != NULL) {
     1025    if(psListGetAndDecrement(iter) != NULL) {
    10261026        psError(PS_ERR_UNKNOWN,true,"psListGetPrevious did not return NULL when offEnd is true");
    10271027        return 18;
     
    10311031        return 19;
    10321032    }
    1033     if(*(psS32*)psListGetPrevious(iter) != 14) {
     1033    if(*(psS32*)psListGetAndDecrement(iter) != 14) {
    10341034        psError(PS_ERR_UNKNOWN,true,"psListGetPrevious did not return correct value of tail.");
    10351035        return 20;
     
    11221122
    11231123    printf("original list = [");
    1124     iter = psListIteratorAlloc(list,PS_LIST_HEAD);
    1125     while( (fValue=psListGetNext(iter)) != NULL ) {
     1124    iter = psListIteratorAlloc(list,PS_LIST_HEAD,true);
     1125    while( (fValue=psListGetAndIncrement(iter)) != NULL ) {
    11261126        printf(" %.1f",*fValue);
    11271127    }
     
    11321132    printf("sorted list = [");
    11331133    psListIteratorSet(iter,PS_LIST_HEAD);
    1134     while( (fValue=psListGetNext(iter)) != NULL ) {
     1134    while( (fValue=psListGetAndIncrement(iter)) != NULL ) {
    11351135        printf(" %.1f",*fValue);
    11361136    }
     
    11381138
    11391139    psListIteratorSet(iter,PS_LIST_HEAD);
    1140     float* prevFValue = psListGetNext(iter);
    1141     while( (fValue=psListGetNext(iter)) != NULL ) {
     1140    float* prevFValue = psListGetAndIncrement(iter);
     1141    while( (fValue=psListGetAndIncrement(iter)) != NULL ) {
    11421142        if (*prevFValue > *fValue) {
    11431143            psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?");
     
    11501150    printf("descending sort list = [");
    11511151    psListIteratorSet(iter,PS_LIST_HEAD);
    1152     while( (fValue=psListGetNext(iter)) != NULL ) {
     1152    while( (fValue=psListGetAndIncrement(iter)) != NULL ) {
    11531153        printf(" %.1f",*fValue);
    11541154    }
     
    11561156
    11571157    psListIteratorSet(iter,PS_LIST_HEAD);
    1158     prevFValue = psListGetNext(iter);
    1159     while( (fValue=psListGetNext(iter)) != NULL ) {
     1158    prevFValue = psListGetAndIncrement(iter);
     1159    while( (fValue=psListGetAndIncrement(iter)) != NULL ) {
    11601160        if (*prevFValue < *fValue) {
    11611161            psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?");
     
    11831183
    11841184    printf("original list = [");
    1185     iter = psListIteratorAlloc(list,PS_LIST_HEAD);
    1186     while( (uValue=psListGetNext(iter)) != NULL ) {
     1185    iter = psListIteratorAlloc(list,PS_LIST_HEAD,true);
     1186    while( (uValue=psListGetAndIncrement(iter)) != NULL ) {
    11871187        printf(" %d",*uValue);
    11881188    }
     
    11931193    printf("sorted list = [");
    11941194    psListIteratorSet(iter,PS_LIST_HEAD);
    1195     while( (uValue=psListGetNext(iter)) != NULL ) {
     1195    while( (uValue=psListGetAndIncrement(iter)) != NULL ) {
    11961196        printf(" %d",*uValue);
    11971197    }
     
    11991199
    12001200    psListIteratorSet(iter,PS_LIST_HEAD);
    1201     psU32* prevUValue = psListGetNext(iter);
    1202     while( (uValue=psListGetNext(iter)) != NULL ) {
     1201    psU32* prevUValue = psListGetAndIncrement(iter);
     1202    while( (uValue=psListGetAndIncrement(iter)) != NULL ) {
    12031203        if (*prevUValue > *uValue) {
    12041204            psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?");
     
    12111211    printf("descending sort list = [");
    12121212    psListIteratorSet(iter,PS_LIST_HEAD);
    1213     while( (uValue=psListGetNext(iter)) != NULL ) {
     1213    while( (uValue=psListGetAndIncrement(iter)) != NULL ) {
    12141214        printf(" %d",*uValue);
    12151215    }
     
    12171217
    12181218    psListIteratorSet(iter,PS_LIST_HEAD);
    1219     prevUValue = psListGetNext(iter);
    1220     while( (uValue=psListGetNext(iter)) != NULL ) {
     1219    prevUValue = psListGetAndIncrement(iter);
     1220    while( (uValue=psListGetAndIncrement(iter)) != NULL ) {
    12211221        if (*prevUValue < *uValue) {
    12221222            psError(PS_ERR_UNKNOWN, true,"Hey, the list wasn't sorted!?");
  • trunk/psLib/test/collections/verified/tst_psList.stderr

    r3084 r3108  
    2525    Following should error with invalid insert location
    2626<DATE><TIME>|<HOST>|E|psListIteratorSet (psList.c:<LINENO>)
    27     Specified location, -10, is invalid.
     27    Specified location, -7, is invalid.
    2828<DATE><TIME>|<HOST>|I|testListAdd
    2929    Following should be a warning.
     
    9696<DATE><TIME>|<HOST>|I|testListIterator
    9797     psListSetIterator/psListGetNext/psListGetPrev shall move the list cursor to the specified location
    98 <DATE><TIME>|<HOST>|W|psListGetPrevious
     98<DATE><TIME>|<HOST>|W|psListGetAndDecrement
    9999    Attempt to get previous with itertator cursor NULL and offEnd false
    100100
Note: See TracChangeset for help on using the changeset viewer.