Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
968 leency 1
typedef unsigned __int32 Dword;
2
typedef unsigned __int16 Word;
3
typedef unsigned __int8 Byte;
4
//typedef unsigned __int32 size_t;
5
 
6
#define NULL 0
7
 
8
#define MAX_PATH				256
9
 
10
#define FO_READ					0
11
#define FO_WRITE				2
12
 
13
#define EM_WINDOW_REDRAW		1
14
#define EM_KEY_PRESS			2
15
#define EM_BUTTON_CLICK			4
16
#define EM_APP_CLOSE			8
17
#define EM_DRAW_BACKGROUND		16
18
#define EM_MOUSE_EVENT			32
19
#define EM_IPC					64
20
#define EM_NETWORK				256
21
 
22
#define KM_CHARS				0
23
#define KM_SCANS				1
24
 
25
#define WRS_BEGIN				1
26
#define WRS_END					2
27
 
28
#define PROCESS_ID_SELF			-1
29
 
30
#define abs(a) (a<0?0-a:a)
31
 
32
extern "C" double acos(double x);
33
extern "C" double asin(double x);
34
extern "C" double floor(double x);
35
extern "C" double round(double x);
36
#pragma function(acos,asin)
37
#if _MSC_VER > 1200
38
#pragma function(floor)
39
#endif
40
 
41
 
42
struct kosFileInfo
43
{
44
	Dword rwMode;
45
	Dword OffsetLow;
46
	Dword OffsetHigh;
47
	Dword dataCount;
48
	Byte *bufferPtr;
49
	char fileURL[MAX_PATH];
50
};
51
 
52
 
53
struct RGB
54
{
55
	Byte b;
56
	Byte g;
57
	Byte r;
58
	//
59
	RGB() {};
60
	//
61
	RGB( Dword value )
62
	{
63
		r = (Byte)(value >> 16);
64
		g = (Byte)(value >> 8);
65
		b = (Byte)value;
66
	};
67
	//
68
	bool operator != ( RGB &another )
69
	{
70
		return this->b != another.b || this->g != another.g || this->r != another.r;
71
	};
72
	//
73
	bool operator == ( RGB &another )
74
	{
75
		return this->b == another.b && this->g == another.g && this->r == another.r;
76
	};
77
};
78
 
79
 
80
union sProcessInfo
81
{
82
	Byte rawData[1024];
83
	struct
84
	{
85
		Dword cpu_usage;
86
		Word window_stack_position;
87
		Word window_stack_value;
88
		Word reserved1;
89
		char process_name[12];
90
		Dword memory_start;
91
		Dword used_memory;
92
		Dword PID;
93
		Dword x_start;
94
		Dword y_start;
95
		Dword x_size;
96
		Dword y_size;
97
		Word slot_state;
98
	} processInfo;
99
};
100
 
101
//
102
extern char *kosExePath;
103
 
104
//
105
void crtStartUp();
106
//
107
int __cdecl _purecall();
108
//
109
int __cdecl atexit( void (__cdecl *func )( void ));
110
//
111
void rtlSrand( Dword seed );
112
Dword rtlRand( void );
113
//
114
char * __cdecl strcpy( char *target, const char *source );
115
int __cdecl strlen( const char *line );
116
char * __cdecl strrchr( const char * string, int c );
117
 
118
#if _MSC_VER < 1400
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 );
121
#pragma intrinsic(memcpy,memset)
122
#else
123
void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
124
void memset( Byte *dst, Byte filler, Dword count );
125
#endif
126
 
127
void sprintf( char *Str, char* Format, ... );
128
//
129
Dword rtlInterlockedExchange( Dword *target, Dword value );
130
// функция -1 завершения процесса
131
void kos_ExitApp();
132
// функция 0
133
void kos_DefineAndDrawWindow(
134
	Word x, Word y,
135
	Word sizeX, Word sizeY,
136
	Byte mainAreaType, Dword mainAreaColour,
137
	Byte headerType, Dword headerColour,
138
	Dword borderColour
139
	);
140
// функция 1 поставить точку
141
void kos_PutPixel( Dword x, Dword y, Dword colour );
142
// функция 2 получить код нажатой клавиши
143
bool kos_GetKey( Byte &keyCode );
144
// функция 3 получить время
145
Dword kos_GetSystemClock();
146
// функция 4
147
void kos_WriteTextToWindow(
148
	Word x, Word y,
149
	Byte fontType,
150
	Dword textColour,
151
	char *textPtr,
152
	Dword textLen
153
	);
154
// функция 7 нарисовать изображение
155
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
156
// функция 8 определить кнопку
157
void kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
158
// функция 5 пауза, в сотых долях секунды
159
void kos_Pause( Dword value );
160
// функция 9 - информация о процессе
161
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
162
// функция 10
163
Dword kos_WaitForEvent();
164
// функция 11
165
Dword kos_CheckForEvent();
166
// функция 12
167
void kos_WindowRedrawStatus( Dword status );
168
// функция 13 нарисовать полосу
169
void kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
170
// функция 17
171
bool kos_GetButtonID( Dword &buttonID );
172
// функция 23
173
Dword kos_WaitForEvent( Dword timeOut );
174
//
175
enum eNumberBase
176
{
177
	nbDecimal = 0,
178
	nbHex,
179
	nbBin
180
};
181
// получение информации о состоянии "мыши" функция 37
182
void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
183
// функция 40 установить маску событий
184
void kos_SetMaskForEvents( Dword mask );
185
// функция 47 вывести в окно приложения число
186
void kos_DisplayNumberToWindow(
187
   Dword value,
188
   Dword digitsNum,
189
   Word x,
190
   Word y,
191
   Dword colour,
192
   eNumberBase nBase = nbDecimal,
193
   bool valueIsPointer = false
194
   );
969 leency 195
// функция 48.4 получить высоту скина
196
Dword kos_GetSkinWidth();
968 leency 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
void kos_Main();