Exemplo n.º 1
0
void KNWidgetSwitcher::setCurrentIndex(const int &currentIndex)
{
    //Ensure the current index is in the range.
    Q_ASSERT(currentIndex>-1 && currentIndex<m_widgets.size());
    //Check the following things:
    //  1. The current index is right the index we want.
    //  2. There's a switching animation is running.
    //If any one of the condition is detected, ignore the requirement.
    if(currentIndex==m_currentIndex ||
            m_movingAnimationGroup->state()==QAbstractAnimation::Running)
    {
        return;
    }
    //Stop the animation group.
    m_movingAnimationGroup->stop();
    //Save the last widget index to out index, set the new current index.
    m_outWidgetIndex=m_currentIndex;
    m_currentIndex=currentIndex;
    //Get the current widget.
    QWidget *currentWidget=m_widgets.at(m_currentIndex);
    //Reset the animation target.
    m_inAnimation->setTargetObject(currentWidget);
    m_outAnimation->setTargetObject(m_widgets.at(m_outWidgetIndex));
    //Update the start and end value.
    updateAnimationPosition();
    //Prepare the widget.
    setWidgetVisible(m_currentIndex, true);
    //Raise the current widget.
    currentWidget->raise();
    //Emit start to move signal.
    emit moveStart();
    //Start animation.
    m_movingAnimationGroup->start();
}
Exemplo n.º 2
0
void checkMove(char first,char last){
	moveStart(temp,first);
  if ((first=='A' && last=='B')||(first=='B' && last=='C')){
    moveBot(sheet_space);
    high(26);
    pause(2000);
    low(26);
  } else if ((first=='B'&& last=='A')||(first=='C' && last=='B')){
    moveBot(-sheet_space);
    high(26);
    pause(2000);
    low(26);
  } else if (first=='A' && last=='C'){
    moveBot(sheet_space * 2);
    high(26);
    pause(2000);
    low(26);
  } else if (first=='C'&& last=='A'){
    moveBot(-sheet_space * 2);
    high(26);
    pause(2000);
    low(26);      
  }
	temp = last;
}
Exemplo n.º 3
0
//Coalesce two free blocks into one, add to free list
static void *coalesce(void *bp)  //bp is pointer to a free block
{
  size_t prev_alloc = GET_ALLOC(FTRP(PREV_BLKP(bp))); 
  size_t next_alloc = GET_ALLOC(HDRP(NEXT_BLKP(bp)));
  size_t size = GET_SIZE(HDRP(bp));
  
  if(prev_alloc && !next_alloc){
    //fwdPointers(NEXT_BLKP(bp), MINFRAG);
    size += GET_SIZE(HDRP(NEXT_BLKP(bp)));
    delete_free_block(NEXT_BLKP(bp));
    PUT(HDRP(bp), PACK(size, 0));
    PUT(FTRP(bp), PACK(size, 0));    
  } 
  
  else if(!prev_alloc && next_alloc){
    //fwdPointers(PREV_BLKP(bp), MINFRAG); //if desperate we can leave this in free list
    size += GET_SIZE(HDRP(PREV_BLKP(bp)));
    delete_free_block(PREV_BLKP(bp));
    PUT(FTRP(bp), PACK(size, 0));       
    PUT(HDRP(PREV_BLKP(bp)), PACK(size, 0)); 
    bp = PREV_BLKP(bp);
  }
  else if(!prev_alloc && !next_alloc) {
    //fwdPointers(PREV_BLKP(bp), MINFRAG);
    //fwdPointers(NEXT_BLKP(bp), MINFRAG);
    delete_free_block(NEXT_BLKP(bp));
    delete_free_block(PREV_BLKP(bp));
    size += GET_SIZE(HDRP(PREV_BLKP(bp))) + GET_SIZE(FTRP(NEXT_BLKP(bp)));
    PUT(HDRP(PREV_BLKP(bp)), PACK(size, 0));
    PUT(FTRP(NEXT_BLKP(bp)), PACK(size, 0));
    bp = PREV_BLKP(bp);
  }
  moveStart(bp);
  return bp;
}
Exemplo n.º 4
0
void QSplineEdit::moveControlHandle(int x, int y)
{
	if(m_selected == HNone) return;
	
	switch (m_selected) {
		case HStart:
			moveStart(y);
			break;
		case HEnd:
			moveEnd(y);
			break;
		case HControlLeft:
			moveControlLeft(x, y);
			break;
		case HControlRight:
			moveControlRight(x, y);
			break;
		default:
			break;
	}
	update();
}
Exemplo n.º 5
0
Xchar ExternalInputSource::fill(Messenger &mgr)
{
  ASSERT(cur() == end());
  while (end() >= bufLim_) {
    // need more data
    while (so_ == 0) {
      if (soIndex_ >= sov_.size())
	return eE;
      if (soIndex_ > 0)
	info_->noteStorageObjectEnd(bufLimOffset_ - (bufLim_ - end()));
      const StorageObjectSpec &spec = info_->spec(soIndex_);
      if (mayNotExist_) {
	NullMessenger nullMgr;
	sov_[soIndex_]
	  = spec.storageManager->makeStorageObject(spec.specId, spec.baseId,
						   spec.search,
						   mayRewind_, nullMgr,
						   info_->id(soIndex_));
      }
      else
	sov_[soIndex_]
	  = spec.storageManager->makeStorageObject(spec.specId, spec.baseId,
						   spec.search,
						   mayRewind_, mgr,
						   info_->id(soIndex_));
      so_ = sov_[soIndex_].pointer();
      if (so_) {
	decoder_ = spec.codingSystem->makeDecoder();
	info_->setDecoder(soIndex_, decoder_);
	zapEof_ = spec.zapEof;
	switch (spec.records) {
	case StorageObjectSpec::asis:
	  recordType_ = asis;
	  insertRS_ = false;
	  break;
	case StorageObjectSpec::cr:
	  recordType_ = cr;
	  break;
	case StorageObjectSpec::lf:
	  recordType_ = lf;
	  break;
	case StorageObjectSpec::crlf:
	  recordType_ = crlf;
	  break;
	case StorageObjectSpec::find:
	  recordType_ = unknown;
	  break;
	default:
	  CANNOT_HAPPEN();
	}
	soIndex_++;
	readSize_ = so_->getBlockSize();
	nLeftOver_ = 0;
	break;
      }
      else
	setAccessError();
      soIndex_++;
    }

    size_t keepSize = end() - start();
    const size_t align = sizeof(int)/sizeof(Char);
    size_t readSizeChars = (readSize_ + (sizeof(Char) - 1))/sizeof(Char);
    readSizeChars = roundUp(readSizeChars, align);
    size_t neededSize;		// in Chars
    size_t startOffset;
    // compute neededSize and readSize
    unsigned minBytesPerChar = decoder_->minBytesPerChar();
    if (nLeftOver_ == 0 && minBytesPerChar >= sizeof(Char)) {
      // In this case we want to do decoding in place.
      // FIXME It might be a win on some systems (Irix?) to arrange that the
      // read buffer is on a page boundary.

      if (keepSize >= size_t(-1)/sizeof(Char) - (align - 1) - insertRS_)
	abort();			// FIXME throw an exception
      
      // Now size_t(-1)/sizeof(Char) - (align - 1) - insertRS_ - keepSize > 0
      if (readSizeChars
	  > size_t(-1)/sizeof(Char) - (align - 1) - insertRS_ - keepSize)
	abort();
      neededSize = roundUp(readSizeChars + keepSize + insertRS_, align);
      startOffset = ((neededSize > bufSize_ ? neededSize : bufSize_)
		     - readSizeChars - insertRS_ - keepSize);
    }
    else {
      // Needs to be room for everything before decoding.
      neededSize = (keepSize + insertRS_ + readSizeChars
		    + (nLeftOver_ + sizeof(Char) - 1)/sizeof(Char));
      // Also must be room for everything after decoding.
      size_t neededSize2
	= (keepSize + insertRS_
	   // all the converted characters
	   + (nLeftOver_ + readSize_)/minBytesPerChar
	   // enough Chars to contain left over bytes
	   + ((readSize_ % minBytesPerChar + sizeof(Char) - 1)
	      / sizeof(Char)));
      if (neededSize2 > neededSize)
	neededSize = neededSize2;
      neededSize = roundUp(neededSize, align);
      if (neededSize > size_t(-1)/sizeof(Char))
	abort();
      startOffset = 0;
    }
    if (bufSize_ < neededSize)
      reallocateBuffer(neededSize);
    Char *newStart = buf_ + startOffset;
    if (newStart != start() && keepSize > 0)
      memmove(newStart, start(), keepSize*sizeof(Char));
    char *bytesStart = (char *)(buf_ + bufSize_ - readSizeChars) - nLeftOver_;
    if (nLeftOver_ > 0 && leftOver_ != bytesStart)
      memmove(bytesStart, leftOver_, nLeftOver_);
    moveStart(newStart);
    bufLim_ = end();

    size_t nread;
    if (so_->read((char *)(buf_ + bufSize_ - readSizeChars), readSize_,
		  mgr, nread)) {
      if (nread > 0) {
	const char *bytesEnd = bytesStart + nLeftOver_ + nread;
	size_t nChars = decoder_->decode((Char *)end() + insertRS_,
					 bytesStart,
					 nLeftOver_ + nread
					 - (zapEof_ && bytesEnd[-1] == EOFCHAR),
					 &leftOver_);
	nLeftOver_ = bytesEnd - leftOver_;
	if (nChars > 0) {
	  if (insertRS_) {
	    noteRS();
	    *(Char *)end() = RS;
	    advanceEnd(end() + 1);
	    insertRS_ = false;
	    bufLim_ += 1;
	    bufLimOffset_ += 1;
	  }
	  bufLim_ += nChars;
	  bufLimOffset_ += nChars;
	  break;
	}
      }
    }
    else
      so_ = 0;
  }
  ASSERT(end() < bufLim_);
  if (insertRS_) {
    noteRS();
    insertChar(RS);
    insertRS_ = false;
    bufLimOffset_ += 1;
  }
  switch (recordType_) {
  case unknown:
    {
      const Char *e = findNextCrOrLf(end(), bufLim_);
      if (e) {
	if (*e == '\n') {
	  recordType_ = lf;
	  info_->noteInsertedRSs();
	  *(Char *)e = RE;
	  advanceEnd(e + 1);
	  insertRS_ = true;
	}
	else {
	  if (e + 1 < bufLim_) {
	    if (e[1] == '\n') {
	      recordType_ = crlf;
	      advanceEnd(e + 1);
	      if (e + 2 == bufLim_) {
		bufLim_--;
		bufLimOffset_--;
		insertRS_ = true;
	      }
	    }
	    else {
	      advanceEnd(e + 1);
	      recordType_ = cr;
	      info_->noteInsertedRSs();
	      insertRS_ = true;
	    }
	  }
	  else {
	    recordType_ = crUnknown;
	    advanceEnd(e + 1);
	  }
	}
      }
      else
	advanceEnd(bufLim_);
    }
    break;
  case crUnknown:
    {
      if (*cur() == '\n') {
	noteRS();
	advanceEnd(cur() + 1);
	recordType_ = crlf;
      }
      else {
	advanceEnd(cur() + 1);
	insertRS_ = true;
	recordType_ = cr;
	info_->noteInsertedRSs();
      }
    }
    break;
  case lf:
    {
      Char *e = (Char *)findNextLf(end(), bufLim_);
      if (e) {
	advanceEnd(e + 1);
	*e = RE;
	insertRS_ = true;
      }
      else
	advanceEnd(bufLim_);
    }
    break;
  case cr:
    {
      const Char *e = findNextCr(end(), bufLim_);
      if (e) {
	advanceEnd(e + 1);
	insertRS_ = true;
      }
      else
	advanceEnd(bufLim_);
    }
    break;
  case crlf:
    {
      const Char *e = end();
      for (;;) {
	e = findNextLf(e, bufLim_);
	if (!e) {
	  advanceEnd(bufLim_);
	  break;
	}
	// Need to delete final RS if not followed by anything.
	if (e + 1 == bufLim_) {
	  bufLim_--;
	  bufLimOffset_--;
	  advanceEnd(e);
	  insertRS_ = true;
	  break;
	}
	noteRSAt(e);
	e++;
      }
    }
    break;
  case asis:
    advanceEnd(bufLim_);
    break;
  default:
    CANNOT_HAPPEN();
  }

  return nextChar();
}
Exemplo n.º 6
0
int Java5Lex::getNextLexeme() {
  int  state           = 0;     // Current state
  int  lastAcceptState = 0;     // Most recently seen accept state
  int  prevState;               // State before lastAcceptState
  int  nextState;               // Next state
  unsigned int  lookahead;      // Lookahead character
  int  anchor;                  // Anchor mode for most recently seen accepting state

  unTerminateLexeme();
  initMore();
  markStart();

  for(;;) {
    // Check end of file. If there's an unprocessed accepting state,
    // lastAcceptState will be nonzero. In this case, ignore EOF for now so
    // that you can do the accepting action; otherwise, try to open another
    // file and return if you can't.

    for(;;) {
      if(((int)(lookahead = look(1))) != EOF) {
        assert(lookahead < 256);
        nextState = nextState(state, lookahead);
        break;
      } else if(lastAcceptState != 0) {   // still something to do
        nextState = -1;
        break;
      } else if(isWrap()) {               // another file?
        terminateLexeme();
        return 0;                         // EOI
      }
    }
    if(m_debug) {
      debugState(_T("--------"), state, lookahead);
    }

    if(nextState != -1) {
      if(advance() < 0) {                 // Buffer full
        const TCHAR *tooLongMessage = _T("Lexeme too long. Discarding extra characters.");
        error(getPos(), tooLongMessage);

        flush(true);

        if(m_debug) {
          debug(tooLongMessage);
          debugState(_T("--------"), state, look(1));
        }
      }

      if(anchor = lexAccept[nextState]) { // Is this an accept state
        prevState       = state;
        lastAcceptState = nextState;
        markEnd();                        // Mark input at current character
      }                                   // A subsequent gotoMark() returns us to this position.
      state = nextState;
    } else if(lastAcceptState == 0) {     // illegal input
      error(getPos(), _istprint(lookahead)?_T("Ignore bad input:'%c'"):_T("Ignore bad input:%#x"),lookahead);

      if(m_debug) {
        debug(_T("Ignore bad input:'%c'"), lookahead);
      }

      advance();
    } else {
      if(m_debug) {
        debugState(_T("accept--"), lastAcceptState, lookahead);
      }

      gotoMark();                         // Back up to previous accept state
      if(anchor & ANCHOR_END) {           // If end anchor is active
        pushback(1);                      // Push back the CR or LF
      }
      if(anchor & ANCHOR_START) {         // If start anchor is active
        moveStart();                      // Skip the leading newline
      }
      terminateLexeme();                  // Null-terminate the string

      switch(lastAcceptState) {
      case 1:
#line 124 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        ;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 2:
#line 87 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return NOT;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 3:
#line 108 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return MOD;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 4:
#line 105 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return AND;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 5:
#line 75 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return LPAR;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 6:
#line 76 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return RPAR;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 7:
#line 103 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return STAR;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 8:
#line 101 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return PLUS;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 9:
#line 82 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return COMMA;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 10:
#line 102 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return MINUS;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 11:
#line 83 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return DOT;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 12:
#line 104 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return DIV;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 13:
      case 58:
      case 61:
      case 64:
      case 66:
#line 39 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return INTEGERLITERAL;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 14:
#line 90 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return COLON;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 15:
#line 81 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return SEMICOLON;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 16:
#line 85 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return LT;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 17:
#line 84 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return ASSIGN;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 18:
#line 86 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return GT;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 19:
#line 89 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return QUESTION;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 20:
#line 92 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return AT;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 21:
#line 48 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return nameOrKeyWord(getText());
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 22:
#line 79 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return LB;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 23:
#line 80 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return RB;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 24:
#line 107 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return XOR;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 25:
#line 77 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return LC;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 26:
#line 106 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return OR;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 27:
#line 78 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return RC;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 28:
#line 88 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return COMPLEMENT;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 29:
#line 96 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return NEQ;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 30:
#line 43 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return STRINGLITERAL;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 31:
#line 119 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return MODASSIGN;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 32:
#line 97 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return ANDAND;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 33:
#line 116 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return ANDASSIGN;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 34:
#line 114 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return STARASSIGN;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 35:
#line 99 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return PLUSPLUS;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 36:
#line 112 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return PLUSASSIGN;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 37:
#line 100 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return MINUSMINUS;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 38:
#line 113 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return MINUSASSIGN;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 39:
      case 59:
      case 62:
#line 41 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return FLOATLITERAL;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 40:
#line 50 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        { int i;
        							  SourcePosition startpos = getPos();
        							  while(i = input()) {
        							    if(i < 0) {
        							      flushBuf();  /* Discard lexeme. */
        							    } else if(i == '*' && look(1) == '/') {
        							     input();
        							     break;       /* Recognized comment.*/
        							    }
        							  }
        							  if(i == 0) {
        							    error( startpos,_T("End of file in comment\n") );
                                      }
        							}
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 41:
#line 65 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        { int i;
        							  while(i = input()) {
        							    if(i < 0) {
        							      flushBuf();  /* Discard lexeme. */
        							    } else if(i == '\n') {
        							      break;
        							    }
                                      }
        							}
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 42:
#line 115 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return DIVASSIGN;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 43:
#line 109 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return SHL;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 44:
#line 94 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return LE;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 45:
#line 93 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return EQ;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 46:
#line 95 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return GE;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 47:
#line 110 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return SSHR;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 48:
#line 118 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return XORASSIGN;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 49:
#line 117 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return ORASSIGN;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 50:
#line 98 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return OROR;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 51:
#line 45 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return CHARACTERLITERAL;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 52:
#line 91 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return ELLIPSIS;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 53:
#line 120 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return SHLASSIGN;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 54:
#line 121 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return SSHRASSIGN;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 55:
#line 111 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return USHR;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;
      case 56:
#line 122 "C:\\mytools2015\\ParserGen\\java\\Java5.lex"
        return USHRASSIGN;
#line 94 "C:\\mytools2015\\parsergen\\lib\\lexgencpp.par"
        break;

      default:
        throwException(_T("%s:Unknown accept state:%d, text=<%s>"), __TFUNCTION__, lastAcceptState,getText());
        break;
      }

      unTerminateLexeme();
      lastAcceptState = 0;

      if(isMore()) {
        state = prevState;                // Back up
        initMore();
      } else {
        state = 0;
        markStart();
      }
    }
  }
}
Exemplo n.º 7
0
bool BasicTextInput::keyPressed(Keyboard::Key key, KeyModifiers mod) {
	
	switch(key) {
		
		case Keyboard::Key_NumPad4: {
			if(mod.num) {
				break;
			}
		} /* fall-through */
		case Keyboard::Key_LeftArrow: {
			if(mod.shift) {
				moveStart();
			} else if(mod.control) {
				moveWordLeft();
			} else {
				moveLeft();
			}
			return true;
		}
		
		case Keyboard::Key_NumPad6: {
			if(mod.num) {
				break;
			}
		} /* fall-through */
		case Keyboard::Key_RightArrow: {
			if(mod.shift) {
				moveEnd();
			} else if(mod.control) {
				moveWordRight();
			} else {
				moveRight();
			}
			return true;
		}
		
		case Keyboard::Key_NumPad7: {
			if(mod.num) {
				break;
			}
		} /* fall-through */
		case Keyboard::Key_Home: {
			moveStart();
			return true;
		}
		
		case Keyboard::Key_NumPad1: {
			if(mod.num) {
				break;
			}
		} /* fall-through */
		case Keyboard::Key_End: {
			moveEnd();
			return true;
		}
		
		case Keyboard::Key_Backspace: {
			if(mod.control && mod.shift) {
				eraseStart();
			} else if(mod.control) {
				eraseWordLeft();
			} else {
				eraseLeft();
			}
			return true;
		}
		
		case Keyboard::Key_NumPoint: {
			if(mod.num) {
				break;
			}
		} /* fall-through */
		case Keyboard::Key_Delete: {
			if(mod.control && mod.shift) {
				eraseEnd();
			} else if(mod.control) {
				eraseWordRight();
			} else {
				eraseRight();
			}
			return true;
		}
		
		default: break;
	}
	
	if(mod.control) {
		switch(key) {
			
			case Keyboard::Key_A: {
				moveStart();
				return true;
			}
			
			case Keyboard::Key_B: {
				moveLeft();
				return true;
			}
			
			case Keyboard::Key_C: {
				clear();
				return true;
			}
			
			case Keyboard::Key_D: {
				eraseRight();
				return true;
			}
			
			case Keyboard::Key_E: {
				moveEnd();
				return true;
			}
			
			case Keyboard::Key_F: {
				moveRight();
				return true;
			}
			
			case Keyboard::Key_H: {
				eraseLeft();
				return true;
			}
			
			case Keyboard::Key_K: {
				eraseEnd();
				return true;
			}
			
			case Keyboard::Key_U: {
				eraseStart();
				return true;
			}
			
			case Keyboard::Key_V: {
				paste(mainApp->getWindow()->getClipboardText());
				return true;
			}
			
			case Keyboard::Key_W: {
				eraseWordLeft();
				return true;
			}
			
			default: break;
		}
	}
	
	return TextInputHandler::keyPressed(key, mod);
}