[BRLTTY] BrlAPI and dot string <-> dot integer conversion
Yannick PLASSIARD
yan at mistigri.org
Wed Dec 13 03:55:11 EST 2006
On Wed, Dec 13, 2006 at 01:12:56AM +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 ?
>
Hi:
I aggree, this could introduce some problems trying to parse and
guess what the programmer wants us to do.
Moreover, this always depends on the Braille Table used in Brltty (if it
actually doesn't, it should).
So my suggestions :
- Allow either char or dot writing (as it works now)
- Allow the programmer to put a "temporary" or "permanent" Braille Table
:
* the temporary would be used only for the application w:ich
sent it.
* The permanent would be used bay all clients, and maybe by the
Brltty's core.
- If the programmer needs to manipulate dots, (don't know really why but
let's suppose), I think it would be better to add this in another
library, or in each program for a start, and if we realize that all API
clients want to do this, we could decide afterwards to implement it into
the API (client-side of course).
> Samuel
Yannick
> _______________________________________________
> 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