TDD program for Linux
T. Joseph CARTER
knghtbrd at bluecherry.net
Tue Nov 22 05:44:57 UTC 2005
Janina Sajka wrote:
> But don't many TDD devices require that users make this change by hand?
> If it were automatic, this might be a great alternative.
It's okay, the BAUDOT thing is easy enough to do. The only part of the
code that is a little weird from the ASCII point of view is the bit code
11x11. Based on the middle bit, you set either letters or figures mode.
In C (non-programmers, that's your cue to stop reading), code to turn
baudot into ASCII might look like this:
#define BAUDOT_MODE_LETTERS 0
#define BAUDOT_MODE_FIGURES 1
static int baudot_mode; /* Must be 0 or 1 */
static const char bd_ascii[][] = {
"\0T\rO HNM\nLRGIPCVEZDBSYFXAWJ\xfeUQK\xff",
"\05\r9 #,.\n)4&80:;3\"$?\a6!/-2'\xfe71(\xff"
};
#define bd_ascii(x) (bd_ascii[x][baudot_mode])
Of course, if you pass \x1B or \x1F to bd_ascii, it will return -2 or -1
respectively, which tells you want to set baudot_mode to. Going the other
direction is harder because we're talking about going from a code with 128
values down to a code with 56 values. Obviously lowercase characters can
be turned into uppercase ones, but that leaves a whole lot of control
characters and punctuation that must be converted or dropped. This is not
extraordinarily difficult, but if I were to take the time to do it, I
would actually be doing it in a bit of source code rather than in some
email. *smile*
--
"We are what we repeatedly do. Excellence, therefore, is not an act,
but a habit."
-- Aristotle
More information about the Blinux-list
mailing list