diff -r 000000000000 -r a03f92240627 memspy/Console/Source/ConsoleMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspy/Console/Source/ConsoleMain.cpp Tue Feb 02 01:57:15 2010 +0200 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "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: +* +*/ + +// System includes +#include +#include +#include +#include +#include +#include +#include + +// Engine includes +#include + +// User includes +#include "ConsoleMenu.h" +#include "ConsoleConstants.h" + + +// --------------------------------------------------------------------------- +// DoMainL() +// +// +// --------------------------------------------------------------------------- +static void DoMainL() + { + // Scheduler + CActiveScheduler* scheduler = new CActiveScheduler(); + CActiveScheduler::Install( scheduler ); + CleanupStack::PushL( scheduler ); + + // F32 + RFs fsSession; + User::LeaveIfError( fsSession.Connect() ); + CleanupClosePushL( fsSession ); + + // Console + CConsoleBase* console = Console::NewL( KMemSpyConsoleName, TSize( KConsFullScreen, KConsFullScreen ) ); + CleanupStack::PushL( console ); + + // Engine + CMemSpyEngine* engine = CMemSpyEngine::NewL( fsSession ); + CleanupStack::PushL( engine ); + + // Menu & event handler AO + CMemSpyConsoleMenu::NewLC( *engine, *console ); + + // Play nicely with external processes + RProcess::Rendezvous( KErrNone ); + + // Start wait loop - console will stop it when done. + CActiveScheduler::Start(); + + // Tidy up + CleanupStack::PopAndDestroy( 5, scheduler ); + } + + + +// --------------------------------------------------------------------------- +// E32Main() +// +// +// --------------------------------------------------------------------------- +GLDEF_C TInt E32Main() + { + __UHEAP_MARK; + RDebug::Print(_L("[MCon] E32Main() - MEMSPY CONSOLE")); + + CTrapCleanup* cleanupTrap = CTrapCleanup::New(); + TRAPD(err, DoMainL()); + if ( err != KErrNone ) + { + RDebug::Printf( " " ); + RDebug::Printf( " " ); + RDebug::Print(_L("[MCon] E32Main() - MEMSPY CONSOLE - error: %d"), err); + if ( err == KErrAlreadyExists ) + { + RDebug::Printf( "\t\t [MCon] NB: MemSpy and MemSpyConsoleUi cannot run simultaneously!", err); + RDebug::Printf( " " ); + RDebug::Printf( " " ); + } + } + delete cleanupTrap; + + __UHEAP_MARKEND; + + return KErrNone; + } +