1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 * This file contains the handle based Memory Manager defines 22 */ 23 24 #ifndef TINSEL_HEAPMEM_H 25 #define TINSEL_HEAPMEM_H 26 27 #include "tinsel/dw.h" // new data types 28 29 namespace Tinsel { 30 31 struct MEM_NODE; 32 33 34 /*----------------------------------------------------------------------*\ 35 |* Memory Function Prototypes *| 36 \*----------------------------------------------------------------------*/ 37 38 void MemoryInit(); // initializes the memory manager 39 void MemoryDeinit(); // deinitializes the memory manager 40 41 // reserves a memory node for a movable & discardable block 42 MEM_NODE *MemoryNoAlloc(); 43 44 // allocates a fixed block with the specified number of bytes 45 MEM_NODE *MemoryAllocFixed(long size); 46 47 void MemoryDiscard( // discards the specified memory object 48 MEM_NODE *pMemNode); // node of the memory object 49 50 void *MemoryLock( // locks a memory object and returns a pointer to the first byte of the objects memory block 51 MEM_NODE *pMemNode); // node of the memory object 52 53 void MemoryReAlloc( // changes the size or attributes of a specified memory object 54 MEM_NODE *pMemNode, // node of the memory object 55 long size); // new size of block 56 57 void MemoryUnlock( // unlocks a memory object 58 MEM_NODE *pMemNode); // node of the memory object 59 60 // 'touch' the memory object, i.e., update its "least recently used" counter. 61 void MemoryTouch(MEM_NODE *pMemNode); 62 63 // Dereference a given memory node 64 uint8 *MemoryDeref(MEM_NODE *pMemNode); 65 66 } // End of namespace Tinsel 67 68 #endif 69