Release 940201
[wine.git] / include / heap.h
blob2b3b157b9a4c7da93751734e827b0c0a3d226415
1 /* $Id: heap.h,v 1.2 1993/07/04 04:04:21 root Exp root $
2 */
3 /*
4 * Copyright Robert J. Amstadt, 1993
5 */
6 #ifndef HEAP_H
7 #define HEAP_H
9 /**********************************************************************
10 * LOCAL HEAP STRUCTURES AND FUNCTIONS
12 typedef struct heap_mem_desc_s
14 struct heap_mem_desc_s *prev, *next;
15 unsigned short length;
16 unsigned char lock;
17 unsigned char flags;
18 } MDESC;
20 extern void HEAP_Init(MDESC **free_list, void *start, int length);
21 extern void *HEAP_Alloc(MDESC **free_list, int flags, int bytes);
22 extern int HEAP_Free(MDESC **free_list, void *block);
23 extern void *HEAP_ReAlloc(MDESC **free_list, void *old_block,
24 int new_size, unsigned int flags);
26 /**********************************************************************
27 * GLOBAL HEAP STRUCTURES AND FUNCTIONS:
29 * Global memory pool descriptor. Segments MUST be maintained in segment
30 * ascending order. If not the reallocation routine will die a horrible
31 * death.
33 * handle = 0, this descriptor contains the address of a free pool.
34 * != 0, this describes an allocated block.
36 * sequence = 0, this is not a huge block
37 * > 0, this is a portion of a huge block
38 * =-1, this is a free segment
40 * addr - address of this memory block.
42 * length - used to maintain huge blocks.
44 typedef struct global_mem_desc_s
46 struct global_mem_desc_s *next;
47 struct global_mem_desc_s *prev;
48 unsigned short handle;
49 short sequence;
50 void *addr;
51 int length;
52 int lock_count;
53 void *linear_addr;
54 int linear_key;
55 int linear_count;
56 } GDESC;
58 extern GDESC *GlobalList;
60 extern void *GlobalQuickAlloc(int size);
61 extern unsigned int GlobalHandleFromPointer(void *block);
62 extern GDESC *GlobalGetGDesc(unsigned int block);
63 extern void *GlobalLinearLock(unsigned int block);
64 extern unsigned int GlobalLinearUnlock(unsigned int block);
66 #endif /* HEAP_H */