2 // Implementation is in internal\object.d
8 alias typeof(int.sizeof
) size_t
;
9 alias typeof(cast(void*)0 - cast(void*)0) ptrdiff_t
;
12 alias invariant(char)[] string
;
13 alias invariant(wchar)[] wstring
;
14 alias invariant(dchar)[] dstring
;
17 { int printf(in char *, ...);
26 int opEquals(Object o
);
28 final void notifyRegister(void delegate(Object
) dg
);
29 final void notifyUnRegister(void delegate(Object
) dg
);
31 static Object
factory(string classname
);
38 ptrdiff_t offset
; // offset to Interface 'this' from Object 'this'
41 class ClassInfo
: Object
43 byte[] init
; // class static initializer
44 string name
; // class name
45 void *[] vtbl
; // virtual function pointer table
46 Interface
[] interfaces
;
49 void (*classInvariant
)(Object
);
51 // 1: // is IUnknown or is derived from IUnknown
52 // 2: // has no possible pointers into GC memory
53 // 4: // has offTi[] member
54 // 8: // has constructors
55 // 16: // has xgetMembers member
57 OffsetTypeInfo
[] offTi
;
58 void* defaultConstructor
; // default Constructor
59 const(MemberInfo
[]) function(string
) xgetMembers
;
61 static ClassInfo
find(string classname
);
63 const(MemberInfo
[]) getMembers(string
);
74 hash_t
getHash(in void *p
);
75 int equals(in void *p1
, in void *p2
);
76 int compare(in void *p1
, in void *p2
);
78 void swap(void *p1
, void *p2
);
82 // 1: // has possible pointers into GC memory
83 OffsetTypeInfo
[] offTi();
84 void destroy(void *p
);
85 void postblit(void *p
);
88 class TypeInfo_Typedef
: TypeInfo
95 class TypeInfo_Enum
: TypeInfo_Typedef
99 class TypeInfo_Pointer
: TypeInfo
104 class TypeInfo_Array
: TypeInfo
109 class TypeInfo_StaticArray
: TypeInfo
115 class TypeInfo_AssociativeArray
: TypeInfo
121 class TypeInfo_Function
: TypeInfo
126 class TypeInfo_Delegate
: TypeInfo
131 class TypeInfo_Class
: TypeInfo
136 class TypeInfo_Interface
: TypeInfo
141 class TypeInfo_Struct
: TypeInfo
146 uint function(in void*) xtoHash
;
147 int function(in void*, in void*) xopEquals
;
148 int function(in void*, in void*) xopCmp
;
149 string
function(const(void)*) xtoString
;
153 const(MemberInfo
[]) function(string
) xgetMembers
;
154 void function(void*) xdtor
;
155 void function(void*) xpostblit
;
158 class TypeInfo_Tuple
: TypeInfo
163 class TypeInfo_Const
: TypeInfo
168 class TypeInfo_Invariant
: TypeInfo_Const
172 abstract class MemberInfo
177 class MemberInfo_field
: MemberInfo
179 this(string name
, TypeInfo ti
, size_t offset
);
181 override string
name();
186 class MemberInfo_function
: MemberInfo
194 this(string name
, TypeInfo ti
, void* fp
, uint flags
);
196 override string
name();
202 // Recoverable errors
204 class Exception
: Object
210 this(string msg
, Error next
);
216 // Non-recoverable errors
218 class Error
: Exception
221 this(string msg
, Error next
);
224 /** If the top-level main throws this, the message will be printed to stderr
225 * and the program terminates with the given exit code.
227 class SystemExit
: Exception
{
230 this(string msg
, int exitCode
= 1);