|
1 |
|
2 // Include Files |
|
3 |
|
4 #include "MultipleMmpApp.h" |
|
5 #include <e32base.h> |
|
6 #include <e32std.h> |
|
7 #include <e32cons.h> // Console |
|
8 #include "OstTraceDefinitions.h" |
|
9 #ifdef OST_TRACE_COMPILER_IN_USE |
|
10 #include "MultipleMmpApp1Traces.h" |
|
11 #endif |
|
12 |
|
13 // Constants |
|
14 |
|
15 _LIT(KTextConsoleTitle, "Console"); |
|
16 _LIT(KTextFailed, " failed, leave code = %d"); |
|
17 _LIT(KTextPressAnyKey, " [press any key]\n"); |
|
18 |
|
19 // Global Variables |
|
20 |
|
21 LOCAL_D CConsoleBase* console; // write all messages to this |
|
22 |
|
23 |
|
24 // Local Functions |
|
25 |
|
26 LOCAL_C void MainL() |
|
27 { |
|
28 /****************************TRACE STATEMENTS*********************************/ |
|
29 OstTrace0( TRACE_FLOW, TEST1_MAINL, "MainL()" ); |
|
30 OstTrace0( TRACE_FLOW, TEST2_MAINL, "MainL()" ); |
|
31 /*****************************************************************************/ |
|
32 |
|
33 CallSomeMoreTraceStatements(); |
|
34 |
|
35 console->Write(_L("Hello, world!\n")); |
|
36 } |
|
37 |
|
38 LOCAL_C void DoStartL() |
|
39 { |
|
40 // Create active scheduler (to run active objects) |
|
41 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler(); |
|
42 CleanupStack::PushL(scheduler); |
|
43 CActiveScheduler::Install(scheduler); |
|
44 |
|
45 MainL(); |
|
46 |
|
47 // Delete active scheduler |
|
48 CleanupStack::PopAndDestroy(scheduler); |
|
49 } |
|
50 |
|
51 // Global Functions |
|
52 |
|
53 GLDEF_C TInt E32Main() |
|
54 { |
|
55 // Create cleanup stack |
|
56 __UHEAP_MARK; |
|
57 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
58 |
|
59 // Create output console |
|
60 TRAPD(createError, console = Console::NewL(KTextConsoleTitle, TSize( |
|
61 KConsFullScreen, KConsFullScreen))); |
|
62 if (createError) |
|
63 return createError; |
|
64 |
|
65 // Run application code inside TRAP harness, wait keypress when terminated |
|
66 TRAPD(mainError, DoStartL()); |
|
67 if (mainError) |
|
68 console->Printf(KTextFailed, mainError); |
|
69 console->Printf(KTextPressAnyKey); |
|
70 console->Getch(); |
|
71 |
|
72 delete console; |
|
73 delete cleanup; |
|
74 __UHEAP_MARKEND; |
|
75 return KErrNone; |
|
76 } |
|
77 |