Move c/h files implementing/defining standard library stuff into a new libc directory...
[kugel-rb.git] / apps / plugins / doom / rockmacros.h
blob89c943622a6d5e8a24a62eeeef0fc4da7731ecd1
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 #undef alloca
37 #define alloca __builtin_alloca
38 #undef fdprintf
39 #define fdprintf(...) rb->fdprintf(__VA_ARGS__)
40 #undef vsnprintf
41 #define vsnprintf(...) rb->vsnprintf(__VA_ARGS__)
42 #undef read_line
43 #define read_line(a,b,c) rb->read_line((a),(b),(c))
45 #ifdef SIMULATOR
46 #define open(a, ...) rb->open((a), __VA_ARGS__)
47 #define close(a) rb->close((a))
48 #else
49 int my_open(const char *file, int flags, ...);
50 int my_close(int id);
51 #define open(a, ...) my_open((a), __VA_ARGS__)
52 #define close(a) my_close((a))
53 #endif
55 #define lseek(a,b,c) rb->lseek((a),(b),(c))
56 #define filesize(a) rb->filesize((a))
57 #define read(a,b,c) rb->read((a),(b),(c))
58 #define write(a,b,c) rb->write((a),(b),(c))
59 #undef strtok
60 #define strtok(a,b) my_strtok((a),(b))
61 #undef strcat
62 #define strcat(a,b) rb->strcat((a),(b))
63 #undef memset
64 #define memset(a,b,c) rb->memset((a),(b),(c))
65 #undef memmove
66 #define memmove(a,b,c) rb->memmove((a),(b),(c))
67 #undef memcmp
68 #define memcmp(a,b,c) rb->memcmp((a),(b),(c))
69 #undef memchr
70 #define memchr(a,b,c) rb->memchr((a),(b),(c))
71 #undef strcpy
72 #define strcpy(a,b) rb->strcpy((a),(b))
73 #undef strlen
74 #define strlen(a) rb->strlen((a))
75 #undef strcmp
76 #define strcmp(a,b) rb->strcmp((a),(b))
77 #undef strncmp
78 #define strncmp(a,b,c) rb->strncmp((a),(b),(c))
79 #undef strchr
80 #define strchr(a,b) rb->strchr((a),(b))
81 #undef strrchr
82 #define strrchr(a,b) rb->strrchr((a),(b))
83 #undef strcasecmp
84 #define strcasecmp(a,b) rb->strcasecmp((a),(b))
85 #undef strncasecmp
86 #define strncasecmp(a,b,c) rb->strncasecmp((a),(b),(c))
87 #define srand(a) rb->srand((a))
88 #define rand() rb->rand()
89 #define atoi(a) rb->atoi((a))
90 #define strcat(a,b) rb->strcat((a),(b))
91 #define snprintf rb->snprintf
93 #define PACKEDATTR __attribute__((packed)) // Needed for a few things
94 #define GAMEBASE ROCKBOX_DIR "/doom/"
95 //#define SIMPLECHECKS
96 #define NO_PREDEFINED_LUMPS
97 #define TABLES_AS_LUMPS // This frees up alot of space in the plugin buffer
99 #define MAKE_FOURCC(a,b,c,d) (uint32_t)((((a)<<24)|((b)<<16)|((c)<<8)|(d)))
101 /* Config file magic - increment the version number whenever the settings
102 structure changes.
104 #define DOOM_CONFIG_MAGIC MAKE_FOURCC('D','O','O','M')
105 #define DOOM_CONFIG_VERSION 3
107 #endif