]> git.sur5r.net Git - cc65/blob - include/_heap.h
Access Atari OS variables by structure.
[cc65] / include / _heap.h
1 /*
2 ** _heap.h
3 **
4 ** Ullrich von Bassewitz, 1998-06-03, 2004-12-19
5 **
6 */
7
8
9
10 #ifndef __HEAP_H
11 #define __HEAP_H
12
13
14
15 /* Structure that preceeds a user block in most cases.
16 ** The aligned_malloc function may generate blocks where the start pointer
17 ** and size are splitted to handle a memory hole that is needed for
18 ** alignment.
19 */
20 struct usedblock {
21     unsigned            size;
22     struct usedblock*   start;
23 };
24
25 /* Space needed for administering used blocks */
26 #define HEAP_ADMIN_SPACE        sizeof (struct usedblock)
27
28 /* The data type used to implement the free list.
29 ** Beware: Field order is significant!
30 */
31 struct freeblock {
32     unsigned            size;
33     struct freeblock*   next;
34     struct freeblock*   prev;
35 };
36
37
38
39 /* Variables that describe the heap */
40 extern unsigned*          _heaporg;     /* Bottom of heap */
41 extern unsigned*          _heapptr;     /* Current top */
42 extern unsigned*          _heapend;     /* Upper limit */
43 extern struct freeblock*  _heapfirst;   /* First free block in list */
44 extern struct freeblock*  _heaplast;    /* Last free block in list */
45
46
47
48 /* End of _heap.h */
49
50 #endif
51
52
53