mmakefile: conffile= no longer needs explicit path
[AROS.git] / test / oop / oop.h
blob74a64af664cf740a84d6d4a087eb1d625440ae5c
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 typedef struct IClass Class;
20 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 in the hashtable */
30 ULONG NumMethods;
32 ULONG SubClassCount;
33 ULONG ObjectCount;
35 Class *SuperClass;
36 struct Bucket **HashTable;
37 ULONG HashTableSize; /* Hashtable size counted in number of *entries* (not bytes) */
41 typedef ULONG Object;
42 typedef ULONG Method;
44 struct _Object
46 Class *oClass;
49 typedef struct
51 ULONG MethodID;
52 } *Msg;
54 /* Used when initializing a class */
55 struct MethodDescr
57 APTR MethodFunc;
58 ULONG MethodID;
64 /* Macros */
66 #define NUM_METHOD_BITS 10
68 #define BASEOBJECT(obj) ((Object *)(_OBJ(obj) + 1))
69 #define _OBJECT(obj) (_OBJ(obj) - 1)
70 #define _OBJ(obj) ((struct _Object *)(obj))
72 #define INST_DATA(cl, obj) \
73 (((VOID *)(obj)) + cl->InstOffset)
76 #define OCLASS(o) (_OBJECT(o)->oClass)
79 #define ROOTCLASS "rootclass"
81 #define RootInterface (0 << NUM_METHOD_BITS)
82 #define M_New (RootInterface + 0)
83 #define M_Dispose (RootInterface + 1)
85 struct P_New
87 ULONG MethodID;
88 APTR ParamPtr;
92 #include "intern.h"
95 #define CallMethodFast(o, m, msg) \
96 ({ \
97 IPTR (*m_func)(Class *, Object *, Msg); \
98 m_func = ((struct Bucket *)m)->MethodFunc; \
99 m_func(((struct Bucket *)m)->Class, o, (Msg)msg); \
102 #endif /* OOP_H */