Subversion Repositories Kolibri OS

Rev

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

Rev 2753 Rev 7495
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
#define EM_WINDOW_REDRAW		1
15
#define EM_WINDOW_REDRAW		1
16
#define EM_KEY_PRESS			2
16
#define EM_KEY_PRESS			2
17
#define EM_BUTTON_CLICK			4
17
#define EM_BUTTON_CLICK			4
18
#define EM_APP_CLOSE			8
18
#define EM_APP_CLOSE			8
19
#define EM_DRAW_BACKGROUND		16
19
#define EM_DRAW_BACKGROUND		16
20
#define EM_MOUSE_EVENT			32
20
#define EM_MOUSE_EVENT			32
21
#define EM_IPC					64
21
#define EM_IPC					64
22
#define EM_NETWORK				256
22
#define EM_NETWORK				256
23
 
23
 
24
#define KM_CHARS				0
24
#define KM_CHARS				0
25
#define KM_SCANS				1
25
#define KM_SCANS				1
26
 
26
 
27
#define WRS_BEGIN				1
27
#define WRS_BEGIN				1
28
#define WRS_END					2
28
#define WRS_END					2
29
 
29
 
30
#define PROCESS_ID_SELF			-1
30
#define PROCESS_ID_SELF			-1
31
 
31
 
32
#define abs(a) (a<0?0-a:a)
32
#define abs(a) (a<0?0-a:a)
33
 
33
 
34
extern "C" double __cdecl acos(double x);
34
extern "C" double __cdecl acos(double x);
35
extern "C" double __cdecl asin(double x);
35
extern "C" double __cdecl asin(double x);
36
extern "C" double __cdecl floor(double x);
36
extern "C" double __cdecl floor(double x);
37
extern "C" double __cdecl round(double x);
37
extern "C" double __cdecl round(double x);
38
#pragma function(acos,asin)
38
#pragma function(acos,asin)
39
#if _MSC_VER > 1200
39
#if _MSC_VER > 1200
40
#pragma function(floor)
40
#pragma function(floor)
41
#endif
41
#endif
42
 
42
 
43
 
43
 
44
struct kosFileInfo
44
struct kosFileInfo
45
{
45
{
46
	Dword rwMode;
46
	Dword rwMode;
47
	Dword OffsetLow;
47
	Dword OffsetLow;
48
	Dword OffsetHigh;
48
	Dword OffsetHigh;
49
	Dword dataCount;
49
	Dword dataCount;
50
	Byte *bufferPtr;
50
	Byte *bufferPtr;
51
	char fileURL[MAX_PATH];
51
	char fileURL[MAX_PATH];
52
};
52
};
53
 
53
 
54
 
54
 
55
struct RGB
55
struct RGB
56
{
56
{
57
	Byte b;
57
	Byte b;
58
	Byte g;
58
	Byte g;
59
	Byte r;
59
	Byte r;
60
	//
60
	//
61
	RGB() {};
61
	RGB() {};
62
	//
62
	//
63
	RGB( Dword value )
63
	RGB( Dword value )
64
	{
64
	{
65
		r = (Byte)(value >> 16);
65
		r = (Byte)(value >> 16);
66
		g = (Byte)(value >> 8);
66
		g = (Byte)(value >> 8);
67
		b = (Byte)value;
67
		b = (Byte)value;
68
	};
68
	};
69
	//
69
	//
70
	bool operator != ( RGB &another )
70
	bool operator != ( RGB &another )
71
	{
71
	{
72
		return this->b != another.b || this->g != another.g || this->r != another.r;
72
		return this->b != another.b || this->g != another.g || this->r != another.r;
73
	};
73
	};
74
	//
74
	//
75
	bool operator == ( RGB &another )
75
	bool operator == ( RGB &another )
76
	{
76
	{
77
		return this->b == another.b && this->g == another.g && this->r == another.r;
77
		return this->b == another.b && this->g == another.g && this->r == another.r;
78
	};
78
	};
79
};
79
};
80
 
