Subversion Repositories Kolibri OS

Rev

Rev 8426 | Blame | Last modification | View Log | Download | RSS feed

  1. #ifndef __KOS_32_SYS_H__
  2. #define __KOS_32_SYS_H__
  3.  
  4. #include <stddef.h>
  5. #include <stdarg.h>
  6. typedef unsigned int uint32_t;
  7. typedef int int32_t;
  8. typedef unsigned char uint8_t;
  9. typedef unsigned short int uint16_t;
  10. typedef unsigned long long uint64_t;
  11.  
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15.  
  16. #define TYPE_3_BORDER_WIDTH  5
  17. #define WIN_STATE_MINIMIZED  0x02
  18. #define WIN_STATE_ROLLED     0x04
  19. #define POS_SCREEN 0
  20. #define POS_WINDOW 1
  21.  
  22. #define IPC_NOBUFFER 1
  23. #define IPC_LOCKED 2
  24. #define IPC_OVERFLOW 3
  25. #define IPC_NOPID 4
  26.  
  27. #define SHM_OPEN        0x00
  28. #define SHM_OPEN_ALWAYS 0x04
  29. #define SHM_CREATE      0x08
  30. #define SHM_READ        0x00
  31. #define SHM_WRITE       0x01
  32.    
  33. // for clipboard funtions    
  34. #define UTF 0
  35. #define CP866 1
  36. #define CP1251 2
  37. #define TEXT 0
  38. #define IMAGE 1
  39. #define RAW 2
  40.  
  41. //Read/Write data as type (int char, etc.) at address "addr" with offset "offset". eg DATA(int, buff, 8);
  42. #define DATA(type, addr, offset) *((type*)((uint8_t*)addr+offset))
  43. #define X_W(X, W) ((X<<16)+W)
  44. #define Y_H X_W
  45.    
  46. typedef struct {
  47.     uint8_t blue;
  48.     uint8_t green;
  49.     uint8_t red;
  50. }RGB;
  51.    
  52. typedef  unsigned int color_t;
  53.  
  54. typedef union __attribute__((packed)) pos_t
  55. {
  56.     uint32_t val;
  57.     struct
  58.     {
  59.         short  x;
  60.         short  y;
  61.     };
  62. } pos_t;
  63.  
  64.  
  65. typedef union __attribute__((packed)) oskey_t
  66. {
  67.     uint32_t val;
  68.     struct
  69.     {
  70.         uint8_t   state;
  71.         uint8_t   code;
  72.         uint16_t  ctrl_key;
  73.     };
  74. } oskey_t;
  75.  
  76. typedef struct
  77. {
  78.   unsigned      handle;
  79.   unsigned      io_code;
  80.   void          *input;
  81.   int           inp_size;
  82.   void          *output;
  83.   int           out_size;
  84. }ioctl_t;
  85.  
  86. typedef union
  87. {
  88.     struct
  89.     {
  90.         void   *data;
  91.         size_t  size;
  92.     } x;
  93.     unsigned long long raw;
  94. }ufile_t;
  95.  
  96. struct kolibri_system_colors {
  97.   color_t frame_area;
  98.   color_t grab_bar;
  99.   color_t grab_bar_button;
  100.   color_t grab_button_text;
  101.   color_t grab_text;
  102.   color_t work_area;
  103.   color_t work_button;
  104.   color_t work_button_text;
  105.   color_t work_text;
  106.   color_t work_graph;
  107. };
  108.  
  109.  
  110. struct blit_call
  111. {
  112.     int dstx;
  113.     int dsty;
  114.     int w;
  115.     int h;
  116.  
  117.     int srcx;
  118.     int srcy;
  119.     int srcw;
  120.     int srch;
  121.  
  122.     void *bitmap;
  123.     int   stride;
  124. };
  125.  
  126. struct ipc_message
  127. {
  128.     uint32_t    pid;        // PID of sending thread
  129.     uint32_t    datalen;    // data bytes
  130.     char        data[0];    // data begin
  131. };
  132.  
  133. struct ipc_buffer
  134. {
  135.     uint32_t    lock;   // nonzero is locked
  136.     uint32_t    used;   // used bytes in buffer
  137.     struct ipc_message  data[0];    // data begin
  138. };
  139.    
  140. static inline void begin_draw(void)
  141. {
  142.     __asm__ __volatile__(
  143.     "int $0x40" ::"a"(12),"b"(1));
  144. };
  145.  
  146. static inline
  147. void end_draw(void)
  148. {
  149.     __asm__ __volatile__(
  150.     "int $0x40" ::"a"(12),"b"(2));
  151. };
  152.  
  153. static inline
  154. void sys_create_window(int x, int y, int w, int h, const char *name,
  155.                        color_t workcolor, uint32_t style)
  156. {
  157.     __asm__ __volatile__(
  158.     "int $0x40"
  159.     ::"a"(0),
  160.      "b"((x << 16) | ((w-1) & 0xFFFF)),
  161.      "c"((y << 16) | ((h-1) & 0xFFFF)),
  162.      "d"((style << 24) | (workcolor & 0xFFFFFF)),
  163.      "D"(name),
  164.      "S"(0) : "memory");
  165. };
  166.  
  167. static inline
  168. void sys_change_window(int new_x, int new_y, int new_w, int new_h)
  169. {
  170.     __asm__ __volatile__(
  171.         "int $0x40"
  172.         ::"a"(67), "b"(new_x), "c"(new_y), "d"(new_w),"S"(new_h)
  173.     );
  174. }
  175.  
  176.  
  177. static inline
  178. void define_button(uint32_t x_w, uint32_t y_h, uint32_t id, uint32_t color)
  179. {
  180.     __asm__ __volatile__(
  181.     "int $0x40"
  182.     ::"a"(8),
  183.       "b"(x_w),
  184.       "c"(y_h),
  185.       "d"(id),
  186.       "S"(color));
  187. };
  188.  
  189. static inline
  190. void draw_line(int xs, int ys, int xe, int ye, color_t color)
  191. {
  192.     __asm__ __volatile__(
  193.     "int $0x40"
  194.     ::"a"(38), "d"(color),
  195.       "b"((xs << 16) | xe),
  196.       "c"((ys << 16) | ye));
  197. }
  198.  
  199. static inline
  200. void draw_bar(int x, int y, int w, int h, color_t color)
  201. {
  202.     __asm__ __volatile__(
  203.     "int $0x40"
  204.     ::"a"(13), "d"(color),
  205.       "b"((x << 16) | w),
  206.       "c"((y << 16) | h));
  207. }
  208.  
  209. static inline
  210. void draw_bitmap(void *bitmap, int x, int y, int w, int h)
  211. {
  212.     __asm__ __volatile__(
  213.     "int $0x40"
  214.     ::"a"(7), "b"(bitmap),
  215.       "c"((w << 16) | h),
  216.       "d"((x << 16) | y));
  217. }
  218.  
  219. static inline
  220. void draw_text_sys(const char *text, int x, int y, int len, color_t color)
  221. {
  222.     __asm__ __volatile__(
  223.     "int $0x40"
  224.     ::"a"(4),"d"(text),
  225.       "b"((x << 16) | y),
  226.       "S"(len),"c"(color)
  227.      :"memory");
  228. }
  229. static inline
  230. void draw_text_sys_bg(const char *text, int x, int y, int len, color_t color, color_t bg)
  231. {
  232.     __asm__ __volatile__(
  233.     "int $0x40"
  234.     ::"a"(4),"d"(text),
  235.       "b"((x << 16) | y),
  236.       "S"(len),"c"(color), "D"(bg)
  237.      :"memory");
  238. }
  239.  
  240.  
  241. static inline
  242. uint32_t get_skin_height(void)
  243. {
  244.     uint32_t height;
  245.  
  246.     __asm__ __volatile__(
  247.     "int $0x40 \n\t"
  248.     :"=a"(height)
  249.     :"a"(48),"b"(4));
  250.     return height;
  251. };
  252.  
  253. static inline
  254. pos_t get_mouse_pos(int origin)
  255. {
  256.     pos_t val;
  257.  
  258.     __asm__ __volatile__(
  259.     "int $0x40 \n\t"
  260.     "rol $16, %%eax"
  261.     :"=a"(val)
  262.     :"a"(37),"b"(origin));
  263.     return val;
  264. }
  265.  
  266. static inline
  267. uint32_t get_mouse_buttons(void)
  268. {
  269.     uint32_t val;
  270.  
  271.     __asm__ __volatile__(
  272.     "int $0x40"
  273.     :"=a"(val)
  274.     :"a"(37),"b"(2));
  275.     return val;
  276. };
  277.  
  278. static inline
  279. uint32_t get_mouse_wheels(void)
  280. {
  281.     uint32_t val;
  282.  
  283.     __asm__ __volatile__(
  284.     "int $0x40 \n\t"
  285.     :"=a"(val)
  286.     :"a"(37),"b"(7));
  287.     return val;
  288. };
  289.  
  290. static inline uint32_t load_cursor(void *path, uint32_t flags)
  291. {
  292.     uint32_t  val;
  293.     __asm__ __volatile__(
  294.     "int $0x40"
  295.     :"=a"(val)
  296.     :"a"(37), "b"(4), "c"(path), "d"(flags));
  297.     return val;
  298. }
  299.  
  300. static inline uint32_t  set_cursor(uint32_t  cursor)
  301. {
  302.     uint32_t  old;
  303.     __asm__ __volatile__(
  304.     "int $0x40"
  305.     :"=a"(old)
  306.     :"a"(37), "b"(5), "c"(cursor));
  307.     return old;
  308. };
  309.  
  310. static inline int destroy_cursor(uint32_t cursor)
  311. {
  312.     int ret;
  313.     __asm__ __volatile__(
  314.     "int $0x40"
  315.     :"=a"(ret)
  316.     :"a"(37), "b"(6), "c"(cursor)
  317.     :"memory");
  318.     return ret;
  319. };
  320.  
  321.  
  322. static inline
  323. uint32_t wait_for_event(uint32_t time)
  324. {
  325.     uint32_t val;
  326.     __asm__ __volatile__(
  327.     "int $0x40"
  328.     :"=a"(val)
  329.     :"a"(23), "b"(time));
  330.     return val;
  331. };
  332.  
  333. static inline uint32_t check_os_event()
  334. {
  335.     uint32_t val;
  336.     __asm__ __volatile__(
  337.     "int $0x40"
  338.     :"=a"(val)
  339.     :"a"(11));
  340.     return val;
  341. };
  342.  
  343. static inline uint32_t get_os_event()
  344. {
  345.     uint32_t val;
  346.     __asm__ __volatile__(
  347.     "int $0x40"
  348.     :"=a"(val)
  349.     :"a"(10));
  350.     return val;
  351. };
  352.  
  353. static inline
  354. uint32_t get_tick_count(void)
  355. {
  356.     uint32_t val;
  357.     __asm__ __volatile__(
  358.     "int $0x40"
  359.     :"=a"(val)
  360.     :"a"(26),"b"(9));
  361.     return val;
  362. };
  363.  
  364. static inline
  365. uint64_t get_ns_count(void)
  366. {
  367.     uint64_t val;
  368.     __asm__ __volatile__(
  369.     "int $0x40"
  370.     :"=A"(val)
  371.     :"a"(26), "b"(10));
  372.     return val;
  373. };
  374.  
  375. static inline oskey_t get_key(void)
  376. {
  377.     oskey_t val;
  378.     __asm__ __volatile__(
  379.     "int $0x40"
  380.     :"=a"(val)
  381.     :"a"(2));
  382.     return val;
  383. }
  384.  
  385. static inline
  386. uint32_t get_os_button()
  387. {
  388.     uint32_t val;
  389.     __asm__ __volatile__(
  390.     "int $0x40"
  391.     :"=a"(val)
  392.     :"a"(17));
  393.     return val>>8;
  394. };
  395.  
  396. static inline uint32_t get_service(char *name)
  397. {
  398.     uint32_t retval = 0;
  399.     __asm__ __volatile__(
  400.     "int $0x40"
  401.     :"=a"(retval)
  402.     :"a"(68),"b"(16),"c"(name)
  403.     :"memory");
  404.  
  405.     return retval;
  406. };
  407.  
  408. static inline int call_service(ioctl_t *io)
  409. {
  410.     int retval;
  411.  
  412.     __asm__ __volatile__(
  413.     "int $0x40"
  414.     :"=a"(retval)
  415.     :"a"(68),"b"(17),"c"(io)
  416.     :"memory","cc");
  417.  
  418.     return retval;
  419. };
  420.  
  421.  
  422. static inline void yield(void)
  423. {
  424.     __asm__ __volatile__(
  425.     "int $0x40"
  426.     ::"a"(68), "b"(1));
  427. };
  428.  
  429. static inline void delay(uint32_t time)
  430. {
  431.     __asm__ __volatile__(
  432.     "int $0x40"
  433.     ::"a"(5), "b"(time)
  434.     :"memory");
  435. };
  436.  
  437. static inline
  438. void *user_alloc(size_t size)
  439. {
  440.     void  *val;
  441.     __asm__ __volatile__(
  442.     "int $0x40"
  443.     :"=a"(val)
  444.     :"a"(68),"b"(12),"c"(size));
  445.     return val;
  446. }
  447.  
  448. static inline
  449. int user_free(void *mem)
  450. {
  451.     int  val;
  452.     __asm__ __volatile__(
  453.     "int $0x40"
  454.     :"=a"(val)
  455.     :"a"(68),"b"(13),"c"(mem));
  456.     return val;
  457. }
  458.  
  459. static inline
  460. void* user_realloc(void *mem, size_t size)
  461. {
  462.     void *val;
  463.     __asm__ __volatile__(
  464.     "int $0x40"
  465.     :"=a"(val)
  466.     :"a"(68),"b"(20),"c"(size),"d"(mem)
  467.     :"memory");
  468.  
  469.     return val;
  470. };
  471.  
  472. static inline
  473. int *user_unmap(void *base, size_t offset, size_t size)
  474. {
  475.     int  *val;
  476.     __asm__ __volatile__(
  477.     "int $0x40"
  478.     :"=a"(val)
  479.     :"a"(68),"b"(26),"c"(base),"d"(offset),"S"(size));
  480.     return val;
  481. };
  482.  
  483. static inline ufile_t load_file(const char *path)
  484. {
  485.     ufile_t uf;
  486.  
  487.     __asm__ __volatile__ (
  488.     "int $0x40"
  489.     :"=A"(uf.raw)
  490.     :"a" (68), "b"(27),"c"(path));
  491.  
  492.     return uf;
  493. };
  494.  
  495. static inline int GetScreenSize()
  496. {
  497.     int retval;
  498.  
  499.     __asm__ __volatile__(
  500.     "int $0x40"
  501.     :"=a"(retval)
  502.     :"a"(61), "b"(1));
  503.     return retval;
  504. }
  505.  
  506.  
  507. static inline void get_proc_info(char *info)
  508. {
  509.     __asm__ __volatile__(
  510.     "int $0x40"
  511.     :
  512.     :"a"(9), "b"(info), "c"(-1)
  513.     :"memory");
  514. };
  515.  
  516. static inline void Blit(void *bitmap, int dst_x, int dst_y,
  517.                         int src_x, int src_y, int w, int h,
  518.                         int src_w, int src_h, int stride)
  519. {
  520.     volatile struct blit_call bc;
  521.  
  522.     bc.dstx = dst_x;
  523.     bc.dsty = dst_y;
  524.     bc.w    = w;
  525.     bc.h    = h;
  526.     bc.srcx = src_x;
  527.     bc.srcy = src_y;
  528.     bc.srcw = src_w;
  529.     bc.srch = src_h;
  530.     bc.stride = stride;
  531.     bc.bitmap = bitmap;
  532.  
  533.     __asm__ __volatile__(
  534.     "int $0x40"
  535.     ::"a"(73),"b"(0),"c"(&bc.dstx));
  536. };
  537.  
  538.  
  539. // newlib exclusive
  540. #ifndef __TINYC__
  541. int create_thread(int (*proc)(void *param), void *param, int stack_size);
  542.  
  543. void* load_library(const char *name);
  544.  
  545. void* get_proc_address(void *handle, const char *proc_name);
  546.  
  547. void enumerate_libraries(int (*callback)(void *handle, const char* name,
  548.                                          uint32_t base, uint32_t size, void *user_data),
  549.                          void *user_data);
  550. #endif
  551.  
  552. // May be next section need to be added in newlibc
  553.  
  554. enum KOLIBRI_GUI_EVENTS {
  555.     KOLIBRI_EVENT_NONE = 0,     /* Event queue is empty */
  556.     KOLIBRI_EVENT_REDRAW = 1,   /* Window and window elements should be redrawn */
  557.     KOLIBRI_EVENT_KEY = 2,      /* A key on the keyboard was pressed */
  558.     KOLIBRI_EVENT_BUTTON = 3,   /* A button was clicked with the mouse */
  559.     KOLIBRI_EVENT_DESKTOP = 5,  /* Desktop redraw finished */
  560.     KOLIBRI_EVENT_MOUSE = 6,    /* Mouse activity (movement, button press) was detected */
  561.     KOLIBRI_EVENT_IPC = 7,      /* Interprocess communication notify */
  562.     KOLIBRI_EVENT_NETWORK = 8,  /* Network event */
  563.     KOLIBRI_EVENT_DEBUG = 9,    /* Debug subsystem event */
  564.     KOLIBRI_EVENT_IRQBEGIN = 16 /* 16..31 IRQ0..IRQ15 interrupt =IRQBEGIN+IRQn */
  565. };
  566.  
  567.  
  568. // copied from /programs/system/shell/system/kolibri.c
  569. // fn's returned -1 as syserror, 1 as error, 0 as OK
  570. static inline
  571. int kol_clip_num()
  572. {
  573.     register uint32_t val;
  574.     asm volatile ("int $0x40":"=a"(val):"a"(54), "b"(0));
  575.     return val;
  576. }
  577.  
  578. static inline
  579. char* kol_clip_get(int n)
  580. // returned buffer must be freed by user_free()
  581. {
  582.     register char* val;
  583.     asm volatile ("int $0x40":"=a"(val):"a"(54), "b"(1), "c"(n));
  584.     return val;
  585. }
  586.  
  587. static inline
  588. int kol_clip_set(int n, char buffer[])
  589. {
  590.     register uint32_t val;
  591.     asm volatile ("int $0x40":"=a"(val):"a"(54), "b"(2), "c"(n), "d"(buffer));
  592.     return val;
  593. }
  594.  
  595. static inline
  596. int kol_clip_pop()
  597. {
  598.     register uint32_t val;
  599.     asm volatile ("int $0x40":"=a"(val):"a"(54), "b"(3));
  600.     return val;
  601. }
  602.  
  603. static inline
  604. int kol_clip_unlock()
  605. {
  606.     register uint32_t val;
  607.     asm volatile ("int $0x40":"=a"(val):"a"(54), "b"(4));
  608.     return val;
  609. }
  610.  
  611. static inline void get_system_colors(struct kolibri_system_colors *color_table)
  612. {
  613.   __asm__ volatile ("int $0x40"
  614.                     :
  615.                     :"a"(48),"b"(3),"c"(color_table),"d"(40)
  616.                     );
  617.  
  618.   /* color_table should point to the system color table */
  619. }
  620.  
  621. static inline void debug_board_write_byte(const char ch){
  622.     __asm__ __volatile__(
  623.     "int $0x40"
  624.     :
  625.     :"a"(63), "b"(1), "c"(ch));
  626. }
  627.  
  628.  
  629. static inline void draw_number_sys(int32_t number, int x, int y, int len, color_t color){
  630.     register uint32_t fmt;
  631.     fmt = len << 16 | 0x80000000; // no leading zeros + width
  632. //    fmt = len << 16 | 0x00000000; //  leading zeros + width
  633.     __asm__ __volatile__(
  634.     "int $0x40"
  635.     :
  636.     :"a"(47), "b"(fmt), "c"(number), "d"((x << 16) | y), "S"(color));
  637. }
  638.  
  639. static inline void draw_number_sys_bg(int32_t number, int x, int y, int len, color_t color, color_t bg){
  640.     register uint32_t fmt;
  641.     fmt = len << 16 | 0x80000000; // no leading zeros + width
  642. //    fmt = len << 16 | 0x00000000; //  leading zeros + width
  643.     __asm__ __volatile__(
  644.     "int $0x40"
  645.     :
  646.     :"a"(47), "b"(fmt), "c"(number), "d"((x << 16) | y), "S"(color), "D"(bg));
  647. }
  648.  
  649. static inline
  650. uint32_t get_mouse_eventstate(void)
  651. {
  652.     uint32_t val;
  653.  
  654.     __asm__ __volatile__(
  655.     "int $0x40"
  656.     :"=a"(val)
  657.     :"a"(37),"b"(3));
  658.     return val;
  659. };
  660.  
  661. static inline
  662. uint32_t set_event_mask(uint32_t mask)
  663. {
  664.     register uint32_t val;
  665.     asm volatile ("int $0x40":"=a"(val):"a"(40), "b"(mask));
  666.     return val;
  667. }
  668.  
  669. typedef void (*thread_proc)(void*);
  670.  
  671. static inline
  672. int start_thread(thread_proc proc, char* stack_top)
  673. {
  674.     register int val;
  675.     asm volatile ("int $0x40":"=a"(val):"a"(51), "b"(1), "c"(proc), "d"(stack_top));
  676.     return val;
  677. }
  678.  
  679. static inline
  680. void kos_exit()
  681. {
  682.     asm volatile ("int $0x40"::"a"(-1));
  683. }
  684.  
  685. static inline void focus_window(int slot){
  686.     asm volatile ("int $0x40"::"a"(18), "b"(3), "c"(slot));
  687. }
  688.  
  689. static inline int get_thread_slot(int tid){
  690.     register int val;
  691.     asm volatile ("int $0x40":"=a"(val):"a"(18), "b"(21), "c"(tid));
  692.     return val;
  693. }
  694.  
  695. static inline void set_current_folder(char* dir){
  696.     asm volatile ("int $0x40"::"a"(30), "b"(1), "c"(dir));
  697. }
  698.  
  699. static inline int get_current_folder(char* buf, int bufsize){
  700.     register int val;
  701.     asm volatile ("int $0x40":"=a"(val):"a"(30), "b"(2), "c"(buf), "d"(bufsize));
  702.     return val;
  703. }
  704.  
  705. static inline
  706. void ipc_set_area(void* buf, int bufsize){
  707.     asm volatile ("int $0x40"::"a"(60), "b"(1), "c"(buf), "d"(bufsize));
  708. }
  709.  
  710. static inline
  711. int ipc_send_message(int pid_reciever, void *data, int datalen) {
  712.     register int val;
  713.     asm volatile ("int $0x40":"=a"(val):"a"(60), "b"(2), "c"(pid_reciever), "d"(data), "S"(datalen));
  714.     return val;
  715. }
  716.  
  717. static inline
  718. void* shm_open(char *shm_name, int msize, int flags, int *retsz){
  719.     register int val, cod;
  720.     asm volatile ("int $0x40":"=a"(val),"=d"(cod):"a"(68), "b"(22), "c"(shm_name), "d"(msize), "S"(flags));
  721.  
  722.     if(retsz) *retsz = cod;  // errcode if NULL or memsize when open
  723.     return (void*)val;
  724. }
  725.  
  726. static inline
  727. void shm_close(char *shm_name){
  728.     asm volatile ("int $0x40"::"a"(68), "b"(23), "c"(shm_name));
  729. }
  730.  
  731. static inline
  732. int start_app(char *app_name, char *args){
  733.     struct file_op_t
  734.     {
  735.         uint32_t    fn;
  736.         uint32_t    flags;
  737.         char*       args;
  738.         uint32_t    res1, res2;
  739.         char        zero;
  740.         char*       app_name  __attribute__((packed));
  741.     } file_op;
  742.     memset(&file_op, 0, sizeof(file_op));
  743.     file_op.fn = 7;
  744.     file_op.args = args;
  745.     file_op.app_name = app_name;
  746.  
  747.     register int val;
  748.     asm volatile ("int $0x40":"=a"(val):"a"(70), "b"(&file_op));
  749.  
  750.     return val;
  751. }
  752.  
  753. // TinyC don't support aliasing of static inline funcs, but support #define :)
  754. #ifndef __TINYC__
  755. static inline void BeginDraw(void) __attribute__ ((alias ("begin_draw")));
  756. static inline void EndDraw(void) __attribute__ ((alias ("end_draw")));
  757. static inline void DrawWindow(int x, int y, int w, int h, const char *name,
  758.                               color_t workcolor, uint32_t style)
  759.                               __attribute__ ((alias ("sys_create_window")));
  760. static inline void DefineButton(void) __attribute__ ((alias ("define_button")));
  761. static inline void DrawLine(int xs, int ys, int xe, int ye, color_t color)
  762.                             __attribute__ ((alias ("draw_line")));
  763. static inline void DrawBar(int x, int y, int w, int h, color_t color)
  764.                            __attribute__ ((alias ("draw_bar")));
  765. static inline void DrawBitmap(void *bitmap, int x, int y, int w, int h)
  766.                               __attribute__ ((alias ("draw_bitmap")));
  767. static inline uint32_t GetSkinHeight(void) __attribute__ ((alias ("get_skin_height")));
  768. static inline pos_t GetMousePos(int origin) __attribute__ ((alias ("get_mouse_pos")));
  769. static inline uint32_t GetMouseButtons(void) __attribute__ ((alias ("get_mouse_buttons")));
  770. static inline uint32_t GetMouseWheels(void) __attribute__ ((alias ("get_mouse_wheels")));
  771. static inline uint32_t  LoadCursor(void *path, uint32_t flags) __attribute__ ((alias ("load_cursor")));
  772. static inline uint32_t SetCursor(uint32_t  cursor) __attribute__ ((alias ("set_cursor")));
  773. static inline int DestroyCursor(uint32_t cursor) __attribute__ ((alias ("destroy_cursor")));
  774. static inline uint32_t GetOsEvent(void) __attribute__ ((alias ("get_os_event")));
  775. static inline void *UserAlloc(size_t size) __attribute__ ((alias ("user_alloc")));
  776. static inline int UserFree(void *mem) __attribute__ ((alias ("user_free")));
  777. static inline void* UserRealloc(void *mem, size_t size) __attribute__ ((alias ("user_realloc")));
  778. static inline int *UserUnmap(void *base, size_t offset, size_t size) __attribute__ ((alias ("user_unmap")));
  779. static inline ufile_t LoadFile(const char *path) __attribute__ ((alias ("load_file")));
  780. static inline void GetProcInfo(char *info) __attribute__ ((alias ("get_proc_info")));
  781. #else
  782.         #define BeginDraw begin_draw
  783.         #define EndDraw end_draw
  784.         #define DrawWindow sys_create_window
  785.         #define DefineButton define_button
  786.         #define DrawLine draw_line
  787.         #define DrawBar draw_bar
  788.         #define DrawBitmap draw_bitmap
  789.         #define GetSkinHeight get_skin_height
  790.         #define GetMousePos get_mouse_pos
  791.         #define GetMouseButtons get_mouse_buttons
  792.         #define GetMouseWheels get_mouse_wheels
  793.         #define LoadCursor load_cursor
  794.         #define SetCursor set_cursor
  795.         #define DestroyCursor destroy_cursor
  796.         #define GetOsEvent get_os_event
  797.         #define UserAlloc user_alloc
  798.         #define UserFree user_free
  799.         #define UserRealloc user_realloc
  800.         #define UserUnmap user_unmap
  801.         #define LoadFile load_file
  802.         #define GetProcInfo get_proc_info
  803. #endif
  804.  
  805. #ifdef __cplusplus
  806. }
  807. #endif
  808.  
  809.  
  810. #endif
  811.  
  812.  
  813.  
  814.  
  815.  
  816.