Subversion Repositories Kolibri OS

Rev

Rev 1764 | Go to most recent revision | Details | 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
 
35
extern "C" double asin(double x);
36
extern "C" double floor(double x);
37
extern "C" double round(double x);
38
#pragma function(acos,asin)
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
 
83
{
84
	Byte rawData[1024];
85
	struct
86
	{
87
		Dword cpu_usage;
88
		Word window_stack_position;
89
		Word window_stack_value;
90
		Word reserved1;
91
		char process_name[12];
92
		Dword memory_start;
93
		Dword used_memory;
94
		Dword PID;
95
		Dword x_start;
96
		Dword y_start;
97
		Dword x_size;
98
		Dword y_size;
99
		Word slot_state;
100
	} processInfo;
101
};
102
103
 
104
extern char *kosExePath;
105
106
 
107
void crtStartUp();
108
//
109
int __cdecl _purecall();
110
//
111
int __cdecl atexit( void (__cdecl *func )( void ));
112
//
113
void rtlSrand( Dword seed );
114
Dword rtlRand( void );
115
//
116
char * __cdecl strcpy( char *target, const char *source );
117
int __cdecl strlen( const char *line );
118
char * __cdecl strrchr( const char * string, int c );
119
120
 
121
//extern "C" void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
122
//extern "C" void memset( Byte *dst, Byte filler, Dword count );
123
//#pragma intrinsic(memcpy,memset)
124
#else
125
void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
126
void memset( Byte *dst, Byte filler, Dword count );
127
#endif
128
129
 
130
//
131
Dword rtlInterlockedExchange( Dword *target, Dword value );
132
// функция -1 завершения процесса
133
void kos_ExitApp();
134
// функция 0
135
void kos_DefineAndDrawWindow(
136
	Word x, Word y,
137
	Word sizeX, Word sizeY,
138
	Byte mainAreaType, Dword mainAreaColour,
139
	Byte headerType, Dword headerColour,
140
	Dword borderColour
141
	);
142
// функция 1 поставить точку
143
void kos_PutPixel( Dword x, Dword y, Dword colour );
144
// функция 2 получить код нажатой клавиши
145
bool kos_GetKey( Byte &keyCode );
146
// функция 3 получить время
147
Dword kos_GetSystemClock();
148
// функция 4
149
void kos_WriteTextToWindow(
150
	Word x, Word y,
151
	Byte fontType,
152
	Dword textColour,
153
	char *textPtr,
154
	Dword textLen
155
	);
156
// функция 7 нарисовать изображение
157
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
158
// функция 8 определить кнопку
159
void kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
160
// функция 5 пауза, в сотых долях секунды
161
void kos_Pause( Dword value );
162
// функция 9 - информация о процессе
163
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
164
// функция 10
165
Dword kos_WaitForEvent();
166
// функция 11
167
Dword kos_CheckForEvent();
168
// функция 12
169
void kos_WindowRedrawStatus( Dword status );
170
// функция 13 нарисовать полосу
171
void kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
172
// функция 17
173
bool kos_GetButtonID( Dword &buttonID );
174
// функция 23
175
Dword kos_WaitForEvent( Dword timeOut );
176
//
177
enum eNumberBase
178
{
179
	nbDecimal = 0,
180
	nbHex,
181
	nbBin
182
};
183
// получение информации о состоянии "мыши" функция 37
184
void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
185
// функция 40 установить маску событий
186
void kos_SetMaskForEvents( Dword mask );
187
// функция 47 вывести в окно приложения число
188
void kos_DisplayNumberToWindow(
189
   Dword value,
190
   Dword digitsNum,
191
   Word x,
192
   Word y,
193
   Dword colour,
194
   eNumberBase nBase = nbDecimal,
195
   bool valueIsPointer = false
196
   );
197
// функция 58 доступ к файловой системе
198
Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
199
// функция 63
200
void kos_DebugOutChar( char ccc );
201
//
202
void rtlDebugOutString( char *str );
203
// функция 64 изменить параметры окна, параметр == -1 не меняется
204
void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY );
205
// функция 67 изменение количества памяти, выделенной для программы
206
bool kos_ApplicationMemoryResize( Dword targetSize );
207
// функция 66 режим получения данных от клавиатуры
208
void kos_SetKeyboardDataMode( Dword mode );
209
210
 
211
212
 
213
void kos_Main();
214