Mercurial > projects > ldc
comparison tests/testincludes/object.di @ 1400:4100c49b753f
Merge some changes from Tango's object.di into the testincludes version.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Tue, 19 May 2009 22:35:08 +0200 |
parents | f2b608012699 |
children |
comparison
equal
deleted
inserted
replaced
1399:d1fd46bbbff7 | 1400:4100c49b753f |
---|---|
9 | 9 |
10 alias typeof(int.sizeof) size_t; | 10 alias typeof(int.sizeof) size_t; |
11 alias typeof(cast(void*)0 - cast(void*)0) ptrdiff_t; | 11 alias typeof(cast(void*)0 - cast(void*)0) ptrdiff_t; |
12 | 12 |
13 alias size_t hash_t; | 13 alias size_t hash_t; |
14 alias int equals_t; | |
14 | 15 |
15 class Object | 16 class Object |
16 { | 17 { |
17 char[] toString(); | 18 char[] toString(); |
18 hash_t toHash(); | 19 hash_t toHash(); |
19 int opCmp(Object o); | 20 int opCmp(Object o); |
20 int opEquals(Object o); | 21 equals_t opEquals(Object o); |
21 | 22 |
22 interface Monitor | 23 interface Monitor |
23 { | 24 { |
24 void lock(); | 25 void lock(); |
25 void unlock(); | 26 void unlock(); |
45 uint flags; | 46 uint flags; |
46 // 1: // IUnknown | 47 // 1: // IUnknown |
47 // 2: // has no possible pointers into GC memory | 48 // 2: // has no possible pointers into GC memory |
48 // 4: // has offTi[] member | 49 // 4: // has offTi[] member |
49 // 8: // has constructors | 50 // 8: // has constructors |
51 // 32: // has typeinfo | |
50 void* deallocator; | 52 void* deallocator; |
51 OffsetTypeInfo[] offTi; | 53 OffsetTypeInfo[] offTi; |
52 void* defaultConstructor; | 54 void* defaultConstructor; |
55 TypeInfo typeinfo; | |
53 | 56 |
54 static ClassInfo find(char[] classname); | 57 static ClassInfo find(char[] classname); |
55 Object create(); | 58 Object create(); |
56 } | 59 } |
57 | 60 |
62 } | 65 } |
63 | 66 |
64 class TypeInfo | 67 class TypeInfo |
65 { | 68 { |
66 hash_t getHash(void *p); | 69 hash_t getHash(void *p); |
67 int equals(void *p1, void *p2); | 70 equals_t equals(void *p1, void *p2); |
68 int compare(void *p1, void *p2); | 71 int compare(void *p1, void *p2); |
69 size_t tsize(); | 72 size_t tsize(); |
70 void swap(void *p1, void *p2); | 73 void swap(void *p1, void *p2); |
71 TypeInfo next(); | 74 TypeInfo next(); |
72 void[] init(); | 75 void[] init(); |
163 static int opApply( int delegate( inout ModuleInfo ) ); | 166 static int opApply( int delegate( inout ModuleInfo ) ); |
164 } | 167 } |
165 | 168 |
166 class Exception : Object | 169 class Exception : Object |
167 { | 170 { |
171 struct FrameInfo{ | |
172 long line; | |
173 ptrdiff_t iframe; | |
174 ptrdiff_t offset; | |
175 size_t address; | |
176 char[] file; | |
177 char[] func; | |
178 char[256] charBuf; | |
179 void writeOut(void delegate(char[])sink); | |
180 } | |
181 interface TraceInfo | |
182 { | |
183 int opApply( int delegate( ref FrameInfo fInfo) ); | |
184 } | |
185 | |
168 char[] msg; | 186 char[] msg; |
169 char[] file; | 187 char[] file; |
170 size_t line; | 188 size_t line; // long would be better |
189 TraceInfo info; | |
171 Exception next; | 190 Exception next; |
172 | 191 |
192 this(char[] msg, char[] file, long line, Exception next, TraceInfo info ); | |
173 this(char[] msg, Exception next = null); | 193 this(char[] msg, Exception next = null); |
174 this(char[] msg, char[] file, size_t line, Exception next = null); | 194 this(char[] msg, char[] file, long line, Exception next = null); |
175 char[] toString(); | 195 char[] toString(); |
196 void writeOut(void delegate(char[]) sink); | |
176 } | 197 } |