Mercurial > projects > dstep
annotate dstep/objc/objc.d @ 20:6255d355d752
Made it compile with dmd 1.056
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Wed, 03 Feb 2010 18:28:01 +0100 |
parents | 19885b43130e |
children | 420969b22201 |
rev | line source |
---|---|
1 | 1 /** |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Feb 1, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.objc.objc; | |
8 | |
9 import dstep.internal.String; | |
10 import dstep.internal.Types; | |
11 import bindings = dstep.objc.bindings; | |
12 import dstep.objc.message; | |
13 import dstep.objc.runtime; | |
14 | |
15 import mambo.io; | |
16 | |
17 alias objc_object* id; | |
18 alias objc_class* Class; | |
19 alias objc_selector* SEL; | |
20 alias extern (C) id function(id self, SEL op, ...) IMP; | |
21 alias bool BOOL; | |
22 alias char* STR; | |
23 | |
24 alias typeof(null) Nil; | |
25 alias typeof(null) nil; | |
26 | |
27 alias c_long arith_t; | |
28 alias c_ulong uarith_t; | |
29 | |
30 const bool YES = true; | |
31 const bool NO = false; | |
32 | |
33 struct objc_object | |
34 { | |
35 Class isa; | |
36 | |
37 // D Extensions: | |
38 | |
39 string getClassName () | |
40 { | |
41 return fromStringz(bindings.object_getClassName(this)); | |
42 } | |
43 | |
44 Ivar setInstanceVariable (T, string name) (T value) | |
45 { | |
46 return bindings.object_setInstanceVariable(this, name.ptr, value); | |
47 } | |
48 | |
49 Ivar getInstanceVariable (T, string name) (out T outValue) | |
50 { | |
51 return bindings.object_getInstanceVariable(this, name.ptr, &outValue); | |
52 } | |
53 | |
54 objc_property_t* getProperty (string name, bool isRequiredProperty, bool isInstanceProperty) | |
55 { | |
56 return bindings.protocol_getProperty(this, name.toStringz(), isRequiredProperty, isInstanceProperty); | |
57 } | |
58 | |
59 objc_property_t* copyPropertyList (out uint outCount) | |
60 { | |
61 return bindings.protocol_copyPropertyList(this, &outCount); | |
62 } | |
63 | |
64 Protocol** copyProtocolList (out uint outCount) | |
65 { | |
66 return bindings.protocol_copyProtocolList(this, &outCount); | |
67 } | |
68 | |
69 string getName () | |
70 { | |
71 return fromStringz(bindings.protocol_getName(this)); | |
72 } | |
73 | |
74 objc_method_description* copyMethodDescriptionList (bool isRequiredMethod, bool isInstanceMethod, out uint outCount) | |
75 { | |
76 return bindings.protocol_copyMethodDescriptionList(this, isRequiredMethod, isInstanceMethod, &outCount); | |
77 } | |
78 | |
79 id copy (size_t size) | |
80 { | |
81 return bindings.object_copy(this, size); | |
82 } | |
83 | |
84 id dispose () | |
85 { | |
86 return bindings.object_dispose(this); | |
87 } | |
88 | |
89 Class getClass () | |
90 { | |
91 return bindings.object_getClass(this); | |
92 } | |
93 | |
94 Class setClass (Class cls) | |
95 { | |
96 return bindings.object_setClass(this, cls); | |
97 } | |
98 | |
99 void* getIndexedIvars () | |
100 { | |
101 return bindings.object_getIndexedIvars(this); | |
102 } | |
103 | |
104 id getIvar (Ivar ivar) | |
105 { | |
106 return bindings.object_getIvar(this, ivar); | |
107 } | |
108 | |
109 void setIvar (Ivar ivar, Protocol* value) | |
110 { | |
111 return bindings.object_setIvar(this, ivar, value); | |
112 } | |
113 | |
114 bool conformsToProtocol (Protocol* other) | |
115 { | |
116 return bindings.protocol_conformsToProtocol(this, other); | |
117 } | |
118 | |
119 bool isEqual (id other) | |
120 { | |
121 return bindings.protocol_isEqual(this, other); | |
122 } | |
123 | |
124 objc_method_description getMethodDescription (SEL aSel, bool isRequiredMethod, bool isInstanceMethod) | |
125 { | |
126 return bindings.protocol_getMethodDescription(this, aSel, isRequiredMethod, isInstanceMethod); | |
127 } | |
128 | |
129 | |
130 | |
131 // message.h | |
132 | |
133 R msgSend (R = id, ARGS...) (SEL op, ARGS args) | |
134 { | |
6
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
135 alias extern (C) R function (id, SEL, ARGS) fp; |
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
136 return (cast(fp)&bindings.objc_msgSend)(this, op, args); |
1 | 137 } |
138 | |
139 void msgSend_stret (T, ARGS...) (out T stretAddr, SEL op, ARGS args) | |
140 { | |
141 if (T.sizeof > STRUCT_SIZE_LIMIT) | |
6
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
142 { |
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
143 alias extern (C) void function (T*, id, SEL, ARGS...) fp; |
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
144 (cast(fp)&bindings.objc_msgSend_stret)(&stretAddr, this, op, args); |
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
145 } |
1 | 146 |
147 else | |
6
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
148 { |
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
149 alias extern (C) T function (id, SEL, ARGS) fp; |
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
150 stretAddr = (*cast(fp)&bindings.objc_msgSend)(this, op, args); |
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
151 } |
1 | 152 } |
153 | |
20 | 154 static if (dstep.internal.Version.X86 || dstep.internal.Version.X86_64) |
1 | 155 { |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
156 R msgSend_fpret (R, ARGS...) (SEL op, ARGS args) |
1 | 157 { |
158 version (X86_64) | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
159 static assert(is(R == real), "dstep.objc.objc.objc_object.msgSend_fpret: Only real are legal return value for objc_msgSend_fpret"); |
1 | 160 |
161 else | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
162 static assert(is(R == double) || is(R == float), "dstep.objc.objc.objc_object.msgSend_fpret: Only double and float are legal return values for objc_msgSend_fpret"); |
1 | 163 |
6
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
164 alias extern (C) R function (id, SEL, ARGS) fp; |
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
165 return (cast(fp)&bindings.objc_msgSend_fpret)(this, op, args); |
1 | 166 } |
167 } | |
168 | |
169 R invoke (R = id, ARGS...) (Method m, ARGS args) | |
170 { | |
6
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
171 alias extern (C) R function (id, SEL, ARGS) fp; |
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
172 return (cast(fp)&bindings.method_invoke)(this, m, args); |
1 | 173 } |
174 | |
175 void invoke_stret (ARGS...) (Method m, ARGS args) | |
176 { | |
6
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
177 alias extern (C) R function (id, SEL, ARGS) fp; |
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
178 return (cast(fp)&bindings.method_invoke_stret)(this, m, args); |
1 | 179 } |
180 | |
181 R msgSendv (R = id, T) (SEL op, size_t arg_size, T arg_frame) | |
182 { | |
6
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
183 alias extern (C) R function (id, SEL, size_t, T) fp; |
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
184 (cast(fp)&bindings.objc_msgSendv)(this, op, arg_size, arg_frame); |
1 | 185 } |
186 | |
187 void msgSendv_stret (R = id, T) (out T stretAddr, SEL op, size_t arg_size, T arg_frame) | |
188 { | |
189 if (R.sizeof > STRUCT_SIZE_LIMIT) | |
6
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
190 { |
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
191 alias extern (C) void function (R*, id, SEL, size_t, T) fp; |
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
192 (cast(fp)&bindings.objc_msgSendv_stret)(&stretAddr, this, op, arg_size, arg_frame); |
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
193 } |
1 | 194 |
195 else | |
6
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
196 { |
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
197 alias extern (C) R function (id, SEL, size_t, T) fp; |
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
198 stretAddr = (*cast(fp)&bindings.objc_msgSendv)(this, op, arg_size, arg_frame); |
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
199 } |
1 | 200 } |
201 | |
202 version (X86) | |
203 { | |
204 R msgSendv_fpret (R = id, T) (SEL op, uint arg_size, T arg_frame) | |
205 { | |
206 static assert(!is(R == double) && !is(R == float), "dstep.objc.objc.objc_object.msgSend_fpret: Only double and float are legal return values for objc_msgSendv_fpret"); | |
6
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
207 alias extern (C) R function (id, SEL, uint, T) fp; |
c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
208 return (cast(fp)&bindings.objc_msgSendv_fpret)(this, op, arg_size, arg_frame); |
1 | 209 } |
210 } | |
211 } | |
212 | |
213 struct objc_selector | |
214 { | |
215 void* sel_id; | |
216 char* sel_types; | |
217 | |
218 | |
219 | |
220 // D Extensions: | |
221 | |
222 string getName () | |
223 { | |
224 return fromStringz(bindings.sel_getName(this)); | |
225 } | |
226 | |
227 bool isEqual (SEL rhs) | |
228 { | |
229 return bindings.sel_isEqual(this, rhs); | |
230 } | |
231 | |
232 bool isMapped () | |
233 { | |
234 return bindings.sel_isMapped(this); | |
235 } | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
236 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
237 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
238 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
239 //D Extensions: |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
240 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
241 struct objc |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
242 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
243 static string[] copyImageNames (out uint outCount) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
244 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
245 string[] ret; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
246 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
247 char** result = bindings.objc_copyImageNames(&outCount); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
248 ret.length = outCount; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
249 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
250 for (size_t i = 0; i < outCount; i++) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
251 ret[i] = fromStringz(result[i]); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
252 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
253 return ret; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
254 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
255 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
256 alias bindings.objc_enumerationMutation objc_enumerationMutation; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
257 alias bindings.objc_setForwardHandler objc_setForwardHandler; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
258 alias bindings.objc_setMultithreaded objc_setMultithreaded; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
259 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
260 static id getClass (string name) () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
261 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
262 return bindings.objc_getClass(name.ptr); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
263 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
264 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
265 static id getMetaClass (string name) () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
266 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
267 return bindings.objc_getMetaClass(name.ptr); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
268 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
269 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
270 static id lookUpClass (string name) () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
271 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
272 return bindings.objc_lookUpClass(name.ptr); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
273 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
274 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
275 static id getRequiredClass (string name) () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
276 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
277 return bindings.objc_getRequiredClass(name.ptr); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
278 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
279 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
280 static Class getFutureClass (string name) () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
281 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
282 return bindings.objc_getFutureClass(name.ptr); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
283 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
284 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
285 static string[] objc_copyClassNamesForImage (string image) (out uint outCount) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
286 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
287 string[] ret; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
288 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
289 char** result = bindings.objc_copyClassNamesForImage(image.ptr, &outCount); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
290 ret.length = outCount; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
291 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
292 for (size_t i = 0; i < outCount; i++) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
293 ret[i] = fromStringz(result[i]); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
294 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
295 return ret; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
296 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
297 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
298 static Class objc_getOrigClass (string name) () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
299 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
300 return bindings.objc_getOrigClass(name.ptr); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
301 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
302 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
303 static Class allocateClassPair (string name) (Class superclass, size_t extraBytes) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
304 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
305 return bindings.objc_allocateClassPair(superclass, name.ptr, extraBytes); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
306 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
307 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
308 alias bindings.objc_registerClassPair registerClassPair; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
309 alias bindings.objc_disposeClassPair disposeClassPair; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
310 alias bindings.objc_getClasses getClasses; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
311 alias bindings.objc_addClass addClass; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
312 alias bindings.class_createInstance createInstance; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
313 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
314 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
315 struct property |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
316 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
317 static string getName (objc_property_t* property) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
318 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
319 return fromStringz(bindings.property_getName(property)); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
320 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
321 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
322 static string getAttributes (objc_property_t* property) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
323 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
324 return fromStringz(bindings.property_getAttributes(property)); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
325 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
326 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
327 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
328 struct sel |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
329 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
330 static SEL getUid (string str) () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
331 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
332 return bindings.sel_getUid(str.ptr); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
333 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
334 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
335 static SEL registerName (string str) () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
336 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
337 return bindings.sel_registerName(str.ptr); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
6
diff
changeset
|
338 } |
1 | 339 } |