memspy/CommandLine/Source/MemSpyCommandLineMain.cpp
changeset 0 a03f92240627
child 30 86a2e675b80a
equal deleted inserted replaced
-1:000000000000 0:a03f92240627
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 // System includes
       
    19 #include <e32std.h>
       
    20 #include <f32file.h>
       
    21 #include <e32base.h>
       
    22 #include <e32cons.h>
       
    23 #include <f32file.h>
       
    24 #include <bacline.h>
       
    25 
       
    26 // User includes
       
    27 #include "MemSpyCommandLine.h"
       
    28 
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // DoMainL()
       
    32 // 
       
    33 // 
       
    34 // ---------------------------------------------------------------------------
       
    35 static void DoMainL()
       
    36     {
       
    37     // Scheduler
       
    38     CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
       
    39     CActiveScheduler::Install( scheduler );
       
    40     CleanupStack::PushL( scheduler );
       
    41 
       
    42     // Get command line 
       
    43     CCommandLineArguments* args = CCommandLineArguments::NewLC();
       
    44 
       
    45     // Command line manager
       
    46     CMemSpyCommandLine* commandLineMgr = CMemSpyCommandLine::NewLC();
       
    47 
       
    48     // Play nicely with external processes
       
    49     RProcess::Rendezvous( KErrNone );
       
    50 
       
    51     // Perform op
       
    52     commandLineMgr->PerformOpL( *args );
       
    53 
       
    54     // Tidy up
       
    55     CleanupStack::PopAndDestroy( 3, scheduler ); // scheduler, args, commandLineMgr
       
    56     }
       
    57    
       
    58 
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 // E32Main()
       
    62 // 
       
    63 // 
       
    64 // ---------------------------------------------------------------------------
       
    65 GLDEF_C TInt E32Main()
       
    66     {
       
    67     __UHEAP_MARK;
       
    68 
       
    69 #ifdef _DEBUG
       
    70     RDebug::Print(_L("[MemSpyCmdLine] E32Main() - MEMSPY COMMANDLINE - Thread %d is STARTING"), (TUint) RThread().Id() );
       
    71 #endif
       
    72 
       
    73     CTrapCleanup* cleanupTrap = CTrapCleanup::New();
       
    74     TRAPD(err, DoMainL());  
       
    75     if  ( err != KErrNone )
       
    76         {
       
    77         RDebug::Print(_L("[MemSpyCmdLine] E32Main() - MEMSPY COMMANDLINE - error: %d"), err);
       
    78         }
       
    79     delete cleanupTrap; 
       
    80 
       
    81     __UHEAP_MARKEND;
       
    82 
       
    83 #ifdef _DEBUG
       
    84     RDebug::Print(_L("[MemSpyCmdLine] E32Main() - MEMSPY COMMANDLINE - Thread %d is ENDING"), (TUint) RThread().Id() );
       
    85 #endif
       
    86 
       
    87     return err;
       
    88     }
       
    89