Subversion Repositories Kolibri OS

Rev

Rev 5996 | Rev 6039 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. //CODED by Veliant, Leency, Nable, Pavelyakov. GNU GPL licence.
  2.  
  3. #ifndef INCLUDE_KOLIBRI_H
  4. #define INCLUDE_KOLIBRI_H
  5. #print "[include <kolibri.h>]\n"
  6.  
  7. #pragma option OST
  8. #pragma option ON
  9. #pragma option cri-
  10. #pragma option -CPA
  11. #initallvar 0
  12. #jumptomain FALSE
  13.  
  14. #startaddress 0
  15.  
  16. #code32 TRUE
  17.  
  18. char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
  19. dword  os_version   = 0x00000001;
  20. dword  start_addr   = #______INIT______;
  21. dword  final_addr   = #______STOP______+32;
  22. dword  alloc_mem    = MEMSIZE;
  23. dword  x86esp_reg   = MEMSIZE;
  24. dword  I_Param      = #param;
  25. dword  I_Path       = #program_path;
  26. char param[4096];
  27. char program_path[4096];
  28.  
  29. dword TEMP = 0;
  30.  
  31. #define NULL      0
  32. #define OLD      -1
  33. #define true      1
  34. #define false     0
  35.  
  36. //Events
  37.  
  38. #define evReDraw  1
  39. #define evKey     2
  40. #define evButton  3
  41. #define evDesktop 5
  42. #define evMouse   6
  43. #define evIPC     7
  44. #define evNetwork 8
  45. #define evDebug   9
  46.  
  47. #define EVENT_MOUSE case 6: mouse.get();
  48.  
  49. //Button options
  50. #define BT_DEL      0x80000000
  51. #define BT_HIDE     0x40000000
  52. #define BT_NOFRAME  0x20000000
  53.  
  54. //ASCII KEYS
  55. #define ASCII_KEY_BS    008
  56. #define ASCII_KEY_TAB   009
  57. #define ASCII_KEY_ENTER 013
  58. #define ASCII_KEY_ESC   027
  59. #define ASCII_KEY_DEL   182
  60. #define ASCII_KEY_INS   185
  61. #define ASCII_KEY_SPACE 032
  62.  
  63. #define ASCII_KEY_LEFT  176
  64. #define ASCII_KEY_RIGHT 179
  65. #define ASCII_KEY_DOWN  177
  66. #define ASCII_KEY_UP    178
  67. #define ASCII_KEY_HOME  180
  68. #define ASCII_KEY_END   181
  69. #define ASCII_KEY_PGDN  183
  70. #define ASCII_KEY_PGUP  184
  71.  
  72. //SCAN CODE KEYS
  73. #define SCAN_CODE_BS    014
  74. #define SCAN_CODE_TAB   015
  75. #define SCAN_CODE_ENTER 028
  76. #define SCAN_CODE_ESC   001
  77. #define SCAN_CODE_DEL   083
  78. #define SCAN_CODE_INS   082
  79. #define SCAN_CODE_SPACE 057
  80.            
  81. #define SCAN_CODE_LEFT  075
  82. #define SCAN_CODE_RIGHT 077
  83. #define SCAN_CODE_DOWN  080
  84. #define SCAN_CODE_UP    072
  85. #define SCAN_CODE_HOME  071
  86. #define SCAN_CODE_END   079
  87. #define SCAN_CODE_PGDN  081
  88. #define SCAN_CODE_PGUP  073
  89.  
  90. #define KEY_LSHIFT     00000000001b
  91. #define KEY_RSHIFT     00000000010b
  92. #define KEY_LCTRL      00000000100b
  93. #define KEY_RCTRL      00000001000b
  94. #define KEY_LALT       00000010000b
  95. #define KEY_RALT       00000100000b
  96. #define KEY_CAPSLOCK   00001000000b
  97. #define KEY_NUMLOCK    00010000000b
  98. #define KEY_SCROLLLOCK 00100000000b
  99. #define KEY_LWIN       01000000000b
  100. #define KEY_RWIN       10000000000b
  101.  
  102.  
  103. inline fastcall word GetKey()  //+Gluk fix
  104. {
  105.                 $push edx
  106. GETKEY:
  107.                 $mov  eax,2
  108.                 $int  0x40
  109.                 $cmp eax,1
  110.                 $jne GETKEYI
  111.                 $mov ah,dh
  112.                 $jmp GETKEYII //jz?
  113. GETKEYI:
  114.                 $mov dh,ah
  115.                 $jmp GETKEY
  116. GETKEYII:
  117.                 $pop edx
  118.                 $shr eax,8
  119. }
  120.  
  121.  
  122. unsigned char key_ascii;
  123. dword key_scancode, key_modifier;
  124. int GetKeys()
  125. {
  126.                 $push edx
  127. GETKEY:
  128.                 $mov  eax,2
  129.                 $int  0x40
  130.                 $cmp eax,1
  131.                 $jne GETKEYI
  132.                 $mov eax,edx
  133.                 $jmp GETKEYII
  134. GETKEYI:
  135.                 $mov edx,eax
  136.                 $jmp GETKEY
  137. GETKEYII:
  138.                 $pop edx
  139.         key_ascii = AH;
  140.         $shr  eax,16
  141.         key_scancode = AL;
  142.         //get alt/shift/ctrl key status
  143.         $mov eax,66
  144.         $mov ebx,3
  145.         $int 0x40
  146.         key_modifier = EAX;
  147. }
  148.  
  149. //allow event mask
  150. #define EVENT_MASK_REDRAW   000000001b
  151. #define EVENT_MASK_KEYBOARD 000000010b
  152. #define EVENT_MASK_BUTTONS  000000100b
  153. #define EVENT_MASK_DESKTOP  000010000b
  154. #define EVENT_MASK_MOUSE    000100000b
  155. #define EVENT_MASK_IPC      001000000b
  156. #define EVENT_MASK_NETWORK  010000000b
  157. #define EVENT_MASK_DEBUG    100000000b
  158.  
  159. //ARGS FUNCTION
  160. #define END_ARGS 0xFF00FF
  161. //-------------------------------------------------------------------------
  162.  
  163. #ifndef INCLUDE_SYSTEM_H
  164. #include "../lib/system.h"
  165. #endif
  166.  
  167. #ifndef INCLUDE_MOUSE_H
  168. #include "../lib/mouse.h"
  169. #endif
  170.  
  171. :struct raw_image {
  172.         dword w, h, data;
  173. };
  174.  
  175.  
  176.  
  177. //------------------------------------------------------------------------------
  178. :dword wait_event_code;
  179. inline fastcall dword WaitEvent()
  180. {
  181.         $mov eax,10
  182.         $int 0x40
  183.         wait_event_code = EAX;
  184.         //if(wait_event_code==evMouse) MOUSE.get();
  185.         //return wait_event_code;
  186. }
  187.  
  188. inline fastcall dword CheckEvent()
  189. {
  190.         $mov eax,11
  191.         $int 0x40
  192. }
  193.  
  194. inline fastcall dword WaitEventTimeout(EBX)
  195. {
  196.         $mov eax,23
  197.         $int 0x40
  198. }
  199.  
  200. inline fastcall SetEventMask(EBX)
  201. {
  202.         $mov eax,40
  203.         $int 0x40
  204. }
  205.  
  206.  
  207. inline fastcall pause(EBX)
  208. {
  209.         $mov eax, 5
  210.         $int 0x40
  211. }
  212.  
  213. inline fastcall word GetButtonID()
  214. {
  215.         $mov eax,17
  216.         $int  0x40
  217.         $shr eax,8
  218. }
  219.  
  220. inline fastcall dword GetFreeRAM()
  221. {
  222.         $mov eax, 18
  223.         $mov ebx, 16
  224.         $int 0x40
  225.         //return eax = ðàçìåð ñâîáîäíîé ïàìÿòè â êèëîáàéòàõ
  226. }
  227.  
  228. inline void draw_line(dword x1,y1,x2,y2,color)
  229. {
  230.         x2--;y2--;y1--;
  231.         $mov EAX,38
  232.         EBX = x1<<16;
  233.         EBX |= x2;
  234.         ECX = y1<<16;
  235.         ECX |= y2;
  236.         $mov EDX,color
  237.         $int 0x40
  238. }
  239.  
  240. inline fastcall dword LoadDriver(ECX) //ECX - èìÿ äðàéâåðà
  241. {
  242.         $mov eax, 68
  243.         $mov ebx, 16
  244.         $int 0x40
  245.         //return 0 - íåóäà÷à, èíà÷å eax = õýíäë äðàéâåðà
  246. }
  247.  
  248. inline fastcall dword RuleDriver(ECX) //óêàçàòåëü íà óïðàâëÿþùóþ ñòðóêòóðó
  249. {
  250.         $mov eax, 68
  251.         $mov ebx, 17
  252.         $int 0x40
  253.         //return eax = îïðåäåëÿåòñÿ äðàéâåðîì
  254. }
  255.  
  256. struct proc_info
  257. {
  258.         #define SelfInfo -1
  259.         dword   use_cpu;
  260.         word    pos_in_stack,num_slot,rezerv1;
  261.         unsigned char name[11];
  262.         char    rezerv2;
  263.         dword   adress,use_memory,ID,left,top,width,height;
  264.         word    status_slot,rezerv3;
  265.         dword   work_left,work_top,work_width,work_height;
  266.         char    status_window;
  267.         dword   cwidth,cheight;
  268.         byte    reserved[1024-71-8];
  269. };
  270.  
  271. inline fastcall void GetProcessInfo(EBX, ECX)
  272. {
  273.         $mov eax,9;
  274.         $int  0x40
  275.         DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth
  276.         DSDWORD[EBX+75] = DSDWORD[EBX+46] - GetSkinHeight() - 4; //set cheight
  277. }
  278.  
  279. inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y
  280. {
  281.         $mov eax,34
  282.         $int 0x40
  283. }
  284.  
  285. inline fastcall int GetProcessSlot( ECX)
  286. {
  287.         EAX = 18;
  288.         EBX = 21;
  289.         $int 0x40
  290. }
  291.  
  292. inline fastcall int GetActiveProcess()
  293. {
  294.         EAX = 18;
  295.         EBX = 7;
  296.         $int 0x40
  297. }
  298.  
  299. :int CheckActiveProcess(int Form_ID)
  300. {
  301.         int id9=GetProcessSlot(Form_ID);
  302.         if (id9==GetActiveProcess()) return 1;
  303.         return 0;
  304. }
  305.  
  306. inline fastcall void ActivateWindow( ECX)
  307. {
  308.         EAX = 18;
  309.         EBX = 3;
  310.         $int 0x40
  311. }
  312.  
  313. inline fastcall int MinimizeWindow()
  314. {
  315.         EAX = 18;
  316.         EBX = 10;
  317.         $int 0x40
  318. }
  319.  
  320. inline fastcall int CreateThread(ECX,EDX)
  321. {
  322.         $mov eax,51
  323.         $mov ebx,1
  324.         $int 0x40
  325. }
  326.  
  327. inline fastcall void SwitchToAnotherThread()
  328. {
  329.         $mov eax,68
  330.         $mov ebx,1
  331.         $int 0x40
  332. }
  333.  
  334. inline fastcall int SendWindowMessage( ECX, EDX)
  335. {
  336.         $mov eax, 72
  337.         $mov ebx, 1
  338.         $int 0x40
  339. }
  340.  
  341. inline fastcall int KillProcess( ECX)
  342. {
  343.         $mov eax,18;
  344.         $mov ebx,18;
  345.         $int 0x40
  346. }
  347.  
  348. #define TURN_OFF 2
  349. #define REBOOT 3
  350. #define KERNEL 4
  351. inline fastcall int ExitSystem( ECX)
  352. {
  353.         $mov eax, 18
  354.         $mov ebx, 9
  355.         $int 0x40
  356. }
  357.  
  358. inline fastcall ExitProcess()
  359. {
  360.         $mov eax,-1;
  361.         $int 0x40
  362. }
  363.  
  364. //------------------------------------------------------------------------------
  365.  
  366. //eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus)
  367. inline fastcall int GetSystemLanguage()
  368. {
  369.         EAX = 26;
  370.         EBX = 5;
  371.         $int 0x40
  372. }
  373.  
  374. inline fastcall GetSkinHeight()
  375. {
  376.         $push ebx
  377.         $mov  eax,48
  378.         $mov  ebx,4
  379.         $int 0x40
  380.         $pop  ebx
  381. }
  382.  
  383. inline fastcall void SetSystemSkin( ECX)
  384. {
  385.         EAX = 48;
  386.         EBX = 8;
  387.         $int 0x40
  388. }
  389.  
  390. inline fastcall int GetScreenWidth()
  391. {
  392.         $mov eax, 14
  393.         $int 0x40
  394.         $shr eax, 16
  395. }
  396.  
  397. inline fastcall int GetScreenHeight()
  398. {
  399.         $mov eax, 14
  400.         $int 0x40
  401.         $and eax,0x0000FFFF
  402. }
  403.  
  404. inline fastcall int GetClientTop()
  405. {
  406.         $mov eax, 48
  407.         $mov ebx, 5
  408.         $int 0x40
  409.     $mov eax, ebx
  410.     $shr eax, 16
  411. }
  412.  
  413. inline fastcall int GetClientHeight()
  414. {
  415.         $mov eax, 48
  416.         $mov ebx, 5
  417.         $int 0x40
  418.     $mov eax, ebx
  419. }
  420.  
  421.  
  422. inline fastcall dword LoadLibrary( ECX)
  423. {
  424.         $mov eax, 68
  425.         $mov ebx, 19
  426.         $int  0x40
  427. }
  428.  
  429. inline fastcall int TestBit( EAX, CL)
  430. {
  431.         $shr eax,cl
  432.         $and eax,1
  433. }
  434.  
  435. inline fastcall int PlaySpeaker( ESI)
  436. {
  437.         $mov eax, 55
  438.         $mov ebx, 55
  439.         $int 0x40
  440. }
  441.  
  442. inline fastcall void debugln( EDX)
  443. {
  444.         $push eax
  445.         $push ebx
  446.         $push ecx
  447.         $mov eax, 63
  448.         $mov ebx, 1
  449. NEXT_CHAR:
  450.         $mov ecx, DSDWORD[edx]
  451.         $or      cl, cl
  452.         $jz  DONE
  453.         $int 0x40
  454.         $inc edx
  455.         $jmp NEXT_CHAR
  456. DONE:
  457.         $mov cl, 13
  458.         $int 0x40
  459.         $mov cl, 10
  460.         $int 0x40
  461.         $pop ecx
  462.         $pop ebx
  463.         $pop eax
  464. }
  465.  
  466. inline fastcall void debug( EDX)
  467. {
  468.         $push eax
  469.         $push ebx
  470.         $push ecx
  471.         $mov eax, 63
  472.         $mov ebx, 1
  473. NEXT_CHAR:
  474.         $mov ecx, DSDWORD[edx]
  475.         $or      cl, cl
  476.         $jz  DONE
  477.         $int 0x40
  478.         $inc edx
  479.         $jmp NEXT_CHAR
  480. DONE:
  481.         $pop ecx
  482.         $pop ebx
  483.         $pop eax
  484. }
  485.  
  486.  
  487. inline fastcall void debugch( ECX)
  488. {
  489.         $push eax
  490.         $push ebx
  491.         $mov eax,63
  492.         $mov ebx,1
  493.         $int 0x40
  494.         $pop ebx
  495.         $pop eax
  496. }
  497. //------------------------------------------------------------------------------
  498.  
  499. void DefineAndDrawWindow(dword x, y, size_w, size_h, byte WindowType,dword WindowAreaColor, EDI, ESI)
  500. {
  501.         EAX = 12;              // function 12:tell os about windowdraw
  502.         EBX = 1;
  503.         $int 0x40
  504.        
  505.         $xor EAX,EAX
  506.         EBX = x << 16 + size_w;
  507.         ECX = y << 16 + size_h;
  508.  
  509.         EDX = WindowType << 24 | WindowAreaColor;
  510.         $int 0x40
  511.  
  512.         EAX = 12;              // function 12:tell os about windowdraw
  513.         EBX = 2;
  514.         $int 0x40
  515. }
  516.  
  517. inline fastcall MoveSize( EBX,ECX,EDX,ESI)
  518. {
  519.         $mov eax, 67
  520.         $int 0x40
  521. }
  522.  
  523. inline fastcall void DrawTitle( ECX)
  524. {
  525.         EAX = 71;
  526.         EBX = 1;
  527.         $int 0x40;
  528. }
  529.  
  530. void WriteTextB(dword x,y,byte fontType, dword color, EDX)
  531. {
  532.         EAX = 4;
  533.         EBX = x<<16+y;
  534.         ECX = fontType<<24+color;
  535.         ESI = 0;
  536.         $int 0x40;
  537.         $add ebx, 1<<16
  538.         $int 0x40
  539. }
  540.  
  541. void WriteText(dword x,y,byte fontType, dword color, EDX)
  542. {
  543.         EAX = 4;
  544.         EBX = x<<16+y;
  545.         ECX = fontType<<24+color;
  546.         $int 0x40;
  547. }
  548.  
  549. dword WriteBufText(dword x,y,byte fontType, dword color, EDX, EDI)
  550. {
  551.         EAX = 4;
  552.         EBX = x<<16+y;
  553.         ECX = fontType<<24+color;
  554.         $int 0x40;
  555. }
  556.  
  557. void WriteNumber(dword x,y,byte fontType, dword color, count, ECX)
  558. {
  559.         EAX = 47;
  560.         EBX = count<<16;
  561.         EDX = x<<16+y;
  562.         ESI = fontType<<24+color;
  563.         $int 0x40;
  564. }
  565.  
  566. void CopyScreen(dword EBX, x, y, w, h)
  567. {
  568.   EAX = 36;
  569.   ECX = w << 16 + h;
  570.   EDX = x << 16 + y;
  571.   $int  0x40;
  572. }
  573.  
  574. :dword GetPixelColor(dword x, x_size, y)
  575. {
  576.         $mov eax, 35
  577.         EBX= y*x_size+x;
  578.         $int 0x40
  579. }
  580.  
  581.  
  582. void _PutImage(dword x,y, w,h, EBX)
  583. {
  584.         EAX = 7;
  585.         ECX = w<<16+h;
  586.         EDX = x<<16+y;
  587.         $int 0x40
  588. }
  589.  
  590. void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI)
  591. {
  592.         EAX = 65;
  593.         ECX = w<<16+h;
  594.         EDX = x<<16+y;
  595.         EBP = 0;
  596.         $int 0x40
  597. }
  598.  
  599. inline fastcall void PutPixel( EBX,ECX,EDX)
  600. {
  601.   EAX=1;
  602.   $int 0x40
  603. }
  604.  
  605. void DrawBar(dword x,y,w,h,EDX)
  606. {
  607.         if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :)
  608.         EAX = 13;
  609.         EBX = x<<16+w;
  610.         ECX = y<<16+h;
  611.         $int 0x40
  612. }
  613.  
  614. void DefineButton(dword x,y,w,h,EDX,ESI)
  615. {
  616.         EAX = 8;
  617.         $push edx
  618.         EDX += BT_DEL;
  619.         $int 0x40;
  620.         $pop edx
  621.         EBX = x<<16+w;
  622.         ECX = y<<16+h;
  623.         $int 0x40
  624. }
  625.  
  626. inline RefreshWindow(dword ID_REFRESH,ID_ACTIVE)
  627. {
  628.         EAX = 18;
  629.         EBX = 22;
  630.         ECX = 3;
  631.         EDX = ID_REFRESH;
  632.         $int 0x40
  633.         EAX = 18;
  634.         EBX = 3;
  635.         EDX = ID_ACTIVE;
  636.         $int 0x40
  637. }
  638.  
  639. inline getIPC(ECX,EDX)
  640. {
  641.         $mov EAX,60
  642.         $mov EBX,2
  643.         $int 0x40
  644. }
  645.  
  646. inline sendIPC(ECX,EDX,ESI)
  647. {
  648.         $mov EAX,60
  649.         $mov EBX,1
  650.         $int 0x40
  651. }
  652.  
  653. void UnsafeDefineButton(dword x,y,w,h,EDX,ESI)
  654. {
  655.         EAX = 8;
  656.         EBX = x<<16+w;
  657.         ECX = y<<16+h;
  658.         $int 0x40
  659. }
  660.  
  661. inline fastcall void DeleteButton( EDX)
  662. {
  663.         EAX = 8;
  664.         EDX += BT_DEL;
  665.         $int 0x40
  666. }
  667.  
  668. inline fastcall dword GetStartTime()
  669. {
  670.         $mov eax,26
  671.         $mov ebx,9
  672.         $int 0x40
  673. }
  674.  
  675. :dword X_EventRedrawWindow,Y_EventRedrawWindow;
  676. :void _EventRedrawWindow()
  677. {
  678.         loop()switch(WaitEvent())
  679.         {
  680.                 case evReDraw:
  681.                         DefineAndDrawWindow(X_EventRedrawWindow,Y_EventRedrawWindow,100,1,1,0x34,0xFFFFFF,"");
  682.                         pause(10);
  683.                         ExitProcess();
  684.                         break;
  685.         }
  686. }
  687. :char REDRAW_BUFF_EVENT_[4096];
  688. :void EventRedrawWindow(dword x,y)
  689. {
  690.         X_EventRedrawWindow = x;
  691.         Y_EventRedrawWindow = y;
  692.         CreateThread(#_EventRedrawWindow,#REDRAW_BUFF_EVENT_+4092);
  693. }
  694.  
  695. :dword ALERT_TEXT;
  696. :void dialog_alert()
  697. {
  698.         byte id;
  699.         loop()switch(WaitEvent())
  700.         {
  701.                 case evReDraw:
  702.                         DefineAndDrawWindow(215,100,250,200,0x34,0xFFFFFF,"Alert");
  703.                         WriteTextB(5,5,0x90,0x0,ALERT_TEXT);
  704.                 break;
  705.                 case evKey:
  706.                 case evButton:
  707.                         id=GetButtonID();
  708.                         if (id==1) ExitProcess();
  709.                 break;
  710.         }
  711. }
  712. :dword alert(dword text)
  713. {
  714.         dword mem = malloc(4096);
  715.         ALERT_TEXT = text;
  716.         CreateThread(#dialog_alert,mem+4092);
  717.         return mem;
  718. }
  719.  
  720. :struct _screen
  721. {
  722.         dword width,height;
  723. } screen;
  724.  
  725. :struct _skin
  726. {
  727.         dword width,height;
  728. } SKIN;
  729.  
  730. :void DrawDate(dword x, y, color, in_date)
  731. {
  732.         //char text[15];
  733.         EDI = in_date;
  734.         EAX = 47;
  735.         EBX = 2<<16;
  736.         EDX = x<<16+y;
  737.         ESI = 0x80<<24+color;
  738.         ECX = EDI.date.day;
  739.         $int 0x40;
  740.         EDX += 18<<16;
  741.         ECX = EDI.date.month;
  742.         $int 0x40;
  743.         EDX += 18<<16;
  744.         EBX = 4<<16;
  745.         ECX = EDI.date.year;
  746.         $int 0x40;
  747.         PutPixel(x+14,y+6,color);
  748.         PutPixel(x+32,y+6,color);
  749.         //sprintf(#text,"%d",EDI.date.year);
  750.         //WriteText(x, y, 0x80, 0x000000, #text);
  751. }
  752.  
  753. :void __path_name__(dword BUF,PATH)
  754. {
  755.         dword beg = PATH;
  756.         dword pos = PATH;
  757.         dword sav = PATH;
  758.         dword i;
  759.         while(DSBYTE[pos])
  760.         {
  761.                 if(DSBYTE[pos]=='/')sav = pos;
  762.                 pos++;
  763.         }
  764.         i = sav-beg;
  765.         while(i)
  766.         {
  767.                 DSBYTE[BUF] = DSBYTE[beg];
  768.                 beg++;
  769.                 BUF++;
  770.                 i--;
  771.         }
  772.         /*while(DSBYTE[beg])
  773.         {
  774.                 DSBYTE[BUF1] = DSBYTE[beg];
  775.                 beg++;
  776.                 BUF1++;
  777.         }*/
  778.         //DSBYTE[BUF1] = 0;
  779.         DSBYTE[BUF] = 0;
  780. }
  781. char __BUF_DIR__[4096];
  782. :struct SELF
  783. {
  784.         dword dir;
  785.         dword file;
  786.         dword path;
  787. } self;
  788.  
  789. dword __generator;  // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë
  790.  
  791. :dword program_path_length;
  792.  
  793. //The initialization of the initial data before running
  794. void ______INIT______()
  795. {
  796.         self.dir = #__BUF_DIR__;
  797.         self.file = 0;
  798.         self.path = I_Path;
  799.         __path_name__(#__BUF_DIR__,I_Path);
  800.        
  801.         SKIN.height   = GetSkinHeight();
  802.         screen.width  = GetScreenWidth();
  803.         screen.height = GetScreenHeight();
  804.        
  805.         //program_path_length = strlen(I_Path);
  806.         DOUBLE_CLICK_DELAY = GetMouseDoubleClickDelay();
  807.         __generator = GetStartTime();
  808.        
  809.         mem_init();
  810.  
  811.         main();
  812.         ExitProcess();
  813. }
  814. ______STOP______:
  815. #endif
  816.  
  817. #ifndef INCLUDE_MEM_H
  818. #include "../lib/mem.h"
  819. #endif
  820.