Allow returning something of type void in a function that returns void
[delight/core.git] / dmd2 / mem.h
blob3d5a340689ada14e0d26fdb1e970dada5c991b21
1 // Copyright (C) 2000-2001 by Chromium Communications
2 // All Rights Reserved
4 /* NOTE: This file has been patched from the original DMD distribution to
5 work with the GDC compiler.
7 Modified by David Friedman, September 2004
8 */
10 #ifndef ROOT_MEM_H
11 #define ROOT_MEM_H
13 #include <sys/types.h> // for size_t
15 typedef void (*FINALIZERPROC)(void* pObj, void* pClientData);
17 struct GC; // thread specific allocator
19 struct Mem
21 GC *gc; // pointer to our thread specific allocator
22 Mem() { gc = NULL; }
24 void init();
26 // Derive from Mem to get these storage allocators instead of global new/delete
27 void * operator new(size_t m_size);
28 void * operator new(size_t m_size, Mem *mem);
29 void * operator new(size_t m_size, GC *gc);
30 void operator delete(void *p);
32 void * operator new[](size_t m_size);
33 void operator delete[](void *p);
35 char *strdup(const char *s);
36 void *malloc(size_t size);
37 void *malloc_uncollectable(size_t size);
38 void *calloc(size_t size, size_t n);
39 void *realloc(void *p, size_t size);
40 void free(void *p);
41 void free_uncollectable(void *p);
42 void *mallocdup(void *o, size_t size);
43 void error();
44 void check(void *p); // validate pointer
45 void fullcollect(); // do full garbage collection
46 void fullcollectNoStack(); // do full garbage collection, no scan stack
47 void mark(void *pointer);
48 void addroots(char* pStart, char* pEnd);
49 void removeroots(char* pStart);
50 void setFinalizer(void* pObj, FINALIZERPROC pFn, void* pClientData);
51 void setStackBottom(void *bottom);
52 GC *getThreadGC(); // get apartment allocator for this thread
55 extern Mem mem;
57 #endif /* ROOT_MEM_H */