Subversion Repositories Kolibri OS

Rev

Rev 7504 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7504 Rev 7507
1
#pragma once
1
#pragma once
2
 
2
 
3
typedef unsigned __int32 Dword;
3
typedef unsigned __int32 Dword;
4
typedef unsigned __int16 Word;
4
typedef unsigned __int16 Word;
5
typedef unsigned __int8 Byte;
5
typedef unsigned __int8 Byte;
6
//typedef unsigned __int32 size_t;
6
//typedef unsigned __int32 size_t;
7
 
7
 
8
#define NULL 0
8
#define NULL 0
9
 
9
 
10
#define MAX_PATH				256
10
#define MAX_PATH				256
11
 
11
 
12
#define FO_READ					0
12
#define FO_READ					0
13
#define FO_WRITE				2
13
#define FO_WRITE				2
14
 
14
 
15
//Process Events
15
//Process Events
16
#define EM_WINDOW_REDRAW		1
16
#define EM_WINDOW_REDRAW		1
17
#define EM_KEY_PRESS			2
17
#define EM_KEY_PRESS			2
18
#define EM_BUTTON_CLICK			3
18
#define EM_BUTTON_CLICK			3
19
#define EM_APP_CLOSE			4
19
#define EM_APP_CLOSE			4
20
#define EM_DRAW_BACKGROUND		5
20
#define EM_DRAW_BACKGROUND		5
21
#define EM_MOUSE_EVENT			6
21
#define EM_MOUSE_EVENT			6
22
#define EM_IPC					7
22
#define EM_IPC					7
23
#define EM_NETWORK				8
23
#define EM_NETWORK				8
24
#define EM_DEBUG				9
24
#define EM_DEBUG				9
25
 
25
 
26
//Event mask bits for function 40
26
//Event mask bits for function 40
27
#define EVM_REDRAW        1
27
#define EVM_REDRAW        1
28
#define EVM_KEY           2
28
#define EVM_KEY           2
29
#define EVM_BUTTON        4
29
#define EVM_BUTTON        4
30
#define EVM_EXIT          8
30
#define EVM_EXIT          8
31
#define EVM_BACKGROUND    16
31
#define EVM_BACKGROUND    16
32
#define EVM_MOUSE         32
32
#define EVM_MOUSE         32
33
#define EVM_IPC           64
33
#define EVM_IPC           64
34
#define EVM_STACK         128
34
#define EVM_STACK         128
35
#define EVM_DEBUG         256
35
#define EVM_DEBUG         256
36
#define EVM_STACK2        512
36
#define EVM_STACK2        512
37
#define EVM_MOUSE_FILTER  0x80000000
37
#define EVM_MOUSE_FILTER  0x80000000
38
#define EVM_CURSOR_FILTER 0x40000000
38
#define EVM_CURSOR_FILTER 0x40000000
39
 
39
 
40
//Button options
40
//Button options
41
#define BT_DEL      0x80000000
41
#define BT_DEL      0x80000000
42
#define BT_HIDE     0x40000000
42
#define BT_HIDE     0x40000000
43
#define BT_NOFRAME  0x20000000
43
#define BT_NOFRAME  0x20000000
44
#define BT_NODRAW   BT_HIDE+BT_NOFRAME
44
#define BT_NODRAW   BT_HIDE+BT_NOFRAME
45
 
45
 
46
#define KM_CHARS				0
46
#define KM_CHARS				0
47
#define KM_SCANS				1
47
#define KM_SCANS				1
48
 
48
 
49
#define WRS_BEGIN				1
49
#define WRS_BEGIN				1
50
#define WRS_END					2
50
#define WRS_END					2
51
 
51
 
52
#define PROCESS_ID_SELF			-1
52
#define PROCESS_ID_SELF			-1
53
 
53
 
54
#define abs(a) (a<0?0-a:a)
54
#define abs(a) (a<0?0-a:a)
55
 
55
 
56
extern "C" double __cdecl acos(double x);
56
extern "C" double __cdecl acos(double x);
57
extern "C" double __cdecl asin(double x);
57
extern "C" double __cdecl asin(double x);
58
extern "C" double __cdecl floor(double x);
58
extern "C" double __cdecl floor(double x);
59
extern "C" double __cdecl round(double x);
59
extern "C" double __cdecl round(double x);
60
#pragma function(acos,asin)
60
#pragma function(acos,asin)
61
#if _MSC_VER > 1200
61
#if _MSC_VER > 1200
62
#pragma function(floor)
62
#pragma function(floor)
63
#endif
63
#endif
64
 
