view dstep/foundation/NSZone.d @ 16:19885b43130e

Huge update, the bridge actually works now
author Jacob Carlborg <doob@me.com>
date Sun, 03 Jan 2010 22:06:11 +0100
parents 89f3c3ef1fd2
children
line wrap: on
line source

/**
 * Copyright: Copyright (c) 2009 Jacob Carlborg.
 * Authors: Jacob Carlborg
 * Version: Initial created: Aug 3, 2009 
 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
 */
module dstep.foundation.NSZone;

import dstep.corefoundation.CFBase;
import dstep.foundation.NSObjCRuntime;
import dstep.foundation.NSString;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc;
import bindings = dstep.foundation.NSZone_bindings;

struct _NSZone;

alias _NSZone NSZone;

enum
{
	NSScannedOption = (1<<0),
	NSCollectorDisabledOption = (1<<1)
}

void NSSetZoneName (NSZone* zone, NSString name)
{
	return Bridge.invokeObjcFunction!(void, bindings.NSSetZoneName, NSZone*, NSString)(zone, name);
}

NSString NSZoneName (NSZone* zone)
{
	return Bridge.invokeObjcFunction!(NSString, bindings.NSZoneName, NSZone*)(zone);
}

extern (C)
{
	NSZone* NSDefaultMallocZone ();
	NSZone* NSCreateZone (NSUInteger startSize, NSUInteger granularity, bool canFree);
	void NSRecycleZone (NSZone* zone);
	NSZone* NSZoneFromPointer (void* ptr);
	void* NSZoneMalloc (NSZone* zone, NSUInteger size);
	void* NSZoneCalloc (NSZone* zone, NSUInteger numElems, NSUInteger byteSize);
	void* NSZoneRealloc (NSZone* zone, void* ptr, NSUInteger size);
	void NSZoneFree (NSZone* zone, void* ptr);
	void* NSAllocateCollectable (NSUInteger size, NSUInteger options);
	void* NSReallocateCollectable (void* ptr, NSUInteger size, NSUInteger options);
	NSUInteger NSPageSize ();
	NSUInteger NSLogPageSize ();
	NSUInteger NSRoundUpToMultipleOfPageSize (NSUInteger bytes);
	NSUInteger NSRoundDownToMultipleOfPageSize (NSUInteger bytes);
	void* NSAllocateMemoryPages (NSUInteger bytes);
	void NSDeallocateMemoryPages (void* ptr, NSUInteger bytes);
	void NSCopyMemoryPages (void* source, void* dest, NSUInteger bytes);
	NSUInteger NSRealMemoryAvailable ();
}