tracefw/tracecompiler/test/multipleMmpTestCases/mmp_traces_mmpname/src/MultipleMmpApp2.cpp
changeset 56 aa2539c91954
parent 54 a151135b0cf9
child 60 e54443a6878c
child 62 1c2bb2fc7c87
equal deleted inserted replaced
54:a151135b0cf9 56:aa2539c91954
     1 /*
       
     2 * Copyright (c) 2010 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 
       
    19 //  Include Files  
       
    20 
       
    21 #include "MultipleMmpApp.h"
       
    22 #include <e32base.h>
       
    23 #include <e32std.h>
       
    24 #include <e32cons.h>			// Console
       
    25 #include "OstTraceDefinitions.h"
       
    26 #ifdef OST_TRACE_COMPILER_IN_USE
       
    27 #include "MultipleMmpApp2Traces.h"
       
    28 #endif
       
    29 
       
    30 //  Constants
       
    31 
       
    32 _LIT(KTextConsoleTitle, "Console");
       
    33 _LIT(KTextFailed, " failed, leave code = %d");
       
    34 _LIT(KTextPressAnyKey, " [press any key]\n");
       
    35 
       
    36 //  Global Variables
       
    37 
       
    38 LOCAL_D CConsoleBase* console; // write all messages to this
       
    39 
       
    40 
       
    41 //  Local Functions
       
    42 
       
    43 LOCAL_C void MainL()
       
    44     {
       
    45     /****************************TRACE STATEMENTS*********************************/
       
    46     OstTrace0( TRACE_FLOW, TEST1_MAINL, "MainL()" );
       
    47     OstTrace0( TRACE_FLOW, TEST2_MAINL, "MainL()" );    
       
    48     /*****************************************************************************/
       
    49     
       
    50     CallSomeMoreTraceStatements();
       
    51     
       
    52     console->Write(_L("Hello, world!\n"));
       
    53     }
       
    54 
       
    55 LOCAL_C void DoStartL()
       
    56     {
       
    57     // Create active scheduler (to run active objects)
       
    58     CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
       
    59     CleanupStack::PushL(scheduler);
       
    60     CActiveScheduler::Install(scheduler);
       
    61 
       
    62     MainL();
       
    63 
       
    64     // Delete active scheduler
       
    65     CleanupStack::PopAndDestroy(scheduler);
       
    66     }
       
    67 
       
    68 //  Global Functions
       
    69 
       
    70 GLDEF_C TInt E32Main()
       
    71     {
       
    72     // Create cleanup stack
       
    73     __UHEAP_MARK;
       
    74     CTrapCleanup* cleanup = CTrapCleanup::New();
       
    75 
       
    76     // Create output console
       
    77     TRAPD(createError, console = Console::NewL(KTextConsoleTitle, TSize(
       
    78             KConsFullScreen, KConsFullScreen)));
       
    79     if (createError)
       
    80         return createError;
       
    81 
       
    82     // Run application code inside TRAP harness, wait keypress when terminated
       
    83     TRAPD(mainError, DoStartL());
       
    84     if (mainError)
       
    85         console->Printf(KTextFailed, mainError);
       
    86     console->Printf(KTextPressAnyKey);
       
    87     console->Getch();
       
    88 
       
    89     delete console;
       
    90     delete cleanup;
       
    91     __UHEAP_MARKEND;
       
    92     return KErrNone;
       
    93     }
       
    94