revert between 56095 -> 55830 in arch
[AROS.git] / workbench / libs / commodities / setfilterix.c
blob0a808b61b3b1d9def72cbe5b8060f9cbcbd7daa8
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 "cxintern.h"
14 #include <aros/debug.h>
15 #include <libraries/commodities.h>
16 #include <proto/exec.h>
18 #define DEBUG_BADFILTER(x) x;
20 AROS_LH2(VOID, SetFilterIX,
22 /* SYNOPSIS */
24 AROS_LHA(CxObj *, filter, A0),
25 AROS_LHA(IX * , ix , A1),
27 /* LOCATION */
29 struct Library *, CxBase, 21, Commodities)
31 /* FUNCTION
33 Set the filter description by supplying an InputXpression.
35 INPUTS
37 filter -- the commodity filter object the attributes of which to set
38 (may be NULL)
39 ix -- InputXpression describing the filter
41 RESULT
43 The internal error field will be updated (COERR_BADFILTER) depending on
44 whether the function succeeded or failed.
46 NOTES
48 The first field in the IX structure must be set to IX_VERSION as
49 defined in <libraries/commodities.h>, to indicate which version of
50 the IX structure is used.
52 EXAMPLE
54 BUGS
56 SEE ALSO
58 SetFilter(), CxObjError(), <libraries/commodities.h>
60 INTERNALS
62 HISTORY
64 ******************************************************************************/
67 AROS_LIBFUNC_INIT
69 if (filter == NULL)
71 return;
74 ObtainSemaphore(&GPB(CxBase)->cx_SignalSemaphore);
76 if (CXOBJType(filter) == CX_FILTER)
78 if (ix->ix_Version == IX_VERSION)
80 CopyMem(ix, filter + 1, sizeof(IX));
81 filter->co_Ext.co_FilterIX = (APTR)(filter + 1);
82 filter->co_Error &= ~COERR_BADFILTER;
84 else
86 DEBUG_BADFILTER(dprintf("SetFilterIX: ix_Version == %lu (should be %lu)!\n", ix->ix_Version, IX_VERSION));
87 filter->co_Error |= COERR_BADFILTER;
90 else
92 filter->co_Error |= COERR_BADTYPE;
95 ReleaseSemaphore(&GPB(CxBase)->cx_SignalSemaphore);
97 AROS_LIBFUNC_EXIT
98 } /* SetFilterIX */