X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=mTask.icl;h=2bbcc30264dc78736e2bbd60709ae48ebf209981;hb=a81623aa9629a3c5c8f8bf920e494a596b30c4b7;hp=f0249c9e5398abb8574269edfe5204b347068fcd;hpb=e25fda18ca554ec3fe937152403872b916367ddb;p=mTask.git diff --git a/mTask.icl b/mTask.icl index f0249c9..2bbcc30 100644 --- a/mTask.icl +++ b/mTask.icl @@ -14,8 +14,11 @@ todo: imporove setp: >>*. */ +import Generics.gCons +import Generics.gdynamic + import iTasks -import gdynamic, gCons, GenEq, StdMisc, StdArray +import GenEq, StdMisc, StdArray, GenBimap import mTaskCode import mTaskSerial, mTaskLCD @@ -56,6 +59,7 @@ instance type2string Char where type2string _ = "char" instance type2string MTask where type2string _ = "task" instance type2string DigitalPin where type2string _ = "int" instance type2string AnalogPin where type2string _ = "int" +instance type2string UserLED where type2string _ = "int" instance type2string String where type2string _ = "Char []" instance type2string () where type2string _ = "" @@ -84,7 +88,7 @@ instance typeSelector Char where typeSelector = c ".c" instance typeSelector Bool where typeSelector = c ".b" instance typeSelector a where typeSelector = c ".w" -read` :: Int (ReadWrite a) State -> (a,State) | dyn a +read` :: Int (ReadWrite a) State` -> (a,State`) | dyn a read` n Rd s = (fromJust (fromDyn (s.store !! n)), s) read` n (Wrt a) s = (a,{s&store=updateAt n (toDyn a) s.store}) read` n (Updt f) s=:{store} @@ -117,9 +121,10 @@ instance long Eval Long where instance == DigitalPin where (==) x y = x === y instance == AnalogPin where (==) x y = x === y +instance == UserLED where (==) x y = x === y -derive consName DigitalPin, AnalogPin, PinMode -derive consIndex DigitalPin, AnalogPin +//derive class gCons UserLED, Long, Pin, Button, UserLED, AnalogPin, DigitalPin, PinMode +//derive class iTask UserLED, Long, Pin, Button, UserLED, AnalogPin, DigitalPin, PinMode tab =: toString (repeatn tabSize ' ') tabSize :== 2