80
 
81
 
81
 
82
#pragma pack(push, 1)
82
#pragma pack(push, 1)
83
union sProcessInfo
83
union sProcessInfo
84
{
84
{
85
	Byte rawData[1024];
85
	Byte rawData[1024];
86
	struct
86
	struct
87
	{
87
	{
88
		Dword cpu_usage;
88
		Dword cpu_usage;
89
		Word window_stack_position;
89
		Word window_stack_position;
90
		Word window_stack_value;
90
		Word window_stack_value;
91
		Word reserved1;
91
		Word reserved1;
92
		char process_name[12];
92
		char process_name[12];
93
		Dword memory_start;
93
		Dword memory_start;
94
		Dword used_memory;
94
		Dword used_memory;
95
		Dword PID;
95
		Dword PID;
96
		Dword x_start;
96
		Dword x_start;
97
		Dword y_start;
97
		Dword y_start;
98
		Dword x_size;
98
		Dword x_size;
99
		Dword y_size;
99
		Dword y_size;
100
		Word slot_state;
100
		Word slot_state;
101
	} processInfo;
101
	} processInfo;
102
};
102
};
103
#pragma pack(pop)
103
#pragma pack(pop)
104
 
104
 
105
#ifndef AUTOBUILD
105
#ifndef AUTOBUILD
106
//
106
//
107
extern char *kosExePath;
107
extern char *kosExePath;
108
#endif
108
#endif
109
 
109
 
110
//
110
//
111
void crtStartUp();
111
void crtStartUp();
112
//
112
//
113
int __cdecl _purecall();
113
int __cdecl _purecall();
114
//
114
//
115
int __cdecl atexit( void (__cdecl *func )( void ));
115
int __cdecl atexit( void (__cdecl *func )( void ));
116
//
116
//
117
void rtlSrand( Dword seed );
117
void rtlSrand( Dword seed );
118
Dword rtlRand( void );
118
Dword rtlRand( void );
119
//
119
//
120
char * __cdecl strcpy( char *target, const char *source );
120
char * __cdecl strcpy( char *target, const char *source );
121
int __cdecl strlen( const char *line );
121
int __cdecl strlen( const char *line );
122
char * __cdecl strrchr( const char * string, int c );
122
char * __cdecl strrchr( const char * string, int c );
123
 
123
 
-
 
124
/*
124
#if _MSC_VER < 1400
125
#if _MSC_VER < 1400
125
extern "C" void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
126
extern "C" void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
126
extern "C" void memset( Byte *dst, Byte filler, Dword count );
127
extern "C" void memset( Byte *dst, Byte filler, Dword count );
127
//#pragma intrinsic(memcpy,memset)
128
//#pragma intrinsic(memcpy,memset)
128
#elif defined AUTOBUILD
129
#elif defined AUTOBUILD
129
void memcpy( void *dst, const void *src, size_t bytesCount );
130
*/
-
 
131
void memcpy( void *dst, const void *src, size_t bytesCount );
130
void memset( Byte *dst, Byte filler, Dword count );
132
void memset( Byte *dst, Byte filler, Dword count );
131
#else
133
/*
-
 
134
#else
132
void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
135
void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
133
void memset( Byte *dst, Byte filler, Dword count );
136
void memset( Byte *dst, Byte filler, Dword count );
134
#endif
137
#endif
135
 
138
*/
-
 
139
 
