Subversion Repositories Kolibri OS

Rev

Rev 7495 | Rev 7500 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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