Mercurial > projects > dstep
comparison 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 |
comparison
equal
deleted
inserted
replaced
13:4f583f7e242e | 14:89f3c3ef1fd2 |
---|---|
1 /** | |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Aug 3, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.foundation.NSDebug; | |
8 | |
9 import dstep.foundation.NSAutoreleasePool; | |
10 import dstep.foundation.NSDate; | |
11 import dstep.foundation.NSObject; | |
12 import dstep.foundation.NSPort; | |
13 import dstep.objc.bridge.Bridge; | |
14 import dstep.objc.objc : id; | |
15 | |
16 import bindings = dstep.foundation.NSDebug_bindings; | |
17 | |
18 extern (C) | |
19 { | |
20 extern | |
21 { | |
22 bool NSDebugEnabled; | |
23 bool NSZombieEnabled; | |
24 bool NSDeallocateZombies; | |
25 bool NSHangOnUncaughtException; | |
26 bool NSKeepAllocationStatistics; | |
27 } | |
28 } | |
29 | |
30 template TNSAutoreleasePoolDebugging () | |
31 { | |
32 static void enableRelease (bool enable) | |
33 { | |
34 return invokeObjcSelfClass!(void, "enableRelease:", bool)(enable); | |
35 } | |
36 | |
37 static void showPools () | |
38 { | |
39 return invokeObjcSelfClass!(void, "showPools"); | |
40 } | |
41 | |
42 static void resetTotalAutoreleasedObjects () | |
43 { | |
44 return invokeObjcSelfClass!(void, "resetTotalAutoreleasedObjects"); | |
45 } | |
46 | |
47 static NSUInteger totalAutoreleasedObjects () | |
48 { | |
49 return invokeObjcSelfClass!(NSUInteger, "totalAutoreleasedObjects"); | |
50 } | |
51 | |
52 static void enableFreedObjectCheck (bool enable) | |
53 { | |
54 return invokeObjcSelfClass!(void, "enableFreedObjectCheck:", bool)(enable); | |
55 } | |
56 | |
57 static NSUInteger autoreleasedObjectCount () | |
58 { | |
59 return invokeObjcSelfClass!(NSUInteger, "autoreleasedObjectCount"); | |
60 } | |
61 | |
62 static NSUInteger topAutoreleasePoolCount () | |
63 { | |
64 return invokeObjcSelfClass!(NSUInteger, "topAutoreleasePoolCount"); | |
65 } | |
66 | |
67 static NSUInteger poolCountHighWaterMark () | |
68 { | |
69 return invokeObjcSelfClass!(NSUInteger, "poolCountHighWaterMark"); | |
70 } | |
71 | |
72 static void setPoolCountHighWaterMark (NSUInteger count) | |
73 { | |
74 return invokeObjcSelfClass!(void, "setPoolCountHighWaterMark:", NSUInteger)(count); | |
75 } | |
76 | |
77 static NSUInteger poolCountHighWaterResolution () | |
78 { | |
79 return invokeObjcSelfClass!(NSUInteger, "poolCountHighWaterResolution"); | |
80 } | |
81 | |
82 static void setPoolCountHighWaterResolution (NSUInteger res) | |
83 { | |
84 return invokeObjcSelfClass!(void, "setPoolCountHighWaterResolution:", NSUInteger)(res); | |
85 } | |
86 } | |
87 | |
88 bool NSIsFreedObject (Object anObject) | |
89 { | |
90 return Bridge.invokeObjcFunction!(bool, bindings.NSIsFreedObject, Object)(anObject); | |
91 } | |
92 | |
93 void NSRecordAllocationEvent (int eventType, Object object) | |
94 { | |
95 return Bridge.invokeObjcFunction!(void, bindings.NSRecordAllocationEvent, int, Object)(eventType, object); | |
96 } | |
97 | |
98 extern (C) | |
99 { | |
100 void* NSFrameAddress (NSUInteger frame); | |
101 void* NSReturnAddress (NSUInteger frame); | |
102 NSUInteger NSCountFrames (); | |
103 void _NSAutoreleaseNoPool (void* object); | |
104 void _NSAutoreleaseFreedObject (void* freedObject); | |
105 void _NSAutoreleaseHighWaterLog (NSUInteger count); | |
106 } |