Subversion Repositories Kolibri OS

Rev

Rev 1764 | 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_slot; //slot
  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 width;
  100.                 Dword height;
  101.                 Word slot_state;
  102.                 Word reserved3;
  103.                 Dword work_left;
  104.                 Dword work_top;
  105.                 Dword work_width;
  106.                 Dword work_height;
  107.                 char status_window;
  108.                 Dword cwidth;
  109.                 Dword cheight;
  110.         } processInfo;
  111. };
  112. #pragma pack(pop)
  113.  
  114. #ifndef AUTOBUILD
  115. //
  116. extern char *kosExePath;
  117. #endif
  118.  
  119. //
  120. void crtStartUp();
  121. //
  122. int __cdecl _purecall();
  123. //
  124. int __cdecl atexit( void (__cdecl *func )( void ));
  125. //
  126. void rtlSrand( Dword seed );
  127. Dword rtlRand( void );
  128. //
  129. char * __cdecl strcpy( char *target, const char *source );
  130. int __cdecl strlen( const char *line );
  131. char * __cdecl strrchr( const char * string, int c );
  132.  
  133. #if _MSC_VER < 1400
  134. extern "C" void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
  135. extern "C" void memset( Byte *dst, Byte filler, Dword count );
  136. //#pragma intrinsic(memcpy,memset)
  137. #elif defined AUTOBUILD
  138. void memcpy( void *dst, const void *src, size_t bytesCount );
  139. void memset( Byte *dst, Byte filler, Dword count );
  140. #else
  141. void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
  142. void memset( Byte *dst, Byte filler, Dword count );
  143. #endif
  144.  
  145. void sprintf( char *Str, char* Format, ... );
  146. //
  147. Dword rtlInterlockedExchange( Dword *target, Dword value );
  148. // ôóíêöèÿ -1 çàâåðøåíèÿ ïðîöåññà
  149. void kos_ExitApp();
  150. // ôóíêöèÿ 0
  151. void kos_DefineAndDrawWindow(
  152.         Word x, Word y,
  153.         Word sizeX, Word sizeY,
  154.         Byte mainAreaType, Dword mainAreaColour,
  155.         Byte headerType, Dword headerColour,
  156.         Dword borderColour
  157.         );
  158. // ôóíêöèÿ 1 ïîñòàâèòü òî÷êó
  159. void kos_PutPixel( Dword x, Dword y, Dword colour );
  160. // ôóíêöèÿ 2 ïîëó÷èòü êîä íàæàòîé êëàâèøè
  161. bool kos_GetKey( Byte &keyCode );
  162. // ôóíêöèÿ 3 ïîëó÷èòü âðåìÿ
  163. Dword kos_GetSystemClock();
  164. // ôóíêöèÿ 4
  165. void __declspec(noinline) kos_WriteTextToWindow(
  166.         Word x, Word y,
  167.         Byte fontType,
  168.         Dword textColour,
  169.         char *textPtr,
  170.         Dword textLen
  171.         );
  172. // ôóíêöèÿ 7 íàðèñîâàòü èçîáðàæåíèå
  173. void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
  174. // ôóíêöèÿ 8 îïðåäåëèòü êíîïêó
  175. void __declspec(noinline) kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
  176. // ôóíêöèÿ 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû
  177. void kos_Pause( Dword value );
  178. // ôóíêöèÿ 9 - èíôîðìàöèÿ î ïðîöåññå
  179. Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
  180. // ôóíêöèÿ 10
  181. Dword kos_WaitForEvent();
  182. // ôóíêöèÿ 11
  183. Dword kos_CheckForEvent();
  184. // ôóíêöèÿ 12
  185. void kos_WindowRedrawStatus( Dword status );
  186. // ôóíêöèÿ 13 íàðèñîâàòü ïîëîñó
  187. void __declspec(noinline) kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
  188. // ôóíêöèÿ 17
  189. bool kos_GetButtonID( Dword &buttonID );
  190. // ôóíêöèÿ 23
  191. Dword kos_WaitForEvent( Dword timeOut );
  192. //
  193. enum eNumberBase
  194. {
  195.         nbDecimal = 0,
  196.         nbHex,
  197.         nbBin
  198. };
  199. // ïîëó÷åíèå èíôîðìàöèè î ñîñòîÿíèè "ìûøè" ôóíêöèÿ 37
  200. void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
  201. // ôóíêöèÿ 40 óñòàíîâèòü ìàñêó ñîáûòèé
  202. void kos_SetMaskForEvents( Dword mask );
  203. // ôóíêöèÿ 47 âûâåñòè â îêíî ïðèëîæåíèÿ ÷èñëî
  204. void kos_DisplayNumberToWindow(
  205.    Dword value,
  206.    Dword digitsNum,
  207.    Word x,
  208.    Word y,
  209.    Dword colour,
  210.    eNumberBase nBase = nbDecimal,
  211.    bool valueIsPointer = false
  212.    );
  213. // ôóíêöèÿ 58 äîñòóï ê ôàéëîâîé ñèñòåìå
  214. Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
  215. // ôóíêöèÿ 63
  216. void kos_DebugOutChar( char ccc );
  217. //
  218. void rtlDebugOutString( char *str );
  219. // ôóíêöèÿ 64 èçìåíèòü ïàðàìåòðû îêíà, ïàðàìåòð == -1 íå ìåíÿåòñÿ
  220. void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY );
  221. // ôóíêöèÿ 67 èçìåíåíèå êîëè÷åñòâà ïàìÿòè, âûäåëåííîé äëÿ ïðîãðàììû
  222. bool kos_ApplicationMemoryResize( Dword targetSize );
  223. // ôóíêöèÿ 66 ðåæèì ïîëó÷åíèÿ äàííûõ îò êëàâèàòóðû
  224. void kos_SetKeyboardDataMode( Dword mode );
  225.  
  226. void kos_InitHeap();
  227.  
  228. //
  229. void kos_Main();
  230.