Subversion Repositories Kolibri OS

Rev

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