Mercurial > projects > dstep
comparison dstep/objc/runtime.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 | 420969b22201 |
comparison
equal
deleted
inserted
replaced
15:7ff919f595d5 | 16:19885b43130e |
---|---|
13 import dstep.internal.Version; | 13 import dstep.internal.Version; |
14 import bindings = dstep.objc.bindings; | 14 import bindings = dstep.objc.bindings; |
15 import dstep.objc.message; | 15 import dstep.objc.message; |
16 import dstep.objc.objc; | 16 import dstep.objc.objc; |
17 | 17 |
18 struct objc_property; | |
19 | |
18 alias objc_method* Method; | 20 alias objc_method* Method; |
19 alias objc_ivar* Ivar; | 21 alias objc_ivar* Ivar; |
20 alias objc_category* Category; | 22 alias objc_category* Category; |
21 alias void* objc_property; | |
22 alias objc_property* objc_property_t; | 23 alias objc_property* objc_property_t; |
23 alias objc_object Protocol; | 24 alias objc_object Protocol; |
24 alias objc_symtab* Symtab; | 25 alias objc_symtab* Symtab; |
25 alias objc_cache* Cache; | 26 alias objc_cache* Cache; |
26 | 27 |
783 alias bindings.class_poseAs class_poseAs; | 784 alias bindings.class_poseAs class_poseAs; |
784 alias bindings.method_getSizeOfArguments method_getSizeOfArguments; | 785 alias bindings.method_getSizeOfArguments method_getSizeOfArguments; |
785 alias bindings.class_respondsToMethod class_respondsToMethod; | 786 alias bindings.class_respondsToMethod class_respondsToMethod; |
786 alias bindings.class_lookupMethod class_lookupMethod; | 787 alias bindings.class_lookupMethod class_lookupMethod; |
787 alias bindings.class_nextMethodList class_nextMethodList; | 788 alias bindings.class_nextMethodList class_nextMethodList; |
788 | |
789 | |
790 | |
791 | |
792 | |
793 | |
794 | |
795 | |
796 // D Extensions: | |
797 | |
798 struct objc | |
799 { | |
800 static string[] copyImageNames (out uint outCount) | |
801 { | |
802 string[] ret; | |
803 | |
804 char** result = bindings.objc_copyImageNames(&outCount); | |
805 ret.length = outCount; | |
806 | |
807 for (size_t i = 0; i < outCount; i++) | |
808 ret[i] = fromStringz(result[i]); | |
809 | |
810 return ret; | |
811 } | |
812 | |
813 alias bindings.objc_enumerationMutation objc_enumerationMutation; | |
814 alias bindings.objc_setForwardHandler objc_setForwardHandler; | |
815 alias bindings.objc_setMultithreaded objc_setMultithreaded; | |
816 | |
817 static id getClass (string name) () | |
818 { | |
819 return bindings.objc_getClass(name.ptr); | |
820 } | |
821 | |
822 static id getMetaClass (string name) () | |
823 { | |
824 return bindings.objc_getMetaClass(name.ptr); | |
825 } | |
826 | |
827 static id lookUpClass (string name) () | |
828 { | |
829 return bindings.objc_lookUpClass(name.ptr); | |
830 } | |
831 | |
832 static id getRequiredClass (string name) () | |
833 { | |
834 return bindings.objc_getRequiredClass(name.ptr); | |
835 } | |
836 | |
837 static Class getFutureClass (string name) () | |
838 { | |
839 return bindings.objc_getFutureClass(name.ptr); | |
840 } | |
841 | |
842 static string[] objc_copyClassNamesForImage (string image) (out uint outCount) | |
843 { | |
844 string[] ret; | |
845 | |
846 char** result = bindings.objc_copyClassNamesForImage(image.ptr, &outCount); | |
847 ret.length = outCount; | |
848 | |
849 for (size_t i = 0; i < outCount; i++) | |
850 ret[i] = fromStringz(result[i]); | |
851 | |
852 return ret; | |
853 } | |
854 | |
855 static Class objc_getOrigClass (string name) () | |
856 { | |
857 return bindings.objc_getOrigClass(name.ptr); | |
858 } | |
859 | |
860 static Class allocateClassPair (string name) (Class superclass, size_t extraBytes) | |
861 { | |
862 return bindings.objc_allocateClassPair(superclass, name.ptr, extraBytes); | |
863 } | |
864 | |
865 alias bindings.objc_registerClassPair registerClassPair; | |
866 alias bindings.objc_disposeClassPair disposeClassPair; | |
867 alias bindings.objc_getClasses getClasses; | |
868 alias bindings.objc_addClass addClass; | |
869 alias bindings.class_createInstance createInstance; | |
870 } | |
871 | |
872 struct property | |
873 { | |
874 static string property_getName (objc_property_t* property) | |
875 { | |
876 return fromStringz(bindings.property_getName(property)); | |
877 } | |
878 | |
879 static string property_getAttributes (objc_property_t* property) | |
880 { | |
881 return fromStringz(bindings.property_getAttributes(property)); | |
882 } | |
883 } | |
884 | |
885 struct sel | |
886 { | |
887 static SEL getUid (string str) () | |
888 { | |
889 return bindings.sel_getUid(str.ptr); | |
890 } | |
891 | |
892 static SEL registerName (string str) () | |
893 { | |
894 return bindings.sel_registerName(str.ptr); | |
895 } | |
896 } |