[comp.sources.wanted] Dvorak keyboard translator wanted

tsf@theory.cs.cmu.edu (Timothy Freeman) (12/11/86)

Does anyone out there have a filter for some flavor of Unix which
makes a QWERTY keyboard behave like a DVORAK keyboard?  The idea is
that I run this filter, and I relabel my keyboard in a DVORAK fashion,
and then the keys work as labelled without any hardware changes.  I
would also be interested in a computer-readable table for translating
between the two, even if it doesn't have a Unix-compatible program
wrapped around it.

Tim Freeman

Arpanet: tsf@theory.cs.cmu.edu

faigin@sdcrdcf.UUCP (Daniel P Faigin) (12/15/86)

In article <1006@theory.cs.cmu.edu> tsf@theory.cs.cmu.edu (Timothy Freeman) writes:
>Does anyone out there have a filter for some flavor of Unix which
>makes a QWERTY keyboard behave like a DVORAK keyboard?

Well, the following does what you want. It may be a bit hard to
read -- it was the grand prize winner in last year's obfusticated
C contest. Note that it is self documenting. I should also add
that I am posting this for its author, Larry Wall, who isn't here
this week. 

[P.S.] To those asking about warp, it will probably be released
sometime in January.

--- cut here ---
#define _c(C)_ (C)&('|'+3):c_()(C)>>('\n'-3) __ /**/
#define C char*
#define keyboard ",,B3-u;.(&*5., /(b*(1\036!a%\031m,,,,,\r\n"
#define main(o,oo)oo(o){
#define _ ;case
C
#define c_(cc)c cc=
#define C_(sand)_O(sand)witch
o=keyboard;
#define __ ;break;
C
ccc(
cc)
C
cc;
{
C
cccc=
cc;int
#ifndef lint
#define keyboard "dijs QH.soav Vdtnsaoh DmfpaksoQz;kkt oa, -dijs"
#endif
c;
main(;c_(=(*cc);*cc++)c,for);
#define _O(s)s
main(0xb+(c>>5),C_(s))
_'\v'
:__ _'\f':
main(c,C_(s));
_c(8098)_c(6055)_c(14779)_c(10682)
#define O_(O)_O(O)stem(ccc(
_c(15276)_c(11196)_c(15150)
#define _C ;return
_c(11070)_c(15663)_c(11583)
}
__
default
:c_(+)o[c&__LINE__-007];
main(c_(-)'-'-1,C_(s))_
0214
:_
0216
:c_(+)025 _
0207
:c_(-)4 _
0233
:c_(+)' '-1;
}}c_(&)'z'+5;
}_C cccc;
}main(,cc)
C
#define O write(1,
c="O";
O_(sy) keyboard));
main(;;,for);
read(0,
c,1);*
c_(&)'~'+1
;O ccc(
c),
'\0');
main(*c,
C_(s));_
4
:O_(sy)";kkt -oa, dijszdijs QQ"))_C
_
13
:O o+' ',
3
)
#undef main
__ _ 127:O"\b \b",3)__
default
:O
c,1)
__}}}main(){
cc();
}
--- end cut here ---

Daniel Faigin (Larry's Officemate)
-- 
UUCP: {akgua allegra ihnp4 hplabs sdcsvax trwrb cbosgd}!sdcrdcf!faigin  
ARPA: sdcrdcf!faigin@UCLA-LOCUS.ARPA --or-- sdcrdcf!faigin@LOCUS.UCLA.EDU
              o
W (Daniel): UNISYS (Defense Systems - System Developement Group)*
            2525 Colorado MD 91-01; Santa Monica CA 90406; (213) 820-4111 x6393
W (Karen) : Amex Systems Incorporated (An Allied Bendix Aerospace Company)
            107 West Carob Street; Compton CA 90220; (213) 604-4500 x4838
H: 8333 Columbus Avenue #17; Sepulveda CA 91343

[*: Formerly, System Development Corporation]

mouse@mcgill-vision.UUCP (der Mouse) (12/18/86)

In article <1006@theory.cs.cmu.edu>, tsf@theory.cs.cmu.edu (Timothy Freeman) writes:
> Does anyone out there have a filter for some flavor of Unix which
> makes a QWERTY keyboard behave like a DVORAK keyboard?  The idea is
> that I run this filter, and I relabel my keyboard in a DVORAK
> fashion, and then the keys work as labelled without any hardware
> changes.

This is a nice idea but I doubt it would work with most terminals.  I
say this because the Dvorak keyboard reassigns letters to some keys
that are normally (ie, QWERTY) not letters, notably ,< .> and /? - and
while this is not itself a problem, it breaks trying to send the
corresponding control character (since control-comma is not normally
distinguishable from control-point and control-slash).

If you are willing to fiddle the Dvorak keyboard slightly so that the
letters appear only on keys that bear letters under QWERTY, this would
be possible.  However, to keep things consistent will require kernel
hacks on any UNIX I know of - otherwise things like the kill character,
let us say you use ^U, would have to be set to something different from
what the keyboard says you're typing.  This is because those control
characters are handled by the kernel - your user program won't get a
chance to see them!

This difficulty *can* be worked around if your system has pseudo
terminals, but it's messy and doesn't work totally anyway.

If you are lucky enough to be running on something with a totally soft
keyboard, such as a Lisp Machine or a Sun, the sort of thing you want
*is* possible.  Not necessarily easy, mind you.  I have software which
is capable of doing this on a Sun-2 or Sun-3, provided you don't want
to run suntools (I don't, but I appear to be in the minority).

As for getting the translation table, I'm sure the CMU library has a
reference which will give this.  I found such a reference once in the
McGill libraries, but the xerox I made of it has vanished and I don't
remember what it was - I'd have to search it out again.

					der Mouse

USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!mcgill-vision!mouse
     think!mosart!mcgill-vision!mouse
Europe: mcvax!decvax!utcsri!mcgill-vision!mouse
ARPAnet: think!mosart!mcgill-vision!mouse@harvard.harvard.edu