64
 
65
 
65
 
66
struct kosFileInfo
66
struct kosFileInfo
67
{
67
{
68
	Dword rwMode;
68
	Dword rwMode;
69
	Dword OffsetLow;
69
	Dword OffsetLow;
70
	char* OffsetHigh;
70
	char* OffsetHigh;
71
	Dword dataCount;
71
	Dword dataCount;
72
	Byte *bufferPtr;
72
	Byte *bufferPtr;
73
	char fileURL[MAX_PATH];
73
	char fileURL[MAX_PATH];
74
};
74
};
75
 
75
 
76
 
76
 
77
struct kosSysColors {
77
struct kosSysColors {
78
	Dword nonset1;
78
	Dword nonset1;
79
	Dword nonset2;
79
	Dword nonset2;
80
	Dword work_dark;
80
	Dword work_dark;
81
	Dword work_light;
81
	Dword work_light;
82
	Dword window_title;
82
	Dword window_title;
83
	Dword work;
83
	Dword work;
84
	Dword work_button;
84
	Dword work_button;
85
	Dword work_button_text;
85
	Dword work_button_text;
86
	Dword work_text;
86
	Dword work_text;
87
	Dword work_graph;
87
	Dword work_graph;
88
};
88
};
89
 
89
 
90
 
90
 
91
struct RGB
91
struct RGB
92
{
92
{
93
	Byte b;
93
	Byte b;
94
	Byte g;
94
	Byte g;
95
	Byte r;
95
	Byte r;
96
	//
96
	//
97
	RGB() {};
97
	RGB() {};
98
	//
98
	//
99
	RGB( Dword value )
99
	RGB( Dword value )
100
	{
100
	{
101
		r = (Byte)(value >> 16);
101
		r = (Byte)(value >> 16);
102
		g = (Byte)(value >> 8);
102
		g = (Byte)(value >> 8);
103
		b = (Byte)value;
103
		b = (Byte)value;
104
	};
104
	};
105
	//
105
	//
106
	bool operator != ( RGB &another )
106
	bool operator != ( RGB &another )
107
	{
107
	{
108
		return this->b != another.b || this->g != another.g || this->r != another.r;
108
		return this->b != another.b || this->g != another.g || this->r != another.r;
109
	};
109
	};
110
	//
110
	//
111
	bool operator == ( RGB &another )
111
	bool operator == ( RGB &another )
112
	{
112
	{
113
		return this->b == another.b && this->g == another.g && this->r == another.r;
113
		return this->b == another.b && this->g == another.g && this->r == another.r;
114
	};
114
	};
115
};
115
};
116
 
116
 
117
 
117
 
118
#pragma pack(push, 1)
118
#pragma pack(push, 1)
119
union sProcessInfo
119
union sProcessInfo
120
{
120
{
121
	Byte rawData[1024];
121
	Byte rawData[1024];
122
	struct
122
	struct
123
	{
123
	{
124
		Dword cpu_usage;
124
		Dword cpu_usage;
125
		Word window_stack_position;
125
		Word window_stack_position;
126
		Word window_slot; //slot
126
		Word window_slot; //slot
127
		Word reserved1;
127
		Word reserved1;
128
		char process_name[12];
128
		char process_name[12];
129
		Dword memory_start;
129
		Dword memory_start;
130
		Dword used_memory;
130
		Dword used_memory;
131
		Dword PID;
131
		Dword PID;
132
		Dword x_start;
132
		Dword x_start;
133
		Dword y_start;
133
		Dword y_start;
134
		Dword width;
134
		Dword width;
135
		Dword height;
135
		Dword height;
136
		Word slot_state;
136
		Word slot_state;
137
		Word reserved3;
137
		Word reserved3;
138
		Dword work_left;
138
		Dword work_left;
139
		Dword work_top;
139
		Dword work_top;
140
		Dword work_width;
140
		Dword work_width;
141
		Dword work_height;
141
		Dword work_height;
142
		char status_window;
142
		char status_window;
143
		Dword cwidth;
143
		Dword cwidth;
144
		Dword cheight;
144
		Dword cheight;
145
	} processInfo;
145
	} processInfo;
146
};
146
};
147
#pragma pack(pop)
147
#pragma pack(pop)
148
 
