~juan457/+junk/zorba

« back to all changes in this revision

Viewing changes to src/runtime/core/var_iterators.cpp

  • Committer: Markos Zaharioudakis
  • Date: 2012-07-11 15:38:39 UTC
  • mfrom: (10924 zorba)
  • mto: This revision was merged to the branch mainline in revision 10932.
  • Revision ID: markos_za@yahoo.com-20120711153839-0mkh15cg2ubknchd
work in progress

Show diffs side-by-side

added added

removed removed

Lines of Context:
676
676
 
677
677
LetVarState::LetVarState()
678
678
{
 
679
  theWindowStart = 0;
 
680
  theWindowEnd = 0;
679
681
}
680
682
 
681
683
 
836
838
      state->theTempSeqIter->open();
837
839
    }
838
840
  }
 
841
  else
 
842
  {
 
843
    state->theWindowStart = startPos - 1;
 
844
    state->theWindowEnd = endPos;
 
845
  }
839
846
}
840
847
 
841
848
 
901
908
  store::Item_t lenItem;
902
909
  xs_integer startPos;
903
910
  xs_integer len;
 
911
  xs_integer seqSize;
904
912
 
905
913
  LetVarState* state;
906
914
  DEFAULT_STACK_INIT(LetVarState, state, planState);
919
927
    if (theTargetLenIter == NULL && theInfLen == false)
920
928
    {
921
929
      if (startPos > Integer(0))
 
930
      {
 
931
        startPos += state->theWindowStart;
 
932
 
922
933
        state->theTempSeq->getItem(startPos, result);
 
934
      }
923
935
 
924
936
      if (result)
925
937
        STACK_PUSH(true, state);
946
958
        startPos = 1;
947
959
      }
948
960
 
 
961
      seqSize = (state->theWindowEnd > 0 ?
 
962
                 state->theWindowEnd :
 
963
                 state->theTempSeq->getSize());
 
964
 
 
965
      startPos += state->theWindowStart;
 
966
 
 
967
      state->thePos = startPos;
949
968
      state->theLastPos = startPos + len;
950
 
      state->thePos = startPos;
 
969
      if (state->theLastPos > seqSize)
 
970
        state->theLastPos = seqSize + 1;
951
971
 
952
972
      while (state->thePos < state->theLastPos)
953
973
      {
954
974
        state->theTempSeq->getItem(state->thePos++, result);
955
975
 
956
 
        if (result)
957
 
          STACK_PUSH(true, state);
958
 
        else
959
 
          break;
 
976
        assert(result);
 
977
        STACK_PUSH(true, state);
960
978
      }
961
979
    }
962
980
  }
969
987
  else if (state->theTempSeqIter)
970
988
  {
971
989
    assert(state->theSourceIter == NULL);
 
990
 
972
991
    while (state->theTempSeqIter->next(result))
973
992
    {
974
993
      STACK_PUSH(true, state);
977
996
  else
978
997
  {
979
998
    assert(state->theSourceIter != NULL && state->theTempSeqIter == NULL);
 
999
 
980
1000
    while (state->theSourceIter->next(result))
981
1001
    {
982
1002
      STACK_PUSH(true, state);