blob: b26b10bdc750f02ed114c9f8c00b37f1de58dc95 [file] [log] [blame]
Benny Prijonoc71ad432007-05-04 07:25:19 +00001/* $Id$ */
2/*
Benny Prijono844653c2008-12-23 17:27:53 +00003 * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
4 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
Benny Prijonoc71ad432007-05-04 07:25:19 +00005 *
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 Prijonoba5926a2007-05-02 11:29:37 +000020#include "ua.h"
Benny Prijonoba5926a2007-05-02 11:29:37 +000021
22#include <e32std.h>
Benny Prijonoba5926a2007-05-02 11:29:37 +000023#include <e32base.h>
24#include <e32std.h>
Benny Prijonoc71ad432007-05-04 07:25:19 +000025#include <stdlib.h>
Benny Prijonoba5926a2007-05-02 11:29:37 +000026
27
28// Global Variables
29CConsoleBase* console;
Benny Prijonoba5926a2007-05-02 11:29:37 +000030
Nanang Izzuddincb2789a2008-07-24 15:30:44 +000031// Needed by APS
Nanang Izzuddin82f7a412008-12-17 11:36:22 +000032TPtrC APP_UID = _L("A000000D");
Nanang Izzuddincb2789a2008-07-24 15:30:44 +000033
Benny Prijonoba5926a2007-05-02 11:29:37 +000034
Benny Prijonoc71ad432007-05-04 07:25:19 +000035////////////////////////////////////////////////////////////////////////////
Benny Prijonoc71ad432007-05-04 07:25:19 +000036
Benny Prijonoba5926a2007-05-02 11:29:37 +000037LOCAL_C void DoStartL()
38{
Benny Prijono897f9f82007-05-03 19:56:21 +000039 CActiveScheduler *scheduler = new (ELeave) CActiveScheduler;
Benny Prijonoba5926a2007-05-02 11:29:37 +000040 CleanupStack::PushL(scheduler);
41 CActiveScheduler::Install(scheduler);
42
Nanang Izzuddin82f7a412008-12-17 11:36:22 +000043 ua_main();
Benny Prijono897f9f82007-05-03 19:56:21 +000044
45 CActiveScheduler::Install(NULL);
Benny Prijonoba5926a2007-05-02 11:29:37 +000046 CleanupStack::Pop(scheduler);
Benny Prijono897f9f82007-05-03 19:56:21 +000047 delete scheduler;
Benny Prijono5d542642007-05-02 18:54:19 +000048}
49
50
51////////////////////////////////////////////////////////////////////////////
52
Benny Prijonoc71ad432007-05-04 07:25:19 +000053// E32Main()
Benny Prijonoba5926a2007-05-02 11:29:37 +000054GLDEF_C TInt E32Main()
55{
Benny Prijonoc71ad432007-05-04 07:25:19 +000056 // Mark heap usage
Benny Prijono897f9f82007-05-03 19:56:21 +000057 __UHEAP_MARK;
Benny Prijonoc71ad432007-05-04 07:25:19 +000058
59 // Create cleanup stack
Benny Prijonoba5926a2007-05-02 11:29:37 +000060 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 Prijonoc71ad432007-05-04 07:25:19 +000070 console->Getch();
Benny Prijonoba5926a2007-05-02 11:29:37 +000071
72 delete console;
73 delete cleanup;
Benny Prijono897f9f82007-05-03 19:56:21 +000074
Benny Prijonoc71ad432007-05-04 07:25:19 +000075 CloseSTDLIB();
76
77 // Mark end of heap usage, detect memory leaks
Benny Prijono897f9f82007-05-03 19:56:21 +000078 __UHEAP_MARKEND;
Benny Prijonoba5926a2007-05-02 11:29:37 +000079 return KErrNone;
80}
81