Fellow ChucKists, STEIM put up the details for the workshop on ChucK I'll host, starting June15 here; http://www.steim.org/steim/workshops.php?id=139&b=1&r=1 People interested in getting a solid start ChucKing and within reach from Amsterdam (NL) in June might want to check that out. Please note places are limited so reservations are needed. Yours, Kas.
It is quite easy to write to terminal in xy-coordinate layouts - one uses the VT100 escape sequences. I attach an example with a class with some such layout functions (which also contains links to VT100 specs). It should write some text in different colors and positions. There are some problems though: 1. One should have a commands that can write a file as is, without additions. Currently "<<<...>>>" writes type when having only item, a space between items, and a newline. 2. One can use commands like echo off and keyboard lock, which would good when playing the typing keyboard and for not littering the terminal display, but then there is no way to reset that when exiting using an interrupt. This could be fixed by allowing users to write their own function exit() which is called upon an exit or kill signal. 3. For some reason, the echo off escape sequence does not work on my Terminal. One can get around it by using 'Std.system("stty -echo")', but then 'Std.system' must be enabled (it seems) using startup option '--caution-to-the-wind'. And this may not be portable if somebody is using an un-Posix computer. So a function echo() might be useful. Hans
Hans;
3. For some reason, the echo off escape sequence does not work on my Terminal. One can get around it by using 'Std.system("stty -echo")', but then 'Std.system' must be enabled (it seems) using startup option '--caution-to-the-wind'.
This is intentional. A ChucK VM is open to connections over the network, actually; using a second (or third...) terminal to send commands to the VM uses a connection to localhost to work at all. Hence having Std.system() take arbitary commands and execute them with the user's permissions meant a rather large security hole. This way the power to use system commands is there for anyone to use but the user him/herself will need to make the choice to trade security for power. As far as I know this is a purely theoretical issue but is is a rather large hole. Your code works beautifully on my Linux install, I'll try Windows later today; we might be lucky (I don't have much hope there but simply trying seems easier than digging through the Windows reference). If it doesn't work maybe it could be ported; the Windows shell does have quite a few options that DOS lacked but I don't know most of them off-hand. Thanks, Kas.
On 3 May 2009, at 14:36, Kassen wrote:
.system' must be enabled (it seems) using startup option '--caution-to-the-wind'.
This is intentional.
A ChucK VM is open to connections over the network, actually; using a second (or third...) terminal to send commands to the VM uses a connection to localhost to work at all. Hence having Std.system() take arbitary commands and execute them with the user's permissions meant a rather large security hole.
This way the power to use system commands is there for anyone to use but the user him/herself will need to make the choice to trade security for power.
As far as I know this is a purely theoretical issue but is is a rather large hole.
Those security issues can be tricky. Echo on/off commands plus a way to resetting when exiting on a signal would suffice.
Your code works beautifully on my Linux install, ...
Fine, though somewhat expected, since xterm supports these escape codes.
I'll try Windows later today; we might be lucky (I don't have much hope there but simply trying seems easier than digging through the Windows reference). If it doesn't work maybe it could be ported; the Windows shell does have quite a few options that DOS lacked but I don't know most of them off-hand.
I wonder what might happen on that platform. If it works, it might be nice with a simple library. Hans
Hans;
Those security issues can be tricky.
It's better to be safe than sorry for sure.
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).
Fine, though somewhat expected, since xterm supports these escape codes.
It can't hurt to confirm.
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. 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. Yours, Kas.
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
Sadly we've had to cancel this workshop due to a lack of people signing up.
I'll have to try to convert The Netherlands to the ChucKist side in some
other way, maybe preaching on street corners ;¬)
Yours,
Kas..
2009/5/2 Kassen
Fellow ChucKists,
STEIM put up the details for the workshop on ChucK I'll host, starting June15 here; http://www.steim.org/steim/workshops.php?id=139&b=1&r=1
People interested in getting a solid start ChucKing and within reach from Amsterdam (NL) in June might want to check that out. Please note places are limited so reservations are needed.
Yours, Kas.
participants (2)
-
Hans Aberg
-
Kassen