diff options
author | Dave Chapman <dave@dchapman.com> | 2006-03-28 15:44:01 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2006-03-28 15:44:01 +0000 |
commit | 47f4a458d636a889e955e68f896708f1276febc0 (patch) | |
tree | 99f770c02ef606f0abbdcd332ac39e69830d8007 /apps/plugins/doom/z_zone.h | |
parent | fff7d6157d56f233cad5c2003475e47a5ff809a7 (diff) | |
download | rockbox-47f4a458d636a889e955e68f896708f1276febc0.tar.gz rockbox-47f4a458d636a889e955e68f896708f1276febc0.zip |
Patch #2969 - Doom! Currently only working on the H300.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9312 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/doom/z_zone.h')
-rw-r--r-- | apps/plugins/doom/z_zone.h | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/apps/plugins/doom/z_zone.h b/apps/plugins/doom/z_zone.h new file mode 100644 index 0000000000..6ab9bba106 --- /dev/null +++ b/apps/plugins/doom/z_zone.h | |||
@@ -0,0 +1,117 @@ | |||
1 | /* Emacs style mode select -*- C++ -*- | ||
2 | *----------------------------------------------------------------------------- | ||
3 | * | ||
4 | * | ||
5 | * PrBoom a Doom port merged with LxDoom and LSDLDoom | ||
6 | * based on BOOM, a modified and improved DOOM engine | ||
7 | * Copyright (C) 1999 by | ||
8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman | ||
9 | * Copyright (C) 1999-2000 by | ||
10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze | ||
11 | * | ||
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. | ||
16 | * | ||
17 | * This program is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | * GNU General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||
25 | * 02111-1307, USA. | ||
26 | * | ||
27 | * DESCRIPTION: | ||
28 | * Zone Memory Allocation, perhaps NeXT ObjectiveC inspired. | ||
29 | * Remark: this was the only stuff that, according | ||
30 | * to John Carmack, might have been useful for | ||
31 | * Quake. | ||
32 | * | ||
33 | * Rewritten by Lee Killough, though, since it was not efficient enough. | ||
34 | * | ||
35 | *---------------------------------------------------------------------*/ | ||
36 | |||
37 | #ifndef __Z_ZONE__ | ||
38 | #define __Z_ZONE__ | ||
39 | |||
40 | #ifndef __GNUC__ | ||
41 | #define __attribute__(x) | ||
42 | #endif | ||
43 | |||
44 | // Include system definitions so that prototypes become | ||
45 | // active before macro replacements below are in effect. | ||
46 | |||
47 | #include "plugin.h" | ||
48 | |||
49 | // ZONE MEMORY | ||
50 | // PU - purge tags. | ||
51 | |||
52 | enum {PU_FREE, PU_STATIC, PU_SOUND, PU_MUSIC, PU_LEVEL, PU_LEVSPEC, PU_CACHE, | ||
53 | /* Must always be last -- killough */ PU_MAX}; | ||
54 | |||
55 | #define PU_PURGELEVEL PU_CACHE /* First purgable tag's level */ | ||
56 | |||
57 | #ifdef INSTRUMENTED | ||
58 | #define DA(x,y) ,x,y | ||
59 | #define DAC(x,y) x,y | ||
60 | #else | ||
61 | #define DA(x,y) | ||
62 | #define DAC(x,y) void | ||
63 | #endif | ||
64 | |||
65 | void *(Z_Malloc)(size_t size, int tag, void **ptr DA(const char *, int)); | ||
66 | void (Z_Free)(void *ptr DA(const char *, int)); | ||
67 | void (Z_FreeTags)(int lowtag, int hightag DA(const char *, int)); | ||
68 | void (Z_ChangeTag)(void *ptr, int tag DA(const char *, int)); | ||
69 | void (Z_Init)(void); | ||
70 | void Z_Close(void); | ||
71 | void *(Z_Calloc)(size_t n, size_t n2, int tag, void **user DA(const char *, int)); | ||
72 | void *(Z_Realloc)(void *p, size_t n, int tag, void **user DA(const char *, int)); | ||
73 | char *(Z_Strdup)(const char *s, int tag, void **user DA(const char *, int)); | ||
74 | void (Z_CheckHeap)(DAC(const char *,int)); // killough 3/22/98: add file/line info | ||
75 | void Z_DumpHistory(char *); | ||
76 | |||
77 | #ifdef INSTRUMENTED | ||
78 | /* cph - save space if not debugging, don't require file | ||
79 | * and line to memory calls */ | ||
80 | #define Z_Free(a) (Z_Free) (a, __FILE__,__LINE__) | ||
81 | #define Z_FreeTags(a,b) (Z_FreeTags) (a,b, __FILE__,__LINE__) | ||
82 | #define Z_ChangeTag(a,b) (Z_ChangeTag)(a,b, __FILE__,__LINE__) | ||
83 | #define Z_Malloc(a,b,c) (Z_Malloc) (a,b,c, __FILE__,__LINE__) | ||
84 | #define Z_Strdup(a,b,c) (Z_Strdup) (a,b,c, __FILE__,__LINE__) | ||
85 | #define Z_Calloc(a,b,c,d) (Z_Calloc) (a,b,c,d,__FILE__,__LINE__) | ||
86 | #define Z_Realloc(a,b,c,d) (Z_Realloc) (a,b,c,d,__FILE__,__LINE__) | ||
87 | #define Z_CheckHeap() (Z_CheckHeap)(__FILE__,__LINE__) | ||
88 | #endif | ||
89 | |||
90 | /* cphipps 2001/11/18 - | ||
91 | * If we're using memory mapped file access to WADs, we won't need to maintain | ||
92 | * our own heap. So we *could* let "normal" malloc users use the libc malloc | ||
93 | * directly, for efficiency. Except we do need a wrapper to handle out of memory | ||
94 | * errors... damn, ok, we'll leave it for now. | ||
95 | */ | ||
96 | |||
97 | #undef malloc | ||
98 | #undef free | ||
99 | #undef realloc | ||
100 | #undef calloc | ||
101 | #undef strdup | ||
102 | |||
103 | #define malloc(n) Z_Malloc(n,PU_STATIC,0) | ||
104 | #define free(p) Z_Free(p) | ||
105 | #define realloc(p,n) Z_Realloc(p,n,PU_STATIC,0) | ||
106 | #define calloc(n1,n2) Z_Calloc(n1,n2,PU_STATIC,0) | ||
107 | #undef strdup | ||
108 | |||
109 | char *strdup(const char *s); | ||
110 | |||
111 | #define strdup(s) Z_Strdup(s,PU_STATIC,0) | ||
112 | |||
113 | void Z_ZoneHistory(char *); | ||
114 | |||
115 | extern size_t zone_size; | ||
116 | |||
117 | #endif | ||