Subversion Repositories Kolibri OS

Rev

Rev 7495 | Rev 7500 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
990 barsuk 1
 
2
3
 
4
typedef unsigned __int16 Word;
5
typedef unsigned __int8 Byte;
6
//typedef unsigned __int32 size_t;
7
8
 
9
10
 
11
12
 
13
#define FO_WRITE				2
14
15
 
7498 leency 16
#define EM_WINDOW_REDRAW		1
990 barsuk 17
#define EM_KEY_PRESS			2
18
#define EM_BUTTON_CLICK			3
7498 leency 19
#define EM_APP_CLOSE			4
20
#define EM_DRAW_BACKGROUND		5
21
#define EM_MOUSE_EVENT			6
22
#define EM_IPC					7
23
#define EM_NETWORK				8
24
#define EM_DEBUG				9
25
990 barsuk 26
 
7498 leency 27
#define EVM_REDRAW        1
28
#define EVM_KEY           2
29
#define EVM_BUTTON        4
30
#define EVM_EXIT          8
31
#define EVM_BACKGROUND    16
32
#define EVM_MOUSE         32
33
#define EVM_IPC           64
34
#define EVM_STACK         128
35
#define EVM_DEBUG         256
36
#define EVM_STACK2        512
37
#define EVM_MOUSE_FILTER  0x80000000
38
#define EVM_CURSOR_FILTER 0x40000000
39
40
 
41
#define BT_DEL      0x80000000
42
#define BT_HIDE     0x40000000
43
#define BT_NOFRAME  0x20000000
44
#define BT_NODRAW   BT_HIDE+BT_NOFRAME
45
46
 
990 barsuk 47
#define KM_SCANS				1
48
49
 
50
#define WRS_END					2
51
52
 
53
54
 
55
56
 
1764 clevermous 57
extern "C" double __cdecl asin(double x);
58
extern "C" double __cdecl floor(double x);
59
extern "C" double __cdecl round(double x);
60
#pragma function(acos,asin)
990 barsuk 61
#if _MSC_VER > 1200
62
#pragma function(floor)
63
#endif
64
65
 
66
 
67
{
68
	Dword rwMode;
69
	Dword OffsetLow;
70
	Dword OffsetHigh;
71
	Dword dataCount;
72
	Byte *bufferPtr;
73
	char fileURL[MAX_PATH];
74
};
75
76
 
77
 
78
{
79
	Byte b;
80
	Byte g;
81
	Byte r;
82
	//
83
	RGB() {};
84
	//
85
	RGB( Dword value )
86
	{
87
		r = (Byte)(value >> 16);
88
		g = (Byte)(value >> 8);
89
		b = (Byte)value;
90
	};
91
	//
92
	bool operator != ( RGB &another )
93
	{
94
		return this->b != another.b || this->g != another.g || this->r != another.r;
95
	};
96
	//
97
	bool operator == ( RGB &another )
98
	{
99
		return this->b == another.b && this->g == another.g && this->r == another.r;
100
	};
101
};
102
103
 
104
 
2753 clevermous 105
union sProcessInfo
990 barsuk 106
{
107
	Byte rawData[1024];
108
	struct
109
	{
110
		Dword cpu_usage;
111
		Word window_stack_position;
112
		Word window_slot; //slot
7498 leency 113
		Word reserved1;
990 barsuk 114
		char process_name[12];
115
		Dword memory_start;
116
		Dword used_memory;
117
		Dword PID;
118
		Dword x_start;
119
		Dword y_start;
120
		Dword width;
7498 leency 121
		Dword height;
122
		Word slot_state;
990 barsuk 123
		Word reserved3;
7498 leency 124
		Dword work_left;
125
		Dword work_top;
126
		Dword work_width;
127
		Dword work_height;
128
		char status_window;
129
		Dword cwidth;
130
		Dword cheight;
131
	} processInfo;
990 barsuk 132
};
133
#pragma pack(pop)
2753 clevermous 134
990 barsuk 135
 
1764 clevermous 136
//
990 barsuk 137
extern char *kosExePath;
138
#endif
1764 clevermous 139
990 barsuk 140
 
