Subversion Repositories Kolibri OS

Rev

Rev 7498 | Rev 7503 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7498 Rev 7500
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
	Dword OffsetHigh;
70
	Dword 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 RGB
77
struct RGB
78
{
78
{
79
	Byte b;
79
	Byte b;
80
	Byte g;
80
	Byte g;
81
	Byte r;
81
	Byte r;
82
	//
82
	//
83
	RGB() {};
83
	RGB() {};
84
	//
84
	//
85
	RGB( Dword value )
85
	RGB( Dword value )
86
	{
86
	{
87
		r = (Byte)(value >> 16);
87
		r = (Byte)(value >> 16);
88
		g = (Byte)(value >> 8);
88
		g = (Byte)(value >> 8);
89
		b = (Byte)value;
89
		b = (Byte)value;
90
	};
90
	};
91
	//
91
	//
92
	bool operator != ( RGB &another )
92
	bool operator != ( RGB &another )
93
	{
93
	{
94
		return this->b != another.b || this->g != another.g || this->r != another.r;
94
		return this->b != another.b || this->g != another.g || this->r != another.r;
95
	};
95
	};
96
	//
96
	//
97
	bool operator == ( RGB &another )
97
	bool operator == ( RGB &another )
98
	{
98
	{
99
		return this->b == another.b && this->g == another.g && this->r == another.r;
99
		return this->b == another.b && this->g == another.g && this->r == another.r;
100
	};
100
	};
101
};
101
};
102
 
102
 
103
 
103
 
104
#pragma pack(push, 1)
104
#pragma pack(push, 1)
105
union sProcessInfo
105
union sProcessInfo
106
{
106
{
107
	Byte rawData[1024];
107
	Byte rawData[1024];
108
	struct
108
	struct
109
	{
109
	{
110
		Dword cpu_usage;
110
		Dword cpu_usage;
111
		Word window_stack_position;
111
		Word window_stack_position;
112
		Word window_slot; //slot
112
		Word window_slot; //slot
113
		Word reserved1;
113
		Word reserved1;
114
		char process_name[12];
114
		char process_name[12];
115
		Dword memory_start;
115
		Dword memory_start;
116
		Dword used_memory;
116
		Dword used_memory;
117
		Dword PID;
117
		Dword PID;
118
		Dword x_start;
118
		Dword x_start;
119
		Dword y_start;
119
		Dword y_start;
120
		Dword width;
120
		Dword width;
121
		Dword height;
121
		Dword height;
122
		Word slot_state;
122
		Word slot_state;
123
		Word reserved3;
123
		Word reserved3;
124
		Dword work_left;
124
		Dword work_left;
125
		Dword work_top;
125
		Dword work_top;
126
		Dword work_width;
126
		Dword work_width;
127
		Dword work_height;
127
		Dword work_height;
128
		char status_window;
128
		char status_window;
129
		Dword cwidth;
129
		Dword cwidth;
130
		Dword cheight;
130
		Dword cheight;
131
	} processInfo;
131
	} processInfo;
132
};
132
};
133
#pragma pack(pop)
133
#pragma pack(pop)
134
 
134
 
135
#ifndef AUTOBUILD
135
#ifndef AUTOBUILD
136
//
136
//
137
extern char *kosExePath;
137
extern char *kosExePath;
138
#endif
138
#endif
139
 
139
 
140
//
140
//
141
void crtStartUp();
141
void crtStartUp();
142
//
142
//
143
int __cdecl _purecall();
143
int __cdecl _purecall();
144
//
144
//
145
int __cdecl atexit( void (__cdecl *func )( void ));
145
int __cdecl atexit( void (__cdecl *func )( void ));
146
//
146
//
147
void rtlSrand( Dword seed );
147
void rtlSrand( Dword seed );
148
Dword rtlRand( void );
148
Dword rtlRand( void );
149
//
149
//
150
char * __cdecl strcpy( char *target, const char *source );
150
char * __cdecl strcpy( char *target, const char *source );
151
int __cdecl strlen( const char *line );
151
int __cdecl strlen( const char *line );
152
char * __cdecl strrchr( const char * string, int c );
152
char * __cdecl strrchr( const char * string, int c );
153
 
153
//
154
/*
-
 
155
#if _MSC_VER < 1400
154
// if you have trouble here look at old SVN revisions for alternatives
156
extern "C" void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
-
 
157
extern "C" void memset( Byte *dst, Byte filler, Dword count );
155
void memcpy( void *dst, const void *src, size_t bytesCount );
158
//#pragma intrinsic(memcpy,memset)
-
 
159
#elif defined AUTOBUILD
-
 
160
*/
-
 
