Update contrib.
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\euser\epoc\win32\uc_epoc.cpp
20 #include <e32std_private.h>
26 //That stuff comes mostly from estub and uc_stub.cpp
27 //We had to put it in there since we don't know how to do an MMP firstlib on Windows
31 GLDEF_C TInt _E32Startup()
45 int CALLBACK _E32Bootstrap(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
68 //#include <e32hashtab.h>
71 //For now we use this for basic testing on our SYMC implementation
74 TInt IdleCallBack(TAny* aParam)
83 CActiveScheduler::Stop();
93 class CBaseTest: public CBase
102 //Testing CBase object
103 CBase* other=new(ELeave) CBase();
104 CleanupStack::PushL(other);
105 CBase* base=new(ELeave) CBase();
106 CleanupStack::PushL(base);
107 CleanupStack::PopAndDestroy(2,other);
110 //Testing cleanup stack
112 base=new(ELeave) CBase();
113 CleanupStack::PushL(base);
114 User::Leave(KErrCancel);
117 ASSERT(err==KErrCancel);
119 //Testing alloc failure
122 TUint8* shouldFail=new(ELeave) TUint8[1024*1024*10];
127 ASSERT(err==KErrNoMemory);
129 //Testing alloc failure without leave
130 TUint8* tooLarge=new TUint8[1024*1024*10];
131 ASSERT(tooLarge==NULL);
134 //Testing simple alloc of T class
135 TUint8* tinyAlloc=new TUint8;
136 ASSERT(tinyAlloc!=NULL);
140 //RHashSet<TUint32> hash;
143 //Install an active scheduler
144 CActiveScheduler* activeScheduler = new(ELeave) CActiveScheduler;
145 CActiveScheduler::Install(activeScheduler);
146 CleanupStack::PushL(activeScheduler);
148 CIdle* idle = CIdle::NewL(CActive::EPriorityIdle);
149 CleanupStack::PushL(idle);
151 idle->Start(TCallBack(IdleCallBack,NULL));
153 CActiveScheduler::Start();
155 CleanupStack::PopAndDestroy(idle);
156 CActiveScheduler::Install(NULL);
157 CleanupStack::PopAndDestroy(activeScheduler);
160 //Testing unbalanced cleanup stack
161 //base=new(ELeave) CBase();
162 //CleanupStack::PushL(base);
166 GLDEF_C TInt E32Main()
173 //CBase* base=new(ELeave) CBase();
174 CBase* base=new CBase();
177 CBaseTest* baseTest=new CBaseTest();
180 HBufC* buf=HBufC::New(10);
183 CArrayFix<TInt>* active=new CArrayFixFlat<TInt>(10);
186 TUint8* test=new TUint8[1024*9];
189 CTrapCleanup* cleanupStack = CTrapCleanup::New();
213 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
215 //User::InitProcess();