148
 
149
#ifndef AUTOBUILD
149
#ifndef AUTOBUILD
150
//
150
//
151
extern char *kosExePath;
151
extern char *kosExePath;
152
#endif
152
#endif
153
 
153
 
154
//
154
//
155
void crtStartUp();
155
void crtStartUp();
156
//
156
//
157
int __cdecl _purecall();
157
int __cdecl _purecall();
158
//
158
//
159
int __cdecl atexit( void (__cdecl *func )( void ));
159
int __cdecl atexit( void (__cdecl *func )( void ));
160
//
160
//
161
void rtlSrand( Dword seed );
161
void rtlSrand( Dword seed );
162
Dword rtlRand( void );
162
Dword rtlRand( void );
163
//
163
//
164
char * __cdecl strcpy( char *target, const char *source );
164
char * __cdecl strcpy( char *target, const char *source );
165
int __cdecl strlen( const char *line );
165
int __cdecl strlen( const char *line );
166
char * __cdecl strrchr( const char * string, int c );
166
char * __cdecl strrchr( const char * string, int c );
167
//
167
//
168
// if you have trouble here look at old SVN revisions for alternatives
168
// if you have trouble here look at old SVN revisions for alternatives
169
void memcpy( void *dst, const void *src, size_t bytesCount );
169
void memcpy( void *dst, const void *src, size_t bytesCount );
170
void memset( Byte *dst, Byte filler, Dword count );
170
void memset( Byte *dst, Byte filler, Dword count );
171
//
171
//
172
void sprintf( char *Str, char* Format, ... );
172
void sprintf( char *Str, char* Format, ... );
173
//
173
//
174
Dword rtlInterlockedExchange( Dword *target, Dword value );
174
Dword rtlInterlockedExchange( Dword *target, Dword value );
175
// function -1 çàâåðøåíèÿ ïðîöåññà
175
// function -1 çàâåðøåíèÿ ïðîöåññà
176
void kos_ExitApp();
176
void kos_ExitApp();
177
// function 0
177
// function 0
178
void kos_DefineAndDrawWindow(
178
void kos_DefineAndDrawWindow(
179
	Word x, Word y,
179
	Word x, Word y,
180
	Word sizeX, Word sizeY,
180
	Word sizeX, Word sizeY,
181
	Byte mainAreaType, Dword mainAreaColour,
181
	Byte mainAreaType, Dword mainAreaColour,
182
	Byte headerType, Dword headerColour,
182
	Byte headerType, Dword headerColour,
183
	Dword borderColour
183
	Dword borderColour
184
	);
184
	);
185
// function 1 ïîñòàâèòü òî÷êó
185
// function 1 ïîñòàâèòü òî÷êó
186
void kos_PutPixel( Dword x, Dword y, Dword colour );
186
void kos_PutPixel( Dword x, Dword y, Dword colour );
187
// function 2 ïîëó÷èòü êîä íàæàòîé êëàâèøè
187
// function 2 ïîëó÷èòü êîä íàæàòîé êëàâèøè
188
bool kos_GetKey( Byte &keyCode );
188
bool kos_GetKey( Byte &keyCode );
189
// function 3 ïîëó÷èòü âðåìÿ
189
bool kos_GetKeys( Dword &key_editbox, Byte &key_ascii, Byte &key_scancode );
-
 
190
// function 3 ïîëó÷èòü âðåìÿ
190
Dword kos_GetSystemClock();
191
Dword kos_GetSystemClock();
191
// function 4
192
// function 4
192
void __declspec(noinline) kos_WriteTextToWindow(
193
void __declspec(noinline) kos_WriteTextToWindow(
193
	Word x, Word y,
194
	Word x, Word y,
194
	Byte fontType,
195
	Byte fontType,
195
	Dword textColour,
196
	Dword textColour,
196
	char *textPtr,
197
	char *textPtr,
197
	Dword textLen
198
	Dword textLen
198
	);
199
	);
