1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#include <eikenv.h>
#include <eikapp.h>
#include <eikappui.h>
#include <stdio.h>
#include <eikapp.h>
#include <e32base.h>
#include <sdlapp.h>
#include <BAUTILS.H>
#include <e32math.h>
char KOpenJazzPath[256];
FILE* mystdout = NULL;
FILE *mystderr = NULL;
class COpenJazzApp: public CSDLApp {
public:
COpenJazzApp();
~COpenJazzApp();
#ifdef UIQ3
/**
* Returns the resource id to be used to declare the views supported by this UIQ3 app
* @return TInt, resource id
*/
TInt ViewResourceId();
#endif
/**
* This has a default empty implementation.
* Is called just before SDL_Main is called to allow init of system vars
*/
virtual void PreInitializeAppL();
TUid AppDllUid() const;
};
CApaApplication* NewApplication() {
// Return pointer to newly created CQMApp
return new COpenJazzApp;
}
#include <eikstart.h>
// E32Main() contains the program's start up code, the entry point for an EXE.
GLDEF_C TInt E32Main() {
return EikStart::RunApplication(NewApplication);
}
COpenJazzApp::COpenJazzApp() {
}
COpenJazzApp::~COpenJazzApp() {
fflush(mystdout);
fflush(mystderr);
fflush(stdout);
fflush(stderr);
fclose(stdout);
fclose(stderr);
}
#ifdef UIQ3
#include <OpenJazz.rsg>
/**
* Returns the resource id to be used to declare the views supported by this UIQ3 app
* @return TInt, resource id
*/
TInt COpenJazzApp::ViewResourceId() {
return R_SDL_VIEW_UI_CONFIGURATIONS;
}
#endif
/**
* This has a default empty implementation.
* Is called just before SDL_Main is called to allow init of system vars
*/
void COpenJazzApp::PreInitializeAppL()
{
TFileName filename;
TPtr8 ptr((unsigned char*) KOpenJazzPath, 0, 255);
#ifdef UIQ3
mystdout = fopen("c:\\shared\\openjazz\\stdout.txt","w+");
mystderr = fopen("c:\\shared\\openjazz\\stderr.txt","w+");
#else
mystdout = fopen("c:\\data\\openjazz\\stdout.txt","w+");
mystderr = fopen("c:\\data\\openjazz\\stderr.txt","w+");
#endif
*stderr = *mystdout;
*stdout = *mystderr;
filename = _L("C:\\openjazz\\");
for(TInt i = 'D';i<'Z';i++)
{
filename[0] = i;
if(BaflUtils::PathExists(CEikonEnv::Static()->FsSession(), filename))
{
ptr.Copy(filename);
ptr.ZeroTerminate();
return;
}
}
#ifdef UIQ3
ptr.Copy(_L8("c:\\shared\\openjazz\\"));
#else
ptr.Copy(_L8("c:\\data\\openjazz\\"));
#endif
ptr.ZeroTerminate();
}
/**
* Responsible for returning the unique UID of this application
* @return unique UID for this application in a TUid
**/
TUid COpenJazzApp::AppDllUid() const {
return TUid::Uid(0xA000A005);
}
float sinf(float value)
{
TReal ret;
Math::Sin(ret, value);
return ret;
}
/////////////////////////////////////////////////////////////////////////////////////////////////