encode (MTTask to data) = "t" +++ to16bit to +++ to16bit (size data) +++ data +++ "\n"
encode (MTUpd i v) = "u" +++ to16bit i +++ v +++ "\n"
+import StdDebug
decode :: String -> MTaskMSGRecv
decode x
| size x == 0 = MTEmpty
# (msgs, st) = toMessages timeout (toRealByteCode (unMain bc))
= (msgs, map f st.sdss)
where
- f (i,d) = (i, sharedStore ("mTaskSDS-" +++ toString i) 0)
+ f (i,d) = (i, sharedStore ("mTaskSDS-" +++ toString i) (dd d))
+ dd [x,y] = toInt x*265 + toInt y
updateSDSs :: [(Int, Shared Int)] (Shared [String]) MTaskMSGRecv -> Task ()
updateSDSs _ m (MTMessage s) = upd (\l->take 20 [s:l]) m @! ()
(False, tty) = ([], tty)
(_, tty)
# (l, tty) = TTYreadline tty
- | not (trace_tn ("recv: '" +++ l +++ "'")) = undef
= ([decode l], tty)
# iworld = {iworld & resources=Just (TTYd tty)}
= case write (r++ml,[],False) rw iworld of