Re-enabled use of AROS.Boot file due to lack of general enthusiasm for
[tangerine.git] / test / oop2 / oop.h
blob3cf39c40a64411bed0064f04b7da58d9bcccabd0
1 #ifndef OOP_H
2 #define OOP_H
3 /*
4 Copyright © 1997-98, The AROS Development Team. All rights reserved.
5 $Id$
7 Desc: Demo of new OOP system
8 Lang: english
9 */
11 #ifndef TYPES_H
12 # include "types.h"
13 #endif
14 #ifndef SUPPORT_H
15 # include "support.h"
16 #endif
18 struct Method;
20 typedef struct IClass
23 /* Array of pointers to methodtables for this class */
24 struct Node ClassNode;
26 ULONG InstOffset;
27 ULONG InstSize;
29 /* The number of methods introduced by this class */
30 ULONG NumMethods;
32 ULONG SubClassCount;
33 ULONG ObjectCount;
35 struct IClass *SuperClass;
36 struct Method *MTable;
37 ULONG MTableSize; /* Counted in # of entries, not in bytes */
39 } Class;
41 struct Method
43 IPTR (*MethodFunc)();
44 Class *m_Class;
48 typedef ULONG Object;
49 typedef ULONG Method;
51 struct _Object
53 Class *o_Class;
56 typedef struct
58 ULONG MethodID;
59 } *Msg;
61 /* Used when initializing a class */
62 struct MethodDescr
64 APTR MethodFunc;
65 ULONG MethodID;
71 /* Macros */
73 #define NUM_METHOD_BITS 10
74 #define METHOD_MASK ((1 << (NUM_METHOD_BITS)) - 1)
76 #define BASEOBJECT(obj) ((Object *)(_OBJ(obj) + 1))
77 #define _OBJECT(obj) (_OBJ(obj) - 1)
78 #define _OBJ(obj) ((struct _Object *)(obj))
80 #define INST_DATA(cl, obj) \
81 (((VOID *)(obj)) + cl->InstOffset)
84 #define OCLASS(o) (_OBJECT(o)->o_Class)
87 #define ROOTCLASS "rootclass"
89 #define NUM_ROOT_METHODS 2
91 #define M_New 0
92 #define M_Dispose 1
94 struct P_New
96 ULONG MethodID;
97 APTR ParamPtr;
101 #endif /* OOP_H */