[BRLTTY] BrlAPI and dot string <-> dot integer conversion

Willie Walker William.Walker at Sun.COM
Wed Dec 13 07:40:00 EST 2006


Thanks for asking!

I agree that this is kind of trivial and perhaps not needed.  I think
extra documentation in the API may help more  :-).  For example,
something like this for the attrOr field of the 'Write' structure,
assuming I understood it correctly after playing around with it for a
while:

attrOr: a string of bytes which must be regionSize in length and whose
dots will end up showing up on the display.  Each byte represents a
bitfield where each bit corresponds to a dot (i.e., bit 0 = dot 1, bit 1
= dot 2, and so on)

Thanks!

Will

On Wed, 2006-12-13 at 01:12 +0100, Samuel Thibault wrote:
> Hi,
> 
> Dave proposed to add the following macros and functions to BrlAPI:
> 
> /* convert a dot number ('2' for instance) into a dot bit (BRL_DOT2) */
> #define brlapi_dotNumberToBit(n) ((n) < 1 ? 0 : ((n) > 8 ? 0 : 1 << (n - '1')))
> 
> /* convert a dot bit (BRL_DOT2 for instance) into a dot number ('2') */
> #define brlapi_dotBitToNumber(n) ((n) ? '0' + ffs(n) : 0)
> 
> /* convert a dot number string ("145" for instance) into dot bits
>  * (BRL_DOT1|BRL_DOT4|BRL_DOT5) */
> unsigned char  brlapi_dotNumbersToBits(unsigned char *numbers)
> 
> /* convert dot bits (BRL_DOT1|BRL_DOT4|BRL_DOT5) into a dot string
>  * ("145" for instance), caller should free() the string after use. */
> unsigned char *brlapi_dotBitsToNumbers(unsigned char bits)
> 
> We're a bit reluctant to add such helper functions because
> - they are quite trivial and don't add much value (particularly the
>   macros).
> - the format for dot strings may vary: should it be "134", or "(134)",
>   or "1 34    ", etc. ?
> 
> What do people think about this?  Would these helpers be useful enough
> for adding them to the API ?
> 
> Samuel
> _______________________________________________
> This message was sent via the BRLTTY mailing list.
> To post a message, send an e-mail to: BRLTTY at mielke.cc
> For general information, go to: http://mielke.cc/mailman/listinfo/brltty



More information about the BRLTTY mailing list