Subversion Repositories Kolibri OS

Rev

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