Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
1805 yogev_ezra 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
 
33
struct kosFileInfo
34
{
35
	Dword rwMode;
36
	Dword OffsetLow;
37
	Dword OffsetHigh;
38
	Dword dataCount;
39
	Byte *bufferPtr;
40
	char fileURL[MAX_PATH];
41
};
42
 
43
 
44
struct RGB
45
{
46
	Byte b;
47
	Byte g;
48
	Byte r;
49
	//
50
	RGB() {};
51
	//
52
	RGB( Dword value )
53
	{
54
		r = value >> 16;
55
		g = value >> 8;
56
		b = value;
57
	};
58
	//
59
	bool operator != ( RGB &another )
60
	{
61
		return this->b != another.b || this->g != another.g || this->r != another.r;
62
	};
63
	//
64
	bool operator == ( RGB &another )
65
	{
66
		return this->b == another.b && this->g == another.g && this->r == another.r;
67
	};
68
};
69
 
5108 clevermous 70
#pragma pack(push, 1)
1805 yogev_ezra 71
union sProcessInfo
72
{
73
	Byte rawData[1024];
74
	struct
75
	{
76
		Dword cpu_usage;
77
		Word window_stack_position;
78
		Word window_stack_value;
79
		Word reserved1;
80
		char process_name[12];
81
		Dword memory_start;
82
		Dword used_memory;
83
		Dword PID;
84
		Dword x_start;
85
		Dword y_start;
86
		Dword x_size;
87
		Dword y_size;
88
		Word slot_state;
89
	} processInfo;
90
};
5108 clevermous 91
#pragma pack(pop)
1805 yogev_ezra 92
 
5107 clevermous 93
#ifdef AUTOBUILD
94
extern char kosExePath[];
95
#else
1805 yogev_ezra 96
//
97
extern char *kosExePath;
5107 clevermous 98
#endif
1805 yogev_ezra 99
 
100
//
101
void crtStartUp();
102
//
103
int __cdecl _purecall();
104
//
105
int __cdecl atexit( void (__cdecl *func )( void ));
106
//
107
void rtlSrand( Dword seed );
108
Dword rtlRand( void );
109
//
110
char * __cdecl strcpy( char *target, const char *source );
111
int __cdecl strlen( const char *line );
112
char * __cdecl strrchr( const char * string, int c );
113
//
114
void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
115
//
116
void memset( Byte *dst, Byte filler, Dword count );
117
//
118
void sprintf( char *Str, char* Format, ... );
119
//
120
Dword rtlInterlockedExchange( Dword *target, Dword value );
121
// функция -1 завершения процесса
122
void kos_ExitApp();
123
// функция 0
124
void kos_DefineAndDrawWindow(
125
	Word x, Word y,
126
	Word sizeX, Word sizeY,
127
	Byte mainAreaType, Dword mainAreaColour,
128
	Byte headerType, Dword headerColour,
4481 hidnplayr 129
	char *textPtr
1805 yogev_ezra 130
	);
131
// функция 1 поставить точку
132
void kos_PutPixel( Dword x, Dword y, Dword colour );
133
// функция 2 получить код нажатой клавиши
134
bool kos_GetKey( Byte &keyCode );
135
// функция 3 получить время
136
Dword kos_GetSystemClock();
137
// функция 4
138
void kos_WriteTextToWindow(
139
	Word x, Word y,
140
	Byte fontType,
141
	Dword textColour,
142
	char *textPtr,
143
	Dword textLen
144
	);
145
// функция 7 нарисовать изображение
146
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
147
// функция 8 определить кнопку
148
void kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
149
// функция 5 пауза, в сотых долях секунды
150
void kos_Pause( Dword value );
151
// функция 9 - информация о процессе
152
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
153
// функция 10
154
Dword kos_WaitForEvent();
155
// функция 11
156
Dword kos_CheckForEvent();
157
// функция 12
158
void kos_WindowRedrawStatus( Dword status );
159
// функция 13 нарисовать полосу
160
void kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
161
// функция 17
162
bool kos_GetButtonID( Dword &buttonID );
163
// функция 23
164
Dword kos_WaitForEvent( Dword timeOut );
165
//
166
enum eNumberBase
167
{
168
	nbDecimal = 0,
169
	nbHex,
170
	nbBin
171
};
172
// получение информации о состоянии "мыши" функция 37
173
void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
174
// функция 40 установить маску событий
175
void kos_SetMaskForEvents( Dword mask );
176
// функция 47 вывести в окно приложения число
177
void kos_DisplayNumberToWindow(
178
   Dword value,
179
   Dword digitsNum,
180
   Word x,
181
   Word y,
182
   Dword colour,
183
   eNumberBase nBase = nbDecimal,
184
   bool valueIsPointer = false
185
   );
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
// 68.12/13/20
195
void* __stdcall kos_malloc(Dword size);
196
void __stdcall kos_free(void* mptr);
197
void* __stdcall kos_realloc(void* mptr, Dword size);
198
// функция 66 режим получения данных от клавиатуры
199
void kos_SetKeyboardDataMode( Dword mode );
200
 
4481 hidnplayr 201
void kos_ChangeWindowCaption(char *textPtr);
202
 
1805 yogev_ezra 203
//
204
void kos_Main();