- Set a default PCM volume so that something can be heard when driver is
[AROS.git] / compiler / libinit / libinit.c
blobad8b15689d5d805c1ece256057a1bd58bb031dfa
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: libinit library - functions calling when opening/closing libs
6 */
8 #include <exec/types.h>
9 #include <aros/symbolsets.h>
11 typedef int (*libfunc)(APTR libbase);
12 typedef int (*opendevfunc)
14 void *libbase,
15 void *ioreq,
16 ULONG unitnum,
17 ULONG flags
19 typedef int (*closedevfunc)
21 void *libbase,
22 void *ioreq
25 int set_call_libfuncs
27 const void * const set[],
28 int order,
29 int test_fail,
30 APTR libbase
33 int pos, (*func)(APTR);
35 ForeachElementInSet(set, order, pos, func)
37 if (test_fail)
39 if (!(*func)(libbase))
40 return FALSE;
42 else
44 (void)(*func)(libbase);
48 return TRUE;
51 int set_call_devfuncs
53 const void * const set[],
54 int order,
55 int test_fail,
56 void *libbase,
57 void *ioreq,
58 IPTR unitnum,
59 ULONG flags
62 int pos;
64 if (order>=0)
66 int (*func)(APTR, APTR, IPTR, ULONG);
68 ForeachElementInSet(set, order, pos, func)
70 if (test_fail)
72 if (!(*func)(libbase, ioreq, unitnum, flags))
73 return FALSE;
75 else
77 (void)(*func)(libbase, ioreq, unitnum, flags);
81 else
83 int (*func)(APTR, APTR);
85 ForeachElementInSet(set, order, pos, func)
87 if (test_fail)
89 if (!(*func)(libbase, ioreq))
90 return FALSE;
92 else
94 (void)(*func)(libbase, ioreq);
99 return TRUE;