Updated PCI IDs to latest snapshot.
[tangerine.git] / test / OOPDemos / include / oop.h
blob103ad0ba4bcb703b35b0392727acddae827d2062
1 #ifndef OOP_H
2 #define OOP_H
4 #include "types.h"
5 #include "support.h"
7 #define InitSemaphore(x)
8 #define ObtainSemaphore(x)
9 #define ObtainSemaphoreShared(x)
10 #define ReleaseSemaphore(x)
14 typedef struct IClass
17 /* Array of pointers to methodtables for this class */
18 struct Node ClassNode;
21 ULONG InstOffset;
22 ULONG InstSize;
24 /* The number of methods that are new for this class */
26 ULONG SubClassCount;
27 ULONG ObjectCount;
29 /* Can also be gotten with indexing the ClassTable */
30 struct IClass *SuperClass;
33 #if (HASHED_METHODS || HASHED_STRINGS)
34 struct MethodBucket **HashTable;
35 ULONG HashMask;
36 ULONG NumMethods; /* Number of buckets in the hashtable */
37 #endif
39 #ifdef HASHED_IFS
40 struct InterfaceBucket **HashTable;
41 ULONG HashMask;
42 ULONG NumInterfaces;
43 #endif
46 #ifdef DIRECT_LOOKUP
47 IPTR (**MethodTab)();
48 #endif
49 */
51 } Class;
53 typedef ULONG Object;
54 typedef struct
56 IPTR MethodID;
57 } *Msg;
59 struct _Object
61 Class *o_Class;
66 /* Macros */
68 #define NUM_METHOD_BITS 10
69 #define METHOD_MASK ((1 << NUM_METHOD_BITS) - 1)
71 #define BASEOBJECT(obj) ((Object *)(_OBJ(obj) + 1))
72 #define _OBJECT(obj) (_OBJ(obj) - 1)
73 #define _OBJ(obj) ((struct _Object *)(obj))
75 #define INST_DATA(cl, obj) \
76 (((VOID *)(obj)) + _OBJECT(obj)->o_Class->InstOffset)
78 #define OCLASS(obj) \
79 (_OBJECT(obj)->o_Class)
82 /** Root class defs */
83 #define ROOTCLASS "rootclass"
86 #if (HASHED_METHODS || HASHED_IFS)
88 # define MIDX_New 0
89 # define MIDX_Dispose 1
91 # define I_Root (0)
92 # define Root_Base (I_Root << NUM_METHOD_BITS)
94 # define M_New (I_Root + MIDX_New)
95 # define M_Dispose (I_Root + MIDX_Dispose)
96 #endif
98 #if (HASHED_STRINGS)
99 # define M_New "New"
100 # define M_Dispose "Dispose"
101 #endif
103 struct P_New
105 ULONG MethodID;
106 APTR ParamPtr;
110 struct OOPBase
112 struct List ClassList;
113 struct Bucket **IDHashTable;
115 #endif /* OOP_H */