136
void sprintf( char *Str, char* Format, ... );
140
void sprintf( char *Str, char* Format, ... );
137
//
141
//
138
Dword rtlInterlockedExchange( Dword *target, Dword value );
142
Dword rtlInterlockedExchange( Dword *target, Dword value );
139
// ôóíêöèÿ -1 çàâåðøåíèÿ ïðîöåññà
143
// ôóíêöèÿ -1 çàâåðøåíèÿ ïðîöåññà
140
void kos_ExitApp();
144
void kos_ExitApp();
141
// ôóíêöèÿ 0
145
// ôóíêöèÿ 0
142
void kos_DefineAndDrawWindow(
146
void kos_DefineAndDrawWindow(
143
	Word x, Word y,
147
	Word x, Word y,
144
	Word sizeX, Word sizeY,
148
	Word sizeX, Word sizeY,
145
	Byte mainAreaType, Dword mainAreaColour,
149
	Byte mainAreaType, Dword mainAreaColour,
146
	Byte headerType, Dword headerColour,
150
	Byte headerType, Dword headerColour,
147
	Dword borderColour
151
	Dword borderColour
148
	);
152
	);
149
// ôóíêöèÿ 1 ïîñòàâèòü òî÷êó
153
// ôóíêöèÿ 1 ïîñòàâèòü òî÷êó
150
void kos_PutPixel( Dword x, Dword y, Dword colour );
154
void kos_PutPixel( Dword x, Dword y, Dword colour );
151
// ôóíêöèÿ 2 ïîëó÷èòü êîä íàæàòîé êëàâèøè
155
// ôóíêöèÿ 2 ïîëó÷èòü êîä íàæàòîé êëàâèøè
152
bool kos_GetKey( Byte &keyCode );
156
bool kos_GetKey( Byte &keyCode );
153
// ôóíêöèÿ 3 ïîëó÷èòü âðåìÿ
157
// ôóíêöèÿ 3 ïîëó÷èòü âðåìÿ
154
Dword kos_GetSystemClock();
158
Dword kos_GetSystemClock();
155
// ôóíêöèÿ 4
159
// ôóíêöèÿ 4
156
void __declspec(noinline) kos_WriteTextToWindow(
160
void __declspec(noinline) kos_WriteTextToWindow(
157
	Word x, Word y,
161
	Word x, Word y,
158
	Byte fontType,
162
	Byte fontType,
159
	Dword textColour,
163
	Dword textColour,
160
	char *textPtr,
164
	char *textPtr,
161
	Dword textLen
165
	Dword textLen
162
	);
166
	);
