[clean-list] A minor issue with usability?
Arjen van Weelden
arjenw@cs.kun.nl
Mon, 03 Nov 2003 15:08:03 +0100
Alan Carlyle wrote:
> Hi All!
>
> I've recently returned to using Clean after a few years hiatus;
mainly as an
> antidote to the .NET development I earn a living with ;}
>
> Now that I've returned I am surprised to see that a rather ugly 'feature'
> has not been corrected. Namely the "press any key to exit" and intrusive
> pause this forces on us for programs compiled for the console.
>
Hi Alan,
Here is a hack (for Windows) that removes the "press any key", and
allows redirection at the command line. Remember to select the 'No
Return Type' project option in the CleanIDE.
// Project options: use No Return Type
import StdFile
setConsoleFlag :: !*World -> *World
setConsoleFlag _ = code {
pushL _console_flag
pushI -4
addI
push_b_a 0
pop_b 1
pushI 1
fill1_r _ 0 1 0 01
.keep 0 1
pop_a 1
fill_a 0 1
pop_a 1
}
stdOut :: !String !*World -> *World
stdOut msg world
# world = setConsoleFlag world
(console, world) = stdio world
console = fwrites msg console
(_, world) = fclose console world
= world
Start :: *World -> *World
Start world = stdOut "Hello C.\n\tCaught you!" world
kind regards,
Arjen