memspy/CommandLine/Source/MemSpyCommandLineMain.cpp
changeset 0 a03f92240627
child 20 ca8a1b6995f6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/memspy/CommandLine/Source/MemSpyCommandLineMain.cpp	Tue Feb 02 01:57:15 2010 +0200
@@ -0,0 +1,89 @@
+/*
+* 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 <e32std.h>
+#include <f32file.h>
+#include <e32base.h>
+#include <e32cons.h>
+#include <f32file.h>
+#include <bacline.h>
+
+// User includes
+#include "MemSpyCommandLine.h"
+
+
+// ---------------------------------------------------------------------------
+// DoMainL()
+// 
+// 
+// ---------------------------------------------------------------------------
+static void DoMainL()
+    {
+    // Scheduler
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
+    CActiveScheduler::Install( scheduler );
+    CleanupStack::PushL( scheduler );
+
+    // Get command line 
+    CCommandLineArguments* args = CCommandLineArguments::NewLC();
+
+    // Command line manager
+    CMemSpyCommandLine* commandLineMgr = CMemSpyCommandLine::NewLC();
+
+    // Play nicely with external processes
+    RProcess::Rendezvous( KErrNone );
+
+    // Perform op
+    commandLineMgr->PerformOpL( *args );
+
+    // Tidy up
+    CleanupStack::PopAndDestroy( 3, scheduler ); // scheduler, args, commandLineMgr
+    }
+   
+
+
+// ---------------------------------------------------------------------------
+// E32Main()
+// 
+// 
+// ---------------------------------------------------------------------------
+GLDEF_C TInt E32Main()
+    {
+    __UHEAP_MARK;
+
+#ifdef _DEBUG
+    RDebug::Print(_L("[MemSpyCmdLine] E32Main() - MEMSPY COMMANDLINE - Thread %d is STARTING"), (TUint) RThread().Id() );
+#endif
+
+    CTrapCleanup* cleanupTrap = CTrapCleanup::New();
+    TRAPD(err, DoMainL());  
+    if  ( err != KErrNone )
+        {
+        RDebug::Print(_L("[MemSpyCmdLine] E32Main() - MEMSPY COMMANDLINE - error: %d"), err);
+        }
+    delete cleanupTrap; 
+
+    __UHEAP_MARKEND;
+
+#ifdef _DEBUG
+    RDebug::Print(_L("[MemSpyCmdLine] E32Main() - MEMSPY COMMANDLINE - Thread %d is ENDING"), (TUint) RThread().Id() );
+#endif
+
+    return err;
+    }
+