1 /* |
|
2 * Copyright (c) 2008 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: Basic console application for installation testing |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "sistest.h" |
|
20 #include <e32base.h> |
|
21 #include <e32std.h> |
|
22 #include <e32cons.h> // Console |
|
23 |
|
24 _LIT( KTextConsoleTitle, "Console" ); |
|
25 _LIT( KTextFailed, " failed, leave code = %d" ); |
|
26 _LIT( KTextPressAnyKey, " [press any key]\n" ); |
|
27 |
|
28 LOCAL_D CConsoleBase* console; |
|
29 |
|
30 LOCAL_C void MainL() |
|
31 { |
|
32 console->Write(_L("Hello, world!\n")); |
|
33 } |
|
34 |
|
35 LOCAL_C void DoStartL() |
|
36 { |
|
37 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler(); |
|
38 CleanupStack::PushL(scheduler); |
|
39 CActiveScheduler::Install(scheduler); |
|
40 |
|
41 MainL(); |
|
42 |
|
43 CleanupStack::PopAndDestroy(scheduler); |
|
44 } |
|
45 |
|
46 GLDEF_C TInt E32Main() |
|
47 { |
|
48 __UHEAP_MARK; |
|
49 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
50 |
|
51 TRAPD( createError, console = Console::NewL( KTextConsoleTitle, |
|
52 TSize( KConsFullScreen,KConsFullScreen ) ) ); |
|
53 if( createError ) |
|
54 { |
|
55 return createError; |
|
56 } |
|
57 |
|
58 TRAPD( mainError, DoStartL() ); |
|
59 if( mainError ) |
|
60 { |
|
61 console->Printf(KTextFailed, mainError); |
|
62 } |
|
63 console->Printf(KTextPressAnyKey); |
|
64 console->Getch(); |
|
65 |
|
66 delete console; |
|
67 delete cleanup; |
|
68 __UHEAP_MARKEND; |
|
69 return KErrNone; |
|
70 } |
|
71 |
|