Mercurial > projects > dstep
comparison dstep/objc/message.d @ 6:c0cfd40362ee
Fixed the bridge to work with ldc and dmd. Added a couple of hooks to manipulate the source code
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Wed, 08 Jul 2009 14:29:59 +0200 |
parents | 033d260cfc9b |
children | 19885b43130e |
comparison
equal
deleted
inserted
replaced
5:7a60c3c4d421 | 6:c0cfd40362ee |
---|---|
33 // for dwt compatibility | 33 // for dwt compatibility |
34 alias super_class cls; | 34 alias super_class cls; |
35 | 35 |
36 R msgSendSuper (R = id, ARGS...) (SEL op, ARGS args) | 36 R msgSendSuper (R = id, ARGS...) (SEL op, ARGS args) |
37 { | 37 { |
38 return (cast(R function (id, SEL, ARGS...))&bindings.objc_msgSendSuper)(this, op, args); | 38 alias extern (C) R function (id, SEL, ARGS) fp; |
39 return (cast(fp)&bindings.objc_msgSendSuper)(this, op, args); | |
39 } | 40 } |
40 | 41 |
41 void msgSendSuper_stret (T, ARGS...) (out T stretAddr, id self, SEL op, ARGS args) | 42 void msgSendSuper_stret (T, ARGS...) (out T stretAddr, id self, SEL op, ARGS args) |
42 { | 43 { |
43 if (T.sizeof > STRUCT_SIZE_LIMIT) | 44 if (T.sizeof > STRUCT_SIZE_LIMIT) |
44 (cast(void function (T*, id, SEL, ARGS...))&bindings.objc_msgSendSuper_stret)(&stretAddr, self, op, args); | 45 { |
46 alias extern (C) void function (T*, id, SEL, ARGS) fp; | |
47 (cast(fp)&bindings.objc_msgSendSuper_stret)(&stretAddr, self, op, args); | |
48 } | |
45 | 49 |
46 else | 50 else |
47 stretAddr = (*cast(T function (id, SEL, ARGS...))&bindings.objc_msgSendSuper)(self, op, args); | 51 { |
52 alias extern (C) T function (id, SEL, ARGS) fp; | |
53 stretAddr = (*cast(fp)&bindings.objc_msgSendSuper)(self, op, args); | |
54 } | |
48 } | 55 } |
49 } | 56 } |
50 | 57 |
51 R objc_msgSend (R = id, ARGS...) (id self, SEL op, ARGS args) | 58 R objc_msgSend (R = id, ARGS...) (id self, SEL op, ARGS args) |
52 { | 59 { |
53 return (cast(R function (id, SEL, ARGS...))&bindings.objc_msgSend)(self, op, args); | 60 alias extern(C) R function (id, SEL, ARGS) fp; |
61 return (cast(fp)&bindings.objc_msgSend)(self, op, args); | |
54 } | 62 } |
55 | 63 |
56 R objc_msgSendSuper (R = id, ARGS...) (objc_super* super_, SEL op, ARGS args) | 64 R objc_msgSendSuper (R = id, ARGS...) (objc_super* super_, SEL op, ARGS args) |
57 { | 65 { |
58 return (cast(R function (id, SEL, ARGS...))&bindings.objc_msgSendSuper)(super_, op, args); | 66 alias extern(C) R function (objc_super*, SEL, ARGS) fp; |
67 return (cast(fp)&bindings.objc_msgSendSuper)(super_, op, args); | |
59 } | 68 } |
60 | 69 |
61 void objc_msgSend_stret (T, ARGS...) (out T stretAddr, id self, SEL op, ARGS args) | 70 void objc_msgSend_stret (T, ARGS...) (out T stretAddr, id self, SEL op, ARGS args) |
62 { | 71 { |
63 if (T.sizeof > STRUCT_SIZE_LIMIT) | 72 if (T.sizeof > STRUCT_SIZE_LIMIT) |
64 (cast(void function (T*, id, SEL, ARGS...))&bindings.objc_msgSend_stret)(&stretAddr, self, op, args); | 73 { |
74 alias extern(C) void function (T*, id, SEL, ARGS) fp; | |
75 (cast(void function (fp))&bindings.objc_msgSend_stret)(&stretAddr, self, op, args); | |
76 } | |
65 | 77 |
66 else | 78 else |
67 stretAddr = (*cast(T function (id, SEL, ARGS...))&bindings.objc_msgSend)(self, op, args); | 79 { |
80 alias extern (C) T function (id, SEL, ARGS) fp; | |
81 stretAddr = (*cast(fp)&bindings.objc_msgSend)(self, op, args); | |
82 } | |
68 } | 83 } |
69 | 84 |
70 static if (X86 || X86_64) | 85 static if (X86 || X86_64) |
71 { | 86 { |
72 R objc_msgSend_fpret (R = id, ARGS...) (id self, SEL op, ARGS args) | 87 R objc_msgSend_fpret (R = id, ARGS...) (id self, SEL op, ARGS args) |
75 static assert(!is(R : real), "Only real are legal return value for objc_msgSend_fpret"); | 90 static assert(!is(R : real), "Only real are legal return value for objc_msgSend_fpret"); |
76 | 91 |
77 else | 92 else |
78 static assert(!is(R : double) && !is(R : float), "Only double and float are legal return values for objc_msgSend_fpret"); | 93 static assert(!is(R : double) && !is(R : float), "Only double and float are legal return values for objc_msgSend_fpret"); |
79 | 94 |
80 return (cast(R function (id, SEL, ARGS...))&bindings.objc_msgSend_fpret)(self, op, args); | 95 alias extern (C) R function (id, SEL, ARGS) fp; |
96 return (cast(fp)&bindings.objc_msgSend_fpret)(self, op, args); | |
81 } | 97 } |
82 } | 98 } |
83 | 99 |
84 R method_invoke (R = id, ARGS...) (id receiver, Method m, ARGS args) | 100 R method_invoke (R = id, ARGS...) (id receiver, Method m, ARGS args) |
85 { | 101 { |
86 static assert(receiver !is null); | 102 static assert(receiver !is null); |
87 return (cast(R function (id, SEL, ARGS...))&bindings.method_invoke)(receiver, m, args); | 103 alias extern (C) R function (id, SEL, ARGS) fp; |
104 return (cast(fp)&bindings.method_invoke)(receiver, m, args); | |
88 } | 105 } |
89 | 106 |
90 void method_invoke_stret (ARGS...) (id receiver, Method m, ARGS args) | 107 void method_invoke_stret (ARGS...) (id receiver, Method m, ARGS args) |
91 { | 108 { |
92 static assert(receiver !is null); | 109 static assert(receiver !is null); |
93 return (cast(R function (id, SEL, ARGS...))&bindings.method_invoke_stret)(receiver, m, args); | 110 alias extern (C) R function (id, SEL, ARGS) fp; |
111 return (cast(fp)&bindings.method_invoke_stret)(receiver, m, args); | |
94 } | 112 } |
95 | 113 |
96 R objc_msgSendv (R = id, T) (id self, SEL op, size_t arg_size, T arg_frame) | 114 R objc_msgSendv (R = id, T) (id self, SEL op, size_t arg_size, T arg_frame) |
97 { | 115 { |
98 (cast(R function (id, SEL, size_t, T))&bindings.objc_msgSendv)(self, op, arg_size, arg_frame); | 116 alias extern (C) R function (id, SEL, size_t, T) fp; |
117 (cast(fp)&bindings.objc_msgSendv)(self, op, arg_size, arg_frame); | |
99 } | 118 } |
100 | 119 |
101 void objc_msgSendv_stret (R = id, T) (out T stretAddr, id self, SEL op, size_t arg_size, T arg_frame) | 120 void objc_msgSendv_stret (R = id, T) (out T stretAddr, id self, SEL op, size_t arg_size, T arg_frame) |
102 { | 121 { |
103 if (R.sizeof > STRUCT_SIZE_LIMIT) | 122 if (R.sizeof > STRUCT_SIZE_LIMIT) |
104 (cast(void function (R*, id, SEL, size_t, T))&bindings.objc_msgSendv_stret)(&stretAddr, self, op, arg_size, arg_frame); | 123 { |
124 alias extern (C) void function (R*, id, SEL, size_t, T) fp; | |
125 (cast(fp)&bindings.objc_msgSendv_stret)(&stretAddr, self, op, arg_size, arg_frame); | |
126 } | |
105 | 127 |
106 else | 128 else |
107 stretAddr = (*cast(R function (id, SEL, size_t, T))&bindings.objc_msgSendv)(self, op, arg_size, arg_frame); | 129 { |
130 alias extern (C) R function (id, SEL, size_t, T) fp; | |
131 stretAddr = (*cast(fp)&bindings.objc_msgSendv)(self, op, arg_size, arg_frame); | |
132 } | |
108 } | 133 } |
109 | 134 |
110 version (X86) | 135 version (X86) |
111 { | 136 { |
112 R objc_msgSendv_fpret (R = id, T) (id self, SEL op, uint arg_size, T arg_frame) | 137 R objc_msgSendv_fpret (R = id, T) (id self, SEL op, uint arg_size, T arg_frame) |
113 { | 138 { |
114 static assert(!is(R : double) && !is(R : float), "Only double and float are legal return values for objc_msgSendv_fpret"); | 139 static assert(!is(R : double) && !is(R : float), "Only double and float are legal return values for objc_msgSendv_fpret"); |
115 return (cast(R function (id, SEL, uint, T))&bindings.objc_msgSendv_fpret)(self, op, arg_size, arg_frame); | 140 alias extern (C) R function (id, SEL, uint, T) fp; |
141 return (cast(fp)&bindings.objc_msgSendv_fpret)(self, op, arg_size, arg_frame); | |
116 } | 142 } |
117 } | 143 } |