1 /* BEGIN INCLUDE FILE alloc.h */ 2 3 /* HISTORY COMMENTS: 4 1) change(86-07-04,Westcott), approve(87-07-13,MCR7580), 5 audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072): 6 Created. 7 END HISTORY COMMENTS */ 8 9 10 /* FUNCTION 11 12 Defines the necessary structures for wsalloc, a memory allocation scheme 13 written for MOWSE. 14 */ 15 16 /* NOTES 17 18 This is essentially a copy of the allocation scheme described in K&R, 19 page 173. 20 */ 21 22 #define ALLOCH 1 23 typedef int ALIGN; /* force alignment */ 24 25 union header { /* free block header */ 26 struct { 27 union header *ptr; /* next free block */ 28 unsigned size; /* size of this free block */ 29 } s; 30 ALIGN x; /* force alignment of blocks */ 31 }; 32 33 typedef union header HEADER; 34 35 struct allocstr { 36 int memory_used; /* non-zero, if all memory used */ 37 int memory_size; /* size of memory block */ 38 char *memory; /* pointer to memory block */ 39 HEADER m_base; /* base free block header */ 40 HEADER *m_allocp; /* last allocated block */ 41 }; 42 43 /* END INCLUDE FILE alloc.h */ 44 ^Z