X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=mTask.dcl;h=2a826790e4d94a17f24420bb2690be44145170ee;hb=6d956995e169ae8fd44d62e26e35d499a9660225;hp=ac9405c0544dc3c916dece2b63203c7e373a3961;hpb=0781ce1e845d7ec4bd06a39105d5d0d68835c693;p=mTask.git diff --git a/mTask.dcl b/mTask.dcl index ac9405c..2a82679 100644 --- a/mTask.dcl +++ b/mTask.dcl @@ -14,17 +14,15 @@ todo: imporove setp: >>*. */ -import Generics.gCons -import Generics.gdynamic - -import iTasks - -import iTasks._Framework.Generic -from iTasks._Framework.Task import :: Task +//import iTasks +// +//import iTasks._Framework.Generic +//from iTasks._Framework.Task import :: Task import StdClass import GenEq, StdMisc, StdArray import mTaskCode, mTaskSimulation, mTaskInterpret +//import mTaskCode, mTaskInterpret import mTaskSerial, mTaskLCD // =================== mTask =================== @@ -65,11 +63,11 @@ instance == MTask unMain :: (Main x) -> x class arith v where - lit :: t -> v t Expr | toCode t & toByteCode t + lit :: t -> v t Expr | toCode t & mTaskType t (+.) infixl 6 :: (v t p) (v t q) -> v t Expr | type, +, zero t & isExpr p & isExpr q //& toExpr2 p & toExpr2 q (-.) infixl 6 :: (v t p) (v t q) -> v t Expr | type, -, zero t & isExpr p & isExpr q //& toExpr2 p & toExpr2 q (*.) infixl 7 :: (v t p) (v t q) -> v t Expr | type, *, zero, one t & isExpr p & isExpr q //& toExpr2 p & toExpr2 q - (/.) infixl 7 :: (v t p) (v t q) -> v t Expr | type, / t & isExpr p & isExpr q //& toExpr2 p & toExpr2 q + (/.) infixl 7 :: (v t p) (v t q) -> v t Expr | type, /, zero t & isExpr p & isExpr q //& toExpr2 p & toExpr2 q class boolExpr v where (&.) infixr 3 :: (v Bool p) (v Bool q) -> v Bool Expr | isExpr p & isExpr q //& toExpr2 p & toExpr2 q (|.) infixr 2 :: (v Bool p) (v Bool q) -> v Bool Expr | isExpr p & isExpr q //& toExpr2 p & toExpr2 q @@ -90,12 +88,17 @@ class var2 v where var2 :: t ((v t Upd)->(Main (v c s))) -> (Main (v c s)) | type, toCode t con2 :: t ((v t Expr) ->(Main (v c s))) -> (Main (v c s)) | type t class sds v where - sds :: ((v t Upd)->In t (Main (v c s))) -> (Main (v c s)) | type, toByteCode, toCode t + sds :: ((v t Upd)->In t (Main (v c s))) -> (Main (v c s)) | type, mTaskType, toCode t con :: ((v t Expr) ->In t (Main (v c s))) -> (Main (v c s)) | type t +class namedsds v where + namedsds :: ((v t Upd)->In (Named t String) (Main (v c s))) -> (Main (v c s)) | type, mTaskType, toCode t +class sdspub v where 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 +class retrn v where + retrn :: v () Expr class step` v where (>>*.) infixl 1 :: (v t p) ((v t Expr) -> [Step v u]) -> v u Stmt | type t & type u :: Step v t = E.p.q: Cond (v Bool q) (v t p) | E.p: Ever (v t p) @@ -132,8 +135,8 @@ class time v where millis :: (v Long Expr) class userLed v where - ledOn :: UserLED -> (v () Stmt) - ledOff :: UserLED -> (v () Stmt) + ledOn :: (v UserLED q) -> (v () Stmt) + ledOff :: (v UserLED q) -> (v () Stmt) class pio p t where pio :: p -> v t Upd | aIO v & dIO v instance pio AnalogPin Int @@ -154,6 +157,7 @@ instance type2string Char instance type2string MTask instance type2string DigitalPin instance type2string AnalogPin +instance type2string UserLED instance type2string String instance type2string () class varName a :: a -> String @@ -190,6 +194,7 @@ instance typeSelector Bool instance typeSelector a :: In a b = In infix 0 a b +:: Named a b = Named infix 1 a b read` :: Int (ReadWrite a) State` -> (a,State`) | dyn a @@ -212,12 +217,9 @@ instance long Eval Long // ----- tools ----- // -derive consName DigitalPin, AnalogPin, PinMode - instance == DigitalPin instance == AnalogPin - -derive consIndex DigitalPin, AnalogPin +instance == UserLED tab =: toString (repeatn tabSize ' ') tabSize :== 2