Rev 1805 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1805 | Rev 5115 | ||
---|---|---|---|
1 | typedef unsigned __int32 Dword; |
1 | typedef unsigned __int32 Dword; |
2 | typedef unsigned __int16 Word; |
2 | typedef unsigned __int16 Word; |
3 | typedef unsigned __int8 Byte; |
3 | typedef unsigned __int8 Byte; |
4 | typedef unsigned __int32 size_t; |
4 | typedef unsigned __int32 size_t; |
5 | 5 | ||
6 | #define NULL 0 |
6 | #define NULL 0 |
7 | 7 | ||
8 | #define MAX_PATH 256 |
8 | #define MAX_PATH 256 |
9 | 9 | ||
10 | #define FO_READ 0 |
10 | #define FO_READ 0 |
11 | #define FO_WRITE 2 |
11 | #define FO_WRITE 2 |
12 | 12 | ||
13 | #define EM_WINDOW_REDRAW 1 |
13 | #define EM_WINDOW_REDRAW 1 |
14 | #define EM_KEY_PRESS 2 |
14 | #define EM_KEY_PRESS 2 |
15 | #define EM_BUTTON_CLICK 4 |
15 | #define EM_BUTTON_CLICK 4 |
16 | #define EM_APP_CLOSE 8 |
16 | #define EM_APP_CLOSE 8 |
17 | #define EM_DRAW_BACKGROUND 16 |
17 | #define EM_DRAW_BACKGROUND 16 |
18 | #define EM_MOUSE_EVENT 32 |
18 | #define EM_MOUSE_EVENT 32 |
19 | #define EM_IPC 64 |
19 | #define EM_IPC 64 |
20 | #define EM_NETWORK 256 |
20 | #define EM_NETWORK 256 |
21 | 21 | ||
22 | #define KM_CHARS 0 |
22 | #define KM_CHARS 0 |
23 | #define KM_SCANS 1 |
23 | #define KM_SCANS 1 |
24 | 24 | ||
25 | #define WRS_BEGIN 1 |
25 | #define WRS_BEGIN 1 |
26 | #define WRS_END 2 |
26 | #define WRS_END 2 |
27 | 27 | ||
28 | #define PROCESS_ID_SELF -1 |
28 | #define PROCESS_ID_SELF -1 |
29 | 29 | ||
30 | #define abs(a) (a<0?0-a:a) |
30 | #define abs(a) (a<0?0-a:a) |
31 | 31 | ||
32 | 32 | ||
33 | struct kosFileInfo |
33 | struct kosFileInfo |
34 | { |
34 | { |
35 | Dword rwMode; |
35 | Dword rwMode; |
36 | Dword offsetLow; |
36 | Dword offsetLow; |
37 | Dword offsetHigh; |
37 | Dword offsetHigh; |
38 | Dword dataCount; |
38 | Dword dataCount; |
39 | Byte *bufferPtr; |
39 | Byte *bufferPtr; |
40 | char fileURL[MAX_PATH]; |
40 | char fileURL[MAX_PATH]; |
41 | }; |
41 | }; |
42 | 42 | ||
43 | 43 | ||
44 | struct RGB |
44 | struct RGB |
45 | { |
45 | { |
46 | Byte b; |
46 | Byte b; |
47 | Byte g; |
47 | Byte g; |
48 | Byte r; |
48 | Byte r; |
49 | // |
49 | // |
50 | RGB() {}; |
50 | RGB() {}; |
51 | // |
51 | // |
52 | RGB( Dword value ) |
52 | RGB( Dword value ) |
53 | { |
53 | { |
54 | r = value >> 16; |
54 | r = value >> 16; |
55 | g = value >> 8; |
55 | g = value >> 8; |
56 | b = value; |
56 | b = value; |
57 | }; |
57 | }; |
58 | // |
58 | // |
59 | bool operator != ( RGB &another ) |
59 | bool operator != ( RGB &another ) |
60 | { |
60 | { |
61 | return this->b != another.b || this->g != another.g || this->r != another.r; |
61 | return this->b != another.b || this->g != another.g || this->r != another.r; |
62 | }; |
62 | }; |
63 | // |
63 | // |
64 | bool operator == ( RGB &another ) |
64 | bool operator == ( RGB &another ) |
65 | { |
65 | { |
66 | return this->b == another.b && this->g == another.g && this->r == another.r; |
66 | return this->b == another.b && this->g == another.g && this->r == another.r; |
67 | }; |
67 | }; |
68 | }; |
68 | }; |
69 | 69 | ||
70 | 70 | ||
71 | union sProcessInfo |
71 | union sProcessInfo |
72 | { |
72 | { |
73 | Byte rawData[1024]; |
73 | Byte rawData[1024]; |
74 | struct |
74 | struct |
75 | { |
75 | { |
76 | Dword cpu_usage; |
76 | Dword cpu_usage; |
77 | Word window_stack_position; |
77 | Word window_stack_position; |
78 | Word window_stack_value; |
78 | Word window_stack_value; |
79 | Word reserved1; |
79 | Word reserved1; |
80 | char process_name[12]; |
80 | char process_name[12]; |
81 | Dword memory_start; |
81 | Dword memory_start; |
82 | Dword used_memory; |
82 | Dword used_memory; |
83 | Dword PID; |
83 | Dword PID; |
84 | Dword x_start; |
84 | Dword x_start; |
85 | Dword y_start; |
85 | Dword y_start; |
86 | Dword x_size; |
86 | Dword x_size; |
87 | Dword y_size; |
87 | Dword y_size; |
88 | Word slot_state; |
88 | Word slot_state; |
89 | } processInfo; |
89 | } processInfo; |
90 | }; |
90 | }; |
91 | 91 | ||
92 | struct PRINTK |
92 | struct PRINTK |
93 | { |
93 | { |
94 | char *fmtline; |
94 | char *fmtline; |
95 | Dword args[11]; |
95 | Dword args[11]; |
96 | }; |
96 | }; |
- | 97 | ||
- | 98 | #ifdef AUTOBUILD |
|
- | 99 | extern char kosExePath[]; |
|
97 | 100 | #else |
|
98 | // |
101 | // |
- | 102 | extern char *kosExePath; |
|
99 | extern char *kosExePath; |
103 | #endif |
100 | 104 | ||
101 | // |
105 | // |
102 | void crtStartUp(); |
106 | void crtStartUp(); |
103 | // |
107 | // |
104 | int __cdecl _purecall(); |
108 | int __cdecl _purecall(); |
105 | // |
109 | // |
106 | int __cdecl atexit( void (__cdecl *func )( void )); |
110 | int __cdecl atexit( void (__cdecl *func )( void )); |
107 | // |
111 | // |
108 | void rtlSrand( Dword seed ); |
112 | void rtlSrand( Dword seed ); |
109 | Dword rtlRand( void ); |
113 | Dword rtlRand( void ); |
110 | // |
114 | // |
111 | char * __cdecl strcpy( char *target, const char *source ); |
115 | char * __cdecl strcpy( char *target, const char *source ); |
112 | int __cdecl strlen( const char *line ); |
116 | int __cdecl strlen( const char *line ); |
113 | char * __cdecl strrchr( const char * string, int c ); |
117 | char * __cdecl strrchr( const char * string, int c ); |
114 | // |
118 | // |
115 | void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount ); |
119 | void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount ); |
116 | // |
120 | // |
117 | void memset( Byte *dst, Byte filler, Dword count ); |
121 | void memset( Byte *dst, Byte filler, Dword count ); |
118 | // |
122 | // |
119 | void sprintk( char *Str, PRINTK *arg ); |
123 | void sprintk( char *Str, PRINTK *arg ); |
120 | // |
124 | // |
121 | Dword rtlInterlockedExchange( Dword *target, Dword value ); |
125 | Dword rtlInterlockedExchange( Dword *target, Dword value ); |
122 | // ôóíêöèÿ -1 çàâåðøåíèÿ ïðîöåññà |
126 | // ôóíêöèÿ -1 çàâåðøåíèÿ ïðîöåññà |
123 | void kos_ExitApp(); |
127 | void kos_ExitApp(); |
124 | // ôóíêöèÿ 0 |
128 | // ôóíêöèÿ 0 |
125 | void kos_DefineAndDrawWindow( |
129 | void kos_DefineAndDrawWindow( |
126 | Word x, Word y, |
130 | Word x, Word y, |
127 | Word sizeX, Word sizeY, |
131 | Word sizeX, Word sizeY, |
128 | Byte mainAreaType, Dword mainAreaColour, |
132 | Byte mainAreaType, Dword mainAreaColour, |
129 | Byte headerType, Dword headerColour, |
133 | Byte headerType, Dword headerColour, |
130 | Dword borderColour |
134 | Dword borderColour |
131 | ); |
135 | ); |
132 | // ôóíêöèÿ 1 ïîñòàâèòü òî÷êó |
136 | // ôóíêöèÿ 1 ïîñòàâèòü òî÷êó |
133 | void kos_PutPixel( Dword x, Dword y, Dword colour ); |
137 | void kos_PutPixel( Dword x, Dword y, Dword colour ); |
134 | // ôóíêöèÿ 2 ïîëó÷èòü êîä íàæàòîé êëàâèøè |
138 | // ôóíêöèÿ 2 ïîëó÷èòü êîä íàæàòîé êëàâèøè |
135 | bool kos_GetKey( Byte &keyCode ); |
139 | bool kos_GetKey( Byte &keyCode ); |
136 | // ôóíêöèÿ 3 ïîëó÷èòü âðåìÿ |
140 | // ôóíêöèÿ 3 ïîëó÷èòü âðåìÿ |
137 | Dword kos_GetSystemClock(); |
141 | Dword kos_GetSystemClock(); |
138 | // ôóíêöèÿ 4 |
142 | // ôóíêöèÿ 4 |
139 | void kos_WriteTextToWindow( |
143 | void kos_WriteTextToWindow( |
140 | Word x, Word y, |
144 | Word x, Word y, |
141 | Byte fontType, |
145 | Byte fontType, |
142 | Dword textColour, |
146 | Dword textColour, |
143 | char *textPtr, |
147 | char *textPtr, |
144 | Dword textLen |
148 | Dword textLen |
145 | ); |
149 | ); |
146 | // ôóíêöèÿ 7 íàðèñîâàòü èçîáðàæåíèå |
150 | // ôóíêöèÿ 7 íàðèñîâàòü èçîáðàæåíèå |
147 | void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y ); |
151 | void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y ); |
148 | // ôóíêöèÿ 8 îïðåäåëèòü êíîïêó |
152 | // ôóíêöèÿ 8 îïðåäåëèòü êíîïêó |
149 | void kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour ); |
153 | void kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour ); |
150 | // ôóíêöèÿ 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû |
154 | // ôóíêöèÿ 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû |
151 | void kos_Pause( Dword value ); |
155 | void kos_Pause( Dword value ); |
152 | // ôóíêöèÿ 9 - èíôîðìàöèÿ î ïðîöåññå |
156 | // ôóíêöèÿ 9 - èíôîðìàöèÿ î ïðîöåññå |
153 | Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF ); |
157 | Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF ); |
154 | // ôóíêöèÿ 10 |
158 | // ôóíêöèÿ 10 |
155 | Dword kos_WaitForEvent(); |
159 | Dword kos_WaitForEvent(); |
156 | // ôóíêöèÿ 11 |
160 | // ôóíêöèÿ 11 |
157 | Dword kos_CheckForEvent(); |
161 | Dword kos_CheckForEvent(); |
158 | // ôóíêöèÿ 12 |
162 | // ôóíêöèÿ 12 |
159 | void kos_WindowRedrawStatus( Dword status ); |
163 | void kos_WindowRedrawStatus( Dword status ); |
160 | // ôóíêöèÿ 13 íàðèñîâàòü ïîëîñó |
164 | // ôóíêöèÿ 13 íàðèñîâàòü ïîëîñó |
161 | void kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour ); |
165 | void kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour ); |
162 | // ôóíêöèÿ 17 |
166 | // ôóíêöèÿ 17 |
163 | bool kos_GetButtonID( Dword &buttonID ); |
167 | bool kos_GetButtonID( Dword &buttonID ); |
164 | // ôóíêöèÿ 23 |
168 | // ôóíêöèÿ 23 |
165 | Dword kos_WaitForEvent( Dword timeOut ); |
169 | Dword kos_WaitForEvent( Dword timeOut ); |
166 | // |
170 | // |
167 | enum eNumberBase |
171 | enum eNumberBase |
168 | { |
172 | { |
169 | nbDecimal = 0, |
173 | nbDecimal = 0, |
170 | nbHex, |
174 | nbHex, |
171 | nbBin |
175 | nbBin |
172 | }; |
176 | }; |
173 | // ïîëó÷åíèå èíôîðìàöèè î ñîñòîÿíèè "ìûøè" ôóíêöèÿ 37 |
177 | // ïîëó÷åíèå èíôîðìàöèè î ñîñòîÿíèè "ìûøè" ôóíêöèÿ 37 |
174 | void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY ); |
178 | void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY ); |
175 | // ôóíêöèÿ 40 óñòàíîâèòü ìàñêó ñîáûòèé |
179 | // ôóíêöèÿ 40 óñòàíîâèòü ìàñêó ñîáûòèé |
176 | void kos_SetMaskForEvents( Dword mask ); |
180 | void kos_SetMaskForEvents( Dword mask ); |
177 | // ôóíêöèÿ 47 âûâåñòè â îêíî ïðèëîæåíèÿ ÷èñëî |
181 | // ôóíêöèÿ 47 âûâåñòè â îêíî ïðèëîæåíèÿ ÷èñëî |
178 | void kos_DisplayNumberToWindow( |
182 | void kos_DisplayNumberToWindow( |
179 | Dword value, |
183 | Dword value, |
180 | Dword digitsNum, |
184 | Dword digitsNum, |
181 | Word x, |
185 | Word x, |
182 | Word y, |
186 | Word y, |
183 | Dword colour, |
187 | Dword colour, |
184 | eNumberBase nBase = nbDecimal, |
188 | eNumberBase nBase = nbDecimal, |
185 | bool valueIsPointer = false |
189 | bool valueIsPointer = false |
186 | ); |
190 | ); |
187 | // ôóíêöèÿ 58 äîñòóï ê ôàéëîâîé ñèñòåìå |
191 | // ôóíêöèÿ 58 äîñòóï ê ôàéëîâîé ñèñòåìå |
188 | Dword kos_FileSystemAccess( kosFileInfo *fileInfo ); |
192 | Dword kos_FileSystemAccess( kosFileInfo *fileInfo ); |
189 | // ôóíêöèÿ 63 |
193 | // ôóíêöèÿ 63 |
190 | void kos_DebugOutChar( char ccc ); |
194 | void kos_DebugOutChar( char ccc ); |
191 | // |
195 | // |
192 | void rtlDebugOutString( char *str ); |
196 | void rtlDebugOutString( char *str ); |
193 | // ôóíêöèÿ 64 èçìåíèòü ïàðàìåòðû îêíà, ïàðàìåòð == -1 íå ìåíÿåòñÿ |
197 | // ôóíêöèÿ 64 èçìåíèòü ïàðàìåòðû îêíà, ïàðàìåòð == -1 íå ìåíÿåòñÿ |
194 | void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY ); |
198 | void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY ); |
195 | // ôóíêöèÿ 67 èçìåíåíèå êîëè÷åñòâà ïàìÿòè, âûäåëåííîé äëÿ ïðîãðàììû |
199 | // ôóíêöèÿ 67 èçìåíåíèå êîëè÷åñòâà ïàìÿòè, âûäåëåííîé äëÿ ïðîãðàììû |
196 | bool kos_ApplicationMemoryResize( Dword targetSize ); |
200 | bool kos_ApplicationMemoryResize( Dword targetSize ); |
197 | // ôóíêöèÿ 66 ðåæèì ïîëó÷åíèÿ äàííûõ îò êëàâèàòóðû |
201 | // ôóíêöèÿ 66 ðåæèì ïîëó÷åíèÿ äàííûõ îò êëàâèàòóðû |
198 | void kos_SetKeyboardDataMode( Dword mode ); |
202 | void kos_SetKeyboardDataMode( Dword mode ); |
199 | 203 | ||
200 | // |
204 | // |
201 | void kos_Main();0?0-a:a) |
205 | void kos_Main();0?0-a:a) |
202 | 206 | ||
203 | 207 | ||
204 | struct> |
208 | struct> |