revert between 56095 -> 55830 in arch
[AROS.git] / rom / utility / packbooltags.c
blobf62e6622e3917bf944e84925d01069f32b3635ac
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
8 #include "intern.h"
10 /*****************************************************************************
12 NAME */
13 #include <utility/tagitem.h>
14 #include <proto/utility.h>
16 AROS_LH3(ULONG, PackBoolTags,
18 /* SYNOPSIS */
19 AROS_LHA(ULONG , initialFlags, D0),
20 AROS_LHA(struct TagItem *, tagList, A0),
21 AROS_LHA(struct TagItem *, boolMap, A1),
23 /* LOCATION */
24 struct UtilityBase *, UtilityBase, 7, Utility)
26 /* FUNCTION
27 Scans through the list tagList to find the tags which are contained
28 in the list boolMap which are then converted to a bit-flag
29 representation as defined in boolMap.
31 If the value of the Tag's data is 0, then the boolean value of the
32 tag is defined as false, otherwise it is true.
34 INPUTS
35 initialFlags - an initial set of bit-flags which will be changed
36 by this function.
38 tagList - A TagItem list which contains some tags which are
39 defined as boolean by having a corresponding tag
40 in boolMap. The boolean value of tag->ti_Data
41 determines whether the bits in the flag are
42 TRUE or FALSE.
44 boolMap - A TagItem list containing a series of tags which
45 are to be considered Boolean.
47 RESULT
48 flags - The value of initialFlags modified by the values
49 of the boolean tags defined in boolMap.
51 NOTES
52 If there is more than one Tag in tagList of a single type. The
53 last of these tags will determine the value of that bit-flag.
55 EXAMPLE
57 BUGS
59 SEE ALSO
60 GetTagData(), FindTagItem(), NextTagItem()
62 INTERNALS
64 HISTORY
65 29-10-95 digulla automatically created from
66 utility_lib.fd and clib/utility_protos.h
67 18-08-96 iaint Created. But still needs some testing.
69 *****************************************************************************/
71 AROS_LIBFUNC_INIT
72 struct TagItem *current, *found, *tstate = tagList;
74 while ((current = NextTagItem(&tstate)))
76 if ((found = FindTagItem (current->ti_Tag, boolMap)))
78 if (current->ti_Data == 0)
79 initialFlags &= ~(found->ti_Data);
80 else
81 initialFlags |= found->ti_Data;
85 return initialFlags;
86 AROS_LIBFUNC_EXIT
87 } /* PackBoolTags */