Subversion Repositories Kolibri OS

Rev

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

Rev 7500 Rev 7503
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
// if you have trouble here look at old SVN revisions for alternatives
154
// if you have trouble here look at old SVN revisions for alternatives
155
void memcpy( void *dst, const void *src, size_t bytesCount );
155
void memcpy( void *dst, const void *src, size_t bytesCount );
156
void memset( Byte *dst, Byte filler, Dword count );
156
void memset( Byte *dst, Byte filler, Dword count );
157
//
157
//
158
void sprintf( char *Str, char* Format, ... );
158
void sprintf( char *Str, char* Format, ... );
159
//
159
//
160
Dword rtlInterlockedExchange( Dword *target, Dword value );
160
Dword rtlInterlockedExchange( Dword *target, Dword value );
161
// ôóíêöèÿ -1 çàâåðøåíèÿ ïðîöåññà
161
// function -1 çàâåðøåíèÿ ïðîöåññà
162
void kos_ExitApp();
162
void kos_ExitApp();
163
// ôóíêöèÿ 0
163
// function 0
164
void kos_DefineAndDrawWindow(
164
void kos_DefineAndDrawWindow(
165
	Word x, Word y,
165
	Word x, Word y,
166
	Word sizeX, Word sizeY,
166
	Word sizeX, Word sizeY,
167
	Byte mainAreaType, Dword mainAreaColour,
167
	Byte mainAreaType, Dword mainAreaColour,
168
	Byte headerType, Dword headerColour,
168
	Byte headerType, Dword headerColour,
169
	Dword borderColour
169
	Dword borderColour
170
	);
170
	);
171
// ôóíêöèÿ 1 ïîñòàâèòü òî÷êó
171
// function 1 ïîñòàâèòü òî÷êó
172
void kos_PutPixel( Dword x, Dword y, Dword colour );
172
void kos_PutPixel( Dword x, Dword y, Dword colour );
173
// ôóíêöèÿ 2 ïîëó÷èòü êîä íàæàòîé êëàâèøè
173
// function 2 ïîëó÷èòü êîä íàæàòîé êëàâèøè
174
bool kos_GetKey( Byte &keyCode );
174
bool kos_GetKey( Byte &keyCode );
175
// ôóíêöèÿ 3 ïîëó÷èòü âðåìÿ
175
// function 3 ïîëó÷èòü âðåìÿ
176
Dword kos_GetSystemClock();
176
Dword kos_GetSystemClock();
177
// ôóíêöèÿ 4
177
// function 4
178
void __declspec(noinline) kos_WriteTextToWindow(
178
void __declspec(noinline) kos_WriteTextToWindow(
179
	Word x, Word y,
179
	Word x, Word y,
180
	Byte fontType,
180
	Byte fontType,
181
	Dword textColour,
181
	Dword textColour,
182
	char *textPtr,
182
	char *textPtr,
183
	Dword textLen
183
	Dword textLen
184
	);
184
	);
185
// ôóíêöèÿ 7 íàðèñîâàòü èçîáðàæåíèå
185
// function 7 íàðèñîâàòü èçîáðàæåíèå
186
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 );
187
// ôóíêöèÿ 8 îïðåäåëèòü êíîïêó
187
// function 8 îïðåäåëèòü êíîïêó
188
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 );
189
// ôóíêöèÿ 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû
189
//
-
 
190
void __declspec(noinline) kos_UnsaveDefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
-
 
