Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

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