[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.4.3 Bit Maps and Masks

str2mask.tpl

This template leverages highly off of enumerations (see section Enumerations). It will produce a header file with bit masks defined for each bit specified with a cmd attribute. 63 is the highest legal bit number because this template has not been extended to cope with multiple word masks. (Patches would be welcome.)

There are a few constraints on the names allowed:

no-code and no-name are honored. dispatch is not. The lookup function will examine each token in an input string, determine which bit is specified and add it into a result. The names may be prefixed with a hyphen (-) or tilde (~) to remove the bit(s) from the cumulative result. If the string begins with a plus (+), hyphen or tilde, a “base value” parameter is used for the starting mask, otherwise the conversion starts with zero.

Beyond the enumeration attributes that are used (or ignored), the ‘str2mask’ template accepts a mask attribute. It takes a few “subattributes”:

m-name

a special name for a sub-collection of the mask bits

m-bit

The name of each previously defined bit(s). If the desired previously defined value is a mask, that m-name must be suffixed with “-mask”.

m-invert

When all done collecting the bits, x-or the value with the mask of all the bits in the collection.

A mask of all bits in the collection is always generated.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Bruce Korb on August 21, 2015 using texi2html 1.82.