Make open() posix compliant api-wise. A few calls (those with O_CREAT) need the addit...
[kugel-rb.git] / apps / plugins / doom / rockmacros.h
blobe066fe861c0ce105700dc536aa8b1eb18a4f6896
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"
25 #include "ctype.h"
26 #include "autoconf.h"
27 #include "z_zone.h"
29 extern bool noprintf;
30 extern bool doomexit;
32 /* libc functions */
33 int printf(const char *fmt, ...);
34 int fileexists(const char * fname);
35 char *my_strtok( char * s, const char * delim );
36 #define alloca __builtin_alloca
37 #define fdprintf(...) rb->fdprintf(__VA_ARGS__)
38 #define vsnprintf(...) rb->vsnprintf(__VA_ARGS__)
39 #define read_line(a,b,c) rb->read_line((a),(b),(c))
41 #ifdef SIMULATOR
42 #define open(a, ...) rb->open((a), __VA_ARGS__)
43 #define close(a) rb->close((a))
44 #else
45 int my_open(const char *file, int flags, ...);
46 int my_close(int id);
47 #define open(a, ...) my_open((a), __VA_ARGS__)
48 #define close(a) my_close((a))
49 #endif
51 #define lseek(a,b,c) rb->lseek((a),(b),(c))
52 #define filesize(a) rb->filesize((a))
53 #define read(a,b,c) rb->read((a),(b),(c))
54 #define write(a,b,c) rb->write((a),(b),(c))
55 #define strtok(a,b) my_strtok((a),(b))
56 #define strcat(a,b) rb->strcat((a),(b))
57 #define memset(a,b,c) rb->memset((a),(b),(c))
58 #define memmove(a,b,c) rb->memmove((a),(b),(c))
59 #define memcmp(a,b,c) rb->memcmp((a),(b),(c))
60 #define memchr(a,b,c) rb->memchr((a),(b),(c))
61 #define strcpy(a,b) rb->strcpy((a),(b))
62 #define strlen(a) rb->strlen((a))
63 #define strcmp(a,b) rb->strcmp((a),(b))
64 #define strncmp(a,b,c) rb->strncmp((a),(b),(c))
65 #define strchr(a,b) rb->strchr((a),(b))
66 #define strrchr(a,b) rb->strrchr((a),(b))
67 #define strcasecmp(a,b) rb->strcasecmp((a),(b))
68 #define strncasecmp(a,b,c) rb->strncasecmp((a),(b),(c))
69 #define srand(a) rb->srand((a))
70 #define rand() rb->rand()
71 #define atoi(a) rb->atoi((a))
72 #define strcat(a,b) rb->strcat((a),(b))
73 #define snprintf rb->snprintf
75 #define PACKEDATTR __attribute__((packed)) // Needed for a few things
76 #define GAMEBASE ROCKBOX_DIR "/doom/"
77 //#define SIMPLECHECKS
78 #define NO_PREDEFINED_LUMPS
79 #define TABLES_AS_LUMPS // This frees up alot of space in the plugin buffer
81 #define MAKE_FOURCC(a,b,c,d) (uint32_t)((((a)<<24)|((b)<<16)|((c)<<8)|(d)))
83 /* Config file magic - increment the version number whenever the settings
84 structure changes.
86 #define DOOM_CONFIG_MAGIC MAKE_FOURCC('D','O','O','M')
87 #define DOOM_CONFIG_VERSION 3
89 #endif