Subversion Repositories Kolibri OS

Rev

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