Subversion Repositories Kolibri OS

Rev

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

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