import iTasks._Framework.Generic
from iTasks._Framework.Task import :: Task
import StdClass
-from iTasks.API.Core.Types import :: Display
import gdynamic, gCons, GenEq, StdMisc, StdArray
import mTaskCode, mTaskSimulation, mTaskInterpret
instance noOp Code where noOp = C \rw c.c
:: Code a p = C ((ReadWrite (Code a Expr)) CODE -> CODE)
-:: CODE =
- { fresh :: Int
- , freshMTask :: Int
- , funs :: [String]
- , ifuns :: Int
- , vars :: [String]
- , ivars :: Int
- , setup :: [String]
- , isetup :: Int
- , loop :: [String]
- , iloop :: Int
- , includes :: [String]
- , def :: Def
- , mode :: Mode
- , binds :: [String]
- }
-
unC :: (Code a p) -> ((ReadWrite (Code a Expr)) CODE -> CODE)
unC (C f) = f
:: Mode = /*MainMode |*/ NoReturn | Return String | SubExp | Assign String
setMode :: Mode -> Code a p
-setMode m = C \rw c.{c & mode = m}
+setMode m = C \rw c.{CODE|c & mode` = m}
getMode :: (Mode -> Code a p) -> Code a p
-getMode f = C \rw c.unC (f c.mode) rw c
+getMode f = C \rw c.unC (f c.mode`) rw c
embed :: (Code a p) -> Code a p
embed e =
, iloop = 4
, includes = []
, def = Setup
- , mode = NoReturn
+ , mode` = NoReturn
, binds = []
}
import iTasks
import gdynamic, gCons, GenEq, StdMisc, StdArray
import mTask
+derive class iTask Display
eval :: (Main (Eval t p)) -> [String] | toString t
eval {main=(E f)} = [toString (fst (f Rd zero))]
simulate :: (Main (Eval a p)) -> Task ()
simulate {main=(E f)} = setup zero where
setup s =
- updateInformation "State" [] (toView s)
- >>* [ OnAction ActionFinish (always shutDown)
- , OnAction (Action "setup" []) (hasValue
- (\si.simloop (snd (f Rd (mergeView s si)))))
- ]
+ updateInformation "State" [] (toView s) @! ()
+// >>* [ OnAction ActionFinish (always shutDown)
+// , OnAction (Action "setup" []) (hasValue
+// (\si.simloop (snd (f Rd (mergeView s si)))))
+// ]
simloop s =
- updateInformation "State" [] (toView s)
- >>* [ OnAction ActionFinish (always shutDown)
- , OnAction (Action "clear serial" []) (always (simloop {s & serial = []}))
- , OnAction ActionNew (always (setup zero))
- : if (isEmpty s.tasks)
- []
- [OnAction (Action "loop" []) (hasValue
- \si.simloop (step` (mergeView s si)))
- ]
- ]
+ updateInformation "State" [] (toView s) @!()
+// >>* [ OnAction ActionFinish (always shutDown)
+// , OnAction (Action "clear serial" []) (always (simloop {s & serial = []}))
+// , OnAction ActionNew (always (setup zero))
+// : if (isEmpty s.tasks)
+// []
+// [OnAction (Action "loop" []) (hasValue
+// \si.simloop (step` (mergeView s si)))
+// ]
+// ]
toView :: State` -> StateInterface
toView s =