* Automatic generation of varargs stub for a function can now be disabled by
[AROS.git] / test / exceptiontest.c
blob56663bb9ee4af6bb991492a734f5cf82a6896223
1 /*
2 Copyright © 1995-2002, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <proto/exec.h>
7 #include <aros/libcall.h>
8 #include <clib/exec_protos.h>
9 #include <exec/execbase.h>
10 #include <stdio.h>
12 ULONG s;
14 /* Function prototype needed on Linux-M68K*/
15 ULONG Test_handler();
17 AROS_LH2(ULONG,handler,
18 AROS_LHA(ULONG,signals,D0),
19 AROS_LHA(APTR,exceptData,A1),
20 struct ExecBase *,SysBase,0,Test)
22 AROS_LIBFUNC_INIT
23 exceptData=0;
24 s=SetSignal(0,0);
25 return signals;
26 AROS_LIBFUNC_EXIT
29 int main(void)
31 int s1,s2;
32 APTR oldexc;
34 s1=AllocSignal(-1);
35 if(s1>=0)
37 printf("sig1: %d\n",s1);
38 s2=AllocSignal(-1);
39 if(s2>=0)
41 printf("sig2: %d\n",s2);
42 oldexc=SysBase->ThisTask->tc_ExceptCode;
43 SysBase->ThisTask->tc_ExceptCode=&AROS_SLIB_ENTRY(handler,Test);
44 SetExcept(1<<s2,1<<s2);
45 Signal(SysBase->ThisTask,(1<<s2)|(1<<s1));
46 SetExcept(0,1<<s2);
47 SysBase->ThisTask->tc_ExceptCode=oldexc;
48 printf("got: %08lx\n",s);
49 FreeSignal(s2);
51 FreeSignal(s1);
53 return 0;