Subversion Repositories Kolibri OS

Rev

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

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