2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
9 /*****************************************************************************
13 #include <aros/debug.h>
15 #include <libraries/commodities.h>
16 #include <proto/exec.h>
17 #include <proto/commodities.h>
19 #define DEBUG_BADFILTER(x) x;
21 AROS_LH2(VOID
, SetFilter
,
25 AROS_LHA(CxObj
*, filter
, A0
),
26 AROS_LHA(STRPTR
, text
, A1
),
30 struct Library
*, CxBase
, 20, Commodities
)
34 Make 'filter' match events of the type specified in 'text'.
38 filter - the commodity filter the matching conditions of which to set
39 text - description telling what to filter
43 The internal error field will be updated (COERR_BADFILTER) according to
44 the success or failure of the operation.
54 SetFilterIX(), CxObjError()
60 ******************************************************************************/
70 ObtainSemaphore(&GPB(CxBase
)->cx_SignalSemaphore
);
72 if (CXOBJType(filter
) == CX_FILTER
)
76 err
= ParseIX(text
, filter
->co_Ext
.co_FilterIX
);
78 if (err
== 0 || err
== -2)
80 filter
->co_Error
&= ~COERR_BADFILTER
;
84 DEBUG_BADFILTER(dprintf("SetFilter: Bad filter \"%s\"!\n", text
));
85 filter
->co_Error
|= COERR_BADFILTER
;
90 filter
->co_Error
|= COERR_BADTYPE
;
93 ReleaseSemaphore(&GPB(CxBase
)->cx_SignalSemaphore
);