using terminal control codes

Joachim Durchholz joachim.durchholz@REDACTED
Mon Dec 22 14:21:45 CET 2003


Vlad Dumitrescu wrote:
> Hi again,
>  
> now I'm a little more focused :-)
>  
> Did anyone try to compile & use slang with Erlang on Windows? I've been 
> fiddling with what's on Jungerl, but the problem is with the slang 
> driver, of course.

You can't rely on control codes and escape sequences in Windows. On Win 
9x, it depends on whether ANSI.SYS is loaded (and loading it is actually 
a bad idea because malware can reprogram the keyboard mapping, though 
that used to be more of a problem in DOS times).
Not sure how things work out in Win NT/2K/XP. But, in general, doing 
fancy interface stuff "isn't done" in text mode on Windows. In other 
words, whatever you do on Windows, you can expect to run into problems 
because fixing the text interface was never important. Worse, you'll 
probably be quite on your own with any problems.

If I were to port a Unix program with an elaborate text UI to Windows, 
/and/ wanted to be portable across Windows versions, I'd probably look 
for a VT100 emulation, and link the software up with that.

There are several ways to emulate VT100:
- install an X server and run an xterm.
- I think there's a way to make Windows loopback the serial interface, 
without even going through the real hardware; if that's possible, one 
could use any serial terminal program (actually Windows comes with one).
- maybe there's even a direct VT100 emulation available that 
communicates with the application via pipes (for NT/2K/XP) or Windows 
messages (for 9x).
- set up an sshd under Windows (maybe using cygwin, though that's quite 
heavy) and connect PuTTY to localhost.
- grab the terminal emulation of PuTTY (it's open source) and make it a 
standalone VT100 emulation.

When programming for a specific flavor of Windows, I'd go digging in 
MSDN and see whether the control codes are available, before taking the 
VT100 route. If it's possible, that's much less work than the VT100 
emulation route.

Regards,
Jo




More information about the erlang-questions mailing list