@j4james asked about the nuances of mouse input from archaic terminal emulators and included a Python test script.
I got results from VWS VT200/ReGIS terminal emulator via simh VAX emulation. I don't expect Python runs under VMS 4.7, so I pulled some shenanigans. In brief: I ran the test script on the host computer, redirecting stdin and stdout to a TCP port exposed by SIMH to fake a DZ11 serial device in VMS.
First, I kludged j4james's python script to comment out references to cbreak and termios. Since its stdin is redirected, Python would have died complaining of "inappropriate ioctls".
- j4james's original script: declrp.py.orig
- hackerb9's kludged script: declrp.py
The following presumes VMS has already been set up, for example by following the steps in a tutorial.
; Four DZ11 serial terminals. Make TTA3 accessible on TCP 6666.
; (MicroVAX uses first two for kbd & mouse)
SET DZ LOG=0=serial0.log
ATT DZ LINE=3,6666-
VWS desktop, click on the background with the mouse and open a VT200/ReGIS teminal. Login as "SYSTEM".
-
At the DCL dollar prompt, type
EDIT ENABLELOCATOR.COMto create a new script. -
If the screen shows an asterisk prompt, type
Cand hit enter. -
Fill in the file with the following:
$! Enable the mouse escape sequences for the VT200 terminal emulator. $! Based on @asmodai, github/hackerb9/vt340test/issues/35 $ define uis$vt_private_color_map true /system $ define uis$vt_enable_sixel_scrolling true /system $ define uis$vt_enable_copy true /system $ define uis$vt_enable_paste true /system $ define uis$vt_paste_format 0 /system $ define uis$vt_button_map 0 /system $ define uis$vt_enable_osc_strings true /system $ define uis$vt_enable_locator true /systemWhen done typing, press ControlZ. Then, at the asterisk prompt, type
EXITto save the file. -
At the dollar prompt, use
@ENABLELOCATORto execute the script you just created. -
In VMS, click on the background to open a new VWS VT200/ReGIS Terminal. Inside it, run
SET HOST /DTE TTA3. This will cause the VWS terminal to be connected to the localhost on port 6666.
-
Connect TCP port 6666 to filedescriptor 6
exec 6<>/dev/tcp/localhost/6666 -
Discard SIMH's TELNET negotiation characters and banner.
while ! read -t0 <&6; do echo -n .; sleep 0.1; done while read -t0 <&6; do read <&6; echo "REPLY: $REPLY"; done -
Run
declrp.pywith its I/O set to filedescriptor 6.TERM=vt220 LANG=C ./declrp.py <&6 >&6 2>&6
A digression on netcat
Perhaps a better way to do this would have been to pipe the script
into nc -tC localhost 6666. The -t option is supposed to do TELNET
negotiation for us, which should include specifying the line ending.
Unfortunately, the version I have (OpenBSD netcat 1.238, I believe)
seems buggy. nc -t does not fix the line endings and instead passes
the negotiation bytes through unchanged. Using nc -tC, which is
supposed to force netcat to send CRLF also doesn't work -- it replaces
LF with solely CR: we need both CR and LF.
Giving up on netcat's TELNET negotiation ability and using simply nc -C is the best of the bad options. It doesn't filter out the
negotiation characters but it does at least send the correct CRLF line
endings. Netcat's method of reading and writing a socket in a pipeline
by using named pipes is rather grotesque:
mknod /tmp/f p
cat /tmp/f |
LANG=en_US.iso8859-1 TERM=vt220 /bin/bash -i 2>&1 |
nc -C localhost 6666 > /tmp/fNote that you'll need to hit ^C on the host-side because one of the negotiation characters from SIMH is a double-quote which gets sent to the bash interpreter, causing it to show the ">" continuation prompt.
The declrp.py script will show instructions on the screen but they may be truncated. At the end of each line of text, the script outputs only a Line Feed, but both a Carriage Return and Line Feed are required, so the text may run off the right edge of the screen. Declrp's instructions say to put the mouse pointer (the tip of the arrow) inside the flashing rectangle and hit Enter.
When it is finished, use Control\ to disconnect VMS from the serial port.
You will find the output of the test script on the host in the file
declrp.log.