From: Mart Lubbers Date: Mon, 23 Jan 2017 11:14:39 +0000 (+0100) Subject: try something X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=b55c1c423b6f00357b2ae2bbdd2abcf4456fd0cd;p=mTask.git try something --- diff --git a/int/interface.c b/int/interface.c index bec4f09..9212720 100644 --- a/int/interface.c +++ b/int/interface.c @@ -75,13 +75,13 @@ void setup(void) void debug(char *fmt, ...) { -#ifdef DEBUG unsigned int i; write_byte('m'); for(i = 0; i>* [OnAction ActionFinish (always shutDown)] ) @@ -104,9 +105,7 @@ mTaskTask ch = ) ) ||- viewSh xs ch - sdsShares = makeShares st - - (msgs, st) = toMessages 500 (toRealByteCode (unMain bc)) + (msgs, sdsShares) = makeBytecode 500 bc bc :: Main (ByteCode () Stmt) bc = sds \x=1 In sds \pinnetje=1 In {main = @@ -131,18 +130,16 @@ mTaskTask ch = digitalWrite D2 (lit True) ) )} -// bc :: Main (ByteCode Int Stmt) -// bc = sds \x=1 In {main = -// If (x ==. lit 3) -// (x =. lit 1) -// (x =. x +. lit 1) :. pub x} - -makeShares :: BCState -> [(Int, Shared Int)] -makeShares {sdss=[]} = [] -makeShares s=:{sdss=[(i,d):xs]} = - [(i, ms ("mTaskSDS-" +++ toString i) 1):makeShares {s & sdss=xs}] + +makeBytecode :: Int (Main (ByteCode () Stmt)) -> ([MTaskMSGSend], [(Int, Shared Int)]) +makeBytecode timeout bc +# (msgs, st) = toMessages timeout (toRealByteCode (unMain bc)) +# shares = map (\(i,d)->(i, sdsFocus (s i) (memoryStore (s i) (Just (dd d))))) st.sdss += (msgs, shares) where - ms name i = sdsFocus name (memoryStore name (Just i)) + s i = "mTaskSDS-" +++ toString i + dd [x,y] = (toInt x)*265+(toInt y) + sendMsg :: [MTaskMSGSend] (Shared ([MTaskMSGRecv],Bool,[MTaskMSGSend],Bool)) -> Task () sendMsg m ch = upd (\(r,rs,s,ss)->(r,rs,s ++ m,ss)) ch @! ()