Benny Prijono | c71ad43 | 2007-05-04 07:25:19 +0000 | [diff] [blame] | 1 | /* $Id$ */ |
| 2 | /* |
Benny Prijono | 844653c | 2008-12-23 17:27:53 +0000 | [diff] [blame^] | 3 | * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com) |
| 4 | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> |
Benny Prijono | c71ad43 | 2007-05-04 07:25:19 +0000 | [diff] [blame] | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | */ |
Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 20 | #include "ua.h" |
Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 21 | |
| 22 | #include <e32std.h> |
Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 23 | #include <e32base.h> |
| 24 | #include <e32std.h> |
Benny Prijono | c71ad43 | 2007-05-04 07:25:19 +0000 | [diff] [blame] | 25 | #include <stdlib.h> |
Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 26 | |
| 27 | |
| 28 | // Global Variables |
| 29 | CConsoleBase* console; |
Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 30 | |
Nanang Izzuddin | cb2789a | 2008-07-24 15:30:44 +0000 | [diff] [blame] | 31 | // Needed by APS |
Nanang Izzuddin | 82f7a41 | 2008-12-17 11:36:22 +0000 | [diff] [blame] | 32 | TPtrC APP_UID = _L("A000000D"); |
Nanang Izzuddin | cb2789a | 2008-07-24 15:30:44 +0000 | [diff] [blame] | 33 | |
Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 34 | |
Benny Prijono | c71ad43 | 2007-05-04 07:25:19 +0000 | [diff] [blame] | 35 | //////////////////////////////////////////////////////////////////////////// |
Benny Prijono | c71ad43 | 2007-05-04 07:25:19 +0000 | [diff] [blame] | 36 | |
Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 37 | LOCAL_C void DoStartL() |
| 38 | { |
Benny Prijono | 897f9f8 | 2007-05-03 19:56:21 +0000 | [diff] [blame] | 39 | CActiveScheduler *scheduler = new (ELeave) CActiveScheduler; |
Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 40 | CleanupStack::PushL(scheduler); |
| 41 | CActiveScheduler::Install(scheduler); |
| 42 | |
Nanang Izzuddin | 82f7a41 | 2008-12-17 11:36:22 +0000 | [diff] [blame] | 43 | ua_main(); |
Benny Prijono | 897f9f8 | 2007-05-03 19:56:21 +0000 | [diff] [blame] | 44 | |
| 45 | CActiveScheduler::Install(NULL); |
Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 46 | CleanupStack::Pop(scheduler); |
Benny Prijono | 897f9f8 | 2007-05-03 19:56:21 +0000 | [diff] [blame] | 47 | delete scheduler; |
Benny Prijono | 5d54264 | 2007-05-02 18:54:19 +0000 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | |
| 51 | //////////////////////////////////////////////////////////////////////////// |
| 52 | |
Benny Prijono | c71ad43 | 2007-05-04 07:25:19 +0000 | [diff] [blame] | 53 | // E32Main() |
Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 54 | GLDEF_C TInt E32Main() |
| 55 | { |
Benny Prijono | c71ad43 | 2007-05-04 07:25:19 +0000 | [diff] [blame] | 56 | // Mark heap usage |
Benny Prijono | 897f9f8 | 2007-05-03 19:56:21 +0000 | [diff] [blame] | 57 | __UHEAP_MARK; |
Benny Prijono | c71ad43 | 2007-05-04 07:25:19 +0000 | [diff] [blame] | 58 | |
| 59 | // Create cleanup stack |
Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 60 | CTrapCleanup* cleanup = CTrapCleanup::New(); |
| 61 | |
| 62 | // Create output console |
| 63 | TRAPD(createError, console = Console::NewL(_L("Console"), TSize(KConsFullScreen,KConsFullScreen))); |
| 64 | if (createError) |
| 65 | return createError; |
| 66 | |
| 67 | TRAPD(startError, DoStartL()); |
| 68 | |
| 69 | console->Printf(_L("[press any key to close]\n")); |
Benny Prijono | c71ad43 | 2007-05-04 07:25:19 +0000 | [diff] [blame] | 70 | console->Getch(); |
Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 71 | |
| 72 | delete console; |
| 73 | delete cleanup; |
Benny Prijono | 897f9f8 | 2007-05-03 19:56:21 +0000 | [diff] [blame] | 74 | |
Benny Prijono | c71ad43 | 2007-05-04 07:25:19 +0000 | [diff] [blame] | 75 | CloseSTDLIB(); |
| 76 | |
| 77 | // Mark end of heap usage, detect memory leaks |
Benny Prijono | 897f9f8 | 2007-05-03 19:56:21 +0000 | [diff] [blame] | 78 | __UHEAP_MARKEND; |
Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 79 | return KErrNone; |
| 80 | } |
| 81 | |