161
void memcpy( void *dst, const void *src, size_t bytesCount );
-
 
162
void memset( Byte *dst, Byte filler, Dword count );
156
void memset( Byte *dst, Byte filler, Dword count );
163
/*
157
//
164
#else
158
void sprintf( char *Str, char* Format, ... );
165
void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
-
 
166
void memset( Byte *dst, Byte filler, Dword count );
-
 
167
#endif
-
 
168
*/
-
 
169
 
-
 
170
void sprintf( char *Str, char* Format, ... );
-
 
171
//
159
//
172
Dword rtlInterlockedExchange( Dword *target, Dword value );
160
Dword rtlInterlockedExchange( Dword *target, Dword value );
173
// ôóíêöèÿ -1 çàâåðøåíèÿ ïðîöåññà
161
// ôóíêöèÿ -1 çàâåðøåíèÿ ïðîöåññà
174
void kos_ExitApp();
162
void kos_ExitApp();
175
// ôóíêöèÿ 0
163
// ôóíêöèÿ 0
176
void kos_DefineAndDrawWindow(
164
void kos_DefineAndDrawWindow(
177
	Word x, Word y,
165
	Word x, Word y,
178
	Word sizeX, Word sizeY,
166
	Word sizeX, Word sizeY,
179
	Byte mainAreaType, Dword mainAreaColour,
167
	Byte mainAreaType, Dword mainAreaColour,
180
	Byte headerType, Dword headerColour,
168
	Byte headerType, Dword headerColour,
181
	Dword borderColour
169
	Dword borderColour
182
	);
170
	);
183
// ôóíêöèÿ 1 ïîñòàâèòü òî÷êó
171
// ôóíêöèÿ 1 ïîñòàâèòü òî÷êó
184
void kos_PutPixel( Dword x, Dword y, Dword colour );
172
void kos_PutPixel( Dword x, Dword y, Dword colour );
185
// ôóíêöèÿ 2 ïîëó÷èòü êîä íàæàòîé êëàâèøè
173
// ôóíêöèÿ 2 ïîëó÷èòü êîä íàæàòîé êëàâèøè
186
bool kos_GetKey( Byte &keyCode );
174
bool kos_GetKey( Byte &keyCode );
187
// ôóíêöèÿ 3 ïîëó÷èòü âðåìÿ
175
// ôóíêöèÿ 3 ïîëó÷èòü âðåìÿ
188
Dword kos_GetSystemClock();
176
Dword kos_GetSystemClock();
189
// ôóíêöèÿ 4
177
// ôóíêöèÿ 4
190
void __declspec(noinline) kos_WriteTextToWindow(
178
void __declspec(noinline) kos_WriteTextToWindow(
191
	Word x, Word y,
179
	Word x, Word y,
192
	Byte fontType,
180
	Byte fontType,
193
	Dword textColour,
181
	Dword textColour,
194
	char *textPtr,
182
	char *textPtr,
195
	Dword textLen
183
	Dword textLen
196
	);
184
	);
