Subversion Repositories Kolibri OS

Rev

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