Bugfix to avoid an endless loop.
[cake.git] / test / callhooktest.c
blob50c46c278f3061b8efb5f47d48ed6f1ac50b5da6
1 /*
2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: CallHook arguments passing test.
6 */
8 #include <stdio.h>
9 #include <proto/alib.h>
10 #include <proto/aros.h>
11 #include <utility/hooks.h>
13 struct Params
15 STACKED char p1; STACKED short p2; STACKED int p3; STACKED long p4;
16 STACKED char p5; STACKED short p6; STACKED int p7; STACKED long p8;
17 STACKED char p9; STACKED short p10; STACKED int p11; STACKED long p12;
18 STACKED char p13; STACKED short p14; STACKED int p15; STACKED long p16;
21 long TestHook(struct Hook *hook, APTR object, struct Params *params)
23 printf("TestHook(%p, %p, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)\n", hook, object,
24 params->p1, params->p2, params->p3, params->p4, params->p5, params->p6, params->p7, params->p8,
25 params->p9, params->p10, params->p11, params->p12, params->p13, params->p14, params->p15, params->p16);
26 return 0xbabadada;
29 int main (int argc, char ** argv)
31 struct Hook hook;
32 hook.h_Entry = &TestHook;
33 long res = CallHook(&hook, 0x0,
34 (char) 0x1, (short) -0x1, (int) 0x2, (long) -0x2,
35 (char) 0x3, (short) -0x3, (int) 0x4, (long) -0x4,
36 (char) 0x5, (short) -0x5, (int) 0x6, (long) -0x6,
37 (char) 0x7, (short) -0x7, (int) 0x8, (long) -0x8
39 printf("CallHook result: %p\n", res);