comparison druntime/src/compiler/dmd/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
comparison
equal deleted inserted replaced
1456:7b218ec1044f 1458:e0b2d67cfe7c
1 /**
2 * Common declarations for runtime implementation.
3 *
4 * Copyright: Copyright Digital Mars 2000 - 2009.
5 * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a>.
6 * Authors: Walter Bright, Sean Kelly
7 *
8 * Copyright Digital Mars 2000 - 2009.
9 * Distributed under the Boost Software License, Version 1.0.
10 * (See accompanying file LICENSE_1_0.txt or copy at
11 * http://www.boost.org/LICENSE_1_0.txt)
12 */
13 #include <stddef.h>
14
15 #if __cplusplus
16 extern "C" {
17 #endif
18
19 struct ClassInfo;
20 struct Vtbl;
21
22 typedef struct Vtbl
23 {
24 size_t len;
25 void **vptr;
26 } Vtbl;
27
28 typedef struct Interface
29 {
30 struct ClassInfo *classinfo;
31 struct Vtbl vtbl;
32 int offset;
33 } Interface;
34
35 typedef struct Object
36 {
37 void **vptr;
38 void *monitor;
39 } Object;
40
41 typedef struct ClassInfo
42 {
43 Object object;
44
45 size_t initlen;
46 void *init;
47
48 size_t namelen;
49 char *name;
50
51 Vtbl vtbl;
52
53 size_t interfacelen;
54 Interface *interfaces;
55
56 struct ClassInfo *baseClass;
57
58 void *destructor;
59 void *invariant;
60
61 int flags;
62 } ClassInfo;
63
64 typedef struct Throwable
65 {
66 Object object;
67
68 size_t msglen;
69 char* msg;
70
71 size_t filelen;
72 char* file;
73
74 size_t line;
75
76 struct Interface *info;
77 struct Throwable *next;
78 } Throwable;
79
80 typedef struct Array
81 {
82 size_t length;
83 void *ptr;
84 } Array;
85
86 typedef struct Delegate
87 {
88 void *thisptr;
89 void (*funcptr)();
90 } Delegate;
91
92 void _d_monitorenter(Object *h);
93 void _d_monitorexit(Object *h);
94
95 int _d_isbaseof(ClassInfo *b, ClassInfo *c);
96 Object *_d_dynamic_cast(Object *o, ClassInfo *ci);
97
98 Object * _d_newclass(ClassInfo *ci);
99 void _d_delclass(Object **p);
100
101 void _d_OutOfMemory();
102
103 #if __cplusplus
104 }
105 #endif