Added very useful and convenient macro for parsing attribute IDs
[AROS.git] / test / callhooktest.c
blob0cc806a5f326ddee9e1e614574f6e3201f26f457
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: CallHook arguments passing test.
6 */
8 /* Additionally, test vararg stubs. */
9 #define NO_INLINE_STDARG
11 #include <stdio.h>
12 #include <proto/alib.h>
13 #include <proto/aros.h>
14 #include <utility/hooks.h>
16 struct Params
18 STACKED char p1; STACKED short p2; STACKED int p3; STACKED long p4;
19 STACKED char p5; STACKED short p6; STACKED int p7; STACKED long p8;
20 STACKED char p9; STACKED short p10; STACKED int p11; STACKED long p12;
21 STACKED char p13; STACKED short p14; STACKED int p15; STACKED long p16;
24 AROS_UFH3(long, TestHook,
25 AROS_UFHA(struct Hook *, hook, A0),
26 AROS_UFHA(APTR, object, A2),
27 AROS_UFHA(struct Params *, params, A1))
29 AROS_USERFUNC_INIT
30 printf("TestHook(%p, %p, %d, %d, %d, %ld, %d, %d, %d, %ld, %d, %d, %d, %ld, %d, %d, %d, %ld)\n", hook, object,
31 params->p1, params->p2, params->p3, params->p4, params->p5, params->p6, params->p7, params->p8,
32 params->p9, params->p10, params->p11, params->p12, params->p13, params->p14, params->p15, params->p16);
33 return 0xbabadada;
34 AROS_USERFUNC_EXIT
37 int main (int argc, char ** argv)
39 struct Hook hook;
40 hook.h_Entry = (HOOKFUNC)TestHook;
41 long res = CallHook(&hook, 0x0,
42 (char) 0x1, (short) -0x1, (int) 0x2, (long) -0x2,
43 (char) 0x3, (short) -0x3, (int) 0x4, (long) -0x4,
44 (char) 0x5, (short) -0x5, (int) 0x6, (long) -0x6,
45 (char) 0x7, (short) -0x7, (int) 0x8, (long) -0x8
47 printf("CallHook result: %lx\n", res);
49 return (res == 0xbabadada) ? 0 : 1;