1 /* $Id: heap.h,v 1.2 1993/07/04 04:04:21 root Exp root $
4 * Copyright Robert J. Amstadt, 1993
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
;
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
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
;
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
);