working again, externalized some device helper functions and added share updating
[mTask.git] / mTaskInterpret.dcl
index 221c8a4..17034be 100644 (file)
@@ -15,11 +15,17 @@ import mTask
        | MTEmpty
 
 :: MTaskMSGSend
-       = MTTask Int String
+       = MTTask MTaskInterval String
        | MTTaskDel Int
        | MTSds Int String
        | MTUpd Int String
 
+:: MTaskInterval
+       = OneShot
+       | OnInterval Int
+       | OnInterrupt Int
+
+instance toString MTaskInterval
 instance toString MTaskMSGRecv
 instance toString MTaskMSGSend
 encode :: MTaskMSGSend -> String
@@ -74,10 +80,16 @@ decode :: String -> MTaskMSGRecv
 instance Semigroup (ByteCode a p)
 instance Monoid (ByteCode a p)
 
+:: BCShare = {
+               sdsi :: Int,
+               sdspub :: Bool,
+               sdsval :: [Char]
+       }
+
 :: BCState = {
                freshl :: [Int],
                freshs :: [Int],
-               sdss :: [(Int, [Char])]
+               sdss :: [BCShare]
        }
 instance zero BCState
 
@@ -89,6 +101,7 @@ instance toByteCode String
 instance toByteCode Long
 instance toByteCode Button
 instance toByteCode UserLED
+//instance toByteCode MTaskInterval
 
 instance toChar Pin
 instance arith ByteCode
@@ -108,9 +121,7 @@ instance assign ByteCode
 instance seq ByteCode
 instance serial ByteCode
 
-//pub :: (ByteCode a b) -> ByteCode a b
-
-toMessages :: Int (String, BCState) -> ([MTaskMSGSend], BCState)
+toMessages :: MTaskInterval (String, BCState) -> ([MTaskMSGSend], BCState)
 toSDSUpdate :: Int Int -> [MTaskMSGSend]
 
 toByteVal :: BC -> [Char]