blob: c3d0fda311fbea14ab1c5565b5200d47ff8909c0 [file] [log] [blame]
Benny Prijonoc71ad432007-05-04 07:25:19 +00001/* $Id$ */
2/*
3 * Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
Benny Prijonoba5926a2007-05-02 11:29:37 +000019#include "ua.h"
Benny Prijonoba5926a2007-05-02 11:29:37 +000020
21#include <e32std.h>
Benny Prijonoba5926a2007-05-02 11:29:37 +000022#include <e32base.h>
23#include <e32std.h>
Benny Prijonoc71ad432007-05-04 07:25:19 +000024#include <stdlib.h>
Benny Prijonoba5926a2007-05-02 11:29:37 +000025
26
27// Global Variables
28CConsoleBase* console;
Benny Prijonoba5926a2007-05-02 11:29:37 +000029
Nanang Izzuddincb2789a2008-07-24 15:30:44 +000030// Needed by APS
Nanang Izzuddin82f7a412008-12-17 11:36:22 +000031TPtrC APP_UID = _L("A000000D");
Nanang Izzuddincb2789a2008-07-24 15:30:44 +000032
Benny Prijonoba5926a2007-05-02 11:29:37 +000033
Benny Prijonoc71ad432007-05-04 07:25:19 +000034////////////////////////////////////////////////////////////////////////////
Benny Prijonoc71ad432007-05-04 07:25:19 +000035
Benny Prijonoba5926a2007-05-02 11:29:37 +000036LOCAL_C void DoStartL()
37{
Benny Prijono897f9f82007-05-03 19:56:21 +000038 CActiveScheduler *scheduler = new (ELeave) CActiveScheduler;
Benny Prijonoba5926a2007-05-02 11:29:37 +000039 CleanupStack::PushL(scheduler);
40 CActiveScheduler::Install(scheduler);
41
Nanang Izzuddin82f7a412008-12-17 11:36:22 +000042 ua_main();
Benny Prijono897f9f82007-05-03 19:56:21 +000043
44 CActiveScheduler::Install(NULL);
Benny Prijonoba5926a2007-05-02 11:29:37 +000045 CleanupStack::Pop(scheduler);
Benny Prijono897f9f82007-05-03 19:56:21 +000046 delete scheduler;
Benny Prijono5d542642007-05-02 18:54:19 +000047}
48
49
50////////////////////////////////////////////////////////////////////////////
51
Benny Prijonoc71ad432007-05-04 07:25:19 +000052// E32Main()
Benny Prijonoba5926a2007-05-02 11:29:37 +000053GLDEF_C TInt E32Main()
54{
Benny Prijonoc71ad432007-05-04 07:25:19 +000055 // Mark heap usage
Benny Prijono897f9f82007-05-03 19:56:21 +000056 __UHEAP_MARK;
Benny Prijonoc71ad432007-05-04 07:25:19 +000057
58 // Create cleanup stack
Benny Prijonoba5926a2007-05-02 11:29:37 +000059 CTrapCleanup* cleanup = CTrapCleanup::New();
60
61 // Create output console
62 TRAPD(createError, console = Console::NewL(_L("Console"), TSize(KConsFullScreen,KConsFullScreen)));
63 if (createError)
64 return createError;
65
66 TRAPD(startError, DoStartL());
67
68 console->Printf(_L("[press any key to close]\n"));
Benny Prijonoc71ad432007-05-04 07:25:19 +000069 console->Getch();
Benny Prijonoba5926a2007-05-02 11:29:37 +000070
71 delete console;
72 delete cleanup;
Benny Prijono897f9f82007-05-03 19:56:21 +000073
Benny Prijonoc71ad432007-05-04 07:25:19 +000074 CloseSTDLIB();
75
76 // Mark end of heap usage, detect memory leaks
Benny Prijono897f9f82007-05-03 19:56:21 +000077 __UHEAP_MARKEND;
Benny Prijonoba5926a2007-05-02 11:29:37 +000078 return KErrNone;
79}
80