Mercurial > projects > dstep
annotate dstep/foundation/NSObjCRuntime.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 |
rev | line source |
---|---|
14 | 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.NSObjCRuntime; | |
8 | |
9 import dstep.foundation.NSString; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
10 import dstep.foundation.NSZone; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
11 import dstep.internal.Version; |
14 | 12 import dstep.objc.bridge.Bridge; |
13 import dstep.objc.objc; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
14 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
15 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
16 import dstep.objc.runtime; |
14 | 17 |
18 import bindings = dstep.foundation.NSObjCRuntime_bindings; | |
19 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
20 version (D_LP64) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
21 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
22 alias long NSInteger; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
23 alias ulong NSUInteger; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
24 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
25 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
26 else |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
27 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
28 alias int NSInteger; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
29 alias uint NSUInteger; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
30 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
31 |
14 | 32 alias NSInteger NSComparisonResult; |
33 | |
34 extern (C) | |
35 { | |
36 extern | |
37 { | |
38 double NSFoundationVersionNumber; | |
39 } | |
40 } | |
41 | |
42 enum _NSComparisonResult | |
43 { | |
44 NSOrderedAscending = -1, | |
45 NSOrderedSame, | |
46 NSOrderedDescending | |
47 } | |
48 | |
49 enum | |
50 { | |
51 NSNotFound = 2147483647L | |
52 } | |
53 | |
54 NSString NSStringFromSelector (SEL aSelector) | |
55 { | |
56 return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromSelector, SEL)(aSelector); | |
57 } | |
58 | |
59 SEL NSSelectorFromString (NSString aSelectorName) | |
60 { | |
61 return Bridge.invokeObjcFunction!(SEL, bindings.NSSelectorFromString, NSString)(aSelectorName); | |
62 } | |
63 | |
64 NSString NSStringFromClass (Class aClass) | |
65 { | |
66 return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromClass, Class)(aClass); | |
67 } | |
68 | |
69 Class NSClassFromString (NSString aClassName) | |
70 { | |
71 return Bridge.invokeObjcFunction!(Class, bindings.NSClassFromString, NSString)(aClassName); | |
72 } | |
73 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
74 NSString NSStringFromProtocol (Protocol* proto) |
14 | 75 { |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
76 return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromProtocol, Protocol*)(proto); |
14 | 77 } |
78 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
79 Protocol* NSProtocolFromString (NSString namestr) |
14 | 80 { |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
81 return Bridge.invokeObjcFunction!(Protocol*, bindings.NSProtocolFromString, NSString)(namestr); |
14 | 82 } |
83 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
84 void NSLog (ARGS...) (NSString format, ARGS args) |
14 | 85 { |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
86 return Bridge.invokeObjcFunction!(void, bindings.NSLog, NSString, ARGS)(format, args); |
14 | 87 } |
88 | |
89 void NSLogv (NSString format, char* args) | |
90 { | |
91 return Bridge.invokeObjcFunction!(void, bindings.NSLogv, NSString, char*)(format, args); | |
92 } | |
93 | |
94 extern (C) | |
95 { | |
96 char* NSGetSizeAndAlignment (char* typePtr, NSUInteger* sizep, NSUInteger* alignp); | |
97 } |