Subversion Repositories Kolibri OS

Rev

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

Rev 968 Rev 969
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 kos_ExitApp();
131
void kos_ExitApp();
132
// ôóíêöèÿ 0
132
// ôóíêöèÿ 0
133
void kos_DefineAndDrawWindow(
133
void 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 kos_GetSystemClock();
145
Dword kos_GetSystemClock();
146
// ôóíêöèÿ 4
146
// ôóíêöèÿ 4
147
void kos_WriteTextToWindow(
147
void kos_WriteTextToWindow(
148
	Word x, Word y,
148
	Word x, Word y,
149
	Byte fontType,
149
	Byte fontType,
150
	Dword textColour,
150
	Dword textColour,
151
	char *textPtr,
151
	char *textPtr,
152
	Dword textLen
152
	Dword textLen
153
	);
153
	);
154
// ôóíêöèÿ 7 íàðèñîâàòü èçîáðàæåíèå
154
// ôóíêöèÿ 7 íàðèñîâàòü èçîáðàæåíèå
155
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
155
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
156
// ôóíêöèÿ 8 îïðåäåëèòü êíîïêó
156
// ôóíêöèÿ 8 îïðåäåëèòü êíîïêó
157
void kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
157
void kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
158
// ôóíêöèÿ 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû
158
// ôóíêöèÿ 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû
159
void kos_Pause( Dword value );
159
void kos_Pause( Dword value );
160
// ôóíêöèÿ 9 - èíôîðìàöèÿ î ïðîöåññå
160
// ôóíêöèÿ 9 - èíôîðìàöèÿ î ïðîöåññå
161
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
161
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
162
// ôóíêöèÿ 10
162
// ôóíêöèÿ 10
163
Dword kos_WaitForEvent();
163
Dword kos_WaitForEvent();
164
// ôóíêöèÿ 11
164
// ôóíêöèÿ 11
165
Dword kos_CheckForEvent();
165
Dword kos_CheckForEvent();
166
// ôóíêöèÿ 12
166
// ôóíêöèÿ 12
167
void kos_WindowRedrawStatus( Dword status );
167
void kos_WindowRedrawStatus( Dword status );
168
// ôóíêöèÿ 13 íàðèñîâàòü ïîëîñó
168
// ôóíêöèÿ 13 íàðèñîâàòü ïîëîñó
169
void kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
169
void kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
170
// ôóíêöèÿ 17
170
// ôóíêöèÿ 17
171
bool kos_GetButtonID( Dword &buttonID );
171
bool kos_GetButtonID( Dword &buttonID );
172
// ôóíêöèÿ 23
172
// ôóíêöèÿ 23
173
Dword kos_WaitForEvent( Dword timeOut );
173
Dword kos_WaitForEvent( Dword timeOut );
174
//
174
//
175
enum eNumberBase
175
enum eNumberBase
176
{
176
{
177
	nbDecimal = 0,
177
	nbDecimal = 0,
178
	nbHex,
178
	nbHex,
179
	nbBin
179
	nbBin
180
};
180
};
181
// ïîëó÷åíèå èíôîðìàöèè î ñîñòîÿíèè "ìûøè" ôóíêöèÿ 37
181
// ïîëó÷åíèå èíôîðìàöèè î ñîñòîÿíèè "ìûøè" ôóíêöèÿ 37
182
void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
182
void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
183
// ôóíêöèÿ 40 óñòàíîâèòü ìàñêó ñîáûòèé
183
// ôóíêöèÿ 40 óñòàíîâèòü ìàñêó ñîáûòèé
184
void kos_SetMaskForEvents( Dword mask );
184
void kos_SetMaskForEvents( Dword mask );
185
// ôóíêöèÿ 47 âûâåñòè â îêíî ïðèëîæåíèÿ ÷èñëî
185
// ôóíêöèÿ 47 âûâåñòè â îêíî ïðèëîæåíèÿ ÷èñëî
186
void kos_DisplayNumberToWindow(
186
void kos_DisplayNumberToWindow(
187
   Dword value,
187
   Dword value,
188
   Dword digitsNum,
188
   Dword digitsNum,
189
   Word x,
189
   Word x,
190
   Word y,
190
   Word y,
191
   Dword colour,
191
   Dword colour,
192
   eNumberBase nBase = nbDecimal,
192
   eNumberBase nBase = nbDecimal,
193
   bool valueIsPointer = false
193
   bool valueIsPointer = false
194
   );
194
   );
-
 
195
// ôóíêöèÿ 48.4 ïîëó÷èòü âûñîòó ñêèíà
-
 
196
Dword kos_GetSkinWidth();
195
// ôóíêöèÿ 58 äîñòóï ê ôàéëîâîé ñèñòåìå
197
// ôóíêöèÿ 58 äîñòóï ê ôàéëîâîé ñèñòåìå
196
Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
198
Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
197
// ôóíêöèÿ 63
199
// ôóíêöèÿ 63
198
void kos_DebugOutChar( char ccc );
200
void kos_DebugOutChar( char ccc );
199
//
201
//
200
void rtlDebugOutString( char *str );
202
void rtlDebugOutString( char *str );
201
// ôóíêöèÿ 64 èçìåíèòü ïàðàìåòðû îêíà, ïàðàìåòð == -1 íå ìåíÿåòñÿ
203
// ôóíêöèÿ 64 èçìåíèòü ïàðàìåòðû îêíà, ïàðàìåòð == -1 íå ìåíÿåòñÿ
202
void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY );
204
void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY );
203
// ôóíêöèÿ 67 èçìåíåíèå êîëè÷åñòâà ïàìÿòè, âûäåëåííîé äëÿ ïðîãðàììû
205
// ôóíêöèÿ 67 èçìåíåíèå êîëè÷åñòâà ïàìÿòè, âûäåëåííîé äëÿ ïðîãðàììû
204
bool kos_ApplicationMemoryResize( Dword targetSize );
206
bool kos_ApplicationMemoryResize( Dword targetSize );
205
// ôóíêöèÿ 66 ðåæèì ïîëó÷åíèÿ äàííûõ îò êëàâèàòóðû
207
// ôóíêöèÿ 66 ðåæèì ïîëó÷åíèÿ äàííûõ îò êëàâèàòóðû
206
void kos_SetKeyboardDataMode( Dword mode );
208
void kos_SetKeyboardDataMode( Dword mode );
207
 
209
 
208
//
210
//
209
void kos_Main();
211
void kos_Main();
210
 
212
 
211
extern>
213
extern>