View Ticket
Not logged in
Ticket Hash: 136aebbd7fe802a14ca5094189ff2ebd86e6e7e8
Title: STDIN can't be used to capture console input
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: Resolution: Not_A_Bug
Last Modified: 2020-07-04 21:20:21
Version Found In: Eppur si muove (downloaded 3 days ago)
User Comments:
anonymous added on 2020-06-30 22:40:34:

In *nix & windows, I can capture console input using: set input [gets stdin]

I am trying to develop a script for use on ANDROIDWISH (to help a blind person use the bus system). However, ANDROIDWISH (and UnDroid) fail:

set input [gets stdin] --> "" (immediate reply, no delay, empty string reply)

The FCONFIGURE settings are as follows (I've modified them in all possible combinations but nothing helps):

Windows laptop (using TCL 8.6.8): % fconfigure stdin -blocking 1 -buffering line -buffersize 4096 -encoding unicode -eofchar (0x1A) -translation auto

Android 8.0 (live/smart device) fconfigure stdin -blocking 1 -buffering none -buffersize 4096 -encoding utf-8 -eofchar {} -translation lf

Undroid: fconfigure stdin -blocking 1 -buffering line -buffersize 4096 -encoding unicode -eofchar {} -translation lf

The obvious differences are: (1) EOFCHAR, (2) BUFFERING, & (3) TRANSLATION. As I said before, I've altered the settings (one at a time, and all combinations) but nothing worked.

I have SCOURED the Internet and found no setting or work-around for this. I MUST be able to accept keyboard input to the console window (to select a menu option, a number from 1 to 30).

HELP!!


anonymous added on 2020-06-30 22:57:45:

Also, tried [read stdin] just to see if that would help; it didn't.


chw added on 2020-07-01 05:45:05:
AndroWish and undroidwish are conceptually similar to what is called a
GUI program in Win32 (what a Win32 wish is, too, btw). These do not have
the concept of an interactive stdin channel in form of a console or xterm.
But they have a special console channel/command described in

  https://www.tcl.tk/man/tcl8.6/TkCmd/console.htm

And that's the reason why "gets stdin" won't work in these environments.
So you have to transform your business logic to GUI (event driven) style
and to use some entry or text widget for user input plus bindings and/or
buttons in order to trigger some action on that input.

anonymous added on 2020-07-04 20:21:47:

So, this means: AndroWish is NOT a good port for TCL, because TCL is a command line-based language; TK is GUI. Why support 10,000 TCL packages when you don't support the MOST BASIC of the I/O functions in the language?

Telling me: "update your crap to GUI" doesn't entice me to re-write 20+ years of projects, it doesn't help my BLIND WIFE at all, and you don't even obey the basics of the language.

AndroWish shouldn't support TCL (only TK) if you are so opposed to following 20+ years of how the language actually works.

Sorry to have bothered you. (I won't repeat what my wife had to say.)


chw added on 2020-07-04 21:20:21:
My final guess is that you have never used wish.exe on Windows.
Otherwise you'd have known the (20+ years old) difference between
wish and tclsh. That's a pity indeed.