Mercurial > projects > ldc
comparison lphobos/object.d @ 31:2841234d2aea trunk
[svn r35] * Attributes on struct fields/methods now work
* Updated object.d to 1.021
* Added -novalidate command line option. this is sometimes useful when debugging as it may let you read the .ll even if it's invalid.
author | lindquist |
---|---|
date | Thu, 04 Oct 2007 16:44:07 +0200 |
parents | c53b6e3fe49a |
children | fd7ad91fd713 |
comparison
equal
deleted
inserted
replaced
30:881158a93592 | 31:2841234d2aea |
---|---|
8 | 8 |
9 alias typeof(int.sizeof) size_t; | 9 alias typeof(int.sizeof) size_t; |
10 alias typeof(cast(void*)0 - cast(void*)0) ptrdiff_t; | 10 alias typeof(cast(void*)0 - cast(void*)0) ptrdiff_t; |
11 alias size_t hash_t; | 11 alias size_t hash_t; |
12 | 12 |
13 alias char[] string; | |
14 alias wchar[] wstring; | |
15 alias dchar[] dstring; | |
16 | |
13 extern (C) | 17 extern (C) |
14 { int printf(char *, ...); | 18 { int printf(char *, ...); |
19 void trace_term(); | |
15 } | 20 } |
16 | 21 |
17 class Object | 22 class Object |
18 { | 23 { |
19 void print(); | 24 void print(); |
22 int opCmp(Object o); | 27 int opCmp(Object o); |
23 int opEquals(Object o); | 28 int opEquals(Object o); |
24 | 29 |
25 final void notifyRegister(void delegate(Object) dg); | 30 final void notifyRegister(void delegate(Object) dg); |
26 final void notifyUnRegister(void delegate(Object) dg); | 31 final void notifyUnRegister(void delegate(Object) dg); |
32 | |
33 static Object factory(char[] classname); | |
27 } | 34 } |
28 | 35 |
29 struct Interface | 36 struct Interface |
30 { | 37 { |
31 ClassInfo classinfo; | 38 ClassInfo classinfo; |
32 void *[] vtbl; | 39 void *[] vtbl; |
33 ptrdiff_t offset; // offset to Interface 'this' from Object 'this' | 40 int offset; // offset to Interface 'this' from Object 'this' |
34 } | 41 } |
35 | 42 |
36 class ClassInfo : Object | 43 class ClassInfo : Object |
37 { | 44 { |
38 byte[] init; // class static initializer | 45 byte[] init; // class static initializer |
44 void (*classInvariant)(Object); | 51 void (*classInvariant)(Object); |
45 uint flags; | 52 uint flags; |
46 // 1: // IUnknown | 53 // 1: // IUnknown |
47 // 2: // has no possible pointers into GC memory | 54 // 2: // has no possible pointers into GC memory |
48 // 4: // has offTi[] member | 55 // 4: // has offTi[] member |
56 // 8: // has constructors | |
49 void *deallocator; | 57 void *deallocator; |
50 OffsetTypeInfo[] offTi; | 58 OffsetTypeInfo[] offTi; |
59 void* defaultConstructor; // default Constructor | |
60 | |
61 static ClassInfo find(char[] classname); | |
62 Object create(); | |
51 } | 63 } |
52 | 64 |
53 struct OffsetTypeInfo | 65 struct OffsetTypeInfo |
54 { | 66 { |
55 size_t offset; | 67 size_t offset; |
139 class TypeInfo_Tuple : TypeInfo | 151 class TypeInfo_Tuple : TypeInfo |
140 { | 152 { |
141 TypeInfo[] elements; | 153 TypeInfo[] elements; |
142 } | 154 } |
143 | 155 |
156 class TypeInfo_Const : TypeInfo | |
157 { | |
158 TypeInfo next; | |
159 } | |
160 | |
161 class TypeInfo_Invariant : TypeInfo_Const | |
162 { | |
163 } | |
164 | |
144 // Recoverable errors | 165 // Recoverable errors |
145 | 166 |
146 class Exception : Object | 167 class Exception : Object |
147 { | 168 { |
148 char[] msg; | 169 string msg; |
149 | 170 |
150 this(char[] msg); | 171 this(string msg); |
151 void print(); | 172 override void print(); |
152 char[] toString(); | 173 override string toString(); |
153 } | 174 } |
154 | 175 |
155 // Non-recoverable errors | 176 // Non-recoverable errors |
156 | 177 |
157 class Error : Exception | 178 class Error : Exception |
158 { | 179 { |
159 Error next; | 180 Error next; |
160 | 181 |
161 this(char[] msg); | 182 this(string msg); |
162 this(char[] msg, Error next); | 183 this(string msg, Error next); |
163 } | 184 } |
164 | 185 |