Subversion Repositories Kolibri OS

Rev

Rev 1764 | Rev 2753 | 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. union sProcessInfo
  84. {
  85.         Byte rawData[1024];
  86.         struct
  87.         {
  88.                 Dword cpu_usage;
  89.                 Word window_stack_position;
  90.                 Word window_stack_value;
  91.                 Word reserved1;
  92.                 char process_name[12];
  93.                 Dword memory_start;
  94.                 Dword used_memory;
  95.                 Dword PID;
  96.                 Dword x_start;
  97.                 Dword y_start;
  98.                 Dword x_size;
  99.                 Dword y_size;
  100.                 Word slot_state;
  101.         } processInfo;
  102. };
  103.  
  104. #ifndef AUTOBUILD
  105. //
  106. extern char *kosExePath;
  107. #endif
  108.  
  109. //
  110. void crtStartUp();
  111. //
  112. int __cdecl _purecall();
  113. //
  114. int __cdecl atexit( void (__cdecl *func )( void ));
  115. //
  116. void rtlSrand( Dword seed );
  117. Dword rtlRand( void );
  118. //
  119. char * __cdecl strcpy( char *target, const char *source );
  120. int __cdecl strlen( const char *line );
  121. char * __cdecl strrchr( const char * string, int c );
  122.  
  123. #if _MSC_VER < 1400
  124. extern "C" void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
  125. extern "C" void memset( Byte *dst, Byte filler, Dword count );
  126. //#pragma intrinsic(memcpy,memset)
  127. #elif defined AUTOBUILD
  128. void memcpy( void *dst, const void *src, size_t bytesCount );
  129. void memset( Byte *dst, Byte filler, Dword count );
  130. #else
  131. void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount );
  132. void memset( Byte *dst, Byte filler, Dword count );
  133. #endif
  134.  
  135. void sprintf( char *Str, char* Format, ... );
  136. //
  137. Dword rtlInterlockedExchange( Dword *target, Dword value );
  138. // ôóíêöèÿ -1 çàâåðøåíèÿ ïðîöåññà
  139. void kos_ExitApp();
  140. // ôóíêöèÿ 0
  141. void kos_DefineAndDrawWindow(
  142.         Word x, Word y,
  143.         Word sizeX, Word sizeY,
  144.         Byte mainAreaType, Dword mainAreaColour,
  145.         Byte headerType, Dword headerColour,
  146.         Dword borderColour
  147.         );
  148. // ôóíêöèÿ 1 ïîñòàâèòü òî÷êó
  149. void kos_PutPixel( Dword x, Dword y, Dword colour );
  150. // ôóíêöèÿ 2 ïîëó÷èòü êîä íàæàòîé êëàâèøè
  151. bool kos_GetKey( Byte &keyCode );
  152. // ôóíêöèÿ 3 ïîëó÷èòü âðåìÿ
  153. Dword kos_GetSystemClock();
  154. // ôóíêöèÿ 4
  155. void __declspec(noinline) kos_WriteTextToWindow(
  156.         Word x, Word y,
  157.         Byte fontType,
  158.         Dword textColour,
  159.         char *textPtr,
  160.         Dword textLen
  161.         );
  162. // ôóíêöèÿ 7 íàðèñîâàòü èçîáðàæåíèå
  163. void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
  164. // ôóíêöèÿ 8 îïðåäåëèòü êíîïêó
  165. void __declspec(noinline) kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
  166. // ôóíêöèÿ 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû
  167. void kos_Pause( Dword value );
  168. // ôóíêöèÿ 9 - èíôîðìàöèÿ î ïðîöåññå
  169. Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
  170. // ôóíêöèÿ 10
  171. Dword kos_WaitForEvent();
  172. // ôóíêöèÿ 11
  173. Dword kos_CheckForEvent();
  174. // ôóíêöèÿ 12
  175. void kos_WindowRedrawStatus( Dword status );
  176. // ôóíêöèÿ 13 íàðèñîâàòü ïîëîñó
  177. void __declspec(noinline) kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
  178. // ôóíêöèÿ 17
  179. bool kos_GetButtonID( Dword &buttonID );
  180. // ôóíêöèÿ 23
  181. Dword kos_WaitForEventTimeout( Dword timeOut );
  182. //
  183. enum eNumberBase
  184. {
  185.         nbDecimal = 0,
  186.         nbHex,
  187.         nbBin
  188. };
  189. // ïîëó÷åíèå èíôîðìàöèè î ñîñòîÿíèè "ìûøè" ôóíêöèÿ 37
  190. void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY );
  191. // ôóíêöèÿ 40 óñòàíîâèòü ìàñêó ñîáûòèé
  192. void kos_SetMaskForEvents( Dword mask );
  193. // ôóíêöèÿ 47 âûâåñòè â îêíî ïðèëîæåíèÿ ÷èñëî
  194. void kos_DisplayNumberToWindow(
  195.    Dword value,
  196.    Dword digitsNum,
  197.    Word x,
  198.    Word y,
  199.    Dword colour,
  200.    eNumberBase nBase = nbDecimal,
  201.    bool valueIsPointer = false
  202.    );
  203. // ôóíêöèÿ 58 äîñòóï ê ôàéëîâîé ñèñòåìå
  204. Dword kos_FileSystemAccess( kosFileInfo *fileInfo );
  205. // ôóíêöèÿ 63
  206. void 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. void kos_InitHeap();
  217.  
  218. //
  219. void kos_Main();
  220.