1 ; reads and prints keys until you hit 'q'
2 ; no need to hit 'enter', and 'enter' has no special meaning
3 ; dies if you wait a while, because so far we never free memory
5 (default-space:space-address <- new space:literal 30:literal)
8 (stdin:channel-address <- init-channel 1:literal)
9 ;? ($print (("main: stdin is " literal)))
10 ;? ($print stdin:channel-address)
11 ;? ($print (("\n" literal)))
12 (fork-helper send-keys-to-stdin:fn nil:literal/globals nil:literal/limit nil:literal/keyboard stdin:channel-address)
13 ; now read characters from stdin until a 'q' is typed
14 ($print (("? " literal)))
16 (x:tagged-value stdin:channel-address/deref <- read stdin:channel-address)
17 (c:character <- maybe-coerce x:tagged-value character:literal)
18 ;? ($print (("main: stdin is " literal)))
19 ;? ($print stdin:channel-address)
20 ;? ($print (("\n" literal)))
21 ;? ($print (("check: " literal)))
22 ;? ($print c:character)
23 (done?:boolean <- equal c:character ((#\q literal)))
24 (break-if done?:boolean)