Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / commodities / setfilter.c
blob7504b4fc57c8c969226c2164f086758fa7a4e9eb
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 /*****************************************************************************
11 NAME */
13 #include <aros/debug.h>
14 #include "cxintern.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,
23 /* SYNOPSIS */
25 AROS_LHA(CxObj *, filter, A0),
26 AROS_LHA(STRPTR, text, A1),
28 /* LOCATION */
30 struct Library *, CxBase, 20, Commodities)
32 /* FUNCTION
34 Make 'filter' match events of the type specified in 'text'.
36 INPUTS
38 filter - the commodity filter the matching conditions of which to set
39 text - description telling what to filter
41 RESULT
43 The internal error field will be updated (COERR_BADFILTER) according to
44 the success or failure of the operation.
46 NOTES
48 EXAMPLE
50 BUGS
52 SEE ALSO
54 SetFilterIX(), CxObjError()
56 INTERNALS
58 HISTORY
60 ******************************************************************************/
63 AROS_LIBFUNC_INIT
65 if (filter == NULL)
67 return;
70 ObtainSemaphore(&GPB(CxBase)->cx_SignalSemaphore);
72 if (CXOBJType(filter) == CX_FILTER)
74 LONG err;
76 err = ParseIX(text, filter->co_Ext.co_FilterIX);
78 if (err == 0 || err == -2)
80 filter->co_Error &= ~COERR_BADFILTER;
82 else
84 DEBUG_BADFILTER(dprintf("SetFilter: Bad filter \"%s\"!\n", text));
85 filter->co_Error |= COERR_BADFILTER;
88 else
90 filter->co_Error |= COERR_BADTYPE;
93 ReleaseSemaphore(&GPB(CxBase)->cx_SignalSemaphore);
95 AROS_LIBFUNC_EXIT
96 } /* SetFilter */