2008-07-23 09:02:47 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* This file contains the handle based Memory Manager defines
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TINSEL_HEAPMEM_H
|
|
|
|
#define TINSEL_HEAPMEM_H
|
|
|
|
|
|
|
|
#include "tinsel/dw.h" // new data types
|
|
|
|
|
|
|
|
namespace Tinsel {
|
|
|
|
|
2009-10-26 20:38:34 +00:00
|
|
|
struct MEM_NODE;
|
2008-07-23 09:02:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------*\
|
|
|
|
|* Memory Function Prototypes *|
|
|
|
|
\*----------------------------------------------------------------------*/
|
|
|
|
|
2011-05-25 15:17:11 +00:00
|
|
|
void MemoryInit(); // initializes the memory manager
|
|
|
|
void MemoryDeinit(); // deinitializes the memory manager
|
2008-07-23 09:02:47 +00:00
|
|
|
|
2009-10-26 16:01:34 +00:00
|
|
|
// reserves a memory node for a movable & discardable block
|
|
|
|
MEM_NODE *MemoryNoAlloc();
|
2008-07-23 09:02:47 +00:00
|
|
|
|
2009-10-26 10:41:11 +00:00
|
|
|
// allocates a fixed block with the specified number of bytes
|
2009-10-27 00:36:56 +00:00
|
|
|
MEM_NODE *MemoryAllocFixed(long size);
|
2009-10-26 10:41:11 +00:00
|
|
|
|
2008-07-23 09:02:47 +00:00
|
|
|
void MemoryDiscard( // discards the specified memory object
|
2008-07-23 10:27:24 +00:00
|
|
|
MEM_NODE *pMemNode); // node of the memory object
|
2008-07-23 09:02:47 +00:00
|
|
|
|
|
|
|
void *MemoryLock( // locks a memory object and returns a pointer to the first byte of the objects memory block
|
2008-07-23 10:27:24 +00:00
|
|
|
MEM_NODE *pMemNode); // node of the memory object
|
2008-07-23 09:02:47 +00:00
|
|
|
|
2009-10-26 16:01:12 +00:00
|
|
|
void MemoryReAlloc( // changes the size or attributes of a specified memory object
|
2008-07-23 10:27:24 +00:00
|
|
|
MEM_NODE *pMemNode, // node of the memory object
|
2009-10-26 16:01:34 +00:00
|
|
|
long size); // new size of block
|
2008-07-23 09:02:47 +00:00
|
|
|
|
|
|
|
void MemoryUnlock( // unlocks a memory object
|
2008-07-23 10:27:24 +00:00
|
|
|
MEM_NODE *pMemNode); // node of the memory object
|
2008-07-23 09:02:47 +00:00
|
|
|
|
2009-10-26 20:38:34 +00:00
|
|
|
// 'touch' the memory object, i.e., update its "least recently used" counter.
|
|
|
|
void MemoryTouch(MEM_NODE *pMemNode);
|
|
|
|
|
|
|
|
// Dereference a given memory node
|
|
|
|
uint8 *MemoryDeref(MEM_NODE *pMemNode);
|
|
|
|
|
2009-10-04 21:26:33 +00:00
|
|
|
} // End of namespace Tinsel
|
2008-07-23 09:02:47 +00:00
|
|
|
|
|
|
|
#endif
|