From 1c8014ff74afb966b891a4689d8ee3e512300746 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Mon, 9 Jan 2017 14:03:36 +0100 Subject: [PATCH] add publishing of sds's --- mTask.dcl | 1 + mTaskCode.icl | 2 +- mTaskInterpret.dcl | 2 +- mTaskInterpret.icl | 7 ++++--- mTaskSimulation.icl | 2 +- miTask.icl | 7 +++---- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/mTask.dcl b/mTask.dcl index 9207cb4..c7a6a3a 100644 --- a/mTask.dcl +++ b/mTask.dcl @@ -88,6 +88,7 @@ class var2 v where class sds v where sds :: ((v t Upd)->In t (Main (v c s))) -> (Main (v c s)) | type, toByteCode, toCode t con :: ((v t Expr) ->In t (Main (v c s))) -> (Main (v c s)) | type t + pub :: (v t Upd) -> v t Expr | type t class seq v where (>>=.) infixr 0 :: (v t p) ((v t Expr) -> (v u q)) -> (v u Stmt) | type t & type u (:.) infixr 0 :: (v t p) (v u q) -> v u Stmt | type t & type u diff --git a/mTaskCode.icl b/mTaskCode.icl index c405cea..410e05e 100644 --- a/mTaskCode.icl +++ b/mTaskCode.icl @@ -74,7 +74,7 @@ instance sds Code where in setCode Var +.+ c (type2string v + " " + name + " = " + toCode v + ";\n") +.+ setCode Setup +.+ unMain body} con f = defCode f -// pub _ = undef + pub _ = undef defCode :: ((Code t p) -> In t (Main (Code u q))) -> Main (Code u r) | type t defCode f = diff --git a/mTaskInterpret.dcl b/mTaskInterpret.dcl index 0fb9efc..cce5735 100644 --- a/mTaskInterpret.dcl +++ b/mTaskInterpret.dcl @@ -94,7 +94,7 @@ instance assign ByteCode instance seq ByteCode instance serial ByteCode -pub :: (ByteCode a b) -> ByteCode a b +//pub :: (ByteCode a b) -> ByteCode a b toMessages :: Int (String, BCState) -> [MTaskMessage] diff --git a/mTaskInterpret.icl b/mTaskInterpret.icl index 51771a3..3cf4dfe 100644 --- a/mTaskInterpret.icl +++ b/mTaskInterpret.icl @@ -83,7 +83,7 @@ runBC (BC m) = m retrn :: ([BC] -> ByteCode a p) retrn = BC o tuple -fmp :: ([BC] -> [BC]) (ByteCode a p) -> ByteCode a p +fmp :: ([BC] -> [BC]) (ByteCode a p) -> ByteCode a q fmp f b = BC \s->let (bc, s`) = runBC b s in (f bc, s`) instance toByteCode Bool where @@ -158,6 +158,7 @@ instance sds ByteCode where in setSDS sds v <++> unMain body } con f = undef + pub x = fmp makePub x // pub _ = undef instance assign ByteCode where @@ -223,8 +224,8 @@ Start = toMessages 500 $ toRealByteCode (unMain bc) sds \y=4 In {main = If (y ==. lit 0) (pub x) (x =. x *. y :. y =. y -. lit 1)} -pub :: (ByteCode a b) -> ByteCode a b -pub x = fmp makePub x +//pub :: (ByteCode a b) -> ByteCode a b +//pub x = fmp makePub x to16bit :: Int -> String to16bit i = toString (toChar (i/265)) +++ toString (toChar (i rem 265)) diff --git a/mTaskSimulation.icl b/mTaskSimulation.icl index ae7ddfb..d28a4fe 100644 --- a/mTaskSimulation.icl +++ b/mTaskSimulation.icl @@ -74,7 +74,7 @@ defEval2 v f = instance sds Eval where sds f = defEval f con f = defEval f -// pub _ = undef + pub _ = undef defEval :: ((Eval t p)->In t (Main (Eval u q))) -> (Main (Eval u q)) | dyn t defEval f = diff --git a/miTask.icl b/miTask.icl index ab37901..2203541 100644 --- a/miTask.icl +++ b/miTask.icl @@ -3,7 +3,6 @@ module miTask import StdDebug, StdMisc from Text import class Text(concat,join,split), instance Text String -from Control.Monad import mapM import iTasks import mTask @@ -12,9 +11,9 @@ derive class iTask MTaskMessage Start :: *World -> *World Start world = startEngine ( - withShared ([], False, [], False) (\ch-> - enterInformation "Port Number?" [] >>= \port->mTaskTask port ch - )) world + enterInformation "Port Number?" [] + >>= \port->withShared ([], False, [], False) (mTaskTask port) + ) world //Start world = startEngine mTaskTask world mTaskTask :: Int (Shared ([MTaskMessage],Bool,[MTaskMessage],Bool)) -> Task () -- 2.20.1