We planned to upgrade GitLab and Mattermost to the latest version this Friday morning. Expect some downtime!

Commit 0f351a7a authored by Mart Lubbers's avatar Mart Lubbers

adapt to new iTasks async

parent 4ec4afbb
Pipeline #18412 passed with stage
in 3 minutes and 30 seconds
definition module iTasksTTY definition module iTasksTTY
from iTasks.Internal.Generic.Visualization import generic gText, :: TextFormat from iTasks.Internal.Generic.Visualization import generic gText, :: TextFormat
from iTasks.SDS.Definition import :: SDS, :: Shared, :: RWShared from iTasks.SDS.Definition import :: Shared, class RWShared, class Readable, class Writeable, class Modifiable, class Registrable, class Identifiable
from iTasks.UI.Editor.Generic import generic gEditor, :: Editor from iTasks.UI.Editor.Generic import generic gEditor, :: Editor
from iTasks.WF.Definition import :: Task from iTasks.WF.Definition import :: Task
from iTasks.WF.Definition import class iTask from iTasks.WF.Definition import class iTask
...@@ -29,4 +29,4 @@ derive class iTask TTYSettings ...@@ -29,4 +29,4 @@ derive class iTask TTYSettings
* @result Task that stops when the stop flag is set * @result Task that stops when the stop flag is set
* @throws TTYException * @throws TTYException
*/ */
syncSerialChannel :: Timespec TTYSettings (b -> String) (String -> (Either String [a], String)) (Shared ([a],[b],Bool)) -> Task () | iTask a & iTask b syncSerialChannel :: Timespec TTYSettings (b -> String) (String -> (Either String [a], String)) (Shared sds ([a],[b],Bool)) -> Task () | iTask a & iTask b & RWShared sds
...@@ -18,7 +18,7 @@ import TTY ...@@ -18,7 +18,7 @@ import TTY
derive class iTask TTYSettings, Parity, BaudRate, ByteSize derive class iTask TTYSettings, Parity, BaudRate, ByteSize
syncSerialChannel :: Timespec TTYSettings (b -> String) (String -> (Either String [a], String)) (Shared ([a],[b],Bool)) -> Task () | iTask a & iTask b syncSerialChannel :: Timespec TTYSettings (b -> String) (String -> (Either String [a], String)) (Shared sds ([a],[b],Bool)) -> Task () | iTask a & iTask b & RWShared sds
syncSerialChannel poll opts enc dec rw = Task eval syncSerialChannel poll opts enc dec rw = Task eval
where where
eval event evalOpts tree=:(TCInit taskId ts) iworld eval event evalOpts tree=:(TCInit taskId ts) iworld
...@@ -47,18 +47,19 @@ where ...@@ -47,18 +47,19 @@ where
[TTYd dp tty] [TTYd dp tty]
# (merr, iworld) = readRegister taskId ticker iworld # (merr, iworld) = readRegister taskId ticker iworld
| isError merr = (ExceptionResult (fromError merr), iworld) | isError merr = (ExceptionResult (fromError merr), iworld)
# (merr, iworld=:{resources}) = read rw iworld //TODO Keep async in mind
# (merr, iworld=:{resources}) = read rw EmptyContext iworld
| isError merr = (ExceptionResult (fromError merr), iworld) | isError merr = (ExceptionResult (fromError merr), iworld)
= case fromOk merr of = case fromOk merr of
//We need to stop //We need to stop
(_,_,True) = ReadingDone (_,_,True) =
(ValueResult (ValueResult
(Value () True) (Value () True)
{TaskEvalInfo|lastEvent=ts,removedTasks=[],attributes=newMap} {TaskEvalInfo|lastEvent=ts,removedTasks=[],attributes=newMap}
rep rep
(TCDestroy tree) (TCDestroy tree)
, {iworld & resources=[TTYd dp tty:resources]}) , {iworld & resources=[TTYd dp tty:resources]})
(r,s,ss) ReadingDone (r,s,ss)
# tty = foldr TTYwrite tty $ reverse $ map enc s # tty = foldr TTYwrite tty $ reverse $ map enc s
# (merr, tty) = readWhileAvailable tty # (merr, tty) = readWhileAvailable tty
| isError merr = (exc (fromError merr), iworld) | isError merr = (exc (fromError merr), iworld)
...@@ -67,8 +68,9 @@ where ...@@ -67,8 +68,9 @@ where
(Left err, newacc) = (exc ("Error while parsing: " +++ join " " [toString (toInt c)\\c<-:acc+toString (fromOk merr)]), iworld) (Left err, newacc) = (exc ("Error while parsing: " +++ join " " [toString (toInt c)\\c<-:acc+toString (fromOk merr)]), iworld)
(Right msgs, newacc) (Right msgs, newacc)
# (merr, iworld) = if (msgs =: [] && s =: []) # (merr, iworld) = if (msgs =: [] && s =: [])
(Ok (), iworld) (Ok WritingDone, iworld)
(write (r++msgs, [], False) rw iworld) //TODO Keep async in mind
(write (r++msgs, [], False) rw EmptyContext iworld)
| isError merr = (ExceptionResult (fromError merr), iworld) | isError merr = (ExceptionResult (fromError merr), iworld)
= (ValueResult = (ValueResult
NoValue NoValue
......
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