Fix cygwin sim build.
[kugel-rb.git] / apps / plugins / doom / rockmacros.h
blob6abf025aac26801a3420f52cbcaf3195739e0489
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 const struct plugin_api* rb;
30 extern bool noprintf;
31 extern bool doomexit;
33 /* libc functions */
34 int printf(const char *fmt, ...);
35 int fileexists(const char * fname);
36 char *my_strtok( char * s, const char * delim );
37 #define alloca __builtin_alloca
38 #define fdprintf(...) rb->fdprintf(__VA_ARGS__)
39 #define vsnprintf(...) rb->vsnprintf(__VA_ARGS__)
40 #define read_line(a,b,c) rb->read_line((a),(b),(c))
42 #ifdef SIMULATOR
43 #define open(a,b) rb->open((a),(b))
44 #define close(a) rb->close((a))
45 #else
46 int my_open(const char *file, int flags);
47 int my_close(int id);
48 #define open(a,b) my_open((a),(b))
49 #define close(a) my_close((a))
50 #endif
52 #define lseek(a,b,c) rb->lseek((a),(b),(c))
53 #define filesize(a) rb->filesize((a))
54 #define read(a,b,c) rb->read((a),(b),(c))
55 #define write(a,b,c) rb->write((a),(b),(c))
56 #define strtok(a,b) my_strtok((a),(b))
57 #define strcat(a,b) rb->strcat((a),(b))
58 #define memset(a,b,c) rb->memset((a),(b),(c))
59 #define memmove(a,b,c) rb->memmove((a),(b),(c))
60 #define memcmp(a,b,c) rb->memcmp((a),(b),(c))
61 #define memchr(a,b,c) rb->memchr((a),(b),(c))
62 #define strcpy(a,b) rb->strcpy((a),(b))
63 #define strncpy(a,b,c) rb->strncpy((a),(b),(c))
64 #define strlen(a) rb->strlen((a))
65 #define strcmp(a,b) rb->strcmp((a),(b))
66 #define strncmp(a,b,c) rb->strncmp((a),(b),(c))
67 #define strchr(a,b) rb->strchr((a),(b))
68 #define strrchr(a,b) rb->strrchr((a),(b))
69 #define strcasecmp(a,b) rb->strcasecmp((a),(b))
70 #define strncasecmp(a,b,c) rb->strncasecmp((a),(b),(c))
71 #define srand(a) rb->srand((a))
72 #define rand() rb->rand()
73 #define atoi(a) rb->atoi((a))
74 #define strcat(a,b) rb->strcat((a),(b))
75 #define snprintf rb->snprintf
77 /* Using #define isn't enough with GCC 4.0.1 */
78 inline void* memcpy(void* dst, const void* src, size_t size);
80 #define PACKEDATTR __attribute__((packed)) // Needed for a few things
81 #define GAMEBASE ROCKBOX_DIR "/doom/"
82 //#define SIMPLECHECKS
83 #define NO_PREDEFINED_LUMPS
84 #define TABLES_AS_LUMPS // This frees up alot of space in the plugin buffer
86 #define MAKE_FOURCC(a,b,c,d) (uint32_t)((((a)<<24)|((b)<<16)|((c)<<8)|(d)))
88 /* Config file magic - increment the version number whenever the settings
89 structure changes.
91 #define DOOM_CONFIG_MAGIC MAKE_FOURCC('D','O','O','M')
92 #define DOOM_CONFIG_VERSION 3
94 #endif