Mercurial > projects > dstep
diff dstep/foundation/NSZone.d @ 14:89f3c3ef1fd2
Added the Foundation framework
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 03 Aug 2009 15:23:15 +0200 |
parents | |
children | 19885b43130e |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dstep/foundation/NSZone.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,53 @@ +/** + * 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 : id; + +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 (); +} \ No newline at end of file