(setq c nil interval 0,001)
(define (output)
(if c
(begin
(print (char c))
(setq c nil)
))
(timer 'output interval)
)
(output)
In console: > (setq c 100)
100
> d
> (setq c (read-key))
13
0 > ## a context "0" ???
0 > (context)
MAIN
>
(define (keys)
(local (k)
(while (!= (setq k (read-key)) 13)
(setq s (string k))
(println s))))
> (read-key) (read-key)
0
59
- first call returns 0, second call returns 59. /* thanks to Peter van Eerten for contributing this function */
/* included non-blocking ability 10.7.3, LM */
CELL * p_readKey(CELL * params)
{
#if defined(WINDOWS) || defined(OS2)
if(!isNil(evaluateExpression(params)) )
{
if(kbhit())
return(stuffInteger(getch()));
else
[b][u]return(stuffInteger(0));[/u][/b]
}
else
return(stuffInteger(getch()));
#else
...
/* not Windows or OS2 */
}