[chuck-users] VT100 emulation

Hans Aberg haberg at math.su.se
Sun May 3 09:51:06 EDT 2009


On 3 May 2009, at 15:25, Kassen wrote:

>> Echo on/off commands plus a way to
>> resetting when exiting on a signal would suffice.
>
> What exactly would you like to reset? You mentioned "keyboard lock"
> but I didn't quite get that; I only have NumLock, CapsLock (disabled
> and turned into a extra Ctrl) and ScrollLock (doesn't seem to do
> anything useful, the led doesn't even turn on anymore).

These escape commands are interpreted when sent to the terminal VT100  
emulator, and may not work from modern keyboards, though they may have  
had keys for it it in the past. Keyboards of the past used to sent  
character codes, and not key numbers. So this stuff is mostly not  
needed, but supported, as there are many programs making use of it.

Echo on/off means that what is typed is not immediately sent to the  
terminal window. On a Posix computer, you can turn it off an on by the  
commands
   stty -echo
   stty echo
If you type in the first one, you will no longer see what you type,  
but you will still be able to type or paste in the second to get it  
back.

By contrast, keyboard lock on lock the keyboard so that it does not  
sent anything at all to the terminal program. Then you will not be  
able to turn it on again - it must be done from a program. But it  
still work with 'chuck' as it listens for the device directly. My code  
has lock_on(), but be ware of that if you do not issue lock_off()  
before leaving the program, you may have to close that terminal window.

Now, if one exits the program using ^C, then there is currently no way  
turn it on again. But one can set it so that an exit signal jumps to a  
function - 'chuck' already does that - only that the user would need  
to add some code. Unless there is a hardwired VT100 class doing it for  
you.

>> I wonder what might happen on that platform. If it works, it might  
>> be nice
>> with a simple library.
>
> I'm still interested in a Std call that would report our OS.

That might be nice. But one can get the terminal capacity reported (I  
think).

> Std.system() (and maybe these print commands) are fine features but
> not at all portable from the Unixy systems to Windows and we might
> want to create compatible code or at least gracefully degrade
> performance.
>
> Anyway, if it doesn't work there might be equivalent commands but last
> time I dived into MS's reference for their CLI wasn't a very pleasant
> experience for me. It's all there but don't ask about the structure of
> the presentation. I do know that the option to change collour at the
> prompt command is gone these days and instead there is one to change
> the whole screen now.

Colors, though, are not so important. They seem not have caught on in  
music, perhaps it just makes it harder to read, and some are color  
deficient.

   Hans




More information about the chuck-users mailing list