-module object;\r
-\r
-alias typeof(int.sizeof) size_t;\r
-alias typeof(cast(void*)0 - cast(void*)0) ptrdiff_t;\r
-\r
-alias size_t hash_t;\r
-alias int equals_t;\r
-\r
-alias char[] string;\r
-alias wchar[] wstring;\r
-alias dchar[] dstring;\r
-\r
-class Object\r
-{\r
- string toString();\r
- hash_t toHash();\r
- int opCmp(Object o);\r
- equals_t opEquals(Object o);\r
-\r
- interface Monitor\r
- {\r
- void lock();\r
- void unlock();\r
- }\r
-}\r
-\r
-struct Interface\r
-{\r
- ClassInfo classinfo;\r
- void*[] vtbl;\r
- ptrdiff_t offset; // offset to Interface 'this' from Object 'this'\r
-}\r
-\r
-class ClassInfo : Object\r
-{\r
- byte[] init; // class static initializer\r
- string name; // class name\r
- void*[] vtbl; // virtual function pointer table\r
- Interface[] interfaces;\r
- ClassInfo base;\r
- void* destructor;\r
- void(*classInvariant)(Object);\r
- uint flags;\r
- // 1: // is IUnknown or is derived from IUnknown\r
- // 2: // has no possible pointers into GC memory\r
- // 4: // has offTi[] member\r
- // 8: // has constructors\r
- void* deallocator;\r
- OffsetTypeInfo[] offTi;\r
- void* defaultConstructor;\r
-\r
- static ClassInfo find(in char[] classname);\r
- Object create();\r
-}\r
-\r
-struct OffsetTypeInfo\r
-{\r
- size_t offset;\r
- TypeInfo ti;\r
-}\r
-\r
-class TypeInfo\r
-{\r
- hash_t getHash(in void* p);\r
- int equals(in void* p1, in void* p2);\r
- int compare(in void* p1, in void* p2);\r
- size_t tsize();\r
- void swap(void* p1, void* p2);\r
- TypeInfo next();\r
- void[] init();\r
- uint flags();\r
- // 1: // has possible pointers into GC memory\r
- OffsetTypeInfo[] offTi();\r
-}\r
-\r
-class TypeInfo_Typedef : TypeInfo\r
-{\r
- TypeInfo base;\r
- string name;\r
- void[] m_init;\r
-}\r
-\r
-class TypeInfo_Enum : TypeInfo_Typedef\r
-{\r
-}\r
-\r
-class TypeInfo_Pointer : TypeInfo\r
-{\r
- TypeInfo m_next;\r
-}\r
-\r
-class TypeInfo_Array : TypeInfo\r
-{\r
- TypeInfo value;\r
-}\r
-\r
-class TypeInfo_StaticArray : TypeInfo\r
-{\r
- TypeInfo value;\r
- size_t len;\r
-}\r
-\r
-class TypeInfo_AssociativeArray : TypeInfo\r
-{\r
- TypeInfo value;\r
- TypeInfo key;\r
-}\r
-\r
-class TypeInfo_Function : TypeInfo\r
-{\r
- TypeInfo next;\r
-}\r
-\r
-class TypeInfo_Delegate : TypeInfo\r
-{\r
- TypeInfo next;\r
-}\r
-\r
-class TypeInfo_Class : TypeInfo\r
-{\r
- ClassInfo info;\r
-}\r
-\r
-class TypeInfo_Interface : TypeInfo\r
-{\r
- ClassInfo info;\r
-}\r
-\r
-class TypeInfo_Struct : TypeInfo\r
-{\r
- string name;\r
- void[] m_init;\r
-\r
- uint function(in void*) xtoHash;\r
- equals_t function(in void*,in void*) xopEquals;\r
- int function(in void*,in void*) xopCmp;\r
- string function(in void*) xtoString;\r
-\r
- uint m_flags;\r
-\r
-}\r
-\r
-class TypeInfo_Tuple : TypeInfo\r
-{\r
- TypeInfo[] elements;\r
-}\r
-\r
-class ModuleInfo\r
-{\r
- string name;\r
- ModuleInfo[] importedModules;\r
- ClassInfo[] localClasses;\r
- uint flags;\r
-\r
- void function() ctor;\r
- void function() dtor;\r
- void function() unitTest;\r
-\r
- static int opApply( int delegate( inout ModuleInfo ) );\r
-}\r
-\r
-class Exception : Object\r
-{\r
- interface TraceInfo\r
- {\r
- int opApply( int delegate( inout char[] ) );\r
- string toString();\r
- }\r
-\r
- char[] msg;\r
- char[] file;\r
- size_t line;\r
- TraceInfo info;\r
- Exception next;\r
-\r
- this(char[] msg, Exception next = null);\r
- this(char[] msg, char[] file, size_t line, Exception next = null);\r
- string toString();\r
-}\r
+module object;
+
+alias typeof(int.sizeof) size_t;
+alias typeof(cast(void*)0 - cast(void*)0) ptrdiff_t;
+
+alias size_t hash_t;
+alias bool equals_t;
+
+alias invariant(char)[] string;
+alias invariant(wchar)[] wstring;
+alias invariant(dchar)[] dstring;
+
+class Object
+{
+ string toString();
+ hash_t toHash();
+ int opCmp(Object o);
+ equals_t opEquals(Object o);
+
+ interface Monitor
+ {
+ void lock();
+ void unlock();
+ }
+
+ static Object factory(string classname);
+}
+
+struct Interface
+{
+ ClassInfo classinfo;
+ void*[] vtbl;
+ ptrdiff_t offset; // offset to Interface 'this' from Object 'this'
+}
+
+class ClassInfo : Object
+{
+ byte[] init; // class static initializer
+ string name; // class name
+ void*[] vtbl; // virtual function pointer table
+ Interface[] interfaces;
+ ClassInfo base;
+ void* destructor;
+ void(*classInvariant)(Object);
+ uint flags;
+ // 1: // is IUnknown or is derived from IUnknown
+ // 2: // has no possible pointers into GC memory
+ // 4: // has offTi[] member
+ // 8: // has constructors
+ // 16: // has xgetMembers member
+ void* deallocator;
+ OffsetTypeInfo[] offTi;
+ void* defaultConstructor;
+ const(MemberInfo[]) function(string) xgetMembers;
+
+ static ClassInfo find(in char[] classname);
+ Object create();
+ const(MemberInfo[]) getMembers(in char[] classname);
+}
+
+struct OffsetTypeInfo
+{
+ size_t offset;
+ TypeInfo ti;
+}
+
+class TypeInfo
+{
+ hash_t getHash(in void* p);
+ equals_t equals(in void* p1, in void* p2);
+ int compare(in void* p1, in void* p2);
+ size_t tsize();
+ void swap(void* p1, void* p2);
+ TypeInfo next();
+ void[] init();
+ uint flags();
+ // 1: // has possible pointers into GC memory
+ OffsetTypeInfo[] offTi();
+ void destroy(void* p);
+ void postblit(void* p);
+}
+
+class TypeInfo_Typedef : TypeInfo
+{
+ TypeInfo base;
+ string name;
+ void[] m_init;
+}
+
+class TypeInfo_Enum : TypeInfo_Typedef
+{
+
+}
+
+class TypeInfo_Pointer : TypeInfo
+{
+ TypeInfo m_next;
+}
+
+class TypeInfo_Array : TypeInfo
+{
+ TypeInfo value;
+}
+
+class TypeInfo_StaticArray : TypeInfo
+{
+ TypeInfo value;
+ size_t len;
+}
+
+class TypeInfo_AssociativeArray : TypeInfo
+{
+ TypeInfo value;
+ TypeInfo key;
+}
+
+class TypeInfo_Function : TypeInfo
+{
+ TypeInfo next;
+}
+
+class TypeInfo_Delegate : TypeInfo
+{
+ TypeInfo next;
+}
+
+class TypeInfo_Class : TypeInfo
+{
+ ClassInfo info;
+}
+
+class TypeInfo_Interface : TypeInfo
+{
+ ClassInfo info;
+}
+
+class TypeInfo_Struct : TypeInfo
+{
+ string name;
+ void[] m_init;
+
+ uint function(in void*) xtoHash;
+ equals_t function(in void*, in void*) xopEquals;
+ int function(in void*, in void*) xopCmp;
+ string function(in void*) xtoString;
+
+ uint m_flags;
+
+ const(MemberInfo[]) function(in char[]) xgetMembers;
+ void function(void*) xdtor;
+ void function(void*) xpostblit;
+}
+
+class TypeInfo_Tuple : TypeInfo
+{
+ TypeInfo[] elements;
+}
+
+class TypeInfo_Const : TypeInfo
+{
+ TypeInfo next;
+}
+
+class TypeInfo_Invariant : TypeInfo_Const
+{
+
+}
+
+abstract class MemberInfo
+{
+ string name();
+}
+
+class MemberInfo_field : MemberInfo
+{
+ this(string name, TypeInfo ti, size_t offset);
+
+ override string name();
+ TypeInfo typeInfo();
+ size_t offset();
+}
+
+class MemberInfo_function : MemberInfo
+{
+ enum
+ {
+ Virtual = 1,
+ Member = 2,
+ Static = 4,
+ }
+
+ this(string name, TypeInfo ti, void* fp, uint flags);
+
+ override string name();
+ TypeInfo typeInfo();
+ void* fp();
+ uint flags();
+}
+
+class ModuleInfo
+{
+ string name;
+ ModuleInfo[] importedModules;
+ ClassInfo[] localClasses;
+ uint flags;
+
+ void function() ctor;
+ void function() dtor;
+ void function() unitTest;
+
+ static int opApply(int delegate(inout ModuleInfo));
+}
+
+class Throwable : Object
+{
+ interface TraceInfo
+ {
+ int opApply(int delegate(inout char[]));
+ string toString();
+ }
+
+ string msg;
+ string file;
+ size_t line;
+ TraceInfo info;
+ Throwable next;
+
+ this(string msg, Throwable next = null);
+ this(string msg, string file, size_t line, Throwable next = null);
+ override string toString();
+}
+
+
+class Exception : Throwable
+{
+ this(string msg, Throwable next = null);
+ this(string msg, string file, size_t line, Throwable next = null);
+}
+
+
+class Error : Throwable
+{
+ this(string msg, Throwable next = null);
+ this(string msg, string file, size_t line, Throwable next = null);
+}