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) ...@@ -93,6 +93,7 @@ TTYread :: !*TTY -> (!Int, !*TTY)
* @result new tty handle * @result new tty handle
*/ */
TTYreadline :: !*TTY -> (!String, !*TTY) TTYreadline :: !*TTY -> (!String, !*TTY)
<<<<<<< HEAD
/** /**
* Checks if the TTY device is available for reading * Checks if the TTY device is available for reading
......
...@@ -105,14 +105,12 @@ where ...@@ -105,14 +105,12 @@ where
getResource = iworldResource (\t=:(TTYd p _)->(p == opts.devicePath, t)) getResource = iworldResource (\t=:(TTYd p _)->(p == opts.devicePath, t))
exc = ExceptionResult o exception exc = ExceptionResult o exception
import StdMisc, StdDebug
readWhileAvailable :: !*TTY -> (MaybeError String [Char], !*TTY) readWhileAvailable :: !*TTY -> (MaybeError String [Char], !*TTY)
readWhileAvailable tty readWhileAvailable tty
# (available, error, tty) = TTYavailable tty # (available, error, tty) = TTYavailable tty
| error = (Error "TTY device disconnected", tty) | error = (Error "TTY device disconnected", tty)
| not available = (Ok [], tty) | not available = (Ok [], tty)
# (c, tty) = TTYread tty # (c, tty) = TTYread tty
| not (trace_tn ("Read: " +++ toString c)) = undef
# (merr, tty) = readWhileAvailable tty # (merr, tty) = readWhileAvailable tty
| isError merr = (merr, tty) | isError merr = (merr, tty)
= (Ok [toChar c:fromOk 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