199
// function 7 íàðèñîâàòü èçîáðàæåíèå
200
// function 7 íàðèñîâàòü èçîáðàæåíèå
200
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
201
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
201
// function 8 îïðåäåëèòü êíîïêó
202
// function 8 îïðåäåëèòü êíîïêó
202
void __declspec(noinline) kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
203
void __declspec(noinline) kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
203
//
204
//
204
void __declspec(noinline) kos_UnsaveDefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
205
void __declspec(noinline) kos_UnsaveDefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
205
// function 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû
206
// function 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû
206
void kos_Pause( Dword value );
207
void kos_Pause( Dword value );
207
// function 9 - èíôîðìàöèÿ î ïðîöåññå
208
// function 9 - èíôîðìàöèÿ î ïðîöåññå
208
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
209
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
209
// function 10
210
// function 10
210
Dword kos_WaitForEvent();
211
Dword kos_WaitForEvent();
211
// function 11
212
// function 11
212
Dword kos_CheckForEvent();
213
Dword kos_CheckForEvent();
213
// function 12
214
// function 12
214
void kos_WindowRedrawStatus( Dword status );
215
void kos_WindowRedrawStatus( Dword status );
215
// function 13 íàðèñîâàòü ïîëîñó
216
// function 13 íàðèñîâàòü ïîëîñó
216
void __declspec(noinline) kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
217
void __declspec(noinline) kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
217
// function 17
218
// function 17
218
bool kos_GetButtonID( Dword &buttonID );
219
bool kos_GetButtonID( Dword &buttonID );
219
// function 23
220
// function 23
220
Dword kos_WaitForEventTimeout( Dword timeOut );
221
Dword kos_WaitForEventTimeout( Dword timeOut );
221
//
222
//
222
enum eNumberBase
223
enum eNumberBase
223
{
224
{
224
	nbDecimal = 0,
225
	nbDecimal = 0,
225
	nbHex,
226
	nbHex,
226
	nbBin
227
	nbBin
227
};
228
};
228
// ïîëó÷åíèå èíôîðìàöèè î ñîñòîÿíèè "ìûøè" function 37
229
// ïîëó÷åíèå èíôîðìàöèè î ñîñòîÿíèè "ìûøè" function 37
229
void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
230
void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
230
// function 38
231
// function 38
231
void kos_DrawLine( Word x1, Word y1, Word x2, Word y2, Dword colour, Dword invert );
232
void kos_DrawLine( Word x1, Word y1, Word x2, Word y2, Dword colour, Dword invert );
232
// function 40 óñòàíîâèòü ìàñêó ñîáûòèé
233
// function 40 óñòàíîâèòü ìàñêó ñîáûòèé
233
void kos_SetMaskForEvents( Dword mask );
234
void kos_SetMaskForEvents( Dword mask );
234
// function 47 âûâåñòè â îêíî ïðèëîæåíèÿ ÷èñëî
235
// function 47 âûâåñòè â îêíî ïðèëîæåíèÿ ÷èñëî
235
void kos_DisplayNumberToWindow(
236
void kos_DisplayNumberToWindow(
236
   Dword value,
237
   Dword value,
237
   Dword digitsNum,
238
   Dword digitsNum,
238
   Word x,
239
   Word x,
239
   Word y,
240
   Word y,
240
   Dword colour,
241
   Dword colour,
241
   eNumberBase nBase = nbDecimal,
242
   eNumberBase nBase = nbDecimal,
242
   bool valueIsPointer = false
243
   bool valueIsPointer = false
243
   );
244
   );
244
// 48.3: get system colors
245
// 48.3: get system colors
245
bool kos_GetSystemColors( kosSysColors *sc );
246
bool kos_GetSystemColors( kosSysColors *sc );
246
// function 63
247
// function 63
247
void kos_DebugOutChar( char ccc );
248
void kos_DebugOutChar( char ccc );
248
//
249
//
249
void rtlDebugOutString( char *str );
250
void rtlDebugOutString( char *str );
250
//
251
//
251
void kos_DebugValue(char *str, int n);
252
void kos_DebugValue(char *str, int n);
252
// function 64 èçìåíèòü ïàðàìåòðû îêíà, ïàðàìåòð == -1 íå ìåíÿåòñÿ
253
// function 64 èçìåíèòü ïàðàìåòðû îêíà, ïàðàìåòð == -1 íå ìåíÿåòñÿ
253
void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY );
254
void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY );
254
// function 67 èçìåíåíèå êîëè÷åñòâà ïàìÿòè, âûäåëåííîé äëÿ ïðîãðàììû
255
// function 67 èçìåíåíèå êîëè÷åñòâà ïàìÿòè, âûäåëåííîé äëÿ ïðîãðàììû
255
bool kos_ApplicationMemoryResize( Dword targetSize );
256
bool kos_ApplicationMemoryResize( Dword targetSize );
256
// function 66 ðåæèì ïîëó÷åíèÿ äàííûõ îò êëàâèàòóðû
257
// function 66 ðåæèì ïîëó÷åíèÿ äàííûõ îò êëàâèàòóðû
257
void kos_SetKeyboardDataMode( Dword mode );
258
void kos_SetKeyboardDataMode( Dword mode );
258
// 68.11: init heap
259
// 68.11: init heap
259
void kos_InitHeap();
260
void kos_InitHeap();
260
// function 70 äîñòóï ê ôàéëîâîé ñèñòåìå
261
// function 70 äîñòóï ê ôàéëîâîé ñèñòåìå
261
Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
262
Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
262
// 70.7: run Kolibri application with param
263
// 70.7: run Kolibri application with param
263
int kos_AppRun(char* app_path, char* param);
264
int kos_AppRun(char* app_path, char* param);
264
//
265
//
265
void kos_Main();
266
void kos_Main();
266
 
