revert between 56095 -> 55830 in arch
[AROS.git] / workbench / classes / datatypes / sound / BoopsiStubs.h
blob0512c4ff9b2b5cdd5baa4e933d578a1f3ca77522
1 #ifndef BOOPSISTUBS_H
2 #define BOOPSISTUBS_H
3 /*
4 ** $VER: BoopsiStubs.h 1.2 (1.9.97)
5 **
6 ** Copyright (C) 1997 Bernardo Innocenti. All rights reserved.
7 **
8 ** Use 4 chars wide TABs to read this file
9 **
10 ** Using these inline versions of the amiga.lib boopsi support functions
11 ** results in faster and smaller code against their linked library
12 ** counterparts. When debug is active, this function also validate the
13 ** parameters you pass in.
17 #ifndef COMPILERSPECIFIC_H
18 #include "CompilerSpecific.h"
19 #endif /* COMPILERSPECIFIC_H */
21 #ifndef DEBUG_H
22 #include "Debug.h"
23 #endif /* DEBUG_H */
26 /* the _HookPtr type is a shortcut for a pointer to a hook function */
28 typedef ASMCALL ULONG (*_HookPtr)
29 (REG(a0, Class *), REG(a2, Object *), REG(a1, APTR));
31 INLINE ULONG CoerceMethodA (struct IClass *cl, Object *o, Msg message)
33 ASSERT_VALIDNO0(cl)
34 ASSERT_VALID(o)
36 return ((_HookPtr)cl->cl_Dispatcher.h_Entry) ((APTR)cl, (APTR)o, (APTR)message);
39 INLINE ULONG DoSuperMethodA (struct IClass *cl, Object *o, Msg message)
41 ASSERT_VALIDNO0(cl)
42 ASSERT_VALID(o)
44 cl = cl->cl_Super;
45 return ((_HookPtr)cl->cl_Dispatcher.h_Entry) ((APTR)cl, (APTR)o, (APTR)message);
48 INLINE ULONG DoMethodA (Object *o, Msg message)
50 Class *cl;
51 ASSERT_VALIDNO0(o)
52 cl = OCLASS (o);
53 ASSERT_VALIDNO0(cl)
55 return ((_HookPtr)cl->cl_Dispatcher.h_Entry) ((APTR)cl, (APTR)o, (APTR)message);
59 #define CoerceMethod(cl, o, msg...) \
60 ({ \
61 ULONG _msg[] = { msg }; \
62 ASSERT_VALIDNO0(cl) \
63 ASSERT_VALID(o) \
64 ((_HookPtr)cl->cl_Dispatcher.h_Entry) ((APTR)cl, (APTR)o, (APTR)_msg); \
67 #define DoSuperMethod(cl, o, msg...) \
68 ({ \
69 Class *_cl; \
70 ULONG _msg[] = { msg }; \
71 ASSERT_VALID(o) \
72 ASSERT_VALIDNO0(cl) \
73 _cl = cl = cl->cl_Super; \
74 ASSERT_VALIDNO0(_cl) \
75 ((_HookPtr)_cl->cl_Dispatcher.h_Entry) ((APTR)_cl, (APTR)o, (APTR)_msg); \
78 #define DoMethod(o, msg...) \
79 ({ \
80 Class *_cl; \
81 ULONG _msg[] = { msg }; \
82 ASSERT_VALIDNO0(o) \
83 _cl = OCLASS(o); \
84 ASSERT_VALIDNO0(_cl) \
85 ((_HookPtr)_cl->cl_Dispatcher.h_Entry) ((APTR)_cl, (APTR)o, (APTR)_msg); \
88 /* Var-args stub for the OM_NOTIFY method */
89 #define NotifyAttrs(o, gi, flags, attrs...) \
90 ({ \
91 Class *_cl; \
92 ULONG _attrs[] = { attrs }; \
93 ULONG _msg[] = { OM_NOTIFY, (ULONG)_attrs, (ULONG)gi, flags }; \
94 ASSERT_VALIDNO0(o) \
95 _cl = OCLASS(o); \
96 ASSERT_VALIDNO0(_cl) \
97 ASSERT_VALID(gi) \
98 ((_HookPtr)_cl->cl_Dispatcher.h_Entry) ((APTR)_cl, (APTR)o, (APTR)_msg); \
101 /* Var-args stub for the OM_UPDATE method */
102 #define UpdateAttrs(o, gi, flags, attrs...) \
103 ({ \
104 Class *_cl; \
105 ULONG _attrs[] = { attrs }; \
106 ULONG _msg[] = { OM_UPDATE, (ULONG)_attrs, (ULONG)gi, flags }; \
107 ASSERT_VALIDNO0(o) \
108 _cl = OCLASS(o); \
109 ASSERT_VALIDNO0(_cl) \
110 ASSERT_VALID(gi) \
111 ((_HookPtr)_cl->cl_Dispatcher.h_Entry) ((APTR)_cl, (APTR)o, (APTR)_msg); \
114 /* Nobody else needs this anymore... */
115 #undef _HookPtr
117 #endif /* !BOOPSISTUBS_H */