~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.1.0/pjlib/src/pjlib-test/main_symbian.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2015-01-07 14:51:16 UTC
  • mfrom: (4.3.5 sid)
  • Revision ID: package-import@ubuntu.com-20150107145116-yxnafinf4lrdvrmx
Tags: 1.4.1-0.1ubuntu1
* Merge with Debian, remaining changes:
 - Drop soprano, nepomuk build-dep
* Drop ubuntu patches, now upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//Auto-generated file. Please do not modify.
2
 
//#include <e32cmn.h>
3
 
 
4
 
//#pragma data_seg(".SYMBIAN")
5
 
//__EMULATOR_IMAGE_HEADER2 (0x1000007a,0x00000000,0x00000000,EPriorityForeground,0x00000000u,0x00000000u,0x00000000,0x00000000,0x00000000,0)
6
 
//#pragma data_seg()
7
 
 
8
 
#include "test.h"
9
 
#include <stdlib.h>
10
 
#include <pj/errno.h>
11
 
#include <pj/os.h>
12
 
#include <pj/log.h>
13
 
#include <pj/unicode.h>
14
 
#include <stdio.h>
15
 
 
16
 
#include <e32std.h>
17
 
 
18
 
#if 0
19
 
int main()
20
 
{
21
 
    int err = 0;
22
 
    int exp = 0;
23
 
 
24
 
    err = test_main();
25
 
    //err = test_main();
26
 
 
27
 
    if (err)
28
 
        return err;
29
 
    return exp;
30
 
    //return 0;
31
 
}
32
 
 
33
 
#else
34
 
#include <pj/os.h>
35
 
 
36
 
#include <e32base.h>
37
 
#include <e32std.h>
38
 
#include <e32cons.h>            // Console
39
 
 
40
 
 
41
 
 
42
 
//  Global Variables
43
 
 
44
 
LOCAL_D CConsoleBase* console;  // write all messages to this
45
 
 
46
 
 
47
 
class MyScheduler : public CActiveScheduler
48
 
{
49
 
public:
50
 
    MyScheduler()
51
 
    {}
52
 
 
53
 
    void Error(TInt aError) const;
54
 
};
55
 
 
56
 
void MyScheduler::Error(TInt aError) const
57
 
{
58
 
    PJ_UNUSED_ARG(aError);
59
 
}
60
 
 
61
 
LOCAL_C void DoStartL()
62
 
    {
63
 
    // Create active scheduler (to run active objects)
64
 
    CActiveScheduler* scheduler = new (ELeave) MyScheduler;
65
 
    CleanupStack::PushL(scheduler);
66
 
    CActiveScheduler::Install(scheduler);
67
 
 
68
 
    test_main();
69
 
 
70
 
    CActiveScheduler::Install(NULL);
71
 
    CleanupStack::Pop(scheduler);
72
 
    delete scheduler;
73
 
    }
74
 
 
75
 
#define WRITE_TO_DEBUG_CONSOLE
76
 
 
77
 
#ifdef WRITE_TO_DEBUG_CONSOLE
78
 
#include<e32debug.h>
79
 
#endif
80
 
 
81
 
//  Global Functions
82
 
static void log_writer(int level, const char *buf, int len)
83
 
{
84
 
    static wchar_t buf16[PJ_LOG_MAX_SIZE];
85
 
 
86
 
    PJ_UNUSED_ARG(level);
87
 
    
88
 
    pj_ansi_to_unicode(buf, len, buf16, PJ_ARRAY_SIZE(buf16));
89
 
    buf16[len] = 0;
90
 
    buf16[len+1] = 0;
91
 
    
92
 
    TPtrC16 aBuf((const TUint16*)buf16, (TInt)len);
93
 
    console->Write(aBuf);
94
 
    
95
 
#ifdef WRITE_TO_DEBUG_CONSOLE
96
 
    RDebug::Print(aBuf);
97
 
#endif
98
 
}
99
 
 
100
 
 
101
 
GLDEF_C TInt E32Main()
102
 
    {
103
 
    // Create cleanup stack
104
 
    __UHEAP_MARK;
105
 
    CTrapCleanup* cleanup = CTrapCleanup::New();
106
 
 
107
 
    // Create output console
108
 
    TRAPD(createError, console = Console::NewL(_L("Console"), TSize(KConsFullScreen,KConsFullScreen)));
109
 
    if (createError)
110
 
        return createError;
111
 
 
112
 
    pj_log_set_log_func(&log_writer);
113
 
 
114
 
    // Run application code inside TRAP harness, wait keypress when terminated
115
 
    TRAPD(mainError, DoStartL());
116
 
    if (mainError)
117
 
        console->Printf(_L(" failed, leave code = %d"), mainError);
118
 
    
119
 
    console->Printf(_L(" [press any key]\n"));
120
 
    console->Getch();
121
 
    
122
 
    delete console;
123
 
    delete cleanup;
124
 
    
125
 
    CloseSTDLIB(); 
126
 
    
127
 
    __UHEAP_MARKEND;
128
 
    
129
 
    return KErrNone;
130
 
    }
131
 
 
132
 
#endif  /* if 0 */
133