2 Copyright © 1997-98, The AROS Development Team. All rights reserved.
5 Desc: Demo of new OOP system
14 #define CallMethod(cl, o, msg) \
16 register struct Bucket *b; \
17 register ULONG mid = msg->MethodID; \
19 for (b = cl->HashTable[CalcHash(mid, cl->HashTableSize)]; \
22 if (b->MethodID == mid) \
24 IPTR (*method)(Class *, Object *, Msg); \
25 method = b->MethodFunc; \
26 return (method(b->mClass, o, msg)); \
32 IPTR
CoerceMethodA(Class
*cl
, Object
*o
, Msg msg
)
34 CallMethod(cl
, o
, msg
);
37 IPTR
DoMethodA(Object
*o
, Msg msg
)
39 register Class
*cl
= OCLASS(o
);
40 CallMethod(cl
, o
, msg
);
43 IPTR
DoSuperMethodA(Class
*cl
, Object
*o
, Msg msg
)
45 Class
*super
= cl
->SuperClass
;
46 CallMethod(super
, o
, msg
)
49 BOOL
GetMethod(Object
*o
, ULONG methodID
, APTR
*methodPtrPtr
, Class
**classPtrPtr
)
53 Class
*cl
= OCLASS(o
);
54 idx
= CalcHash(methodID
, cl
->HashTableSize
);
55 b
= cl
->HashTable
[idx
];
58 if (b
->MethodID
== methodID
)
60 *methodPtrPtr
= b
->MethodFunc
;
61 *classPtrPtr
= b
->mClass
;