|
Revision 728:635f91212b78, 1.4 kB
(checked in by Christian Kamm <kamm incasoftware de>, 4 years ago)
|
Change _d_newclass into _d_allocclass. Add initialization to ClassInfo?.create.
|
| Line | |
|---|
| 1 |
/* |
|---|
| 2 |
* Placed into the Public Domain |
|---|
| 3 |
* written by Walter Bright, Digital Mars |
|---|
| 4 |
* www.digitalmars.com |
|---|
| 5 |
*/ |
|---|
| 6 |
|
|---|
| 7 |
/* |
|---|
| 8 |
* Modified by Sean Kelly <sean@f4.ca> for use with Tango. |
|---|
| 9 |
*/ |
|---|
| 10 |
|
|---|
| 11 |
#include <stddef.h> |
|---|
| 12 |
|
|---|
| 13 |
#if __cplusplus |
|---|
| 14 |
extern "C" { |
|---|
| 15 |
#endif |
|---|
| 16 |
|
|---|
| 17 |
struct ClassInfo; |
|---|
| 18 |
struct Vtbl; |
|---|
| 19 |
|
|---|
| 20 |
typedef struct Vtbl |
|---|
| 21 |
{ |
|---|
| 22 |
size_t len; |
|---|
| 23 |
void **vptr; |
|---|
| 24 |
} Vtbl; |
|---|
| 25 |
|
|---|
| 26 |
typedef struct Interface |
|---|
| 27 |
{ |
|---|
| 28 |
struct ClassInfo *classinfo; |
|---|
| 29 |
struct Vtbl vtbl; |
|---|
| 30 |
int offset; |
|---|
| 31 |
} Interface; |
|---|
| 32 |
|
|---|
| 33 |
typedef struct Object |
|---|
| 34 |
{ |
|---|
| 35 |
void **vptr; |
|---|
| 36 |
void *monitor; |
|---|
| 37 |
} Object; |
|---|
| 38 |
|
|---|
| 39 |
typedef struct ClassInfo |
|---|
| 40 |
{ |
|---|
| 41 |
Object object; |
|---|
| 42 |
|
|---|
| 43 |
size_t initlen; |
|---|
| 44 |
void *init; |
|---|
| 45 |
|
|---|
| 46 |
size_t namelen; |
|---|
| 47 |
char *name; |
|---|
| 48 |
|
|---|
| 49 |
Vtbl vtbl; |
|---|
| 50 |
|
|---|
| 51 |
size_t interfacelen; |
|---|
| 52 |
Interface *interfaces; |
|---|
| 53 |
|
|---|
| 54 |
struct ClassInfo *baseClass; |
|---|
| 55 |
|
|---|
| 56 |
void *destructor; |
|---|
| 57 |
void *invariant; |
|---|
| 58 |
|
|---|
| 59 |
int flags; |
|---|
| 60 |
} ClassInfo; |
|---|
| 61 |
|
|---|
| 62 |
typedef struct Exception |
|---|
| 63 |
{ |
|---|
| 64 |
Object object; |
|---|
| 65 |
|
|---|
| 66 |
size_t msglen; |
|---|
| 67 |
char* msg; |
|---|
| 68 |
|
|---|
| 69 |
size_t filelen; |
|---|
| 70 |
char* file; |
|---|
| 71 |
|
|---|
| 72 |
size_t line; |
|---|
| 73 |
|
|---|
| 74 |
struct Interface *info; |
|---|
| 75 |
struct Exception *next; |
|---|
| 76 |
} Exception; |
|---|
| 77 |
|
|---|
| 78 |
typedef struct Array |
|---|
| 79 |
{ |
|---|
| 80 |
size_t length; |
|---|
| 81 |
void *ptr; |
|---|
| 82 |
} Array; |
|---|
| 83 |
|
|---|
| 84 |
typedef struct Delegate |
|---|
| 85 |
{ |
|---|
| 86 |
void *thisptr; |
|---|
| 87 |
void (*funcptr)(); |
|---|
| 88 |
} Delegate; |
|---|
| 89 |
|
|---|
| 90 |
void _d_monitorenter(Object *h); |
|---|
| 91 |
void _d_monitorexit(Object *h); |
|---|
| 92 |
|
|---|
| 93 |
int _d_isbaseof(ClassInfo *b, ClassInfo *c); |
|---|
| 94 |
Object *_d_dynamic_cast(Object *o, ClassInfo *ci); |
|---|
| 95 |
|
|---|
| 96 |
Object * _d_allocclass(ClassInfo *ci); |
|---|
| 97 |
void _d_delclass(Object **p); |
|---|
| 98 |
|
|---|
| 99 |
void _d_OutOfMemory(); |
|---|
| 100 |
|
|---|
| 101 |
#if __cplusplus |
|---|
| 102 |
} |
|---|
| 103 |
#endif |
|---|