197
// ôóíêöèÿ 7 íàðèñîâàòü èçîáðàæåíèå
185
// ôóíêöèÿ 7 íàðèñîâàòü èçîáðàæåíèå
198
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
186
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
199
// ôóíêöèÿ 8 îïðåäåëèòü êíîïêó
187
// ôóíêöèÿ 8 îïðåäåëèòü êíîïêó
200
void __declspec(noinline) kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
188
void __declspec(noinline) kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
201
// ôóíêöèÿ 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû
189
// ôóíêöèÿ 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû
202
void kos_Pause( Dword value );
190
void kos_Pause( Dword value );
203
// ôóíêöèÿ 9 - èíôîðìàöèÿ î ïðîöåññå
191
// ôóíêöèÿ 9 - èíôîðìàöèÿ î ïðîöåññå
204
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
192
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
205
// ôóíêöèÿ 10
193
// ôóíêöèÿ 10
206
Dword kos_WaitForEvent();
194
Dword kos_WaitForEvent();
207
// ôóíêöèÿ 11
195
// ôóíêöèÿ 11
208
Dword kos_CheckForEvent();
196
Dword kos_CheckForEvent();
209
// ôóíêöèÿ 12
197
// ôóíêöèÿ 12
210
void kos_WindowRedrawStatus( Dword status );
198
void kos_WindowRedrawStatus( Dword status );
211
// ôóíêöèÿ 13 íàðèñîâàòü ïîëîñó
199
// ôóíêöèÿ 13 íàðèñîâàòü ïîëîñó
212
void __declspec(noinline) kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
200
void __declspec(noinline) kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
213
// ôóíêöèÿ 17
201
// ôóíêöèÿ 17
214
bool kos_GetButtonID( Dword &buttonID );
202
bool kos_GetButtonID( Dword &buttonID );
215
// ôóíêöèÿ 23
203
// ôóíêöèÿ 23
216
Dword kos_WaitForEventTimeout( Dword timeOut );
204
Dword kos_WaitForEventTimeout( Dword timeOut );
217
//
205
//
218
enum eNumberBase
206
enum eNumberBase
219
{
207
{
220
	nbDecimal = 0,
208
	nbDecimal = 0,
221
	nbHex,
209
	nbHex,
222
	nbBin
210
	nbBin
223
};
211
};
224
// ïîëó÷åíèå èíôîðìàöèè î ñîñòîÿíèè "ìûøè" ôóíêöèÿ 37
212
// ïîëó÷åíèå èíôîðìàöèè î ñîñòîÿíèè "ìûøè" ôóíêöèÿ 37
225
void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
213
void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
226
// ôóíêöèÿ 40 óñòàíîâèòü ìàñêó ñîáûòèé
214
// ôóíêöèÿ 40 óñòàíîâèòü ìàñêó ñîáûòèé
227
void kos_SetMaskForEvents( Dword mask );
215
void kos_SetMaskForEvents( Dword mask );
228
// ôóíêöèÿ 47 âûâåñòè â îêíî ïðèëîæåíèÿ ÷èñëî
216
// ôóíêöèÿ 47 âûâåñòè â îêíî ïðèëîæåíèÿ ÷èñëî
229
void kos_DisplayNumberToWindow(
217
void kos_DisplayNumberToWindow(
230
   Dword value,
218
   Dword value,
231
   Dword digitsNum,
219
   Dword digitsNum,
232
   Word x,
220
   Word x,
233
   Word y,
221
   Word y,
234
   Dword colour,
222
   Dword colour,
235
   eNumberBase nBase = nbDecimal,
223
   eNumberBase nBase = nbDecimal,
236
   bool valueIsPointer = false
224
   bool valueIsPointer = false
237
   );
225
   );
238
// ôóíêöèÿ 58 äîñòóï ê ôàéëîâîé ñèñòåìå
226
// ôóíêöèÿ 58 äîñòóï ê ôàéëîâîé ñèñòåìå
239
Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
227
Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
240
// ôóíêöèÿ 63
228
// ôóíêöèÿ 63
241
void kos_DebugOutChar( char ccc );
229
void kos_DebugOutChar( char ccc );
242
//
230
//
243
void rtlDebugOutString( char *str );
231
void rtlDebugOutString( char *str );
244
// ôóíêöèÿ 64 èçìåíèòü ïàðàìåòðû îêíà, ïàðàìåòð == -1 íå ìåíÿåòñÿ
232
// ôóíêöèÿ 64 èçìåíèòü ïàðàìåòðû îêíà, ïàðàìåòð == -1 íå ìåíÿåòñÿ
245
void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY );
233
void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY );
246
// ôóíêöèÿ 67 èçìåíåíèå êîëè÷åñòâà ïàìÿòè, âûäåëåííîé äëÿ ïðîãðàììû
234
// ôóíêöèÿ 67 èçìåíåíèå êîëè÷åñòâà ïàìÿòè, âûäåëåííîé äëÿ ïðîãðàììû
247
bool kos_ApplicationMemoryResize( Dword targetSize );
235
bool kos_ApplicationMemoryResize( Dword targetSize );
248
// ôóíêöèÿ 66 ðåæèì ïîëó÷åíèÿ äàííûõ îò êëàâèàòóðû
236
// ôóíêöèÿ 66 ðåæèì ïîëó÷åíèÿ äàííûõ îò êëàâèàòóðû
249
void kos_SetKeyboardDataMode( Dword mode );
237
void kos_SetKeyboardDataMode( Dword mode );
250
 
238
 
251
void kos_InitHeap();
239
void kos_InitHeap();
252
 
240
 
253
//
241
//
254
void kos_Main();
242
void kos_Main();
255
 
243
 
256
extern>
244
extern>