141
void crtStartUp();
142
//
143
int __cdecl _purecall();
144
//
145
int __cdecl atexit( void (__cdecl *func )( void ));
146
//
147
void rtlSrand( Dword seed );
148
Dword rtlRand( void );
149
//
150
char * __cdecl strcpy( char *target, const char *source );
151
int __cdecl strlen( const char *line );
152
char * __cdecl strrchr( const char * string, int c );
153
154
 
7495 leency 155
#if _MSC_VER < 1400
990 barsuk 156
extern "C" void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
157
extern "C" void memset( Byte *dst, Byte filler, Dword count );
158
//#pragma intrinsic(memcpy,memset)
159
#elif defined AUTOBUILD
1764 clevermous 160
*/
7495 leency 161
void memcpy( void *dst, const void *src, size_t bytesCount );
1764 clevermous 162
void memset( Byte *dst, Byte filler, Dword count );
163
/*
7495 leency 164
#else
990 barsuk 165
void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
166
void memset( Byte *dst, Byte filler, Dword count );
167
#endif
168
*/
7495 leency 169
990 barsuk 170
 
171
//
172
Dword rtlInterlockedExchange( Dword *target, Dword value );
173
// функция -1 завершения процесса
174
void kos_ExitApp();
175
// функция 0
176
void kos_DefineAndDrawWindow(
177
	Word x, Word y,
178
	Word sizeX, Word sizeY,
179
	Byte mainAreaType, Dword mainAreaColour,
180
	Byte headerType, Dword headerColour,
181
	Dword borderColour
182
	);
183
// функция 1 поставить точку
184
void kos_PutPixel( Dword x, Dword y, Dword colour );
185
// функция 2 получить код нажатой клавиши
186
bool kos_GetKey( Byte &keyCode );
187
// функция 3 получить время
188
Dword kos_GetSystemClock();
189
// функция 4
190
void __declspec(noinline) kos_WriteTextToWindow(
1764 clevermous 191
	Word x, Word y,
990 barsuk 192
	Byte fontType,
193
	Dword textColour,
194
	char *textPtr,
195
	Dword textLen
196
	);
197
// функция 7 нарисовать изображение
198
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
199
// функция 8 определить кнопку
200
void __declspec(noinline) kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
1764 clevermous 201
// функция 5 пауза, в сотых долях секунды
990 barsuk 202
void kos_Pause( Dword value );
203
// функция 9 - информация о процессе
204
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
205
// функция 10
206
Dword kos_WaitForEvent();
207
// функция 11
208
Dword kos_CheckForEvent();
209
// функция 12
210
void kos_WindowRedrawStatus( Dword status );
211
// функция 13 нарисовать полосу
212
void __declspec(noinline) kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
1764 clevermous 213
// функция 17
990 barsuk 214
bool kos_GetButtonID( Dword &buttonID );
215
// функция 23
216
Dword kos_WaitForEventTimeout( Dword timeOut );
2750 leency 217
//
990 barsuk 218
enum eNumberBase
219
{
220
	nbDecimal = 0,
221
	nbHex,
222
	nbBin
223
};
224
// получение информации о состоянии "мыши" функция 37
225
void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
226
// функция 40 установить маску событий
227
void kos_SetMaskForEvents( Dword mask );
228
// функция 47 вывести в окно приложения число
229
void kos_DisplayNumberToWindow(
230
   Dword value,
231
   Dword digitsNum,
232
   Word x,
233
   Word y,
234
   Dword colour,
235
   eNumberBase nBase = nbDecimal,
236
   bool valueIsPointer = false
237
   );
238
// функция 58 доступ к файловой системе
239
Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
240
// функция 63
241
void kos_DebugOutChar( char ccc );
242
//
243
void rtlDebugOutString( char *str );
244
// функция 64 изменить параметры окна, параметр == -1 не меняется
245
void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY );
246
// функция 67 изменение количества памяти, выделенной для программы
247
bool kos_ApplicationMemoryResize( Dword targetSize );
248
// функция 66 режим получения данных от клавиатуры
249
void kos_SetKeyboardDataMode( Dword mode );
250
251
 
252
253
 
254
void kos_Main();
255