Commit 65f357c5 authored by Mart Lubbers's avatar Mart Lubbers

Merge branch 'master' of gitlab.science.ru.nl:mlubbers/CleanSerial

parents 641acfba 16e7ae6d
......@@ -93,6 +93,7 @@ TTYread :: !*TTY -> (!Int, !*TTY)
* @result new tty handle
*/
TTYreadline :: !*TTY -> (!String, !*TTY)
<<<<<<< HEAD
/**
* Checks if the TTY device is available for reading
......
......@@ -105,14 +105,12 @@ where
getResource = iworldResource (\t=:(TTYd p _)->(p == opts.devicePath, t))
exc = ExceptionResult o exception
import StdMisc, StdDebug
readWhileAvailable :: !*TTY -> (MaybeError String [Char], !*TTY)
readWhileAvailable tty
# (available, error, tty) = TTYavailable tty
| error = (Error "TTY device disconnected", tty)
| not available = (Ok [], tty)
# (c, tty) = TTYread tty
| not (trace_tn ("Read: " +++ toString c)) = undef
# (merr, tty) = readWhileAvailable tty
| isError merr = (merr, tty)
= (Ok [toChar c:fromOk merr], tty)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment