Subversion Repositories Kolibri OS

Rev

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

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