1 #include "include/classdefs.h"
2 #include <utility/hooks.h>
3 #include <intuition/classes.h>
4 #include <intuition/cghooks.h>
5 #include <proto/alib.h>
6 #include <proto/exec.h>
7 #include <proto/utility.h>
8 #include <proto/graphics.h>
9 #include <proto/intuition.h>
10 #include <libraries/locale.h>
12 #ifndef BGUI_COMPILERSPECIFIC_H
13 #include <bgui/bgui_compilerspecific.h>
17 BOOL
DisplayAGuideInfo(struct NewAmigaGuide
*nag
, struct TagItem
* tags
)
20 struct Library
* AmigaGuideBase
;
21 AmigaGuideBase
= OpenLibrary("amigaguide.library",0);
23 if (NULL
!= AmigaGuideBase
)
25 AMIGAGUIDECONTEXT handle
= OpenAmigaGuideA(nag
, tags
);
29 CloseAmigaGuide(handle
);
31 CloseLibrary(AmigaGuideBase
);
38 //ASM ULONG ScaleWeight(REG(d2) ULONG e, REG(d3) ULONG f, REG(d4) ULONG a)
39 ASM
REGFUNC3(ULONG
, ScaleWeight
,
40 REGPARAM(D2
, ULONG
, e
),
41 REGPARAM(D3
, ULONG
, f
),
42 REGPARAM(D4
, ULONG
, a
))
44 ULONG r
= UMult32(a
,e
);
45 return UDivMod32((f
>> 1) + r
, f
);
51 //void MyPutChProc_StrLenfA(REG(d0) BYTE c, REG(a3) ULONG * putChData)
52 REGFUNC2(void, MyPutChProc_StrLenfA
,
53 REGPARAM(D0
, BYTE
, c
),
54 REGPARAM(A3
, ULONG
*, putChData
))
60 //ASM ULONG StrLenfA(REG(a0) UBYTE * FormatString, REG(a1) ULONG * DataStream)
61 ASM
REGFUNC2(ULONG
, StrLenfA
,
62 REGPARAM(A0
, UBYTE
*, FormatString
),
63 REGPARAM(A1
, ULONG
*, DataStream
))
66 RawDoFmt(FormatString
, DataStream
, ((APTR
)MyPutChProc_StrLenfA
), &c
);
73 //void MyPutChProc_SPrintfA(REG(d0) char c, REG(a3) char **PutChData)
74 REGFUNC2(void, MyPutChProc_SPrintfA
,
75 REGPARAM(D0
, char, c
),
76 REGPARAM(A3
, char **, PutChData
))
83 //ASM VOID SPrintfA(REG(a3) UBYTE * buffer, REG(a0) UBYTE * format, REG(a1) ULONG * args)
84 ASM
REGFUNC3(VOID
, SPrintfA
,
85 REGPARAM(A3
, UBYTE
*, buffer
),
86 REGPARAM(A0
, UBYTE
*, format
),
87 REGPARAM(A1
, ULONG
*, args
))
89 RawDoFmt(format
, args
, ((APTR
)MyPutChProc_SPrintfA
), &buffer
);
94 //ASM VOID LHook_Count(REG(a0) struct Hook * hook, REG(a1) ULONG chr, REG(a2) struct Locale * loc)
95 ASM
REGFUNC3(VOID
, LHook_Count
,
96 REGPARAM(A0
, struct Hook
*, hook
),
97 REGPARAM(A2
, struct Locale
*, loc
),
98 REGPARAM(A1
, ULONG
, chr
))
105 //ASM VOID LHook_Format(REG(a0) struct Hook * hook, REG(a1) ULONG chr, REG(a2) struct Locale *loc)
106 ASM
REGFUNC3(VOID
, LHook_Format
,
107 REGPARAM(A0
, struct Hook
*, hook
),
108 REGPARAM(A2
, struct Locale
*, loc
),
109 REGPARAM(A1
, ULONG
, chr
))
111 char * cptr
= (char *)hook
->h_Data
;
118 //ASM struct RastPort *BGUI_ObtainGIRPort(REG(a0) struct GadgetInfo * gi)
119 ASM
REGFUNC1(struct RastPort
*, BGUI_ObtainGIRPort
,
120 REGPARAM(A0
, struct GadgetInfo
*, gi
))
122 struct RastPort
* rp
;
123 BYTE
* userdata
= NULL
;
127 if (NULL
!= gi
->gi_Window
)
128 userdata
= gi
->gi_Window
->UserData
;
130 if (NULL
!= gi
->gi_Layer
)
132 /* Does this make sense?? */
133 LockLayerRom(gi
->gi_Layer
); // this function returns void!!
134 UnlockLayerRom(gi
->gi_Layer
);
137 rp
= ObtainGIRPort(gi
);
139 rp
->RP_User
= (APTR
)userdata
;
146 ULONG
AsmDoMethod(Object
* obj
, ULONG MethodID
, ...)
148 AROS_SLOWSTACKMETHODS_PRE(MethodID
)
150 ASSERT_VALID_PTR(obj
);
151 ASSERT_VALID_PTR(OCLASS(obj
));
156 retval
= CallHookPkt ((struct Hook
*)OCLASS(obj
)
158 , AROS_SLOWSTACKMETHODS_ARG(MethodID
)
160 AROS_SLOWSTACKMETHODS_POST
163 //ULONG AsmDoMethodA(REG(a2) Object * obj, REG(a1) Msg message)
164 REGFUNC2(ULONG
, AsmDoMethodA
,
165 REGPARAM(A2
, Object
*, obj
),
166 REGPARAM(A1
, Msg
, message
))
168 DoMethodA(obj
, message
);
172 ULONG
AsmDoSuperMethod( Class
* cl
, Object
* obj
, ULONG MethodID
, ...)
174 AROS_SLOWSTACKMETHODS_PRE(MethodID
)
178 retval
= CallHookPkt ((struct Hook
*)cl
->cl_Super
180 , AROS_SLOWSTACKMETHODS_ARG(MethodID
)
182 AROS_SLOWSTACKMETHODS_POST
185 //ULONG AsmDoSuperMethodA( REG(a0) Class * cl, REG(a2) Object * obj, REG(a1) Msg message)
186 REGFUNC3(ULONG
, AsmDoSuperMethodA
,
187 REGPARAM(A0
, Class
*, cl
),
188 REGPARAM(A2
, Object
*, obj
),
189 REGPARAM(A1
, Msg
, message
))
191 DoSuperMethodA(cl
,obj
,message
);
195 ULONG
AsmCoerceMethod( Class
* cl
, Object
* obj
, ULONG MethodID
, ...)
197 AROS_SLOWSTACKMETHODS_PRE(MethodID
)
201 retval
= CallHookPkt ((struct Hook
*)cl
203 , AROS_SLOWSTACKMETHODS_ARG(MethodID
)
205 AROS_SLOWSTACKMETHODS_POST
208 //ULONG AsmCoerceMethodA( REG(a0) Class * cl, REG(a2) Object * obj, REG(a1) Msg message)
209 REGFUNC3(ULONG
, AsmCoerceMethodA
,
210 REGPARAM(A0
, Class
*, cl
),
211 REGPARAM(A2
, Object
*, obj
),
212 REGPARAM(A1
, Msg
, message
))
214 CoerceMethodA(cl
, obj
, message
);