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 | 7f02df4 | 2009-05-05 10:46:51 +0000 | [diff] [blame] | 32 | //TPtrC APP_UID = _L("200235D3"); |
| 33 | TPtrC APP_UID = _L("A000000D"); |
Nanang Izzuddin | cb2789a | 2008-07-24 15:30:44 +0000 | [diff] [blame] | 34 | |
Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 35 | |
Benny Prijono | c71ad43 | 2007-05-04 07:25:19 +0000 | [diff] [blame] | 36 | //////////////////////////////////////////////////////////////////////////// |
Benny Prijono | c71ad43 | 2007-05-04 07:25:19 +0000 | [diff] [blame] | 37 | |
Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 38 | LOCAL_C void DoStartL() |
| 39 | { |
Benny Prijono | 897f9f8 | 2007-05-03 19:56:21 +0000 | [diff] [blame] | 40 | CActiveScheduler *scheduler = new (ELeave) CActiveScheduler; |
Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 41 | CleanupStack::PushL(scheduler); |
| 42 | CActiveScheduler::Install(scheduler); |
| 43 | |
Nanang Izzuddin | 82f7a41 | 2008-12-17 11:36:22 +0000 | [diff] [blame] | 44 | ua_main(); |
Benny Prijono | 897f9f8 | 2007-05-03 19:56:21 +0000 | [diff] [blame] | 45 | |
| 46 | CActiveScheduler::Install(NULL); |
Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 47 | CleanupStack::Pop(scheduler); |
Benny Prijono | 897f9f8 | 2007-05-03 19:56:21 +0000 | [diff] [blame] | 48 | delete scheduler; |
Benny Prijono | 5d54264 | 2007-05-02 18:54:19 +0000 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | |
| 52 | //////////////////////////////////////////////////////////////////////////// |
| 53 | |
Benny Prijono | c71ad43 | 2007-05-04 07:25:19 +0000 | [diff] [blame] | 54 | // E32Main() |
Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 55 | GLDEF_C TInt E32Main() |
| 56 | { |
Benny Prijono | c71ad43 | 2007-05-04 07:25:19 +0000 | [diff] [blame] | 57 | // Mark heap usage |
Benny Prijono | 897f9f8 | 2007-05-03 19:56:21 +0000 | [diff] [blame] | 58 | __UHEAP_MARK; |
Benny Prijono | c71ad43 | 2007-05-04 07:25:19 +0000 | [diff] [blame] | 59 | |
| 60 | // Create cleanup stack |
Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 61 | CTrapCleanup* cleanup = CTrapCleanup::New(); |
| 62 | |
| 63 | // Create output console |
| 64 | TRAPD(createError, console = Console::NewL(_L("Console"), TSize(KConsFullScreen,KConsFullScreen))); |
| 65 | if (createError) |
| 66 | return createError; |
| 67 | |
| 68 | TRAPD(startError, DoStartL()); |
| 69 | |
| 70 | console->Printf(_L("[press any key to close]\n")); |
Benny Prijono | c71ad43 | 2007-05-04 07:25:19 +0000 | [diff] [blame] | 71 | console->Getch(); |
Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 72 | |
| 73 | delete console; |
| 74 | delete cleanup; |
Benny Prijono | 897f9f8 | 2007-05-03 19:56:21 +0000 | [diff] [blame] | 75 | |
Benny Prijono | c71ad43 | 2007-05-04 07:25:19 +0000 | [diff] [blame] | 76 | CloseSTDLIB(); |
| 77 | |
| 78 | // Mark end of heap usage, detect memory leaks |
Benny Prijono | 897f9f8 | 2007-05-03 19:56:21 +0000 | [diff] [blame] | 79 | __UHEAP_MARKEND; |
Benny Prijono | ba5926a | 2007-05-02 11:29:37 +0000 | [diff] [blame] | 80 | return KErrNone; |
| 81 | } |
| 82 | |