163
// ôóíêöèÿ 7 íàðèñîâàòü èçîáðàæåíèå
167
// ôóíêöèÿ 7 íàðèñîâàòü èçîáðàæåíèå
164
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
168
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
165
// ôóíêöèÿ 8 îïðåäåëèòü êíîïêó
169
// ôóíêöèÿ 8 îïðåäåëèòü êíîïêó
166
void __declspec(noinline) kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
170
void __declspec(noinline) kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
167
// ôóíêöèÿ 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû
171
// ôóíêöèÿ 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû
168
void kos_Pause( Dword value );
172
void kos_Pause( Dword value );
169
// ôóíêöèÿ 9 - èíôîðìàöèÿ î ïðîöåññå
173
// ôóíêöèÿ 9 - èíôîðìàöèÿ î ïðîöåññå
170
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
174
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
171
// ôóíêöèÿ 10
175
// ôóíêöèÿ 10
172
Dword kos_WaitForEvent();
176
Dword kos_WaitForEvent();
173
// ôóíêöèÿ 11
177
// ôóíêöèÿ 11
174
Dword kos_CheckForEvent();
178
Dword kos_CheckForEvent();
175
// ôóíêöèÿ 12
179
// ôóíêöèÿ 12
176
void kos_WindowRedrawStatus( Dword status );
180
void kos_WindowRedrawStatus( Dword status );
177
// ôóíêöèÿ 13 íàðèñîâàòü ïîëîñó
181
// ôóíêöèÿ 13 íàðèñîâàòü ïîëîñó
178
void __declspec(noinline) kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
182
void __declspec(noinline) kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
179
// ôóíêöèÿ 17
183
// ôóíêöèÿ 17
180
bool kos_GetButtonID( Dword &buttonID );
184
bool kos_GetButtonID( Dword &buttonID );
181
// ôóíêöèÿ 23
185
// ôóíêöèÿ 23
182
Dword kos_WaitForEventTimeout( Dword timeOut );
186
Dword kos_WaitForEventTimeout( Dword timeOut );
183
//
187
//
184
enum eNumberBase
188
enum eNumberBase
185
{
189
{
186
	nbDecimal = 0,
190
	nbDecimal = 0,
187
	nbHex,
191
	nbHex,
188
	nbBin
192
	nbBin
189
};
193
};
190
// ïîëó÷åíèå èíôîðìàöèè î ñîñòîÿíèè "ìûøè" ôóíêöèÿ 37
194
// ïîëó÷åíèå èíôîðìàöèè î ñîñòîÿíèè "ìûøè" ôóíêöèÿ 37
191
void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
195
void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
192
// ôóíêöèÿ 40 óñòàíîâèòü ìàñêó ñîáûòèé
196
// ôóíêöèÿ 40 óñòàíîâèòü ìàñêó ñîáûòèé
193
void kos_SetMaskForEvents( Dword mask );
197
void kos_SetMaskForEvents( Dword mask );
194
// ôóíêöèÿ 47 âûâåñòè â îêíî ïðèëîæåíèÿ ÷èñëî
198
// ôóíêöèÿ 47 âûâåñòè â îêíî ïðèëîæåíèÿ ÷èñëî
195
void kos_DisplayNumberToWindow(
199
void kos_DisplayNumberToWindow(
196
   Dword value,
200
   Dword value,
197
   Dword digitsNum,
201
   Dword digitsNum,
198
   Word x,
202
   Word x,
199
   Word y,
203
   Word y,
200
   Dword colour,
204
   Dword colour,
201
   eNumberBase nBase = nbDecimal,
205
   eNumberBase nBase = nbDecimal,
202
   bool valueIsPointer = false
206
   bool valueIsPointer = false
203
   );
207
   );
204
// ôóíêöèÿ 58 äîñòóï ê ôàéëîâîé ñèñòåìå
208
// ôóíêöèÿ 58 äîñòóï ê ôàéëîâîé ñèñòåìå
205
Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
209
Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
206
// ôóíêöèÿ 63
210
// ôóíêöèÿ 63
207
void kos_DebugOutChar( char ccc );
211
void kos_DebugOutChar( char ccc );
208
//
212
//
209
void rtlDebugOutString( char *str );
213
void rtlDebugOutString( char *str );
210
// ôóíêöèÿ 64 èçìåíèòü ïàðàìåòðû îêíà, ïàðàìåòð == -1 íå ìåíÿåòñÿ
214
// ôóíêöèÿ 64 èçìåíèòü ïàðàìåòðû îêíà, ïàðàìåòð == -1 íå ìåíÿåòñÿ
211
void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY );
215
void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY );
212
// ôóíêöèÿ 67 èçìåíåíèå êîëè÷åñòâà ïàìÿòè, âûäåëåííîé äëÿ ïðîãðàììû
216
// ôóíêöèÿ 67 èçìåíåíèå êîëè÷åñòâà ïàìÿòè, âûäåëåííîé äëÿ ïðîãðàììû
213
bool kos_ApplicationMemoryResize( Dword targetSize );
217
bool kos_ApplicationMemoryResize( Dword targetSize );
214
// ôóíêöèÿ 66 ðåæèì ïîëó÷åíèÿ äàííûõ îò êëàâèàòóðû
218
// ôóíêöèÿ 66 ðåæèì ïîëó÷åíèÿ äàííûõ îò êëàâèàòóðû
215
void kos_SetKeyboardDataMode( Dword mode );
219
void kos_SetKeyboardDataMode( Dword mode );
216
 
220
 
217
void kos_InitHeap();
221
void kos_InitHeap();
218
 
222
 
219
//
223
//
220
void kos_Main();
224
void kos_Main();
221
 
225
 
222
extern>
226
extern>