Subversion Repositories Kolibri OS

Rev

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