| 1 | /* |
| 2 | $Header: d:/cvsroot/tads/TADS2/MCH.H,v 1.2 1999/05/17 02:52:12 MJRoberts Exp $ |
| 3 | */ |
| 4 | |
| 5 | /* |
| 6 | * Copyright (c) 1991, 2002 Michael J. Roberts. All Rights Reserved. |
| 7 | * |
| 8 | * Please see the accompanying license file, LICENSE.TXT, for information |
| 9 | * on using and copying this software. |
| 10 | */ |
| 11 | /* |
| 12 | Name |
| 13 | mch.h - memory cache heap manager |
| 14 | Function |
| 15 | Low-level heap management functions |
| 16 | Notes |
| 17 | This is the low-level heap manager, which maintains a list of |
| 18 | non-relocatable, non-swappable blocks of memory. The cache |
| 19 | manager uses the heap manager for its basic storage needs. |
| 20 | Modified |
| 21 | 08/03/91 MJRoberts - creation |
| 22 | */ |
| 23 | |
| 24 | #ifndef MCH_INCLUDED |
| 25 | #define MCH_INCLUDED |
| 26 | |
| 27 | #include <stdlib.h> |
| 28 | |
| 29 | #ifndef STD_INCLUDED |
| 30 | #include "std.h" |
| 31 | #endif |
| 32 | #ifndef ERR_INCLUDED |
| 33 | #include "err.h" |
| 34 | #endif |
| 35 | |
| 36 | /* |
| 37 | * Allocate a block of memory; returns pointer to the block. |
| 38 | * An out-of-memory error is signalled if insufficient memory |
| 39 | * is available. The comment is for debugging purposes only. |
| 40 | */ |
| 41 | uchar *mchalo(errcxdef *ctx, size_t siz, char *comment); |
| 42 | |
| 43 | /* allocate a structure */ |
| 44 | #define MCHNEW(errctx, typ, comment) \ |
| 45 | ((typ *)mchalo(errctx, sizeof(typ), comment)) |
| 46 | |
| 47 | /* free a block of memory */ |
| 48 | /* void mchfre(uchar *ptr); */ |
| 49 | #define mchfre(ptr) (osfree(ptr)) |
| 50 | |
| 51 | #endif /* MCH_INCLUDED */ |