Mercurial > projects > dstep
annotate dstep/objc/bindings.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 | 033d260cfc9b |
children |
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.bindings; | |
8 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
1
diff
changeset
|
9 import dstep.internal.Version; |
1 | 10 import dstep.objc.message; |
11 import dstep.objc.objc; | |
12 import dstep.objc.runtime; | |
13 | |
14 extern (C) | |
15 { | |
16 // runtime.h | |
17 id object_copy (id obj, size_t size); | |
18 id object_dispose (id obj); | |
19 Class object_getClass (id obj); | |
20 Class object_setClass (id obj, Class cls); | |
21 char* object_getClassName (id obj); | |
22 void* object_getIndexedIvars (id obj); | |
23 id object_getIvar (id obj, Ivar ivar); | |
24 void object_setIvar (id obj, Ivar ivar, id value); | |
25 Ivar object_setInstanceVariable (id obj, char* name, void* value); | |
26 Ivar object_getInstanceVariable (id obj, char* name, void** outValue); | |
27 id objc_getClass (char* name); | |
28 id objc_getMetaClass (char* name); | |
29 id objc_lookUpClass (char* name); | |
30 id objc_getRequiredClass (char* name); | |
31 Class objc_getFutureClass (char* name); | |
32 void objc_setFutureClass (Class cls, char* name); | |
33 int objc_getClassList (Class* buffer, int bufferCount); | |
34 id objc_getProtocol (char* name); | |
35 Protocol** objc_copyProtocolList (uint* outCount); | |
36 char* class_getName (Class cls); | |
37 bool class_isMetaClass (Class cls); | |
38 Class class_getSuperclass (Class cls); | |
39 Class class_setSuperclass (Class cls, Class newSuper); | |
40 int class_getVersion (Class cls); | |
41 void class_setVersion (Class cls, int version_); | |
42 size_t class_getInstanceSize (Class cls); | |
43 Ivar class_getInstanceVariable (Class cls, char* name); | |
44 Ivar class_getClassVariable (Class cls, char* name); | |
45 Ivar* class_copyIvarList (Class cls, uint* outCount); | |
46 Method class_getInstanceMethod (Class cls, SEL name); | |
47 Method class_getClassMethod (Class cls, SEL name); | |
48 IMP class_getMethodImplementation (Class cls, SEL name); | |
49 IMP class_getMethodImplementation_stret (Class cls, SEL name); | |
50 bool class_respondsToSelector (Class cls, SEL sel); | |
51 Method* class_copyMethodList (Class cls, uint* outCount); | |
52 bool class_conformsToProtocol (Class cls, Protocol* protocol); | |
53 Protocol** class_copyProtocolList (Class cls, uint* outCount); | |
54 objc_property_t* class_getProperty (Class cls, char* name); | |
55 objc_property_t* class_copyPropertyList (Class cls, uint* outCount); | |
56 char* class_getIvarLayout (Class cls); | |
57 char* class_getWeakIvarLayout (Class cls); | |
58 id class_createInstance (Class cls, size_t extraBytes); | |
59 Class objc_allocateClassPair (Class superclass, char* name, size_t extraBytes); | |
60 void objc_registerClassPair (Class cls); | |
61 Class objc_duplicateClass (Class original, char* name, size_t extraBytes); | |
62 void objc_disposeClassPair (Class cls); | |
63 bool class_addMethod (Class cls, SEL name, IMP imp, char* types); | |
64 IMP class_replaceMethod (Class cls, SEL name, IMP imp, char* types); | |
65 bool class_addIvar (Class cls, char* name, size_t size, ubyte alignment, char* types); | |
66 bool class_addProtocol (Class cls, Protocol* protocol); | |
67 void class_setIvarLayout (Class cls, char* layout); | |
68 void class_setWeakIvarLayout (Class cls, char* layout); | |
69 SEL method_getName (Method m); | |
70 IMP method_getImplementation (Method m); | |
71 char* method_getTypeEncoding (Method m); | |
72 uint method_getNumberOfArguments (Method m); | |
73 char* method_copyReturnType (Method m); | |
74 char* method_copyArgumentType (Method m, uint index); | |
75 void method_getReturnType (Method m, char* dst, size_t dst_len); | |
76 void method_getArgumentType (Method m, uint index, char* dst, size_t dst_len); | |
77 objc_method_description* method_getDescription (Method m); | |
78 IMP method_setImplementation (Method m, IMP imp); | |
79 void method_exchangeImplementations (Method m1, Method m2); | |
80 char* ivar_getName (Ivar v); | |
81 char* ivar_getTypeEncoding (Ivar v); | |
82 ptrdiff_t ivar_getOffset (Ivar v); | |
83 char* property_getName (objc_property_t* property); | |
84 char* property_getAttributes (objc_property_t* property); | |
85 bool protocol_conformsToProtocol (id proto, id other); | |
86 bool protocol_isEqual (id proto, id other); | |
87 char* protocol_getName (id p); | |
88 objc_method_description protocol_getMethodDescription (id p, SEL aSel, bool isRequiredMethod, bool isInstanceMethod); | |
89 objc_method_description* protocol_copyMethodDescriptionList(id p, bool isRequiredMethod, bool isInstanceMethod, uint* outCount); | |
90 objc_property_t* protocol_getProperty (id proto, char* name, bool isRequiredProperty, bool isInstanceProperty); | |
91 objc_property_t* protocol_copyPropertyList (id proto, uint* outCount); | |
92 Protocol** protocol_copyProtocolList (id proto, uint* outCount); | |
93 char** objc_copyImageNames (uint* outCount); | |
94 char* class_getImageName (Class cls); | |
95 char** objc_copyClassNamesForImage (char* image, uint* outCount); | |
96 char* sel_getName (SEL sel); | |
97 SEL sel_getUid (char* str); | |
98 SEL sel_registerName (char* str); | |
99 bool sel_isEqual (SEL lhs, SEL rhs); | |
100 void objc_enumerationMutation (id arg0); | |
101 void objc_setForwardHandler (void* fwd, void* fwd_stret); | |
102 bool sel_isMapped (SEL sel); | |
103 id object_copyFromZone (id anObject, size_t nBytes, void* z); | |
104 id object_realloc (id anObject, size_t nBytes); | |
105 id object_reallocFromZone (id anObject, size_t nBytes, void* z); | |
106 void* objc_getClasses (); | |
107 void objc_addClass (Class myClass); | |
108 void objc_setMultithreaded (bool flag); | |
109 id class_createInstanceFromZone (Class arg0, size_t idxIvars, void* z); | |
110 void class_addMethods (Class arg0, objc_method_list* arg1); | |
111 void class_removeMethods (Class arg0, objc_method_list* arg1); | |
112 Class class_poseAs (Class imposter, Class original); | |
113 uint method_getSizeOfArguments (Method m); | |
114 uint method_getArgumentInfo (objc_method* m, int arg, char** type, int* offset); | |
115 bool class_respondsToMethod (Class arg0, SEL arg1); | |
116 IMP class_lookupMethod (Class arg0, SEL arg1); | |
117 Class objc_getOrigClass (char* name); | |
118 objc_method_list* class_nextMethodList (Class arg0, void* arg1); | |
119 | |
120 // message.h | |
121 id objc_msgSend (id self, SEL op, ...); | |
122 id objc_msgSendSuper (objc_super* super_, SEL op, ...); | |
123 void objc_msgSend_stret (void* stretAddr, id self, SEL op, ...); | |
124 void objc_msgSendSuper_stret (void* stretAddr, objc_super* super_, SEL op, ...); | |
125 id objc_msgSendv (id self, SEL op, size_t arg_size, void* arg_frame); | |
126 void objc_msgSendv_stret (void* stretAddr, id self, SEL op, size_t arg_size, void* arg_frame); | |
127 | |
128 id method_invoke (id receiver, Method m, ...); | |
129 void method_invoke_stret (id receiver, Method m, ...); | |
130 | |
131 version (X86_64) | |
132 real objc_msgSend_fpret (id self, SEL op, ...); | |
133 | |
134 else version (X86) | |
135 { | |
136 double objc_msgSendv_fpret (id self, SEL op, uint arg_size, void* arg_frame); | |
137 double objc_msgSend_fpret (id self, SEL op, ...); | |
138 } | |
139 } | |
140 | |
141 version (build) | |
142 { | |
143 version (GNU) | |
144 { | |
145 pragma(link, "objc -framework Cocoa"); | |
146 } | |
147 | |
148 else | |
149 { | |
150 pragma(link, "objc -L-framework -LCocoa"); | |
151 } | |
152 } |