Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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