From f3ab456a17af1c89a6e3be4d20c5944853df1cb0 Mon Sep 17 00:00:00 2001 From: "David M. Lee" Date: Mon, 7 Jan 2013 14:24:28 -0600 Subject: Import pjproject-2.0.1 --- pjlib/src/pjlib-test/main_symbian.cpp | 133 ++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 pjlib/src/pjlib-test/main_symbian.cpp (limited to 'pjlib/src/pjlib-test/main_symbian.cpp') diff --git a/pjlib/src/pjlib-test/main_symbian.cpp b/pjlib/src/pjlib-test/main_symbian.cpp new file mode 100644 index 0000000..a91b671 --- /dev/null +++ b/pjlib/src/pjlib-test/main_symbian.cpp @@ -0,0 +1,133 @@ +//Auto-generated file. Please do not modify. +//#include + +//#pragma data_seg(".SYMBIAN") +//__EMULATOR_IMAGE_HEADER2 (0x1000007a,0x00000000,0x00000000,EPriorityForeground,0x00000000u,0x00000000u,0x00000000,0x00000000,0x00000000,0) +//#pragma data_seg() + +#include "test.h" +#include +#include +#include +#include +#include +#include + +#include + +#if 0 +int main() +{ + int err = 0; + int exp = 0; + + err = test_main(); + //err = test_main(); + + if (err) + return err; + return exp; + //return 0; +} + +#else +#include + +#include +#include +#include // Console + + + +// Global Variables + +LOCAL_D CConsoleBase* console; // write all messages to this + + +class MyScheduler : public CActiveScheduler +{ +public: + MyScheduler() + {} + + void Error(TInt aError) const; +}; + +void MyScheduler::Error(TInt aError) const +{ + PJ_UNUSED_ARG(aError); +} + +LOCAL_C void DoStartL() + { + // Create active scheduler (to run active objects) + CActiveScheduler* scheduler = new (ELeave) MyScheduler; + CleanupStack::PushL(scheduler); + CActiveScheduler::Install(scheduler); + + test_main(); + + CActiveScheduler::Install(NULL); + CleanupStack::Pop(scheduler); + delete scheduler; + } + +#define WRITE_TO_DEBUG_CONSOLE + +#ifdef WRITE_TO_DEBUG_CONSOLE +#include +#endif + +// Global Functions +static void log_writer(int level, const char *buf, int len) +{ + static wchar_t buf16[PJ_LOG_MAX_SIZE]; + + PJ_UNUSED_ARG(level); + + pj_ansi_to_unicode(buf, len, buf16, PJ_ARRAY_SIZE(buf16)); + buf16[len] = 0; + buf16[len+1] = 0; + + TPtrC16 aBuf((const TUint16*)buf16, (TInt)len); + console->Write(aBuf); + +#ifdef WRITE_TO_DEBUG_CONSOLE + RDebug::Print(aBuf); +#endif +} + + +GLDEF_C TInt E32Main() + { + // Create cleanup stack + __UHEAP_MARK; + CTrapCleanup* cleanup = CTrapCleanup::New(); + + // Create output console + TRAPD(createError, console = Console::NewL(_L("Console"), TSize(KConsFullScreen,KConsFullScreen))); + if (createError) + return createError; + + pj_log_set_log_func(&log_writer); + + // Run application code inside TRAP harness, wait keypress when terminated + TRAPD(mainError, DoStartL()); + if (mainError) + console->Printf(_L(" failed, leave code = %d"), mainError); + + console->Printf(_L(" [press any key]\n")); + console->Getch(); + + delete console; + delete cleanup; + + CloseSTDLIB(); + + __UHEAP_MARKEND; + + return KErrNone; + } + +#endif /* if 0 */ + -- cgit v1.2.3