Subversion Repositories Kolibri OS

Rev

Rev 1764 | Details | Compare with Previous | Last modification | View Log | RSS feed

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