comparison dwt/internal/objc/runtime.d @ 155:e91dcbf77cc7

Fixes runtime problems with dmd and ldc. Changed a couple of floats to CGFloat
author Jacob Carlborg <doob@me.com>
date Mon, 06 Jul 2009 21:17:03 +0200
parents ad4e1fe71a5a
children 969e7de37c3d
comparison
equal deleted inserted replaced
154:535243e6d16a 155:e91dcbf77cc7
30 30
31 else version (PPC) 31 else version (PPC)
32 const int STRUCT_SIZE_LIMIT = 4; 32 const int STRUCT_SIZE_LIMIT = 4;
33 33
34 else version (X86_64) 34 else version (X86_64)
35 const int STRUCT_SIZE_LIMIT = 16;
36
37 else version (PPC64)
35 const int STRUCT_SIZE_LIMIT = 16; 38 const int STRUCT_SIZE_LIMIT = 16;
36 39
37 struct objc_object 40 struct objc_object
38 { 41 {
39 Class isa; 42 Class isa;
187 return dwt.internal.objc.bindings.sel_registerName(str.toStringz()); 190 return dwt.internal.objc.bindings.sel_registerName(str.toStringz());
188 } 191 }
189 192
190 id objc_msgSend (ARGS...) (id theReceiver, SEL theSelector, ARGS args) 193 id objc_msgSend (ARGS...) (id theReceiver, SEL theSelector, ARGS args)
191 { 194 {
192 return (cast(id (*)(id, SEL, ARGS...))&dwt.internal.objc.bindings.objc_msgSend)(theReceiver, theSelector, args); 195 alias extern (C) id function (id, SEL, ARGS) fp;
196 return (cast(fp)&dwt.internal.objc.bindings.objc_msgSend)(theReceiver, theSelector, args);
193 } 197 }
194 198
195 void objc_msgSend_struct (T, ARGS...) (T* result, id theReceiver, SEL theSelector, ARGS args) 199 void objc_msgSend_struct (T, ARGS...) (T* result, id theReceiver, SEL theSelector, ARGS args)
196 { 200 {
197 result = cast(T*) dwt.internal.objc.bindings.objc_msgSend(theReceiver, theSelector, args); 201 alias extern (C) T* function (id, SEL, ARGS) fp;
202 result = (cast(fp)&dwt.internal.objc.bindings.objc_msgSend)(theReceiver, theSelector, args);
203 //result = cast(T*) dwt.internal.objc.bindings.objc_msgSend(theReceiver, theSelector, args);
198 } 204 }
199 205
200 void objc_msgSend_stret (T, ARGS...) (T* stretAddr, id theReceiver, SEL theSelector, ARGS args) 206 void objc_msgSend_stret (T, ARGS...) (T* stretAddr, id theReceiver, SEL theSelector, ARGS args)
201 { 207 {
202 if (T.sizeof > STRUCT_SIZE_LIMIT) 208 if (T.sizeof > STRUCT_SIZE_LIMIT)
203 (cast(void (*)(T *, id, SEL, ARGS...))&dwt.internal.objc.bindings.objc_msgSend_stret)(stretAddr, theReceiver, theSelector, args); 209 {
210 alias extern (C) void function (T *, id, SEL, ARGS) fp;
211 (cast(fp)&dwt.internal.objc.bindings.objc_msgSend_stret)(stretAddr, theReceiver, theSelector, args);
212 }
204 213
205 else 214 else
206 *stretAddr = (*cast(T (*)(id, SEL, ARGS...))&dwt.internal.objc.bindings.objc_msgSend)(theReceiver, theSelector, args); 215 {
216 alias extern (C) T function (id, SEL, ARGS) fp;
217 *stretAddr = (*cast(fp)&dwt.internal.objc.bindings.objc_msgSend)(theReceiver, theSelector, args);
218 }
207 } 219 }
208 220
209 id objc_msgSendSuper (ARGS...) (objc_super* superr, SEL op, ARGS args) 221 id objc_msgSendSuper (ARGS...) (objc_super* superr, SEL op, ARGS args)
210 { 222 {
211 return (cast(id (*)(objc_super*, SEL, ARGS...))&dwt.internal.objc.bindings.objc_msgSendSuper)(superr, op, args); 223 alias extern (C) id function (objc_super*, SEL, ARGS) fp;
224 return (cast(fp)&dwt.internal.objc.bindings.objc_msgSendSuper)(superr, op, args);
212 } 225 }
213 226
214 bool objc_msgSend_bool (ARGS...) (id theReceiver, SEL theSelector, ARGS args) 227 bool objc_msgSend_bool (ARGS...) (id theReceiver, SEL theSelector, ARGS args)
215 { 228 {
216 return (cast(bool (*)(id, SEL, ARGS...))&dwt.internal.objc.bindings.objc_msgSend)(theReceiver, theSelector, args); 229 alias extern (C) bool function (id, SEL, ARGS) fp;
230 return (cast(fp)&dwt.internal.objc.bindings.objc_msgSend)(theReceiver, theSelector, args);
217 } 231 }
218 232
219 version (X86) 233 version (X86)
220 { 234 {
221 double objc_msgSend_fpret(ARGS...) (id self, SEL op, ARGS args) 235 double objc_msgSend_fpret(ARGS...) (id self, SEL op, ARGS args)
222 { 236 {
223 return (cast(double (*)(id, SEL, ARGS...))&dwt.internal.objc.bindings.objc_msgSend_fpret)(self, op, args); 237 alias extern (C) double function (id, SEL, ARGS) fp;
238 return (cast(fp)&dwt.internal.objc.bindings.objc_msgSend_fpret)(self, op, args);
224 } 239 }
225 } 240 }
226 241
227 else 242 else
228 { 243 {
229 double objc_msgSend_fpret(ARGS...) (id self, SEL op, ARGS args) 244 double objc_msgSend_fpret(ARGS...) (id self, SEL op, ARGS args)
230 { 245 {
231 return (cast(double (*)(id, SEL, ARGS...))&dwt.internal.objc.bindings.objc_msgSend)(self, op, args); 246 alias extern (C) double function (id, SEL, ARGS) fp;
232 } 247 return (cast(fp)&dwt.internal.objc.bindings.objc_msgSend)(self, op, args);
233 } 248 }
249 }