Make open() posix compliant api-wise. A few calls (those with O_CREAT) need the addit...
[kugel-rb.git] / apps / plugins / rockboy / rockmacros.h
blobe7f79a53d34750e6a4a39ebfc0773fbc1757bb90
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2005 Michiel van der Kolk, Jens Arnold
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #ifndef __ROCKMACROS_H__
22 #define __ROCKMACROS_H__
24 #include "plugin.h"
26 #include "autoconf.h"
28 #define malloc(a) my_malloc(a)
29 void *my_malloc(size_t size);
31 extern int shut,cleanshut;
32 void vid_init(void);
33 inline void vid_begin(void);
34 void die(char *message, ...);
35 void doevents(void) ICODE_ATTR;
36 void ev_poll(void);
37 int do_user_menu(void);
38 void setvidmode(void);
39 #if defined(HAVE_LCD_COLOR)
40 void set_pal(void);
41 #else
42 void vid_update(int scanline);
43 #endif
44 #ifdef DYNAREC
45 extern struct dynarec_block newblock;
46 void dynamic_recompile (struct dynarec_block *newblock);
47 #endif
49 #define USER_MENU_QUIT -2
51 /* Disable IBSS when using dynarec since it won't fit */
52 #ifdef DYNAREC
53 #undef IBSS_ATTR
54 #define IBSS_ATTR
55 #endif
57 /* libc functions */
58 #define isdigit(c) ((c) >= '0' && (c) <= '9')
59 #define isalpha(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && ((c) <= 'Z')))
60 #define isalnum(c) (isdigit(c) || (isalpha(c)))
62 /* only 1 fixed argument for open, since variadic macros don't except empty
63 * variable parameters */
64 #define open(a, ...) rb->open((a), __VA_ARGS__)
65 #define lseek(a,b,c) rb->lseek((a),(b),(c))
66 #define close(a) rb->close((a))
67 #define read(a,b,c) rb->read((a),(b),(c))
68 #define write(a,b,c) rb->write((a),(b),(c))
69 #define strcat(a,b) rb->strcat((a),(b))
70 #define memset(a,b,c) rb->memset((a),(b),(c))
71 #define strcpy(a,b) rb->strcpy((a),(b))
72 #define strlcpy(a,b,c) rb->strlcpy((a),(b),(c))
73 #define strlen(a) rb->strlen((a))
74 #define strcmp(a,b) rb->strcmp((a),(b))
75 #define strchr(a,b) rb->strchr((a),(b))
76 #define strrchr(a,b) rb->strrchr((a),(b))
77 #define strcasecmp(a,b) rb->strcasecmp((a),(b))
78 #define srand(a) rb->srand((a))
79 #define rand() rb->rand()
80 #define atoi(a) rb->atoi((a))
81 #define strcat(a,b) rb->strcat((a),(b))
82 #define snprintf(...) rb->snprintf(__VA_ARGS__)
83 #define fdprintf(...) rb->fdprintf(__VA_ARGS__)
84 #define tolower(_A_) (isupper(_A_) ? (_A_ - 'A' + 'a') : _A_)
86 /* Using #define isn't enough with GCC 4.0.1 */
87 void* memcpy(void* dst, const void* src, size_t size) ICODE_ATTR;
89 struct options {
90 int A, B, START, SELECT, MENU;
91 int UP, DOWN, LEFT, RIGHT;
92 int frameskip, fps, maxskip;
93 int sound, scaling, showstats;
94 int rotate;
95 int pal;
96 int dirty;
99 bool plugbuf;
101 extern struct options options;
102 #define savedir ROCKBOX_DIR "/rockboy"
104 #endif