main_symbian.cpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
  3. * Copyright (C) 2003-2008 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. */
  19. #include <e32std.h>
  20. #include <e32base.h>
  21. #include <e32std.h>
  22. #include <e32cons.h>
  23. #include <stdlib.h>
  24. // Global Variables
  25. CConsoleBase* console;
  26. // Needed by APS
  27. TPtrC APP_UID = _L("A000000E");
  28. int app_main();
  29. ////////////////////////////////////////////////////////////////////////////
  30. LOCAL_C void DoStartL()
  31. {
  32. CActiveScheduler *scheduler = new (ELeave) CActiveScheduler;
  33. CleanupStack::PushL(scheduler);
  34. CActiveScheduler::Install(scheduler);
  35. app_main();
  36. CActiveScheduler::Install(NULL);
  37. CleanupStack::Pop(scheduler);
  38. delete scheduler;
  39. }
  40. ////////////////////////////////////////////////////////////////////////////
  41. // E32Main()
  42. GLDEF_C TInt E32Main()
  43. {
  44. // Mark heap usage
  45. __UHEAP_MARK;
  46. // Create cleanup stack
  47. CTrapCleanup* cleanup = CTrapCleanup::New();
  48. // Create output console
  49. TRAPD(createError, console = Console::NewL(_L("Console"), TSize(KConsFullScreen,KConsFullScreen)));
  50. if (createError)
  51. return createError;
  52. TRAPD(startError, DoStartL());
  53. //console->Printf(_L("[press any key to close]\n"));
  54. //console->Getch();
  55. delete console;
  56. delete cleanup;
  57. CloseSTDLIB();
  58. // Mark end of heap usage, detect memory leaks
  59. __UHEAP_MARKEND;
  60. return KErrNone;
  61. }