Mercurial > projects > dstep
diff dstep/foundation/NSDebug.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/NSDebug.d Mon Aug 03 15:23:15 2009 +0200 @@ -0,0 +1,106 @@ +/** + * 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.NSDebug; + +import dstep.foundation.NSAutoreleasePool; +import dstep.foundation.NSDate; +import dstep.foundation.NSObject; +import dstep.foundation.NSPort; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc : id; + +import bindings = dstep.foundation.NSDebug_bindings; + +extern (C) +{ + extern + { + bool NSDebugEnabled; + bool NSZombieEnabled; + bool NSDeallocateZombies; + bool NSHangOnUncaughtException; + bool NSKeepAllocationStatistics; + } +} + +template TNSAutoreleasePoolDebugging () +{ + static void enableRelease (bool enable) + { + return invokeObjcSelfClass!(void, "enableRelease:", bool)(enable); + } + + static void showPools () + { + return invokeObjcSelfClass!(void, "showPools"); + } + + static void resetTotalAutoreleasedObjects () + { + return invokeObjcSelfClass!(void, "resetTotalAutoreleasedObjects"); + } + + static NSUInteger totalAutoreleasedObjects () + { + return invokeObjcSelfClass!(NSUInteger, "totalAutoreleasedObjects"); + } + + static void enableFreedObjectCheck (bool enable) + { + return invokeObjcSelfClass!(void, "enableFreedObjectCheck:", bool)(enable); + } + + static NSUInteger autoreleasedObjectCount () + { + return invokeObjcSelfClass!(NSUInteger, "autoreleasedObjectCount"); + } + + static NSUInteger topAutoreleasePoolCount () + { + return invokeObjcSelfClass!(NSUInteger, "topAutoreleasePoolCount"); + } + + static NSUInteger poolCountHighWaterMark () + { + return invokeObjcSelfClass!(NSUInteger, "poolCountHighWaterMark"); + } + + static void setPoolCountHighWaterMark (NSUInteger count) + { + return invokeObjcSelfClass!(void, "setPoolCountHighWaterMark:", NSUInteger)(count); + } + + static NSUInteger poolCountHighWaterResolution () + { + return invokeObjcSelfClass!(NSUInteger, "poolCountHighWaterResolution"); + } + + static void setPoolCountHighWaterResolution (NSUInteger res) + { + return invokeObjcSelfClass!(void, "setPoolCountHighWaterResolution:", NSUInteger)(res); + } +} + +bool NSIsFreedObject (Object anObject) +{ + return Bridge.invokeObjcFunction!(bool, bindings.NSIsFreedObject, Object)(anObject); +} + +void NSRecordAllocationEvent (int eventType, Object object) +{ + return Bridge.invokeObjcFunction!(void, bindings.NSRecordAllocationEvent, int, Object)(eventType, object); +} + +extern (C) +{ + void* NSFrameAddress (NSUInteger frame); + void* NSReturnAddress (NSUInteger frame); + NSUInteger NSCountFrames (); + void _NSAutoreleaseNoPool (void* object); + void _NSAutoreleaseFreedObject (void* freedObject); + void _NSAutoreleaseHighWaterLog (NSUInteger count); +} \ No newline at end of file