ExpressionNode::ExpressionNode(string funcname){ type = OPERATOR; theOp = GetOperator(funcname); theVar = NULLVar; parent=NULL; //cout<<funcname<<" node is created"<<endl; }
virtual void Paint(gfxContext* aContext, Layer* aMaskLayer) { if (IsHidden()) return; AutoSetOperator setOperator(aContext, GetOperator()); PaintColorTo(mColor, GetEffectiveOpacity(), aContext, aMaskLayer); }
int ConstExpression::P() { Operator *op; if(op=GetOperator(Next()->type_id(),1)) // unary { Consume(); int q = op->prec; int t = Exp(q); return MakeNode(op,t,0); } else if(Next()->type_id()==TKN_L_PAREN) { Consume(); int t = Exp(0); Expect(TKN_R_PAREN); return t; } else if(Next()->type_id()==TKN_NUMBER) { int t = atoi(Next()->get_text().c_str()); Consume(); return t; } else exit(0); }
void BasicCanvasLayer::PaintWithOpacity(gfxContext* aContext, float aOpacity, Layer* aMaskLayer) { NS_ASSERTION(BasicManager()->InDrawing(), "Can only draw in drawing phase"); if (!mSurface) { NS_WARNING("No valid surface to draw!"); return; } nsRefPtr<gfxPattern> pat = new gfxPattern(mSurface); pat->SetFilter(mFilter); pat->SetExtend(gfxPattern::EXTEND_PAD); gfxMatrix m; if (mNeedsYFlip) { m = aContext->CurrentMatrix(); aContext->Translate(gfxPoint(0.0, mBounds.height)); aContext->Scale(1.0, -1.0); } // If content opaque, then save off current operator and set to source. // This ensures that alpha is not applied even if the source surface // has an alpha channel gfxContext::GraphicsOperator savedOp; if (GetContentFlags() & CONTENT_OPAQUE) { savedOp = aContext->CurrentOperator(); aContext->SetOperator(gfxContext::OPERATOR_SOURCE); } AutoSetOperator setOperator(aContext, GetOperator()); aContext->NewPath(); // No need to snap here; our transform is already set up to snap our rect aContext->Rectangle(gfxRect(0, 0, mBounds.width, mBounds.height)); aContext->SetPattern(pat); FillWithMask(aContext, aOpacity, aMaskLayer); #if defined (MOZ_X11) && defined (MOZ_EGL_XRENDER_COMPOSITE) if (mGLContext && !mForceReadback) { // Wait for X to complete all operations before continuing // Otherwise gl context could get cleared before X is done. mGLContext->WaitNative(); } #endif // Restore surface operator if (GetContentFlags() & CONTENT_OPAQUE) { aContext->SetOperator(savedOp); } if (mNeedsYFlip) { aContext->SetMatrix(m); } }
ExpressionNode* ExpressionNode::AddNewChild(string funcname){ ExpressionNode* xnode = new ExpressionNode(); xnode->type = OPERATOR; xnode->theOp = GetOperator(funcname); children.push_back(xnode); xnode->parent = this; return xnode; }
inline void Type_::GiveElements( TheFrontPushOperation & theFrontPushOperation, Consumer & theConsumer ) { theConsumer.TakeElement( GetOperator() ); if ( !theFrontPushOperation.thisProgram.IsEmpty() ) { theConsumer.TakeQuotedElements(theFrontPushOperation.thisProgram); } }
inline void Type_::GiveElements( ThePairOperation & thePairOperation, Consumer & theConsumer ) { theConsumer.TakeElement( GetOperator() ); if ( !thePairOperation.thisExpression.IsEmpty() ) { theConsumer.TakeQuotedElements(thePairOperation.thisExpression); } }
std::string CDatabaseQueryRule::GetWhereClause(const CDatabase &db, const std::string& strType) const { SEARCH_OPERATOR op = GetOperator(strType); std::string operatorString = GetOperatorString(op); std::string negate; if (op == OPERATOR_DOES_NOT_CONTAIN || op == OPERATOR_FALSE || (op == OPERATOR_DOES_NOT_EQUAL && GetFieldType(m_field) != REAL_FIELD && GetFieldType(m_field) != NUMERIC_FIELD && GetFieldType(m_field) != SECONDS_FIELD)) negate = " NOT "; // boolean operators don't have any values in m_parameter, they work on the operator if (m_operator == OPERATOR_FALSE || m_operator == OPERATOR_TRUE) return GetBooleanQuery(negate, strType); // The BETWEEN operator is handled special if (op == OPERATOR_BETWEEN) { if (m_parameter.size() != 2) return ""; FIELD_TYPE fieldType = GetFieldType(m_field); if (fieldType == REAL_FIELD) return db.PrepareSQL("%s BETWEEN %s AND %s", GetField(m_field, strType).c_str(), m_parameter[0].c_str(), m_parameter[1].c_str()); else if (fieldType == NUMERIC_FIELD) return db.PrepareSQL("CAST(%s as DECIMAL(5,1)) BETWEEN %s AND %s", GetField(m_field, strType).c_str(), m_parameter[0].c_str(), m_parameter[1].c_str()); else if (fieldType == SECONDS_FIELD) return db.PrepareSQL("CAST(%s as INTEGER) BETWEEN %s AND %s", GetField(m_field, strType).c_str(), m_parameter[0].c_str(), m_parameter[1].c_str()); else return db.PrepareSQL("%s BETWEEN '%s' AND '%s'", GetField(m_field, strType).c_str(), m_parameter[0].c_str(), m_parameter[1].c_str()); } // now the query parameter std::string wholeQuery; for (std::vector<std::string>::const_iterator it = m_parameter.begin(); it != m_parameter.end(); ++it) { std::string query = '(' + FormatWhereClause(negate, operatorString, *it, db, strType) + ')'; if (it + 1 != m_parameter.end()) { if (negate.empty()) query += " OR "; else query += " AND "; } wholeQuery += query; } return wholeQuery; }
inline void Type_::GiveElements( TheChooseOperation & theChooseOperation, Consumer & theConsumer ) { theConsumer.TakeElement( GetOperator() ); if (0 < theChooseOperation.thisOperandCount) { theConsumer.TakeElement(theChooseOperation.thisEmptyCase); if (1 < theChooseOperation.thisOperandCount) { theConsumer.TakeElement(theChooseOperation.thisNonEmptyCase); } } }
void BasicCanvasLayer::Paint(DrawTarget* aTarget, SourceSurface* aMaskSurface) { if (IsHidden()) return; FirePreTransactionCallback(); UpdateTarget(); FireDidTransactionCallback(); CompositionOp mixBlendMode = GetEffectiveMixBlendMode(); PaintWithOpacity(aTarget, GetEffectiveOpacity(), aMaskSurface, mixBlendMode != CompositionOp::OP_OVER ? mixBlendMode : GetOperator()); }
string Info::GetSubtitle() const { if (!IsFeature()) { if (IsBookmark()) return m_bookmarkCategoryName; return {}; } vector<string> values; // Bookmark category. if (IsBookmark()) values.push_back(m_bookmarkCategoryName); // Type. values.push_back(GetLocalizedType()); // Flats. string const flats = GetFlats(); if (!flats.empty()) values.push_back(flats); // Cuisines. for (string const & cuisine : GetLocalizedCuisines()) values.push_back(cuisine); // Stars. string const stars = FormatStars(); if (!stars.empty()) values.push_back(stars); // Operator. string const op = GetOperator(); if (!op.empty()) values.push_back(op); // Elevation. string const eleStr = GetElevationFormatted(); if (!eleStr.empty()) values.push_back(kMountainSymbol + eleStr); if (HasWifi()) values.push_back(m_localizedWifiString); return strings::JoinStrings(values, kSubtitleSeparator); }
string Info::FormatSubtitle(bool withType) const { std::vector<std::string> subtitle; if (IsBookmark()) subtitle.push_back(m_bookmarkCategoryName); if (withType) subtitle.push_back(GetLocalizedType()); // Flats. string const flats = GetFlats(); if (!flats.empty()) subtitle.push_back(flats); // Cuisines. for (string const & cuisine : GetLocalizedCuisines()) subtitle.push_back(cuisine); // Airport IATA code. string const iata = GetAirportIata(); if (!iata.empty()) subtitle.push_back(iata); // Stars. string const stars = FormatStars(); if (!stars.empty()) subtitle.push_back(stars); // Operator. string const op = GetOperator(); if (!op.empty()) subtitle.push_back(op); // Elevation. string const eleStr = GetElevationFormatted(); if (!eleStr.empty()) subtitle.push_back(kMountainSymbol + eleStr); if (HasWifi()) subtitle.push_back(m_localizedWifiString); // Wheelchair if (GetWheelchairType() == ftraits::WheelchairAvailability::Yes) subtitle.push_back(kWheelchairSymbol); return strings::JoinStrings(subtitle, kSubtitleSeparator); }
void cActiveSkillObject::ProcessStart() { switch(GetInfo().DelayType) { /// 발동 딜레이 없음 case DELAY_NONE: { /// 스킬 종료 상태로 변경 mState = SKILL_STATE_END; /// 스킬 실행 Excute(); } break; /// 시간형 case DELAY_TIME: { mProcessTick = gCurTime + DWORD(GetInfo().DelayTime / mAttackSpeedRate); mState = SKILL_STATE_PROCESS; } break; /// 이동형 case DELAY_SCOPE: { VECTOR3 oper; VECTOR3 tar; /// 시전자 위치 GetOperator()->GetPosition( &oper ); /// 타겟 위치 tar.x = mSkillObjectInfo.mainTarget.cpTargetPos.wx; tar.z = mSkillObjectInfo.mainTarget.cpTargetPos.wz; const DWORD distance = ( DWORD )CalcDistanceXZ( &oper, &tar ); mProcessTick = ( distance / GetInfo().DelayTime ) * 1000 + gCurTime; mState = SKILL_STATE_PROCESS; } break; } }
int ConstExpression::Exp(int pre) { int t = P(); Operator *op; while( Next()->type_id()>0 && (op=GetOperator(Next()->type_id(),0)) && op->prec >= pre) { Consume(); int q; if(op->assoc == ASSOC_LEFT) q = op->prec+1; else if (op->assoc == ASSOC_RIGHT) q = op->prec; int t1 = Exp(q); t = MakeNode( op, t, t1); } return t; }
already_AddRefed<gfxPattern> BasicImageLayer::GetAndPaintCurrentImage(gfxContext* aContext, float aOpacity, Layer* aMaskLayer) { if (!mContainer) return nullptr; mContainer->SetImageFactory(mManager->IsCompositingCheap() ? nullptr : BasicManager()->GetImageFactory()); nsRefPtr<gfxASurface> surface; AutoLockImage autoLock(mContainer, getter_AddRefs(surface)); Image *image = autoLock.GetImage(); gfxIntSize size = mSize = autoLock.GetSize(); if (!surface || surface->CairoStatus()) { return nullptr; } nsRefPtr<gfxPattern> pat = new gfxPattern(surface); if (!pat) { return nullptr; } pat->SetFilter(mFilter); // The visible region can extend outside the image, so just draw // within the image bounds. if (aContext) { AutoSetOperator setOperator(aContext, GetOperator()); PaintContext(pat, nsIntRegion(nsIntRect(0, 0, size.width, size.height)), aOpacity, aContext, aMaskLayer); GetContainer()->NotifyPaintedImage(image); } return pat.forget(); }
SKILL_STATE cActiveSkillObject::Update() { if( !GetOperator() ) { mState = SKILL_STATE_DESTROY; } if( mState == SKILL_STATE_DESTROY ) { return cSkillObject::Update(); } switch( mState ) { /// 시전중 case SKILL_STATE_CASTING: { CastingState(); } break; /// 발동중 case SKILL_STATE_PROCESS: { ProcessState(); } break; case SKILL_STATE_END: { EndState(); } break; case SKILL_STATE_DESTROY: break; } return cSkillObject::Update(); }
void BasicShadowCanvasLayer::Paint(gfxContext* aContext, Layer* aMaskLayer) { NS_ASSERTION(BasicManager()->InDrawing(), "Can only draw in drawing phase"); if (!IsSurfaceDescriptorValid(mFrontSurface)) { return; } AutoOpenSurface autoSurface(OPEN_READ_ONLY, mFrontSurface); nsRefPtr<gfxPattern> pat = new gfxPattern(autoSurface.Get()); pat->SetFilter(mFilter); pat->SetExtend(gfxPattern::EXTEND_PAD); gfxRect r(0, 0, mBounds.width, mBounds.height); gfxMatrix m; if (mNeedsYFlip) { m = aContext->CurrentMatrix(); aContext->Translate(gfxPoint(0.0, mBounds.height)); aContext->Scale(1.0, -1.0); } AutoSetOperator setOperator(aContext, GetOperator()); aContext->NewPath(); // No need to snap here; our transform has already taken care of it aContext->Rectangle(r); aContext->SetPattern(pat); FillWithMask(aContext, GetEffectiveOpacity(), aMaskLayer); if (mNeedsYFlip) { aContext->SetMatrix(m); } }
void BasicThebesLayer::PaintThebes(gfxContext* aContext, Layer* aMaskLayer, LayerManager::DrawThebesLayerCallback aCallback, void* aCallbackData, ReadbackProcessor* aReadback) { PROFILER_LABEL("BasicThebesLayer", "PaintThebes"); NS_ASSERTION(BasicManager()->InDrawing(), "Can only draw in drawing phase"); nsRefPtr<gfxASurface> targetSurface = aContext->CurrentSurface(); if (!mContentClient) { // we pass a null pointer for the Forwarder argument, which means // this will not have a ContentHost on the other side. mContentClient = new ContentClientBasic(nullptr, BasicManager()); } nsTArray<ReadbackProcessor::Update> readbackUpdates; if (aReadback && UsedForReadback()) { aReadback->GetThebesLayerUpdates(this, &readbackUpdates); } //TODO: This is going to copy back pixels that we might end up // drawing over anyway. It would be nice if we could avoid // this duplication. mContentClient->SyncFrontBufferToBackBuffer(); bool canUseOpaqueSurface = CanUseOpaqueSurface(); ContentType contentType = canUseOpaqueSurface ? gfxASurface::CONTENT_COLOR : gfxASurface::CONTENT_COLOR_ALPHA; float opacity = GetEffectiveOpacity(); if (!BasicManager()->IsRetained()) { NS_ASSERTION(readbackUpdates.IsEmpty(), "Can't do readback for non-retained layer"); mValidRegion.SetEmpty(); mContentClient->Clear(); nsIntRegion toDraw = IntersectWithClip(GetEffectiveVisibleRegion(), aContext); RenderTraceInvalidateStart(this, "FFFF00", toDraw.GetBounds()); if (!toDraw.IsEmpty() && !IsHidden()) { if (!aCallback) { BasicManager()->SetTransactionIncomplete(); return; } aContext->Save(); bool needsClipToVisibleRegion = GetClipToVisibleRegion(); bool needsGroup = opacity != 1.0 || GetOperator() != gfxContext::OPERATOR_OVER || aMaskLayer; nsRefPtr<gfxContext> groupContext; if (needsGroup) { groupContext = BasicManager()->PushGroupForLayer(aContext, this, toDraw, &needsClipToVisibleRegion); if (GetOperator() != gfxContext::OPERATOR_OVER) { needsClipToVisibleRegion = true; } } else { groupContext = aContext; } SetAntialiasingFlags(this, groupContext); aCallback(this, groupContext, toDraw, CLIP_NONE, nsIntRegion(), aCallbackData); if (needsGroup) { BasicManager()->PopGroupToSourceWithCachedSurface(aContext, groupContext); if (needsClipToVisibleRegion) { gfxUtils::ClipToRegion(aContext, toDraw); } AutoSetOperator setOperator(aContext, GetOperator()); PaintWithMask(aContext, opacity, aMaskLayer); } aContext->Restore(); } RenderTraceInvalidateEnd(this, "FFFF00"); return; } { uint32_t flags = 0; #ifndef MOZ_WIDGET_ANDROID if (BasicManager()->CompositorMightResample()) { flags |= ThebesLayerBuffer::PAINT_WILL_RESAMPLE; } if (!(flags & ThebesLayerBuffer::PAINT_WILL_RESAMPLE)) { if (MayResample()) { flags |= ThebesLayerBuffer::PAINT_WILL_RESAMPLE; } } #endif if (mDrawAtomically) { flags |= ThebesLayerBuffer::PAINT_NO_ROTATION; } PaintState state = mContentClient->BeginPaintBuffer(this, contentType, flags); mValidRegion.Sub(mValidRegion, state.mRegionToInvalidate); if (state.mContext) { // The area that became invalid and is visible needs to be repainted // (this could be the whole visible area if our buffer switched // from RGB to RGBA, because we might need to repaint with // subpixel AA) state.mRegionToInvalidate.And(state.mRegionToInvalidate, GetEffectiveVisibleRegion()); nsIntRegion extendedDrawRegion = state.mRegionToDraw; SetAntialiasingFlags(this, state.mContext); RenderTraceInvalidateStart(this, "FFFF00", state.mRegionToDraw.GetBounds()); PaintBuffer(state.mContext, state.mRegionToDraw, extendedDrawRegion, state.mRegionToInvalidate, state.mDidSelfCopy, state.mClip, aCallback, aCallbackData); MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) PaintThebes", this)); Mutated(); RenderTraceInvalidateEnd(this, "FFFF00"); } else { // It's possible that state.mRegionToInvalidate is nonempty here, // if we are shrinking the valid region to nothing. So use mRegionToDraw // instead. NS_WARN_IF_FALSE(state.mRegionToDraw.IsEmpty(), "No context when we have something to draw, resource exhaustion?"); } } if (BasicManager()->IsTransactionIncomplete()) return; gfxRect clipExtents; clipExtents = aContext->GetClipExtents(); // Pull out the mask surface and transform here, because the mask // is internal to basic layers AutoMaskData mask; gfxASurface* maskSurface = nullptr; const gfxMatrix* maskTransform = nullptr; if (GetMaskData(aMaskLayer, &mask)) { maskSurface = mask.GetSurface(); maskTransform = &mask.GetTransform(); } if (!IsHidden() && !clipExtents.IsEmpty()) { AutoSetOperator setOperator(aContext, GetOperator()); mContentClient->DrawTo(this, aContext, opacity, maskSurface, maskTransform); } for (uint32_t i = 0; i < readbackUpdates.Length(); ++i) { ReadbackProcessor::Update& update = readbackUpdates[i]; nsIntPoint offset = update.mLayer->GetBackgroundLayerOffset(); nsRefPtr<gfxContext> ctx = update.mLayer->GetSink()->BeginUpdate(update.mUpdateRect + offset, update.mSequenceCounter); if (ctx) { NS_ASSERTION(opacity == 1.0, "Should only read back opaque layers"); ctx->Translate(gfxPoint(offset.x, offset.y)); mContentClient->DrawTo(this, ctx, 1.0, maskSurface, maskTransform); update.mLayer->GetSink()->EndUpdate(ctx, update.mUpdateRect + offset); } } }
void cActiveSkillObject::Init( sSKILL_CREATE_INFO* pInfo ) { cSkillObject::Init( pInfo); GetTarget().RemoveAll(); // 광역 스킬은 시전자가 포함될지 여부를 클라이언트에서 조회해온다 if(TARGET_KIND_SINGLE == GetInfo().Area ) { GetTarget().AddData( pInfo->mainTarget.dwMainTargetID); } m_BuffSkillTable.RemoveAll(); for(DWORD i = 0; i < MAX_BUFF_COUNT; ++i) { const cBuffSkillInfo* const buffSkillInfo = SKILLMGR->GetBuffInfo( GetInfo().Buff[i]); if(0 == buffSkillInfo) { break; } else if(buffSkillInfo->GetInfo().IsEndTime && buffSkillInfo->GetInfo().NoUpdate) { CharacterBuffAdd( GetOperator()->GetID(), buffSkillInfo->GetIndex(), buffSkillInfo->GetInfo().DelayTime, buffSkillInfo->GetInfo().Count, TRUE); } } mAttackSpeedRate = 1.0f; if( GetOperator()->GetObjectKind() == eObjectKind_Player ) { CPlayer* pPlayer = ( CPlayer* )GetOperator(); if( GetInfo().Kind == SKILLKIND_PHYSIC || GetInfo().Kind == SKILLKIND_MAGIC ) { if( (GetSkillIdx() / 100000) % 10 ) { switch( GetInfo().Unit ) { case UNITKIND_PHYSIC_ATTCK: case UNITKIND_PHYSIC_FAKE_DAMAGE: { mAttackSpeedRate += ( ( pPlayer->GetRateBuffStatus()->PhysicSkillSpeedRate + pPlayer->GetRatePassiveStatus()->PhysicSkillSpeedRate ) * 0.01f ); } break; case UNITKIND_NONE: case UNITKIND_MAGIC_ATTCK: case UNITKIND_LIFE_RECOVER: case UNITKIND_RESURRECTION: case UNITKIND_DEBUFF: case UNITKIND_MANA_RECOVER: case UNITKIND_MAGIC_FAKE_DAMAGE: { float SpeedRate = min( pPlayer->GetRateBuffStatus()->MagicSkillSpeedRate + pPlayer->GetRatePassiveStatus()->MagicSkillSpeedRate, 99.f ); mAttackSpeedRate = ( 1 / ( 1 - ( SpeedRate*0.01f ) ) ); if( (GetInfo().CastingTime / mAttackSpeedRate) < MIN_MAGIC_CASTING_TIME ) mAttackSpeedRate = GetInfo().CastingTime / MIN_MAGIC_CASTING_TIME; } break; } } else { mAttackSpeedRate += ( ( pPlayer->GetRateBuffStatus()->NormalSpeedRate + pPlayer->GetRatePassiveStatus()->NormalSpeedRate ) * 0.01f ); } } } /// 플레이어의 경우 if( GetOperator()->GetObjectKind() == eObjectKind_Player ) { mCoolingTick = gCurTime + GetInfo().CoolTime; } if( mAttackSpeedRate <= 0 ) { mAttackSpeedRate = 1.0f; } MSG_SKILLOBJECT_ADD2 msg; msg.Category = MP_SKILL; msg.Protocol = MP_SKILL_SKILLOBJECT_ADD; msg.bCreate = TRUE; msg.SkillObjectInfo.SkillObjectIdx = pInfo->skillObjectId; msg.SkillObjectInfo.SkillIdx = GetSkillIdx(); msg.SkillObjectInfo.Pos = pInfo->pos; msg.SkillObjectInfo.StartTime = 0; msg.SkillObjectInfo.Direction = pInfo->skillDir; msg.SkillObjectInfo.SkillLevel = ( BYTE )pInfo->level; msg.SkillObjectInfo.Operator = pInfo->operatorId; msg.SkillObjectInfo.Rate = mAttackSpeedRate; msg.SkillObjectInfo.RemainTime = 0; msg.SkillObjectInfo.Count = 0; memcpy( &( msg.SkillObjectInfo.MainTarget ), &( pInfo->mainTarget ), sizeof( MAINTARGET ) ); msg.SkillObjectInfo.BattleID = GetBattleID(); PACKEDDATA_OBJ->QuickSend( GetOperator(), &msg, sizeof( MSG_SKILLOBJECT_ADD2 ) ); GetOperator()->CurCastingSkillID = GetID(); if(0 < GetInfo().CastingTime) { CastingStart(); } else { ProcessStart(); } }
LONG GetExpression(VOID) { LONG op1; LONG op2; WCHAR byOperator; UINT wFlags; /* Get the first operand */ op1 = GetOperand(); /* take care of symbol use */ if (curChar == SYMUSESTART) { GetSymbol(TRUE, curChar); token.sym.nID = token.val; } /* Loop until end of expression */ for (; ; ) { /* Get the operator */ wFlags = GetOperator(&byOperator); /* If this is a right paren, dec the count */ if (byOperator == L')') { /* Bring the paren count back down */ --nParenCount; /* Skip the paren and any trailing whitespace */ OurGetChar(); SkipWhitespace(); } /* If this isn't an operator, we're done with the expression */ if (!wFlags) { token.sym.nID = (unsigned)op1; return op1; } token.sym.name[0] = L'\0'; /* Get the second operand */ op2 = GetOperand(); /* Compute the value of the expression */ switch (byOperator) { case L'+': op1 += op2; break; case L'-': op1 -= op2; break; case L'&': op1 &= op2; break; case L'|': op1 |= op2; break; } } }
void cActiveSkillObject::Excute() { // 081203 LUJ, 공격 스킬이 실패했을 경우에만 참으로 설정된다 BOOL attackUnitIsFailed = FALSE; // 081203 LUJ, 유닛 실행 결과에 따라 플래그 값을 설정한다 if( mpSkillUnit ) { const BOOL unitIsFailed = ( ! mpSkillUnit->Excute() ); const UNITKIND kind = mpSkillUnit->GetKind(); const BOOL isAttackUnit = ( UNITKIND_MAGIC_ATTCK == kind || UNITKIND_PHYSIC_ATTCK == kind ); attackUnitIsFailed = ( unitIsFailed && isAttackUnit ); } CObject* const pOperator = GetOperator(); if(0 == pOperator) { mState = SKILL_STATE_DESTROY; return; } pOperator->CurCastingSkillID = 0; if(FALSE == Consume(*pOperator)) { mState = SKILL_STATE_DESTROY; return; } if(GetInfo().IsMove) { GetTarget().SetPositionHead(); while(CObject* const pTarget = GetTarget().GetData()) { if( pTarget->GetState() == eObjectState_Die ) { continue; } pTarget->SetEffectMove(); } } // 081203 LUJ, 공격 스킬이 실패한 경우에는 버프를 실행하지 않는다 for( int i = ( attackUnitIsFailed ? MAX_BUFF_COUNT : 0 ); i < MAX_BUFF_COUNT; ++i ) { if(GetInfo().BuffRate[i] <= rand() % 100) { continue; } cBuffSkillInfo* const buffSkillInfo = (cBuffSkillInfo*)SKILLMGR->GetBuffInfo( GetInfo().Buff[i]); if(0 == buffSkillInfo) { continue; } GetTarget().SetPositionHead(); while(CObject* const pTarget = GetTarget().GetData()) { if( pTarget->GetState() == eObjectState_Die ) { continue; } else if(const AbnormalStatus* const status = pTarget->GetAbnormalStatus()) { if(status->IsUnableBuff) { continue; } } sSKILL_CREATE_INFO skillCreateInfo = mSkillObjectInfo; skillCreateInfo.mainTarget.SetMainTarget( pTarget->GetID()); if(cBuffSkillObject* pBuff = (cBuffSkillObject*)SKILLMGR->OnBuffSkillStart(buffSkillInfo, &skillCreateInfo)) { m_BuffSkillTable.Add( pBuff, pBuff->GetID()); pTarget->AddEventSkill( *pBuff); } } } }
//(1)支持and与or以构建复杂的条件 //(2)支持=与!=操作 //(3)值用单引号扩起(两个连续单引号表示一个单引号值) //(4)日期的值格式为:[a,b];[a,b);(a,b];(a,b); //(5)Host,Date,App,Module,Func,File,Key,Level,DMN,AIN,Line bool CLogChooser::AddChooser(const char* sCond) { bool bFirst = true; const char* sWhere = sCond; m_oMutex.Leave(); AddGroup(); if(sCond)while(sCond[0]) { bool bNot, bIncBeg, bIncEnd; CString oName, oVal1, oVal2; if(!sCond[0]) break; if(GetIdentifier(sCond, oName)) { RemoveEmptyGroup(); m_oMutex.Leave(); FocpError(("CLogChooser::AddChooser(%u:%s): get compare item failure", sCond-sWhere, sWhere)); return false; } if(!bFirst) { if(!oName.Compare("and", false)) continue; if(!oName.Compare("or", false)) { AddGroup(); continue; } } bFirst = false; uint32 nRet, nType = GetItemType(oName); if(nType >= 11) { RemoveEmptyGroup(); m_oMutex.Leave(); FocpError(("CLogChooser::AddChooser(%u:%s): the item '%s' is invalid", sCond-sWhere, sWhere, oName.GetStr())); return false; } if(GetOperator(sCond, bNot)) { RemoveEmptyGroup(); m_oMutex.Leave(); FocpError(("CLogChooser::AddChooser(%u:%s): get oprand failure", sCond-sWhere, sWhere)); return false; } if(nType == 1) nRet = GetDateTime(sCond, oVal1, oVal2, bIncBeg, bIncEnd); else if(nType >= 7) nRet = GetInt(sCond, oVal1); else nRet = GetString(sCond, oVal1); if(nRet) { RemoveEmptyGroup(); m_oMutex.Leave(); FocpError(("CLogChooser::AddChooser(%u:%s): get value failure", sCond-sWhere, sWhere)); return false; } AddCond(nType, bNot, oVal1, oVal2, bIncBeg, bIncEnd); } RemoveEmptyGroup(); m_oMutex.Leave(); return true; }
void ExpressionNode::operator=(string funcname){ type = OPERATOR; theOp = GetOperator(funcname); theVar = NULLVar; parent=NULL; }
void BasicThebesLayer::PaintThebes(gfxContext* aContext, Layer* aMaskLayer, LayerManager::DrawThebesLayerCallback aCallback, void* aCallbackData, ReadbackProcessor* aReadback) { PROFILER_LABEL("BasicThebesLayer", "PaintThebes"); NS_ASSERTION(BasicManager()->InDrawing(), "Can only draw in drawing phase"); nsTArray<ReadbackProcessor::Update> readbackUpdates; if (aReadback && UsedForReadback()) { aReadback->GetThebesLayerUpdates(this, &readbackUpdates); } float opacity = GetEffectiveOpacity(); CompositionOp effectiveOperator = GetEffectiveOperator(this); if (!BasicManager()->IsRetained()) { NS_ASSERTION(readbackUpdates.IsEmpty(), "Can't do readback for non-retained layer"); mValidRegion.SetEmpty(); mContentClient->Clear(); nsIntRegion toDraw = IntersectWithClip(GetEffectiveVisibleRegion(), aContext); RenderTraceInvalidateStart(this, "FFFF00", toDraw.GetBounds()); if (!toDraw.IsEmpty() && !IsHidden()) { if (!aCallback) { BasicManager()->SetTransactionIncomplete(); return; } aContext->Save(); bool needsClipToVisibleRegion = GetClipToVisibleRegion(); bool needsGroup = opacity != 1.0 || effectiveOperator != CompositionOp::OP_OVER || aMaskLayer; nsRefPtr<gfxContext> groupContext; if (needsGroup) { groupContext = BasicManager()->PushGroupForLayer(aContext, this, toDraw, &needsClipToVisibleRegion); if (effectiveOperator != CompositionOp::OP_OVER) { needsClipToVisibleRegion = true; } } else { groupContext = aContext; } SetAntialiasingFlags(this, groupContext); aCallback(this, groupContext, toDraw, DrawRegionClip::CLIP_NONE, nsIntRegion(), aCallbackData); if (needsGroup) { BasicManager()->PopGroupToSourceWithCachedSurface(aContext, groupContext); if (needsClipToVisibleRegion) { gfxUtils::ClipToRegion(aContext, toDraw); } AutoSetOperator setOptimizedOperator(aContext, ThebesOp(effectiveOperator)); PaintWithMask(aContext, opacity, aMaskLayer); } aContext->Restore(); } RenderTraceInvalidateEnd(this, "FFFF00"); return; } if (BasicManager()->IsTransactionIncomplete()) return; gfxRect clipExtents; clipExtents = aContext->GetClipExtents(); // Pull out the mask surface and transform here, because the mask // is internal to basic layers AutoMoz2DMaskData mask; SourceSurface* maskSurface = nullptr; Matrix maskTransform; if (GetMaskData(aMaskLayer, &mask)) { maskSurface = mask.GetSurface(); maskTransform = mask.GetTransform(); } if (!IsHidden() && !clipExtents.IsEmpty()) { mContentClient->DrawTo(this, aContext->GetDrawTarget(), opacity, GetOperator(), maskSurface, &maskTransform); } for (uint32_t i = 0; i < readbackUpdates.Length(); ++i) { ReadbackProcessor::Update& update = readbackUpdates[i]; nsIntPoint offset = update.mLayer->GetBackgroundLayerOffset(); nsRefPtr<gfxContext> ctx = update.mLayer->GetSink()->BeginUpdate(update.mUpdateRect + offset, update.mSequenceCounter); if (ctx) { NS_ASSERTION(opacity == 1.0, "Should only read back opaque layers"); ctx->Translate(gfxPoint(offset.x, offset.y)); mContentClient->DrawTo(this, ctx->GetDrawTarget(), 1.0, CompositionOpForOp(ctx->CurrentOperator()), maskSurface, &maskTransform); update.mLayer->GetSink()->EndUpdate(ctx, update.mUpdateRect + offset); } } }
const ErrorListRef BinaryExpression::Validate( const shared_ptr<ExecutionContext> execution_context, const_shared_ptr<TypeSpecifier> valid_left, const_shared_ptr<TypeSpecifier> valid_right) const { ErrorListRef errors = ErrorList::GetTerminator(); const OperatorType op = GetOperator(); auto left = GetLeft(); auto left_errors = left->Validate(execution_context); if (ErrorList::IsTerminator(left_errors)) { auto left_type_specifier_result = left->GetTypeSpecifier( execution_context); auto left_type_specifier_errors = left_type_specifier_result.GetErrors(); if (ErrorList::IsTerminator(left_type_specifier_errors)) { auto left_type_specifier = left_type_specifier_result.GetData(); auto left_analysis = left_type_specifier->AnalyzeAssignmentTo( valid_left, execution_context->GetTypeTable()); if (left_analysis != EQUIVALENT && left_analysis != UNAMBIGUOUS) { errors = ErrorList::From( make_shared<Error>(Error::SEMANTIC, Error::INVALID_LEFT_OPERAND_TYPE, left->GetLocation().begin, OperatorToString(op)), errors); } } else { errors = ErrorList::Concatenate(errors, left_type_specifier_errors); } } else { errors = ErrorList::Concatenate(errors, left_errors); } auto right = GetRight(); auto right_errors = right->Validate(execution_context); if (ErrorList::IsTerminator(right_errors)) { auto right_type_specifier_result = GetRight()->GetTypeSpecifier( execution_context); auto right_type_specifier_errors = right_type_specifier_result.GetErrors(); if (ErrorList::IsTerminator(right_type_specifier_errors)) { auto right_type_specifier = right_type_specifier_result.GetData(); auto right_analysis = right_type_specifier->AnalyzeAssignmentTo( valid_right, execution_context->GetTypeTable()); if (right_analysis != EQUIVALENT && right_analysis != UNAMBIGUOUS) { errors = ErrorList::From( make_shared<Error>(Error::SEMANTIC, Error::INVALID_RIGHT_OPERAND_TYPE, right->GetLocation().begin, OperatorToString(op)), errors); } } else { errors = ErrorList::Concatenate(errors, right_type_specifier_errors); } } else { errors = ErrorList::Concatenate(errors, right_errors); } return errors; }
virtual void Paint(gfxContext* aContext, Layer* aMaskLayer) { AutoSetOperator setOperator(aContext, GetOperator()); BasicColorLayer::PaintColorTo(mColor, GetEffectiveOpacity(), aContext, aMaskLayer); }
int main(int argc, char* argv[]) { printf("Welcome!! I'm a ploynomail calculator\n"); //string strCommand; //명령줄 buffer /* if(argc > 1) //파일로 읽기. { FILE * fp = fopen(argv[1],"rt"); char c; while( (c = getc(fp)) != -1 ) str.append(1,c); } else //명령줄로 읽기. */ int state = S_NORMAL; while(state != S_EXIT) { printf("> "); char buf[255]; gets(buf); string str(buf); //입력 받은 모든 공백을 제거한다. str.erase(remove_if(str.begin(), str.end() , IsSpace) , str.end()); int i = 0; //exit 체크 int nFind; nFind = str.find(GetOperator(EXIT)); if (nFind != -1) { state = S_EXIT; break; } //assing 체크 nFind = str.find(GetOperator(ASSING)); POLY poly; if (nFind != -1) //type 문 { poly.id.append(str.begin(),nFind); if(CheckIdValid(poly.id) == false) continue; i+= nFind+sizeof(GetOperator(ASSING)); } //이름이 없을 경우 id.empty() == true //state = S_OPERATOR; TERMS& termVector = poly.terms; while( i < str.size() ) { TERM term; //실제 다항식 계산. string strOperand,strOperator; int readNum,value; int result = GetNumber(str.c_str()+i,&readNum,&value); if(result == RETURN_ERROR) break; else if(result == true) { while(IsDigit(str[i])) strOperand.append(1,str[i++]); term.coefficient = atoi(strOperand.c_str()); } else term.coefficient = 1; strOperand.erase(); if(IsLetter(str[i])) { } termVector.push_back(term); } sort(termVector.begin(),termVector.end(),BinaryTerm); } printf("Press any key to continue"); char t; scanf("%c",&t); return 0; }