| 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 int equals_t; |
|---|
| 8 |
|
|---|
| 9 |
alias char[] string; |
|---|
| 10 |
alias wchar[] wstring; |
|---|
| 11 |
alias 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 |
void* deallocator; |
|---|
| 51 |
OffsetTypeInfo[] offTi; |
|---|
| 52 |
void* defaultConstructor; |
|---|
| 53 |
|
|---|
| 54 |
static ClassInfo find(in char[] classname); |
|---|
| 55 |
Object create(); |
|---|
| 56 |
} |
|---|
| 57 |
|
|---|
| 58 |
struct OffsetTypeInfo |
|---|
| 59 |
{ |
|---|
| 60 |
size_t offset; |
|---|
| 61 |
TypeInfo ti; |
|---|
| 62 |
} |
|---|
| 63 |
|
|---|
| 64 |
class TypeInfo |
|---|
| 65 |
{ |
|---|
| 66 |
hash_t getHash(in void* p); |
|---|
| 67 |
equals_t equals(in void* p1, in void* p2); |
|---|
| 68 |
int compare(in void* p1, in void* p2); |
|---|
| 69 |
size_t tsize(); |
|---|
| 70 |
void swap(void* p1, void* p2); |
|---|
| 71 |
TypeInfo next(); |
|---|
| 72 |
void[] init(); |
|---|
| 73 |
uint flags(); |
|---|
| 74 |
// 1: // has possible pointers into GC memory |
|---|
| 75 |
OffsetTypeInfo[] offTi(); |
|---|
| 76 |
} |
|---|
| 77 |
|
|---|
| 78 |
class TypeInfo_Typedef : TypeInfo |
|---|
| 79 |
{ |
|---|
| 80 |
TypeInfo base; |
|---|
| 81 |
string name; |
|---|
| 82 |
void[] m_init; |
|---|
| 83 |
} |
|---|
| 84 |
|
|---|
| 85 |
class TypeInfo_Enum : TypeInfo_Typedef |
|---|
| 86 |
{ |
|---|
| 87 |
|
|---|
| 88 |
} |
|---|
| 89 |
|
|---|
| 90 |
class TypeInfo_Pointer : TypeInfo |
|---|
| 91 |
{ |
|---|
| 92 |
TypeInfo m_next; |
|---|
| 93 |
} |
|---|
| 94 |
|
|---|
| 95 |
class TypeInfo_Array : TypeInfo |
|---|
| 96 |
{ |
|---|
| 97 |
TypeInfo value; |
|---|
| 98 |
} |
|---|
| 99 |
|
|---|
| 100 |
class TypeInfo_StaticArray : TypeInfo |
|---|
| 101 |
{ |
|---|
| 102 |
TypeInfo value; |
|---|
| 103 |
size_t len; |
|---|
| 104 |
} |
|---|
| 105 |
|
|---|
| 106 |
class TypeInfo_AssociativeArray : TypeInfo |
|---|
| 107 |
{ |
|---|
| 108 |
TypeInfo value; |
|---|
| 109 |
TypeInfo key; |
|---|
| 110 |
} |
|---|
| 111 |
|
|---|
| 112 |
class TypeInfo_Function : TypeInfo |
|---|
| 113 |
{ |
|---|
| 114 |
TypeInfo next; |
|---|
| 115 |
} |
|---|
| 116 |
|
|---|
| 117 |
class TypeInfo_Delegate : TypeInfo |
|---|
| 118 |
{ |
|---|
| 119 |
TypeInfo next; |
|---|
| 120 |
} |
|---|
| 121 |
|
|---|
| 122 |
class TypeInfo_Class : TypeInfo |
|---|
| 123 |
{ |
|---|
| 124 |
ClassInfo info; |
|---|
| 125 |
} |
|---|
| 126 |
|
|---|
| 127 |
class TypeInfo_Interface : TypeInfo |
|---|
| 128 |
{ |
|---|
| 129 |
ClassInfo info; |
|---|
| 130 |
} |
|---|
| 131 |
|
|---|
| 132 |
class TypeInfo_Struct : TypeInfo |
|---|
| 133 |
{ |
|---|
| 134 |
string name; |
|---|
| 135 |
void[] m_init; |
|---|
| 136 |
|
|---|
| 137 |
uint function(in void*) xtoHash; |
|---|
| 138 |
equals_t function(in void*, in void*) xopEquals; |
|---|
| 139 |
int function(in void*, in void*) xopCmp; |
|---|
| 140 |
string function(in void*) xtoString; |
|---|
| 141 |
|
|---|
| 142 |
uint m_flags; |
|---|
| 143 |
|
|---|
| 144 |
} |
|---|
| 145 |
|
|---|
| 146 |
class TypeInfo_Tuple : TypeInfo |
|---|
| 147 |
{ |
|---|
| 148 |
TypeInfo[] elements; |
|---|
| 149 |
} |
|---|
| 150 |
|
|---|
| 151 |
class ModuleInfo |
|---|
| 152 |
{ |
|---|
| 153 |
string name; |
|---|
| 154 |
ModuleInfo[] importedModules; |
|---|
| 155 |
ClassInfo[] localClasses; |
|---|
| 156 |
uint flags; |
|---|
| 157 |
|
|---|
| 158 |
void function() ctor; |
|---|
| 159 |
void function() dtor; |
|---|
| 160 |
void function() unitTest; |
|---|
| 161 |
|
|---|
| 162 |
static int opApply(int delegate(inout ModuleInfo)); |
|---|
| 163 |
} |
|---|
| 164 |
|
|---|
| 165 |
class Throwable : Object |
|---|
| 166 |
{ |
|---|
| 167 |
interface TraceInfo |
|---|
| 168 |
{ |
|---|
| 169 |
int opApply(int delegate(inout char[])); |
|---|
| 170 |
string toString(); |
|---|
| 171 |
} |
|---|
| 172 |
|
|---|
| 173 |
string msg; |
|---|
| 174 |
string file; |
|---|
| 175 |
size_t line; |
|---|
| 176 |
TraceInfo info; |
|---|
| 177 |
Throwable next; |
|---|
| 178 |
|
|---|
| 179 |
this(string msg, Throwable next = null); |
|---|
| 180 |
this(string msg, string file, size_t line, Throwable next = null); |
|---|
| 181 |
override string toString(); |
|---|
| 182 |
} |
|---|
| 183 |
|
|---|
| 184 |
|
|---|
| 185 |
class Exception : Throwable |
|---|
| 186 |
{ |
|---|
| 187 |
this(string msg, Throwable next = null); |
|---|
| 188 |
this(string msg, string file, size_t line, Throwable next = null); |
|---|
| 189 |
} |
|---|
| 190 |
|
|---|
| 191 |
|
|---|
| 192 |
class Error : Throwable |
|---|
| 193 |
{ |
|---|
| 194 |
this(string msg, Throwable next = null); |
|---|
| 195 |
this(string msg, string file, size_t line, Throwable next = null); |
|---|
| 196 |
} |
|---|