mm::Piece::Piece(std::string const& s) : mRotation(0) , mMaxRotations(0) , mPosX(InvalidPosition.first) , mPosY(InvalidPosition.second) , isSpecial(false) , originalStr(s) { mStr[0] = CharToInt(s[3]); mStr[1] = CharToInt(s[0]); mStr[2] = CharToInt(s[1]); mStr[3] = CharToInt(s[2]); mL[0] = 100*BL() + 10*TL() + TR(); mL[1] = 100*TL() + 10*TR() + BR(); mL[2] = 100*TR() + 10*BR() + BL(); mL[3] = 100*BR() + 10*BL() + TL(); if (mStr[0] == mStr[1] && mStr[1] == mStr[2] && mStr[0] == mStr[3]) { mMaxRotations = 1; } else if (mStr[0] == mStr[2] && mStr[1] == mStr[3]) { mMaxRotations = 2; } else { mMaxRotations = 4; } if (s == "GGGG" || s == "BBBB" || s == "YYYY" || s == "YRBG") { isSpecial = true; } }
// ----------------------------------------------------------------------------- // CMdETestScripter::NameL // ----------------------------------------------------------------------------- // TInt CMdETestScripter::NameL( CStifItemParser& aItem ) { TInt mode; TPtrC name; User::LeaveIfError( aItem.GetNextInt( mode )); if ( mode == EPropertyDef ) { CMdEPropertyDef* propDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); User::LeaveIfError( aItem.GetNextString( name )); TL( name.Compare( propDef->Name()) == 0 ); } else if ( mode == ENamespaceDef ) { CMdENamespaceDef* spaceDef = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); User::LeaveIfError( aItem.GetNextString( name )); TL( name.Compare( spaceDef->Name()) == 0 ); } else { User::Leave( KErrArgument ); } return KErrNone; }
// ----------------------------------------------------------------------------- // Tests CAiwDialDataExt setting and getting values. // ----------------------------------------------------------------------------- // TInt CAiwDialDataTests::ExtSetAndGetTestL( TTestResult& /*aResult*/ ) { _LIT( KPhoneNumber, "1234567890"); _LIT8( KContactLink, "ContactLink"); _LIT( KName, "Mr Smith" ); CAiwDialDataExt* dialData = CAiwDialDataExt::NewLC(); dialData->SetPhoneNumberL( KPhoneNumber ); dialData->SetCallType( CAiwDialData::EAIWVideo ); dialData->SetWindowGroup( 1 ); dialData->SetInitiateCall( ETrue ); dialData->SetNameL( KName ); dialData->SetRedial( AIWDialDataExt::KAIWRedialOff ); dialData->SetShowNumber( EFalse ); dialData->SetContactLinkL( KContactLink ); TL( dialData->PhoneNumber() == KPhoneNumber() ); T1L( dialData->CallType(), CAiwDialData::EAIWVideo ); T1L( dialData->WindowGroup(), 1 ); TL( dialData->InitiateCall() ); TL( dialData->Name() == KName() ); T1L( dialData->Redial(), AIWDialDataExt::KAIWRedialOff ); TL( !dialData->ShowNumber() ); TL( dialData->ContactLink() == KContactLink() ); CAiwGenericParamList* list = CAiwGenericParamList::NewLC(); dialData->FillInParamListL( *list ); CleanupStack::PopAndDestroy( 2, dialData ); return KErrNone; }
TInt CTestHistoryLog::AddNewJobEntryL( CStifItemParser& /*aItem*/ ) { TInt arrayCount = iHistoryArray->Count() + 1; TInt profileId(1); RArray<TInt> tasks; tasks.Append(KTaskId1); tasks.Append(KTaskId2); CSyncMLHistoryJob * entry = CSyncMLHistoryJob::NewL(profileId, tasks ); CleanupStack::PushL(entry); tasks.Reset(); tasks.Close(); iHistoryArray->AppendEntryL(entry); TL(iHistoryArray->Count() == arrayCount); if (iOwnerShip) { CleanupStack::Pop(entry); } else { CleanupStack::PopAndDestroy(entry); } return KErrNone; }
TInt CTestHistoryLog::AddMoreThanFivePushMsgsL( CStifItemParser& /*aItem*/ ) { for (TInt i = 0; i < KMaxMsgSize; i++) { CSyncMLHistoryPushMsg * entry = CSyncMLHistoryPushMsg::NewL(); CleanupStack::PushL(entry); CSmlAlertInfo info; info.TaskIds().Append(KOne); info.TaskIds().Append(KTwo); info.TaskSyncTypes().Append( (TSmlSyncType)0); info.TaskSyncTypes().Append( (TSmlSyncType)KOne); iHistoryArray->AppendEntryL(entry); if (iOwnerShip) { CleanupStack::Pop(entry); } else { CleanupStack::PopAndDestroy(entry); } } TL(iHistoryArray->Count() == KMaxMsgSize); return KErrNone; }
void GEMENI_charsent() { unsigned long r = s->log[s->lc]; if (UCA0IFG & UCTXIFG) { s->nch++; switch (s->nch) { case 1: UCA0TXBUF = SL(r) << 5 |TL(r)<<4|KL(r)<<3|PL(r)<<2|WL(r)<<1|HL(r); break; case 2: UCA0TXBUF = RL(r)<<6 | AL(r)<<5 | OL(r)<<4 | STAR(r)<<3; break; case 3: UCA0TXBUF = ER(r)<<3 | UR(r)<<2 | FR(r)<<1 | RR(r); break; case 4: UCA0TXBUF = PR(r)<<6 | BR(r)<<5 | LR(r)<<4 | GR(r)<<3 | TR(r)<<2 | SR(r)<<1 | DRS(r); break; case 5: UCA0TXBUF = POUND(r)<<1 | ZRS(r); break; default: s->lc++; if (s->lc != s->nc-1) { s->nch = 0; UCA0TXBUF = 1 << 7; // first packet, no fn or '#' } else { s->flags &= ~CSEND; } } } }
// ----------------------------------------------------------------------------- // CMdETestScripter::GetSchemaVersionL // ----------------------------------------------------------------------------- // TInt CMdETestScripter::GetSchemaVersionL( CStifItemParser& aItem ) { TInt majorVersion; TInt minorVersion; TInt expectedMajorVersion; TInt expectedMinorVersion; User::LeaveIfError( aItem.GetNextInt( expectedMajorVersion )); User::LeaveIfError( aItem.GetNextInt( expectedMinorVersion )); iMdeSession->GetSchemaVersionL( majorVersion, minorVersion ); TL( majorVersion == expectedMajorVersion ); TL( minorVersion == expectedMinorVersion ); return KErrNone; }
// ----------------------------------------------------------------------------- // CMdETestScripter::EngineSessionL // ----------------------------------------------------------------------------- // TInt CMdETestScripter::EngineSessionL( CStifItemParser& /* aItem */ ) { RMdEEngineSession& session = iMdeSession->EngineSession(); TL( &session ); return KErrNone; }
// ----------------------------------------------------------------------------- // CMdETestScripter::ImportMetadataL // ----------------------------------------------------------------------------- // TInt CMdETestScripter::ImportMetadataL( CStifItemParser& aItem ) { TPtrC path; TInt mode; TInt ret = KErrNone; User::LeaveIfError( aItem.GetNextString( path )); User::LeaveIfError( aItem.GetNextInt( mode )); TFileName filePath( iFilePath ); filePath.Append( path ); filePath.ZeroTerminate(); if ( mode == KAsync ) { TRequestStatus status = KRequestPending; TPckgBuf<TInt> buf( ret ); iMdeSession->ImportMetadata( filePath, buf, status ); User::WaitForRequest( status ); ret = buf(); } else if ( mode == KSync ) { ret = iMdeSession->ImportMetadataL( filePath ); } else { User::Leave( KErrArgument ); } iLog->Log( _L( "ImportMetadataL ret: %d" ), ret ); TL ( ret >= 0 ); return KErrNone; }
void fillWall(struct TILE *map, int sy, int sx, int ft, int wt){ int y, x; for(y = 1; y < sy - 1; y++){ for(x = 1; x < sx - 1; x++){ if(map[CM(y,sx,x)].tT == TILE_BLANK){ if(map[TL(y,sx,x)].tT == ft || map[TM(y,sx,x)].tT == ft || map[TR(y,sx,x)].tT == ft || map[CL(y,sx,x)].tT == ft || map[CR(y,sx,x)].tT == ft || map[BL(y,sx,x)].tT == ft || map[BM(y,sx,x)].tT == ft || map[BR(y,sx,x)].tT == ft){ map[CM(y,sx,x)].tT = wt; } } } } for(y = 0; y < sy; y++){ for(x = 0; x < sx; x++){ if(y == 0){ if(map[S(y,sx,x)].tT == ft) map[C(y,sx,x)].tT = wt; } if(x == 0){ if(map[E(y,sx,x)].tT == ft) map[C(y,sx,x)].tT = wt; } if(y == sy - 1){ if(map[N(y,sx,x)].tT == ft) map[C(y,sx,x)].tT = wt; } if(x == sx - 1){ if(map[W(y,sx,x)].tT == ft) map[C(y,sx,x)].tT = wt; } } } }
TInt CSenServiceManagerBCTest::UT_CSenServiceManager_NewLL( TTestResult& aResult ) { Empty(); CSenServiceManager* serviceManager = NULL; CSenServiceManager* serviceManager2 = NULL; serviceManager = CSenServiceManager::NewL(); TL(serviceManager != (CSenServiceManager*)NULL); __ASSERT_ALWAYS_NO_LEAVE(delete serviceManager ); serviceManager = NULL; serviceManager = CSenServiceManager::NewL(); TRAPD(error, serviceManager2 = CSenServiceManager::NewL()); RDebug::Print( _L( "WSModTester: CSenServiceManager_NewL 2nd try with status %d" ), error); LOCAL_ASSERT(error==KErrNone); if (serviceManager != NULL){ __ASSERT_ALWAYS_NO_LEAVE(delete serviceManager ); serviceManager = NULL; } if (serviceManager2 != NULL){ __ASSERT_ALWAYS_NO_LEAVE(delete serviceManager2 ); serviceManager2 = NULL; } Empty(); return KErrNone; }
// ----------------------------------------------------------------------------- // CMdETestScripter::ObjectDefL // ----------------------------------------------------------------------------- // TInt CMdETestScripter::ObjectDefL( CStifItemParser& aItem ) { TInt mode; TPtrC name; TInt index; CMdEObjectDef* objectDef = NULL; User::LeaveIfError( aItem.GetNextInt( mode )); User::LeaveIfError( aItem.GetNextString( name )); if ( mode == ENamespaceDef ) { CMdENamespaceDef* space = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); User::LeaveIfError( aItem.GetNextInt( index )); objectDef = &space->ObjectDefL( index ); } else if ( mode == EPropertyDef ) { CMdEPropertyDef* propDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); objectDef = &propDef->ObjectDef(); } else { User::Leave( KErrArgument ); } TL( objectDef ); iObjectDefArray.Append( objectDef ); AppendNameL( iObjectDefNameArray, name ); return KErrNone; }
TInt CTestHistoryLog::AddMoreThanFiveJobsL( CStifItemParser& /*aItem*/ ) { for (TInt i = 0; i < KMaxMsgSize; i++) { RArray<TInt> tasks; tasks.Append(KTaskId1); tasks.Append(KTaskId2); CSyncMLHistoryJob * entry = CSyncMLHistoryJob::NewL(i, tasks ); CleanupStack::PushL(entry); tasks.Reset(); tasks.Close(); iHistoryArray->AppendEntryL(entry); if (iOwnerShip) { CleanupStack::Pop(entry); } else { CleanupStack::PopAndDestroy(entry); } } TL(iHistoryArray->Count() == KMaxMsgSize); return KErrNone; }
// ----------------------------------------------------------------------------- // CMdETestScripter::ParentL // ----------------------------------------------------------------------------- // TInt CMdETestScripter::ParentL( CStifItemParser& aItem ) { CMdEObjectDef* objectDef = SanitizeArrayIndexL( iObjectDefArray, *iObjectDefNameArray, aItem ); CMdEObjectDef* parentDef = SanitizeArrayIndexL( iObjectDefArray, *iObjectDefNameArray, aItem ); TL( objectDef->ParentL() == parentDef ); return KErrNone; }
static Temp_tempList F_make_calle_saves(void) { Temp_temp rbx = Temp_newtemp(), r12 = Temp_newtemp(), r13 = Temp_newtemp(), r14 = Temp_newtemp(), r15 = Temp_newtemp(); F_add_to_map("rbx", rbx); F_add_to_map("r12", r12); F_add_to_map("r13", r13); F_add_to_map("r14", r14); F_add_to_map("r15", r15); return TL(F_SP(), TL(F_FP(), TL(rbx, TL(r12, TL(r13, TL(r14, TL(r15, NULL))))))); }
// ----------------------------------------------------------------------------- // CMdETestScripter::VerifyObserverNotificationTypeL // ----------------------------------------------------------------------------- // TInt CMdETestScripter::VerifyObserverNotificationTypeL( CStifItemParser& aItem ) { TInt type; User::LeaveIfError( aItem.GetNextInt( type )); TL( iNotificationType == type ); return KErrNone; }
// ----------------------------------------------------------------------------- // CMdETestScripter::NamespaceDefCountL // ----------------------------------------------------------------------------- // TInt CMdETestScripter::NamespaceDefCountL( CStifItemParser& aItem ) { TInt count; User::LeaveIfError( aItem.GetNextInt( count )); TInt state = iMdeSession->NamespaceDefCount(); TL( count == state ); return KErrNone; }
// ----------------------------------------------------------------------------- // CMdETestScripter::EventDefCountL // ----------------------------------------------------------------------------- // TInt CMdETestScripter::EventDefCountL( CStifItemParser& aItem ) { TInt count; CMdENamespaceDef* space = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); User::LeaveIfError( aItem.GetNextInt( count )); TL( space->EventDefCount() == count ); return KErrNone; }
TInt CSenServiceManagerBCTest::UT_CSenServiceManager_NewLCL( TTestResult& aResult ) { Empty(); CSenServiceManager* serviceManager = NULL; serviceManager = CSenServiceManager::NewLC(); TL(serviceManager != (CSenServiceManager*)NULL); CleanupStack::PopAndDestroy(); serviceManager = NULL; Empty(); return KErrNone; }
TInt CsenservicemanagerTester::UT_CSenServiceManager_NewLCL( CStifItemParser& aItem ) { Empty(); CSenServiceManager* serviceManager = NULL; serviceManager = CSenServiceManager::NewLC(); TL(serviceManager != (CSenServiceManager*)NULL); CleanupStack::PopAndDestroy(); serviceManager = NULL; Empty(); return KErrNone; }
TInt CTestHistoryLog::RemoveEntry( CStifItemParser& /*aItem*/ ) { CSyncMLHistoryEntry* tempPtrToHistoryArray; TL(iHistoryArray->Count() == KTwo); tempPtrToHistoryArray = iHistoryArray->RemoveEntry(1); delete tempPtrToHistoryArray; tempPtrToHistoryArray = NULL; TL(iHistoryArray->Count() == 1); tempPtrToHistoryArray = iHistoryArray->RemoveEntry(0); delete tempPtrToHistoryArray; tempPtrToHistoryArray = NULL; TL(iHistoryArray->Count() == 0); tempPtrToHistoryArray = iHistoryArray->RemoveEntry(-1); delete tempPtrToHistoryArray; tempPtrToHistoryArray = NULL; return KErrNone; }
void CEquivManager::Read(void) { struct_stat NewStat; base_stat((const char *) m_Filename.GetBuffer(), &NewStat); if (GetSize() && (m_Stat.st_mtime == NewStat.st_mtime)) return; m_LoadMutex.Lock(); m_Stat = NewStat; RemoveAll(); (* (CTSStringTable *) this) = m_PersistentTable; CLocalFile File(m_Filename); if (File.OpenReadBinary()) { CVector<CString> Lines; File.ReadLines(&Lines); CString Line; for (register int i=0; i<(int) Lines.GetSize(); i++) { Line = Lines[i]; //// _L_DEBUG(6, cout << "CEquivManager::Read() - parsing " << Line << endl); if (!Line.GetLength()) continue; if (Line[0] == '#') { Line.Delete(0, 1); if ((Line.Pos('<')>=0)&&(Line.Pos('>')> Line.Pos('<'))) m_EmailVector += Line; } else { CVector<CString> Tokens; CString::StrToVector(Line, ',', &Tokens); if ((Tokens.GetSize() == 2)&&(Tokens[0].GetLength())&&(Tokens[1].GetLength())) { // complex equivalences CVector<CString> TokensLeft; CString::StrToVector(Tokens[0], '+', &TokensLeft); CVector<CString> TokensRight; CString::StrToVector(Tokens[1], '+', &TokensRight); if ((int) TokensLeft.GetSize() > 1) { if (TokensLeft.GetSize() > TokensRight.GetSize()) { cout << "Dropping malformed equivalence at " << Tokens[0] << "=" << Tokens[1] << endl; } else { for (int ii=1; ii<(int)TokensLeft.GetSize(); ii++) { CString TL(TokensLeft[0]); TL+=TokensLeft[ii]; CString TR(TokensRight[0]); TR+=TokensRight[ii]; CTSStringTable::Set(TL, TR); } } } else { CTSStringTable::Set(Tokens[0], Tokens[1]); } } } } } m_LoadMutex.UnLock(); }
TInt CsenservicemanagerTester::UT_CSenServiceManager_NewL_1CL( CStifItemParser& aItem ) { Empty(); CSenServiceManager* serviceManager = NULL; MSenAuthenticationProvider aProvider; serviceManager = CSenServiceManager::NewLC(aProvider); TL(serviceManager != (CSenServiceManager*)NULL); CleanupStack::PopAndDestroy(); serviceManager = NULL; Empty(); return KErrNone; }
// ----------------------------------------------------------------------------- // CMdETestScripter::GetEventDefL // ----------------------------------------------------------------------------- // TInt CMdETestScripter::GetEventDefL( CStifItemParser& aItem ) { TPtrC name; User::LeaveIfError( aItem.GetNextString( name )); TPtrC eventString; CMdENamespaceDef* space = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); User::LeaveIfError( aItem.GetNextString( eventString )); CMdEEventDef& eventDef = space->GetEventDefL( eventString ); TL( &eventDef ); iEventDefArray.Append( &eventDef ); AppendNameL( iEventDefNameArray, name ); return KErrNone; }
Poly *prim_polys(Prim *s, Poly *p) { int i; Poly *l = plist_alloc(7, p->n); for (i = 0; i < p->n; i++) { PL(l)->v[i] = SL(l)->v[i] = prim_point(s, p->v[i].x, p->v[i].y); NL(l)->v[i] = prim_normal(s, p->v[i].x, p->v[i].y); TL(l)->v[i] = prim_texc(s, p->v[i].x, p->v[i].y); DUL(l)->v[i] = v3_unit(prim_du(s, p->v[i].x, p->v[i].y)); DVL(l)->v[i] = v3_unit(prim_dv(s, p->v[i].x, p->v[i].y)); } return l; }
static Temp_tempList F_make_arg_regs(void) { Temp_temp rdi = Temp_newtemp(), rsi = Temp_newtemp(), rdx = Temp_newtemp(), rcx = Temp_newtemp(), r8 = Temp_newtemp(), r9 = Temp_newtemp(); F_add_to_map("rdi", rdi); F_add_to_map("rsi", rsi); F_add_to_map("rdx", rdx); F_add_to_map("rcx", rcx); F_add_to_map("r8", r8); F_add_to_map("r9", r9); return TL(rdi, TL(rsi, TL(rdx, TL(rcx, TL(r8, TL(r9, NULL)))))); }
TInt CsenservicemanagerTester::UT_CSenServiceManager_NewL_1L( CStifItemParser& aItem ) { Empty(); CSenServiceManager* serviceManager = NULL; MSenAuthenticationProvider aProvider; serviceManager = CSenServiceManager::NewL(aProvider); TL(serviceManager != (CSenServiceManager*)NULL); if (serviceManager != NULL){ __ASSERT_ALWAYS_NO_LEAVE(delete serviceManager ); serviceManager = NULL; } Empty(); return KErrNone; }
// ----------------------------------------------------------------------------- // Tests CAiwDialDataExt construction // ----------------------------------------------------------------------------- // TInt CAiwDialDataTests::ExtConstructionTestL( TTestResult& /*aResult*/ ) { CAiwDialDataExt* dialData = CAiwDialDataExt::NewL(); delete dialData; dialData = CAiwDialDataExt::NewLC(); TL( dialData->PhoneNumber() == KNullDesC() ); T1L( dialData->CallType(), CAiwDialData::EAIWVoice ); T1L( dialData->WindowGroup(), 0 ); TL( !dialData->InitiateCall() ); TL( dialData->Name() == KNullDesC() ); T1L( dialData->Redial(), AIWDialDataExt::KAIWRedialDefault ); TL( dialData->ShowNumber() ); TL( dialData->ContactLink() == KNullDesC8() ); CAiwGenericParamList* list = CAiwGenericParamList::NewLC(); dialData->FillInParamListL( *list ); CleanupStack::PopAndDestroy( 2, dialData ); return KErrNone; }
void P_fun() { scanf("%d", &next_angle); if(M) { G(); return; } else { if(next_angle == 0)TL(); else { if(next_angle >= 160) { backward(X); return; } if(next_angle <= -160) { backward(X); return; } if(next_angle <= 20 && next_angle >= -20) { front(X); return; } if(next_angle > 20 && next_angle < 160) { if(next_angle > 20 && next_angle < 90) left(X); if(next_angle >= 90 && next_angle < 160) right(X); return; } if((next_angle < -20) && (next_angle > -160)) { if((next_angle < -20) && (next_angle > -90)) right(X); if((next_angle <= -90) && (next_angle > -160)) left(X); return; } } } }
// ----------------------------------------------------------------------------- // CMdETestScripter::RelationDefL // ----------------------------------------------------------------------------- // TInt CMdETestScripter::RelationDefL( CStifItemParser& aItem ) { TPtrC name; User::LeaveIfError( aItem.GetNextString( name )); TInt index; CMdENamespaceDef* space = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); User::LeaveIfError( aItem.GetNextInt( index )); CMdERelationDef& relationDef = space->RelationDefL( index ); TL( &relationDef ); iRelationDefArray.Append( &relationDef ); AppendNameL( iRelationDefNameArray, name ); return KErrNone; }