void BytecodeGenerator::visitForNode(ForNode* node) { throwIfNotRangeOp(node); node->inExpr()->visit(this); Bytecode* bc = _state.currentBcToFill(); // init iter var VarCoords iterVarCoords = _state.findVar(node->var()->name()); genStoreBc(VT_INT, iterVarCoords); // begin for: check iter_var <= upper val (it is always on stack) Label forStart(bc); bc->bind(forStart); genLoadBc(VT_INT, iterVarCoords); bc->addInsn(BC_ICMP); bc->addInsn(BC_ILOAD1); Label forEnd(bc); bc->addBranch(BC_IFICMPE, forEnd); // then genRepeatInsn(bc, BC_POP, 3); node->body()->visit(this); // ++ iter_var genIntIncrBc(iterVarCoords); bc->addBranch(BC_JA, forStart); bc->bind(forEnd); // below we have 4 because of upper val genRepeatInsn(bc, BC_POP, 4); }
void UIEmitGestureRecognizer::touchesMoved_withEvent(CCSet* touches ,UIEvent* events) { self->state = UIGestureRecognizeStateChanged; bool fistTouch = true; CGPoint touchLoaction; forSet(UITouch* ,touch ,touches) if(fistTouch) { touchLoaction = touch->getlocation(); fistTouch= false; }else{ CIVector* newVector = CIVector::vectorFrom_to( touch->getlocation() , touchLoaction); CGFloat newRotation = CGAngleMake ( self->gestureStartOrentaion ,newVector); if(lastOrentaionOfHands == nil) { self->rotation = newRotation * 0.25f; }else{ self->rotation = (newRotation * 0.25f + baseRotaion) ; } newVector->release(); } forEnd (m_pListener->*m_pSelector)(nil,self); }