267
 
-
 
268
//SCAN CODE KEYS
-
 
269
#define SCAN_CODE_BS    14
-
 
270
#define SCAN_CODE_TAB   15
-
 
271
#define SCAN_CODE_ENTER 28
-
 
272
#define SCAN_CODE_ESC    1
-
 
273
#define SCAN_CODE_DEL   83
-
 
274
#define SCAN_CODE_INS   82
-
 
275
#define SCAN_CODE_SPACE 57
-
 
276
#define SCAN_CODE_MENU  93
-
 
277
 
-
 
278
#define SCAN_CODE_LEFT  75
-
 
279
#define SCAN_CODE_RIGHT 77
-
 
280
#define SCAN_CODE_DOWN  80
-
 
281
#define SCAN_CODE_UP    72
-
 
282
#define SCAN_CODE_HOME  71
-
 
283
#define SCAN_CODE_END   79
-
 
284
#define SCAN_CODE_PGDN  81
-
 
285
#define SCAN_CODE_PGUP  73
-
 
286
 
-
 
287
#define SCAN_CODE_MINUS 12
-
 
288
#define SCAN_CODE_PLUS  13
-
 
289
 
-
 
290
#define SCAN_CODE_F1    59
-
 
291
#define SCAN_CODE_F2    60
-
 
292
#define SCAN_CODE_F3    61
-
 
293
#define SCAN_CODE_F4    62
-
 
294
#define SCAN_CODE_F5    63
-
 
295
#define SCAN_CODE_F6    64
-
 
296
#define SCAN_CODE_F7    65
-
 
297
#define SCAN_CODE_F8    66
-
 
298
#define SCAN_CODE_F9    67
-
 
299
#define SCAN_CODE_F10   68
-
 
300
#define SCAN_CODE_F11   87
-
 
301
#define SCAN_CODE_F12   88
-
 
302
 
-
 
303
#define SCAN_CODE_KEY_A 30
-
 
304
#define SCAN_CODE_KEY_B 48
-
 
305
#define SCAN_CODE_KEY_C 46
-
 
306
#define SCAN_CODE_KEY_D 32
-
 
307
#define SCAN_CODE_KEY_E 18
-
 
308
#define SCAN_CODE_KEY_F 33
-
 
309
#define SCAN_CODE_KEY_H 35
-
 
310
#define SCAN_CODE_KEY_I 23
-
 
311
#define SCAN_CODE_KEY_L 38
-
 
312
#define SCAN_CODE_KEY_M 50
-
 
313
#define SCAN_CODE_KEY_N 49
-
 
314
#define SCAN_CODE_KEY_O 24
-
 
315
#define SCAN_CODE_KEY_P 25
-
 
316
#define SCAN_CODE_KEY_R 19
-
 
317
#define SCAN_CODE_KEY_S 31
-
 
318
#define SCAN_CODE_KEY_T 20
-
 
319
#define SCAN_CODE_KEY_U 22
-
 
320
#define SCAN_CODE_KEY_V 47
-
 
321
#define SCAN_CODE_KEY_X 45 
-
 
322
#define SCAN_CODE_KEY_Y 21 
-
 
323
#define SCAN_CODE_KEY_Z 44
-
 
324
 
267
extern>
325
extern>