Subversion Repositories Kolibri OS

Rev

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