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>
16 BOOL
DisplayAGuideInfo(struct NewAmigaGuide
*nag
, Tag tag
, ...)
18 AROS_SLOWSTACKTAGS_PRE_AS(tag
, BOOL
)
19 struct Library
* AmigaGuideBase
;
20 AmigaGuideBase
= OpenLibrary("amigaguide.library",0);
23 if (NULL
!= AmigaGuideBase
)
25 AMIGAGUIDECONTEXT handle
= OpenAmigaGuideA(nag
, AROS_SLOWSTACKTAGS_ARG(tag
));
29 CloseAmigaGuide(handle
);
31 CloseLibrary(AmigaGuideBase
);
33 AROS_SLOWSTACKTAGS_POST
36 ASM ULONG
ScaleWeight(REG(d2
) ULONG e
, REG(d3
) ULONG f
, REG(d4
) ULONG a
)
38 ULONG r
= UMult32(a
,e
);
39 return UDivMod32((f
>> 1) + r
, f
);
42 //void MyPutChProc_StrLenfA(REG(d0) BYTE c, REG(a3) ULONG * putChData)
43 REGFUNC2(void, MyPutChProc_StrLenfA
,
44 REGPARAM(D0
, BYTE
, c
),
45 REGPARAM(A3
, ULONG
*, putChData
))
51 ASM ULONG
StrLenfA(REG(a0
) UBYTE
* FormatString
, REG(a1
) IPTR
* DataStream
)
54 RawDoFmt(FormatString
, DataStream
, ((APTR
)MyPutChProc_StrLenfA
), &c
);
58 //void MyPutChProc_SPrintfA(REG(d0) char c, REG(a3) char **PutChData)
59 REGFUNC2(void, MyPutChProc_SPrintfA
,
60 REGPARAM(D0
, char, c
),
61 REGPARAM(A3
, char **, PutChData
))
68 ASM VOID
SPrintfA(REG(a3
) UBYTE
* buffer
, REG(a0
) UBYTE
* format
, REG(a1
) IPTR
* args
)
70 RawDoFmt(format
, args
, ((APTR
)MyPutChProc_SPrintfA
), &buffer
);
74 ASM
REGFUNC3(VOID
, LHook_Count
,
75 REGPARAM(A0
, struct Hook
*, hook
),
76 REGPARAM(A2
, struct Locale
*, loc
),
77 REGPARAM(A1
, ULONG
, chr
))
83 ASM
REGFUNC3(VOID
, LHook_Format
,
84 REGPARAM(A0
, struct Hook
*, hook
),
85 REGPARAM(A2
, struct Locale
*, loc
),
86 REGPARAM(A1
, ULONG
, chr
))
88 char * cptr
= (char *)hook
->h_Data
;
89 *(cptr
++) = (char)chr
;
95 ASM
struct RastPort
*BGUI_ObtainGIRPort(REG(a0
) struct GadgetInfo
* gi
)
98 BYTE
* userdata
= NULL
;
102 if (NULL
!= gi
->gi_Window
)
103 userdata
= gi
->gi_Window
->UserData
;
105 if (NULL
!= gi
->gi_Layer
)
107 /* Does this make sense?? */
108 LockLayerRom(gi
->gi_Layer
); // this function returns void!!
109 UnlockLayerRom(gi
->gi_Layer
);
112 rp
= ObtainGIRPort(gi
);
114 rp
->RP_User
= (APTR
)userdata
;
119 IPTR
AsmDoMethod(Object
* obj
, STACKULONG MethodID
, ...)
121 AROS_SLOWSTACKMETHODS_PRE(MethodID
)
125 retval
= CallHookPkt ((struct Hook
*)OCLASS(obj
)
127 , AROS_SLOWSTACKMETHODS_ARG(MethodID
)
129 AROS_SLOWSTACKMETHODS_POST
132 IPTR
AsmDoMethodA(REG(a2
) Object
* obj
, REG(a1
) Msg message
)
134 return DoMethodA(obj
, message
);
137 IPTR
AsmDoSuperMethod( Class
* cl
, Object
* obj
, STACKULONG MethodID
, ...)
139 AROS_SLOWSTACKMETHODS_PRE(MethodID
)
143 retval
= CallHookPkt ((struct Hook
*)cl
->cl_Super
145 , AROS_SLOWSTACKMETHODS_ARG(MethodID
)
147 AROS_SLOWSTACKMETHODS_POST
150 IPTR
AsmDoSuperMethodA( REG(a0
) Class
* cl
, REG(a2
) Object
* obj
, REG(a1
) Msg message
)
152 return DoSuperMethodA(cl
,obj
,message
);
155 IPTR
AsmCoerceMethod( Class
* cl
, Object
* obj
, STACKULONG MethodID
, ...)
157 AROS_SLOWSTACKMETHODS_PRE(MethodID
)
161 retval
= CallHookPkt ((struct Hook
*)cl
163 , AROS_SLOWSTACKMETHODS_ARG(MethodID
)
165 AROS_SLOWSTACKMETHODS_POST
168 IPTR
AsmCoerceMethodA( REG(a0
) Class
* cl
, REG(a2
) Object
* obj
, REG(a1
) Msg message
)
170 return CoerceMethodA(cl
, obj
, message
);