Subversion Repositories Kolibri OS

Rev

Rev 7498 | Rev 7503 | 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. // if you have trouble here look at old SVN revisions for alternatives
  156. void memcpy( void *dst, const void *src, size_t bytesCount );
  157. void memset( Byte *dst, Byte filler, Dword count );
  158. //
  159. void sprintf( char *Str, char* Format, ... );
  160. //
  161. Dword rtlInterlockedExchange( Dword *target, Dword value );
  162. // ôóíêöèÿ -1 çàâåðøåíèÿ ïðîöåññà
  163. void kos_ExitApp();
  164. // ôóíêöèÿ 0
  165. void kos_DefineAndDrawWindow(
  166.         Word x, Word y,
  167.         Word sizeX, Word sizeY,
  168.         Byte mainAreaType, Dword mainAreaColour,
  169.         Byte headerType, Dword headerColour,
  170.         Dword borderColour
  171.         );
  172. // ôóíêöèÿ 1 ïîñòàâèòü òî÷êó
  173. void kos_PutPixel( Dword x, Dword y, Dword colour );
  174. // ôóíêöèÿ 2 ïîëó÷èòü êîä íàæàòîé êëàâèøè
  175. bool kos_GetKey( Byte &keyCode );
  176. // ôóíêöèÿ 3 ïîëó÷èòü âðåìÿ
  177. Dword kos_GetSystemClock();
  178. // ôóíêöèÿ 4
  179. void __declspec(noinline) kos_WriteTextToWindow(
  180.         Word x, Word y,
  181.         Byte fontType,
  182.         Dword textColour,
  183.         char *textPtr,
  184.         Dword textLen
  185.         );
  186. // ôóíêöèÿ 7 íàðèñîâàòü èçîáðàæåíèå
  187. void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
  188. // ôóíêöèÿ 8 îïðåäåëèòü êíîïêó
  189. void __declspec(noinline) kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
  190. // ôóíêöèÿ 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû
  191. void kos_Pause( Dword value );
  192. // ôóíêöèÿ 9 - èíôîðìàöèÿ î ïðîöåññå
  193. Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
  194. // ôóíêöèÿ 10
  195. Dword kos_WaitForEvent();
  196. // ôóíêöèÿ 11
  197. Dword kos_CheckForEvent();
  198. // ôóíêöèÿ 12
  199. void kos_WindowRedrawStatus( Dword status );
  200. // ôóíêöèÿ 13 íàðèñîâàòü ïîëîñó
  201. void __declspec(noinline) kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
  202. // ôóíêöèÿ 17
  203. bool kos_GetButtonID( Dword &buttonID );
  204. // ôóíêöèÿ 23
  205. Dword kos_WaitForEventTimeout( Dword timeOut );
  206. //
  207. enum eNumberBase
  208. {
  209.         nbDecimal = 0,
  210.         nbHex,
  211.         nbBin
  212. };
  213. // ïîëó÷åíèå èíôîðìàöèè î ñîñòîÿíèè "ìûøè" ôóíêöèÿ 37
  214. void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
  215. // ôóíêöèÿ 40 óñòàíîâèòü ìàñêó ñîáûòèé
  216. void kos_SetMaskForEvents( Dword mask );
  217. // ôóíêöèÿ 47 âûâåñòè â îêíî ïðèëîæåíèÿ ÷èñëî
  218. void kos_DisplayNumberToWindow(
  219.    Dword value,
  220.    Dword digitsNum,
  221.    Word x,
  222.    Word y,
  223.    Dword colour,
  224.    eNumberBase nBase = nbDecimal,
  225.    bool valueIsPointer = false
  226.    );
  227. // ôóíêöèÿ 58 äîñòóï ê ôàéëîâîé ñèñòåìå
  228. Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
  229. // ôóíêöèÿ 63
  230. void kos_DebugOutChar( char ccc );
  231. //
  232. void rtlDebugOutString( char *str );
  233. // ôóíêöèÿ 64 èçìåíèòü ïàðàìåòðû îêíà, ïàðàìåòð == -1 íå ìåíÿåòñÿ
  234. void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY );
  235. // ôóíêöèÿ 67 èçìåíåíèå êîëè÷åñòâà ïàìÿòè, âûäåëåííîé äëÿ ïðîãðàììû
  236. bool kos_ApplicationMemoryResize( Dword targetSize );
  237. // ôóíêöèÿ 66 ðåæèì ïîëó÷åíèÿ äàííûõ îò êëàâèàòóðû
  238. void kos_SetKeyboardDataMode( Dword mode );
  239.  
  240. void kos_InitHeap();
  241.  
  242. //
  243. void kos_Main();
  244.