NAME PackBoolTags -- Builds a "Flag" word from a TagList. (V36) SYNOPSIS boolflags = PackBoolTags( initialFlags, tagList, boolMap ) D0 D0 A0 A1 ULONG PackBoolTags( ULONG initialFlags, struct tagitem *taglist, struct tagitem *boolmap ); FUNCTION Picks out the Boolean TagItems in a tagitem list and converts them into bit-flag representations according to a correspondence defined by the tagitem list 'boolmap.' A Boolean tagitem is one where only the logical value of the ti_Data is relevant. If this field is 0, the value is FALSE, otherwise TRUE. INPUTS initialFlags - a starting set of bit-flags which will be changed by the processing of TRUE and FALSE Boolean tags in tagList. tagList - a tagitem list which may contain several tagitems defined to be "Boolean" by their presence in boolMap. The logical value of ti_Data determines whether a tagitem causes the bit-flag value related by boolMap to set or cleared in the returned flag longword. boolMap - a tagitem list defining the boolean tags to be recognized, and the bit (or bits) in the returned longword that are to be set or cleared when a Boolean Tag is found to be TRUE or FALSE in tagList. RESULT boolflags - the accumulated longword of bit-flags, starting with InitialFlags and modified by each Boolean tagitem encountered. EXAMPLE /* define some nice user tag values ... */ enum mytags { tag1 = TAG_USER+1, tag2, tag3, tag4, tag5 }; /* this tagitem list defines the correspondence between boolean tags * and bit-flag values. */ struct tagitem boolmap[] = { { tag1, 0x0001 }, { tag2, 0x0002 }, { tag3, 0x0004 }, { tag4, 0x0008 }, { TAG_DONE } }; /* You are probably passed these by some client, and you want * to "collapse" the Boolean content into a single longword. */ struct tagitem boolexample[] = { { tag1, TRUE }, { tag2, FALSE }, { tag5, Irrelevant }, { tag3, TRUE }, { TAG_DONE } }; /* Perhaps 'boolflags' already has a current value of 0x800002. */ boolflags = PackBoolTags( boolflags, boolexample, boolmap ); /* The resulting new value of 'boolflags' will be 0x80005. /* BUGS There are some undefined cases if there is duplication of a given Tag in either list. It is probably safe to say that the *last* of identical Tags in TagList will hold sway. SEE ALSO utility/tagitem.h, gettagdata(), findtagitem(), nexttagitem()