IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3082


Ignore:
Timestamp:
Jan 24, 2005, 2:12:12 PM (21 years ago)
Author:
evanalst
Message:

Allow function psListGetPrevious to come back onto the list after
psListGetNext has gone beyond the end.

Location:
trunk/psLib/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/collections/psList.c

    r3065 r3082  
    66 *  @author Robert Daniel DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-01-20 00:51:29 $
     8 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-01-25 00:12:12 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    512512psPtr psListGetPrevious(psListIterator* iterator)
    513513{
    514     if (iterator == NULL || iterator->cursor == NULL) {
     514    if ( (iterator == NULL ) || ((iterator->cursor == NULL) && (!iterator->offEnd)) ) {
     515        return NULL;
     516    }
     517    if ( (iterator->cursor == NULL) && (iterator->offEnd) ) {
     518        iterator->cursor = iterator->list->tail;
     519        iterator->index = iterator->list->size-1;
     520        iterator->offEnd = false;
    515521        return NULL;
    516522    }
  • trunk/psLib/src/types/psList.c

    r3065 r3082  
    66 *  @author Robert Daniel DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-01-20 00:51:29 $
     8 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-01-25 00:12:12 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    512512psPtr psListGetPrevious(psListIterator* iterator)
    513513{
    514     if (iterator == NULL || iterator->cursor == NULL) {
     514    if ( (iterator == NULL ) || ((iterator->cursor == NULL) && (!iterator->offEnd)) ) {
     515        return NULL;
     516    }
     517    if ( (iterator->cursor == NULL) && (iterator->offEnd) ) {
     518        iterator->cursor = iterator->list->tail;
     519        iterator->index = iterator->list->size-1;
     520        iterator->offEnd = false;
    515521        return NULL;
    516522    }
Note: See TracChangeset for help on using the changeset viewer.