view dstep/coreservices/carboncore/MacMemory.d @ 11:07194b026fa4

Added bindings to a couple of frameworks, new license + some other things
author Jacob Carlborg <doob@me.com>
date Sat, 01 Aug 2009 15:03:28 +0200
parents
children
line wrap: on
line source

/**
 * Copyright: Copyright (c) 2009 Jacob Carlborg.
 * Authors: Jacob Carlborg
 * Version: Initial created: Jul 21, 2009 
 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
 */
module dstep.coreservices.carboncore.MacMemory;

//import dstep.AvailabilityMacros;
import dstep.coreservices.carboncore.MacTypes;
import dstep.coreservices.carboncore.MixedMode;
//import dstep.string;

enum
{
	maxSize = 0x7FFFFFF0
}

enum
{
	defaultPhysicalEntryCount = 8
}

enum
{
	kPageInMemory = 0,
	kPageOnDisk = 1,
	kNotPaged = 2
}

enum
{
	k32BitHeap = 1,
	kNewStyleHeap = 2,
	kNewDebugHeap = 4
}

enum
{
	kHandleIsResourceBit = 5,
	kHandlePurgeableBit = 6,
	kHandleLockedBit = 7
}

enum
{
	kHandleIsResourceMask = 0x20,
	kHandlePurgeableMask = 0x40,
	kHandleLockedMask = 0x80
}

extern (C)
{
	short MemError ();
	short LMGetMemErr ();
	void LMSetMemErr (short value);
	Handle NewHandle (int byteCount);
	Handle NewHandleClear (int byteCount);
	Handle RecoverHandle (char* p);
	char* NewPtr (int byteCount);
	char* NewPtrClear (int byteCount);
	Handle NewEmptyHandle ();
	void HLock (Handle h);
	void HLockHi (Handle h);
	void HUnlock (Handle h);
	Handle TempNewHandle (int logicalSize, OSErr* resultCode);
	void DisposePtr (char* p);
	int GetPtrSize (char* p);
	void SetPtrSize (char* p, int newSize);
	void DisposeHandle (Handle h);
	void SetHandleSize (Handle h, int newSize);
	int GetHandleSize (Handle h);
	void ReallocateHandle (Handle h, int byteCount);
	void EmptyHandle (Handle h);
	void HSetRBit (Handle h);
	void HClrRBit (Handle h);
	byte HGetState (Handle h);
	void HSetState (Handle h, byte flags);
	short HandToHand (Handle* theHndl);
	short PtrToXHand (void* srcPtr, Handle dstHndl, int size);
	short PtrToHand (void* srcPtr, Handle* dstHndl, int size);
	short HandAndHand (Handle hand1, Handle hand2);
	short PtrAndHand (void* ptr1, Handle hand2, int size);
	ubyte IsHeapValid ();
	ubyte IsHandleValid (Handle h);
	ubyte IsPointerValid (char* p);
}