Mercurial > projects > ldc
diff druntime/src/compiler/ldc/mars.h @ 1458:e0b2d67cfe7c
Added druntime (this should be removed once it works).
author | Robert Clipsham <robert@octarineparrot.com> |
---|---|
date | Tue, 02 Jun 2009 17:43:06 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/druntime/src/compiler/ldc/mars.h Tue Jun 02 17:43:06 2009 +0100 @@ -0,0 +1,105 @@ +/** + * Common declarations for runtime implementation. + * + * Copyright: Copyright Digital Mars 2000 - 2009. + * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a>. + * Authors: Walter Bright, Sean Kelly + * + * Copyright Digital Mars 2000 - 2009. + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + */ +#include <stddef.h> + +#if __cplusplus +extern "C" { +#endif + +struct ClassInfo; +struct Vtbl; + +typedef struct Vtbl +{ + size_t len; + void **vptr; +} Vtbl; + +typedef struct Interface +{ + struct ClassInfo *classinfo; + struct Vtbl vtbl; + int offset; +} Interface; + +typedef struct Object +{ + void **vptr; + void *monitor; +} Object; + +typedef struct ClassInfo +{ + Object object; + + size_t initlen; + void *init; + + size_t namelen; + char *name; + + Vtbl vtbl; + + size_t interfacelen; + Interface *interfaces; + + struct ClassInfo *baseClass; + + void *destructor; + void *invariant; + + int flags; +} ClassInfo; + +typedef struct Throwable +{ + Object object; + + size_t msglen; + char* msg; + + size_t filelen; + char* file; + + size_t line; + + struct Interface *info; + struct Throwable *next; +} Throwable; + +typedef struct Array +{ + size_t length; + void *ptr; +} Array; + +typedef struct Delegate +{ + void *thisptr; + void (*funcptr)(); +} Delegate; + +void _d_monitorenter(Object *h); +void _d_monitorexit(Object *h); + +int _d_isbaseof(ClassInfo *b, ClassInfo *c); +Object *_d_dynamic_cast(Object *o, ClassInfo *ci); + +Object * _d_newclass(ClassInfo *ci); +void _d_delclass(Object **p); + +void _d_OutOfMemory(); + +#if __cplusplus +} +#endif