Mercurial > projects > ldc
comparison druntime/import/object.di @ 760:6f33b427bfd1
Seems like hg ignores .di files, so I missed a bunch of stuff. complete druntime should be there now :)
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Wed, 12 Nov 2008 00:19:18 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
759:d3eb054172f9 | 760:6f33b427bfd1 |
---|---|
1 module object; | |
2 | |
3 alias typeof(int.sizeof) size_t; | |
4 alias typeof(cast(void*)0 - cast(void*)0) ptrdiff_t; | |
5 | |
6 alias size_t hash_t; | |
7 alias bool equals_t; | |
8 | |
9 alias invariant(char)[] string; | |
10 alias invariant(wchar)[] wstring; | |
11 alias invariant(dchar)[] dstring; | |
12 | |
13 class Object | |
14 { | |
15 string toString(); | |
16 hash_t toHash(); | |
17 int opCmp(Object o); | |
18 equals_t opEquals(Object o); | |
19 | |
20 interface Monitor | |
21 { | |
22 void lock(); | |
23 void unlock(); | |
24 } | |
25 | |
26 static Object factory(string classname); | |
27 } | |
28 | |
29 struct Interface | |
30 { | |
31 ClassInfo classinfo; | |
32 void*[] vtbl; | |
33 ptrdiff_t offset; // offset to Interface 'this' from Object 'this' | |
34 } | |
35 | |
36 class ClassInfo : Object | |
37 { | |
38 byte[] init; // class static initializer | |
39 string name; // class name | |
40 void*[] vtbl; // virtual function pointer table | |
41 Interface[] interfaces; | |
42 ClassInfo base; | |
43 void* destructor; | |
44 void(*classInvariant)(Object); | |
45 uint flags; | |
46 // 1: // is IUnknown or is derived from IUnknown | |
47 // 2: // has no possible pointers into GC memory | |
48 // 4: // has offTi[] member | |
49 // 8: // has constructors | |
50 // 16: // has xgetMembers member | |
51 void* deallocator; | |
52 OffsetTypeInfo[] offTi; | |
53 void* defaultConstructor; | |
54 const(MemberInfo[]) function(string) xgetMembers; | |
55 | |
56 static ClassInfo find(in char[] classname); | |
57 Object create(); | |
58 const(MemberInfo[]) getMembers(in char[] classname); | |
59 } | |
60 | |
61 struct OffsetTypeInfo | |
62 { | |
63 size_t offset; | |
64 TypeInfo ti; | |
65 } | |
66 | |
67 class TypeInfo | |
68 { | |
69 hash_t getHash(in void* p); | |
70 equals_t equals(in void* p1, in void* p2); | |
71 int compare(in void* p1, in void* p2); | |
72 size_t tsize(); | |
73 void swap(void* p1, void* p2); | |
74 TypeInfo next(); | |
75 void[] init(); | |
76 uint flags(); | |
77 // 1: // has possible pointers into GC memory | |
78 OffsetTypeInfo[] offTi(); | |
79 void destroy(void* p); | |
80 void postblit(void* p); | |
81 } | |
82 | |
83 class TypeInfo_Typedef : TypeInfo | |
84 { | |
85 TypeInfo base; | |
86 string name; | |
87 void[] m_init; | |
88 } | |
89 | |
90 class TypeInfo_Enum : TypeInfo_Typedef | |
91 { | |
92 | |
93 } | |
94 | |
95 class TypeInfo_Pointer : TypeInfo | |
96 { | |
97 TypeInfo m_next; | |
98 } | |
99 | |
100 class TypeInfo_Array : TypeInfo | |
101 { | |
102 TypeInfo value; | |
103 } | |
104 | |
105 class TypeInfo_StaticArray : TypeInfo | |
106 { | |
107 TypeInfo value; | |
108 size_t len; | |
109 } | |
110 | |
111 class TypeInfo_AssociativeArray : TypeInfo | |
112 { | |
113 TypeInfo value; | |
114 TypeInfo key; | |
115 } | |
116 | |
117 class TypeInfo_Function : TypeInfo | |
118 { | |
119 TypeInfo next; | |
120 } | |
121 | |
122 class TypeInfo_Delegate : TypeInfo | |
123 { | |
124 TypeInfo next; | |
125 } | |
126 | |
127 class TypeInfo_Class : TypeInfo | |
128 { | |
129 ClassInfo info; | |
130 } | |
131 | |
132 class TypeInfo_Interface : TypeInfo | |
133 { | |
134 ClassInfo info; | |
135 } | |
136 | |
137 class TypeInfo_Struct : TypeInfo | |
138 { | |
139 string name; | |
140 void[] m_init; | |
141 | |
142 uint function(in void*) xtoHash; | |
143 equals_t function(in void*, in void*) xopEquals; | |
144 int function(in void*, in void*) xopCmp; | |
145 string function(in void*) xtoString; | |
146 | |
147 uint m_flags; | |
148 | |
149 const(MemberInfo[]) function(in char[]) xgetMembers; | |
150 void function(void*) xdtor; | |
151 void function(void*) xpostblit; | |
152 } | |
153 | |
154 class TypeInfo_Tuple : TypeInfo | |
155 { | |
156 TypeInfo[] elements; | |
157 } | |
158 | |
159 class TypeInfo_Const : TypeInfo | |
160 { | |
161 TypeInfo next; | |
162 } | |
163 | |
164 class TypeInfo_Invariant : TypeInfo_Const | |
165 { | |
166 | |
167 } | |
168 | |
169 abstract class MemberInfo | |
170 { | |
171 string name(); | |
172 } | |
173 | |
174 class MemberInfo_field : MemberInfo | |
175 { | |
176 this(string name, TypeInfo ti, size_t offset); | |
177 | |
178 override string name(); | |
179 TypeInfo typeInfo(); | |
180 size_t offset(); | |
181 } | |
182 | |
183 class MemberInfo_function : MemberInfo | |
184 { | |
185 enum | |
186 { | |
187 Virtual = 1, | |
188 Member = 2, | |
189 Static = 4, | |
190 } | |
191 | |
192 this(string name, TypeInfo ti, void* fp, uint flags); | |
193 | |
194 override string name(); | |
195 TypeInfo typeInfo(); | |
196 void* fp(); | |
197 uint flags(); | |
198 } | |
199 | |
200 class ModuleInfo | |
201 { | |
202 string name; | |
203 ModuleInfo[] importedModules; | |
204 ClassInfo[] localClasses; | |
205 uint flags; | |
206 | |
207 void function() ctor; | |
208 void function() dtor; | |
209 void function() unitTest; | |
210 | |
211 void* xgetMembers; // module getMembers() function | |
212 void function() ictor; // module static constructor (order independent) | |
213 | |
214 static int opApply(int delegate(inout ModuleInfo)); | |
215 } | |
216 | |
217 class Throwable : Object | |
218 { | |
219 interface TraceInfo | |
220 { | |
221 int opApply(int delegate(inout char[])); | |
222 string toString(); | |
223 } | |
224 | |
225 string msg; | |
226 string file; | |
227 size_t line; | |
228 TraceInfo info; | |
229 Throwable next; | |
230 | |
231 this(string msg, Throwable next = null); | |
232 this(string msg, string file, size_t line, Throwable next = null); | |
233 override string toString(); | |
234 } | |
235 | |
236 | |
237 class Exception : Throwable | |
238 { | |
239 this(string msg, Throwable next = null); | |
240 this(string msg, string file, size_t line, Throwable next = null); | |
241 } | |
242 | |
243 | |
244 class Error : Throwable | |
245 { | |
246 this(string msg, Throwable next = null); | |
247 this(string msg, string file, size_t line, Throwable next = null); | |
248 } |