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