1. More Manual Typo/errors
- Posted by K_D_R Nov 16, 2015
- 1911 views
Forked from Re: manual typo for public function gcd(atom p, atom q)
I made a ticket 941. It is for 4.0.
SD Pringle
In the manual discussion of maybe_any_key The Two examples given appear to have been copied from the previous entry for "any_key" without prepending "maybe_"
Also, the program "regexps.ex" in the demo folder uses "maybe_any_key" consequently the program does not pause as needed under Linux.
-- in the demo program regexps.ex change: -- maybe_any_key() -- to: ifdef UNIX then any_key() elsifdef WINDOWS then maybe any_key() -- Requires Windows XP or later or Windows 2003 or later to work end ifdef
Ken
2. Re: More Manual Typo/errors
- Posted by SDPringle Nov 17, 2015
- 1865 views
Linux and Windows versions of Euphoria work very different from a user's perspective. On Windows, if you open a EUPHORIA program from the GUI. The program will create a console Window for you and do its STDIN and STDOUT in that Window. On Linux, the Euphoria programs cannot be opened from the GUI at all. But suppose we figure out how to do so then the Interpreter under Linux will not create such a Window and you will see nothing.
So for UNIX in general we assume console programs are run from the console. On Windows we don't need to assume because this can be determined in a program. Without a maybe_any_key() Windows would create the window, run the program and then close the window without user interaction. When run in an already created console the Window would not close until you close it manually or type in 'exit' to close the shell. So, in this case the program doesn't ask for you to press a key.
Why should the interpreter ask for a key press? Are you opening demos from a GUI in Linux?
3. Re: More Manual Typo/errors
- Posted by K_D_R Nov 19, 2015
- 1819 views
On Linux, the Euphoria programs cannot be opened from the GUI at all. But suppose we figure out how to do so then the Interpreter under Linux will not create such a Window and you will see nothing.
"Suppose we can figure out how to do so.."?? Shawn, you have lost the plot completely. A number of LINUX editors have supported the use of a terminal for years. Even before terminal support was added to WEE I simply ran WEE from a command line in a terminal, loaded the console program I was editing in the editor and then, once I executed the console program, I switched back to the terminal window to see the console programs output. This worked fine because my console program required a key press to exit. The latest version of WEE supports execution of a console program in a terminal - which works for some console programs, but not for other console programs such as the demo, "regexps.ex" which only works as expected in a GUI's terminal, provided you ask for a key press in order to keep the program from terminating instantly.
So for UNIX, in general, we assume console programs are run from the console. On Windows, we don't need to assume because this can be determined in a program. Without a maybe_any_key() Windows would create the window, run the program and then close the window without user interaction. When run in an already created console the Window would not close until you close it manually or type in 'exit' to close the shell. So, in this case, the program doesn't ask for you to press a key.
Why should the interpreter ask for a key press? Are you opening demos from a GUI in Linux?
We should not assume that Unix console programs are run from the console - especially euphoria demo programs. GUI editors with terminal support are now ubiquitous. It is likely that a new user will use a GUI Editor to explore Euphoria's demo programs. Console demo programs can easily be easily adapted to run from a GUI editor at the cost of one command asking for a key press - which places no onerous burden on any user who executes the console demo directly from the console.
-- in the demo program "regexps.ex" -- replace line: -- maybe_any_key() -- This command is absolutely useless!!!! -- with: any_key("\nPress Any Key to Exit")
4. No maybes. Replace maybe_any_key with any_key in demos
- Posted by SDPringle Nov 19, 2015
- 1858 views
If one of the installer lets you run uncompiled EUPHORIA programs from the GUI, I have to agree with you.
SD Pringle
5. Re: More Manual Typo/errors
- Posted by jimcbrown (admin) Nov 19, 2015
- 1856 views
The latest version of WEE supports execution of a console program in a terminal - which works for some console programs, but not for other console programs such as the demo, "regexps.ex" which only works as expected in a GUI's terminal, provided you ask for a key press in order to keep the program from terminating instantly.
The difference is that the stupid operating system provides a concept of a console subsystem vs a GUI subsystem. Consoles simply work differently there, and it's relatively simple to determine if a Windoze console is in use or not. This is what maybe_any_key() uses.
On nix, it's not trivial to determine if a process is running directly inside an xterm or similar program, as opposed to running inside of an ssh or telnet or rlogin session, or in something like GNU screen.
I think the consensus is that, under nix, since the IDE is the one that knows if it started the child process inside of an xterm or not (unlike process itself), it should be the one responsible for keeing that xterm alive after the process ends.
We should not assume that Unix console programs are run from the console - especially euphoria demo programs. GUI editors with terminal support are now ubiquitous.
Then these GUI editors should support an option like "Run via xterm - keep xterm alive after process ends" or a similar setting.
If you are fond of a particular editor that does not support this sort of setting, there are also workarounds you can use. E.g. http://stackoverflow.com/questions/3512055/avoid-gnome-terminal-close-after-script-execution
Alternatively, we could come up with an euiw for nix, where the only difference from eui is that the nix euiw simply always returns 0 for has_console(). Then set up the editor to run code with euiw instead of eui.
It is likely that a new user will use a GUI Editor to explore Euphoria's demo programs. Console demo programs can easily be easily adapted to run from a GUI editor at the cost of one command asking for a key press - which places no onerous burden on any user who executes the console demo directly from the console.
-- in the demo program "regexps.ex" -- replace line: -- maybe_any_key() -- This command is absolutely useless!!!! -- with: any_key("\nPress Any Key to Exit")
Right, but if someone is running it from the command line directly, via a getty session (outside of X), then pausing here is probably the wrong thing to do - it's unnecessary since you won't lose output after the key press. Ditto if I'm running the program directly on the command line.
Why should the interpreter ask for a key press? Are you opening demos from a GUI in Linux?
That said, if someone has a patch or some code that can, under Linux/GNU, determine if a process is running under an xterm or something, I'm not necessarily opposed to reviewing it and including it. It's just not a very easy thing to do.
6. Re: More Manual Typo/errors
- Posted by SDPringle Nov 21, 2015
- 1762 views
Not all Linux distributions come with xterm. Mint comes with 'gnome-terminal' already installed but not xterm. You could install xterm however. The demo directory has always been meant to be run via the command line. The only good solution is if someone could make maybe_any_key behave as in Windows on Linux. Arguably maybe it is better to default to asking for a key when you cannot detect one way or another.
SD Pringle
7. Re: More Manual Typo/errors
- Posted by SDPringle Nov 21, 2015
- 1829 views
A switch could be added to the std/console.e to make this kind of thing work the way it should
ifdef NO_CONSOLE then public function has_console() return 0 end function elsedef public function has_console() -- stuff that is there now end function end ifdef
Then in the GUI settings you put:
gnome-terminal -command 'eui -D NO_CONSOLE $filename'
8. Re: More Manual Typo/errors
- Posted by jimcbrown (admin) Nov 23, 2015
- 1744 views
Then these GUI editors should support an option like "Run via xterm - keep xterm alive after process ends" or a similar setting.
If you are fond of a particular editor that does not support this sort of setting, there are also workarounds you can use. E.g. http://stackoverflow.com/questions/3512055/avoid-gnome-terminal-close-after-script-execution
Not all Linux distributions come with xterm. Mint comes with 'gnome-terminal' already installed but not xterm.
Generally, there should be a symbolic link called x-terminal-emulator that points to the installed binary, whether it's gnome-terminal, xterm, urxvt, konsole, or something else. Most editors that support this option should also enable you to configure which terminal emulator to use anyways.
The workaround link I provided is explicitly for gnome-terminal, not xterm, though it's generic enough to work with either.
The only good solution is if someone could make maybe_any_key behave as in Windows on Linux.
Please explain why asking the IDE to add a pause is not a good solution.
A switch could be added to the std/console.e to make this kind of thing work the way it should
ifdef NO_CONSOLE then public function has_console() return 0 end function elsedef public function has_console() -- stuff that is there now end function end ifdef
Then in the GUI settings you put:
gnome-terminal -command 'eui -D NO_CONSOLE $filename'
I think if someone wants to go this route, it's better to make the change in maybe_any_key() only.
Arguably maybe it is better to default to asking for a key when you cannot detect one way or another.
I have no problems with this in principle.
9. Re: More Manual Typo/errors
- Posted by SDPringle Dec 02, 2015
- 1620 views
Can someone make this into a ticket please...
10. Re: More Manual Typo/errors
- Posted by jimcbrown (admin) Dec 02, 2015
- 1590 views
Can someone make this into a ticket please...
For wee?
11. Re: More Manual Typo/errors
- Posted by jimcbrown (admin) Dec 02, 2015
- 1586 views
Can someone make this into a ticket please...
For wee?
While some workarounds that could be implemented in euphoria were discussed, I think the undisputed and correct solution remains to fix the IDE to add the required prompt, instead of changing how maybe_any_key() works.