Miłosz Staszewski wrote:
> Well I think this is a dispatcher. I've never written anything for MUI and
> have no experience with it.
> I get this error message:
>
> YAM.c:425: syntax error before `void'
> YAM.c:590: syntax error before `void'
>
> and begining with the 425th line we can see this fragment of code:
>
> ==========
>
> HOOKPROTONHNONP(AY_GoPageFunc, void)
> {
> GotoURL("http://www.yam.ch/");
> }
>
> ==========
>
> HOOKPROTONHNONP is defined in the SDI_Hook.h which I enclose.
> As you can see it's full of m68k registers. Isn't it then architecture
> related ?
>
> Thanks in advance for any help and best regards,
OK. I don't understand why people keep making the Hooks so complicated.
:-) I can't imagine YAM being that performance sensitive ...
Anyway. You could define your own macros in the spirit of the existing,
but it will required inline assembly. Here is the source code of
HookEntry which could be helpful for figuring out what registers to use:
__asm("
.text
.balign 4
.type _HookEntry,@function
_HookEntry:
movl %ebp,%eax /* A1 */
bswap %eax
push %eax
movl %esi,%eax /* A2 */
bswap %eax
push %eax
movl %ebx,%eax /* A0 */
bswap %eax
push %eax
mov 12(%ebx),%eax
bswap %eax
call *%eax
add $12,%esp
ret
.L_HookEntry:
.size _HookEntry,.L_HookEntry-_HookEntry
.globl HookEntry
.type HookEntry,@function
HookEntry = _HookEntry+1
");
However, I would suggest you to change the code to use Hookentry
instead. Here is an example. The following code works EVERYWHERE, be it
AmigaOS, MorphOS, Amithlon, AmigaOS 4.x or AROS ...
#include <clib/alib_protos.h>
ULONG AY_GoPageFunc(struct Hook *hookPtr, Object *obj, APTR message)
{
GotoURL("http://www.yam.ch/");
}
struct Hook hookname = {
{NULL, NULL},
HookEntry, AY_GoPageFunc, NULL
};
--
---- Martin Blom --------------------------- martin@... ----
Eccl 1:18 http://martin.blom.org/