191
// function 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû
190
void kos_Pause( Dword value );
192
void kos_Pause( Dword value );
191
// ôóíêöèÿ 9 - èíôîðìàöèÿ î ïðîöåññå
193
// function 9 - èíôîðìàöèÿ î ïðîöåññå
192
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
194
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
193
// ôóíêöèÿ 10
195
// function 10
194
Dword kos_WaitForEvent();
196
Dword kos_WaitForEvent();
195
// ôóíêöèÿ 11
197
// function 11
196
Dword kos_CheckForEvent();
198
Dword kos_CheckForEvent();
197
// ôóíêöèÿ 12
199
// function 12
198
void kos_WindowRedrawStatus( Dword status );
200
void kos_WindowRedrawStatus( Dword status );
199
// ôóíêöèÿ 13 íàðèñîâàòü ïîëîñó
201
// function 13 íàðèñîâàòü ïîëîñó
200
void __declspec(noinline) kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
202
void __declspec(noinline) kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
201
// ôóíêöèÿ 17
203
// function 17
202
bool kos_GetButtonID( Dword &buttonID );
204
bool kos_GetButtonID( Dword &buttonID );
203
// ôóíêöèÿ 23
205
// function 23
204
Dword kos_WaitForEventTimeout( Dword timeOut );
206
Dword kos_WaitForEventTimeout( Dword timeOut );
205
//
207
//
206
enum eNumberBase
208
enum eNumberBase
207
{
209
{
208
	nbDecimal = 0,
210
	nbDecimal = 0,
209
	nbHex,
211
	nbHex,
210
	nbBin
212
	nbBin
211
};
213
};
212
// ïîëó÷åíèå èíôîðìàöèè î ñîñòîÿíèè "ìûøè" ôóíêöèÿ 37
214
// ïîëó÷åíèå èíôîðìàöèè î ñîñòîÿíèè "ìûøè" function 37
213
void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
215
void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
214
// ôóíêöèÿ 40 óñòàíîâèòü ìàñêó ñîáûòèé
216
// function 38
-
 
217
void kos_DrawLine( Word x1, Word y1, Word x2, Word y2, Dword colour, Dword invert );
-
 
218
// function 40 óñòàíîâèòü ìàñêó ñîáûòèé
215
void kos_SetMaskForEvents( Dword mask );
219
void kos_SetMaskForEvents( Dword mask );
216
// ôóíêöèÿ 47 âûâåñòè â îêíî ïðèëîæåíèÿ ÷èñëî
220
// function 47 âûâåñòè â îêíî ïðèëîæåíèÿ ÷èñëî
217
void kos_DisplayNumberToWindow(
221
void kos_DisplayNumberToWindow(
218
   Dword value,
222
   Dword value,
219
   Dword digitsNum,
223
   Dword digitsNum,
220
   Word x,
224
   Word x,
221
   Word y,
225
   Word y,
222
   Dword colour,
226
   Dword colour,
223
   eNumberBase nBase = nbDecimal,
227
   eNumberBase nBase = nbDecimal,
224
   bool valueIsPointer = false
228
   bool valueIsPointer = false
225
   );
229
   );
226
// ôóíêöèÿ 58 äîñòóï ê ôàéëîâîé ñèñòåìå
230
// function 58 äîñòóï ê ôàéëîâîé ñèñòåìå
227
Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
231
Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
228
// ôóíêöèÿ 63
232
// function 63
229
void kos_DebugOutChar( char ccc );
233
void kos_DebugOutChar( char ccc );
230
//
234
//
231
void rtlDebugOutString( char *str );
235
void rtlDebugOutString( char *str );
232
// ôóíêöèÿ 64 èçìåíèòü ïàðàìåòðû îêíà, ïàðàìåòð == -1 íå ìåíÿåòñÿ
236
//
-
 
237
void kos_DebugValue(char *str, int n);
-
 
238
// function 64 èçìåíèòü ïàðàìåòðû îêíà, ïàðàìåòð == -1 íå ìåíÿåòñÿ
233
void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY );
239
void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY );
234
// ôóíêöèÿ 67 èçìåíåíèå êîëè÷åñòâà ïàìÿòè, âûäåëåííîé äëÿ ïðîãðàììû
240
// function 67 èçìåíåíèå êîëè÷åñòâà ïàìÿòè, âûäåëåííîé äëÿ ïðîãðàììû
235
bool kos_ApplicationMemoryResize( Dword targetSize );
241
bool kos_ApplicationMemoryResize( Dword targetSize );
236
// ôóíêöèÿ 66 ðåæèì ïîëó÷åíèÿ äàííûõ îò êëàâèàòóðû
242
// function 66 ðåæèì ïîëó÷åíèÿ äàííûõ îò êëàâèàòóðû
237
void kos_SetKeyboardDataMode( Dword mode );
243
void kos_SetKeyboardDataMode( Dword mode );
238
 
244
 
239
void kos_InitHeap();
245
void kos_InitHeap();
240
 
246
 
241
//
247
//
242
void kos_Main();
248
void kos_Main();
243
 
249
 
244
extern>
250
extern>