kernel/eka/euser/epoc/win32/uc_epoc.cpp
author Stephane Lenclud <tortoisehg@lenclud.com>
Tue, 27 Apr 2010 20:22:55 +0200
branchanywhere
changeset 95 f561f9ae805b
parent 94 f36eb4948686
child 96 428c5911a502
permissions -rw-r--r--
Trying to get trap/leave to work properly but the whole WINS stuff seems over complicated with a lot of assembly in the middle and it's not working on my compiler. When the throw happens the debugger complains about uncaught exception when I'm definitly inside a catch implemented by our TRAP. I think I'm going to come up with a much simplified trap/leave implementation for SYMC. On my prototype all that stuff was working fine in like 20 lines of C++.

// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the License "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
// e32\euser\epoc\win32\uc_epoc.cpp
// 
//

#include <e32std.h>
#include <e32std_private.h>
#include <e32wins.h>

//#include <e32cmn.h>
#include <nwdl.h>

#if defined __SYMC__

//SL: Empty on FCL ?
//For now we use this for basic testing on our SYMC implementation


GLDEF_C void MainL()
	{

	CBase* base=new(ELeave) CBase();
	delete base;
	
	//Testing cleanup stack
	TRAPD(err,
	base=new(ELeave) CBase();
	CleanupStack::PushL(base);
	User::Leave(KErrCancel);
	);

	ASSERT(err==KErrCancel);

	//Testing alloc failure
	TRAP(err,
	TUint8* test=new(ELeave) TUint8[1024*1024*10];
	delete[] test;
	);

	ASSERT(err==KErrNoMemory);

	}


GLDEF_C TInt E32Main()
	{
	//What do we do then
	
	__UHEAP_MARK;

	//CBase* base=new(ELeave) CBase();
	CBase* base=new CBase();
	delete base;

	TUint8* test=new TUint8[1024*9];
	delete[] test;

	CTrapCleanup* cleanupStack = CTrapCleanup::New();
	if (!cleanupStack)
		{
		return KErrNoMemory;
		}

	TRAPD(err,MainL());

	delete cleanupStack;

	__UHEAP_MARKEND;

	return err;
	}


TInt main()
	{
	User::InitProcess();
	//BootEpoc(ETrue);
	E32Main();

	User::Exit(0);
	return 0;
	}

#endif